From af30a3d74a1c6b4a501f994ec43d97597e94e098 Mon Sep 17 00:00:00 2001 From: Ani Sinha Date: Tue, 9 Jan 2024 10:07:57 +0530 Subject: [PATCH 2/3] Revert "hv/hv_kvp_daemon: Some small fixes for handling NM keyfiles" 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: [2/3] 9d25d58204ad78881d21865fda902dd29a462fa8 This reverts commit 0b5a275023d7779db38f3d944103419532f034f4. 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_kvp_daemon.c | 20 ++++++++------------ hv_set_ifconfig.sh | 4 ++-- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c index 318e2da..264eeb9 100644 --- a/hv_kvp_daemon.c +++ b/hv_kvp_daemon.c @@ -1421,7 +1421,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) if (error) goto setval_error; - if (new_val->addr_family & ADDR_FAMILY_IPV6) { + if (new_val->addr_family == ADDR_FAMILY_IPV6) { error = fprintf(nmfile, "\n[ipv6]\n"); if (error < 0) goto setval_error; @@ -1455,18 +1455,14 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) if (error < 0) goto setval_error; - /* we do not want ipv4 addresses in ipv6 section and vice versa */ - if (is_ipv6 != is_ipv4((char *)new_val->gate_way)) { - error = fprintf(nmfile, "gateway=%s\n", (char *)new_val->gate_way); - if (error < 0) - goto setval_error; - } + error = fprintf(nmfile, "gateway=%s\n", (char *)new_val->gate_way); + if (error < 0) + goto setval_error; + + error = fprintf(nmfile, "dns=%s\n", (char *)new_val->dns_addr); + if (error < 0) + goto setval_error; - if (is_ipv6 != is_ipv4((char *)new_val->dns_addr)) { - error = fprintf(nmfile, "dns=%s\n", (char *)new_val->dns_addr); - if (error < 0) - goto setval_error; - } fclose(nmfile); fclose(ifcfg_file); diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh index 9c2ee30..35aae6f 100644 --- a/hv_set_ifconfig.sh +++ b/hv_set_ifconfig.sh @@ -53,7 +53,7 @@ # or "manual" if no boot-time protocol should be used) # # address1=ipaddr1/plen -# address2=ipaddr2/plen +# address=ipaddr2/plen # # gateway=gateway1;gateway2 # @@ -61,7 +61,7 @@ # # [ipv6] # address1=ipaddr1/plen -# address2=ipaddr2/plen +# address2=ipaddr1/plen # # gateway=gateway1;gateway2 # -- 2.41.0