From eb4f3620e350c45a88c24d1a56523bbb1ab28fe8 Mon Sep 17 00:00:00 2001 From: Ani Sinha Date: Tue, 9 Jan 2024 10:05:14 +0530 Subject: [PATCH 1/3] Revert "Changes for adding keyfile support in RHEL specific script" RH-Author: Ani Sinha RH-MergeRequest: 14: Revert all changes related to adding keyfile support in hyperv-daemons RH-Jira: RHEL-9901 RH-Acked-by: Cathy Avery RH-Acked-by: Jon Maloy RH-Commit: [1/3] 474dc7d7388a29dbf3e15217b092504295efee25 This reverts commit eeb77fe2cd3232abd96a1bdf1bbcfcd04053ffff. The revert is necessary because the keyfile support generates a regression when both ipv4 and ipv6 are used together. Please see the thread https://lkml.org/lkml/2023/12/23/138 Signed-off-by: Ani Sinha --- hv_set_ifconfig.sh | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh index 93decd6..9c2ee30 100644 --- a/hv_set_ifconfig.sh +++ b/hv_set_ifconfig.sh @@ -74,23 +74,19 @@ # call. # -# This is RHEL specific bash script that configures NM keyfiles. -# ifcfg files passed as the first argument to this script remains untouched. -if [ -z "$2" ]; then - echo "No input NM keyfile. Exiting!" - exit 1 -fi -sed -i '/\[ipv4\]/a ignore-auto-dns=false' $2 -sed -i '/\[connection\]/a autoconnect=true' $2 +echo "IPV6INIT=yes" >> $1 +echo "PEERDNS=yes" >> $1 +echo "ONBOOT=yes" >> $1 -filename="${2##*/}" +#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 $2 /etc/NetworkManager/system-connections/ -chmod 600 /etc/NetworkManager/system-connections/$filename +cp $1 /etc/sysconfig/network-scripts/ -nmcli connection load "/etc/NetworkManager/system-connections/${filename}" -nmcli connection up filename "/etc/NetworkManager/system-connections/${filename}" - -exit 0 +filename="${1##*/}" +nmcli connection load "/etc/sysconfig/network-scripts/${filename}" +nmcli connection up filename "/etc/sysconfig/network-scripts/${filename}" -- 2.41.0