Blob Blame History Raw
From 8acc8ecc93352bfb3d78e8d37c5ed03a4948a39d Mon Sep 17 00:00:00 2001
From: Mohammed Gamal <mgamal@redhat.com>
Date: Tue, 8 Nov 2022 16:20:17 +0100
Subject: [PATCH] redhat: hv_set_if_config: Workaround for gateway numbering in
 NetworkManager

RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
RH-MergeRequest: 10: redhat: hv_set_if_config: Workaround for gateway numbering in NetworkManager
RH-Bugzilla: 2150255
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
RH-Commit: [1/1] a52af3c2a8c4365cbe6777fe1afe4ebcf81954d6

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2150255

Unlike older sysconfig scripts, NetworkManager expects GATEWAYx=ipaddr for all values of x.
So the first gateway is GATEWAY0 instead of GATEWAY. Other values should remain unchanged.
Workaround this by replacing GATEWAY= with GATEWAY0=.

A proper fix however, would be to generate NetworkManager keyfiles instead of ifcfg files.
That can be done eitter by changing hypervkvpd code to do that or to let the script parse
ifcfg files and generate corresponding NetworkManager keyfiles

Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
---
 hv_set_ifconfig.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
index 146829b..fe7fccf 100644
--- a/hv_set_ifconfig.sh
+++ b/hv_set_ifconfig.sh
@@ -54,6 +54,10 @@ echo "IPV6INIT=yes" >> $1
 echo "PEERDNS=yes" >> $1
 echo "ONBOOT=yes" >> $1
 
+#Unlike older sysconfig scripts, NetworkManager expects GATEWAYx=ipaddr for all values of x.
+#So the first gateway is GATEWAY0 instead of GATEWAY. Other values should remain unchanged.
+#Workaround this by replacing GATEWAY= with GATEWAY0=.
+sed -i "s/GATEWAY=/GATEWAY0=/" $1
 
 cp $1 /etc/sysconfig/network-scripts/
 
-- 
2.37.3