Compare commits

...

No commits in common. "c8" and "c8s" have entirely different histories.
c8 ... c8s

36 changed files with 1312 additions and 14 deletions

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: 3rd-hyperv-2019-ci.brew-build.tier1.functional}

View File

@ -0,0 +1,65 @@
From eeb77fe2cd3232abd96a1bdf1bbcfcd04053ffff Mon Sep 17 00:00:00 2001
From: Ani Sinha <anisinha@redhat.com>
Date: Tue, 10 Oct 2023 11:50:30 +0530
Subject: [PATCH 3/3] Changes for adding keyfile support in RHEL specific
script
RH-Author: Ani Sinha <None>
RH-MergeRequest: 13: hv/hv_kvp_daemon:Support for keyfile based connection profile
RH-Jira: RHEL-9901
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
RH-Commit: [3/3] 9ce1fe8f1578d41d4265d2c970123c8f71c0c80c
Some adjustments to the RHEL specific customization script in order to support
Network Manager keyfiles. These changes were tested internally by Red Hat QE.
These changes are mostly trivial and are not pushed upstream at this momemnt.
Jira: https://issues.redhat.com/browse/RHEL-9901
Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
hv_set_ifconfig.sh | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
index 9c2ee30..93decd6 100644
--- a/hv_set_ifconfig.sh
+++ b/hv_set_ifconfig.sh
@@ -74,19 +74,23 @@
# 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
-echo "IPV6INIT=yes" >> $1
-echo "PEERDNS=yes" >> $1
-echo "ONBOOT=yes" >> $1
+sed -i '/\[ipv4\]/a ignore-auto-dns=false' $2
+sed -i '/\[connection\]/a autoconnect=true' $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
+filename="${2##*/}"
-cp $1 /etc/sysconfig/network-scripts/
+cp $2 /etc/NetworkManager/system-connections/
+chmod 600 /etc/NetworkManager/system-connections/$filename
-filename="${1##*/}"
-nmcli connection load "/etc/sysconfig/network-scripts/${filename}"
-nmcli connection up filename "/etc/sysconfig/network-scripts/${filename}"
+nmcli connection load "/etc/NetworkManager/system-connections/${filename}"
+nmcli connection up filename "/etc/NetworkManager/system-connections/${filename}"
+
+exit 0
--
2.41.0

View File

@ -0,0 +1,65 @@
From eb4f3620e350c45a88c24d1a56523bbb1ab28fe8 Mon Sep 17 00:00:00 2001
From: Ani Sinha <anisinha@redhat.com>
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 <None>
RH-MergeRequest: 14: Revert all changes related to adding keyfile support in hyperv-daemons
RH-Jira: RHEL-9901
RH-Acked-by: Cathy Avery <cavery@redhat.com>
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
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 <anisinha@redhat.com>
---
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

View File

@ -0,0 +1,89 @@
From af30a3d74a1c6b4a501f994ec43d97597e94e098 Mon Sep 17 00:00:00 2001
From: Ani Sinha <anisinha@redhat.com>
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 <None>
RH-MergeRequest: 14: Revert all changes related to adding keyfile support in hyperv-daemons
RH-Jira: RHEL-9901
RH-Acked-by: Cathy Avery <cavery@redhat.com>
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
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 <anisinha@redhat.com>
---
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

View File

@ -0,0 +1,407 @@
From 814ef4ba2f28f766811da9cbf39c4dd826810fea Mon Sep 17 00:00:00 2001
From: Ani Sinha <anisinha@redhat.com>
Date: Tue, 9 Jan 2024 10:10:29 +0530
Subject: [PATCH 3/3] Revert "hv/hv_kvp_daemon:Support for keyfile based
connection profile"
RH-Author: Ani Sinha <None>
RH-MergeRequest: 14: Revert all changes related to adding keyfile support in hyperv-daemons
RH-Jira: RHEL-9901
RH-Acked-by: Cathy Avery <cavery@redhat.com>
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
RH-Commit: [3/3] e5ef938a993ede072c749d9923fe5384d82586fa
This reverts commit a360344134e075dfebc99c1551e141e2ec25a2fa.
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 <anisinha@redhat.com>
---
hv_kvp_daemon.c | 233 ++++++---------------------------------------
hv_set_ifconfig.sh | 30 +-----
2 files changed, 33 insertions(+), 230 deletions(-)
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
index 264eeb9..27f5e7d 100644
--- a/hv_kvp_daemon.c
+++ b/hv_kvp_daemon.c
@@ -1171,79 +1171,12 @@ static int process_ip_string(FILE *f, char *ip_string, int type)
return 0;
}
-/*
- * Only IPv4 subnet strings needs to be converted to plen
- * For IPv6 the subnet is already privided in plen format
- */
-static int kvp_subnet_to_plen(char *subnet_addr_str)
-{
- int plen = 0;
- struct in_addr subnet_addr4;
-
- /*
- * Convert subnet address to binary representation
- */
- if (inet_pton(AF_INET, subnet_addr_str, &subnet_addr4) == 1) {
- uint32_t subnet_mask = ntohl(subnet_addr4.s_addr);
-
- while (subnet_mask & 0x80000000) {
- plen++;
- subnet_mask <<= 1;
- }
- } else {
- return -1;
- }
-
- return plen;
-}
-
-static int process_ip_string_nm(FILE *f, char *ip_string, char *subnet,
- int is_ipv6)
-{
- char addr[INET6_ADDRSTRLEN];
- char subnet_addr[INET6_ADDRSTRLEN];
- int error, i = 0;
- int ip_offset = 0, subnet_offset = 0;
- int plen;
-
- memset(addr, 0, sizeof(addr));
- memset(subnet_addr, 0, sizeof(subnet_addr));
-
- while (parse_ip_val_buffer(ip_string, &ip_offset, addr,
- (MAX_IP_ADDR_SIZE * 2)) &&
- parse_ip_val_buffer(subnet,
- &subnet_offset,
- subnet_addr,
- (MAX_IP_ADDR_SIZE *
- 2))) {
- if (!is_ipv6)
- plen = kvp_subnet_to_plen((char *)subnet_addr);
- else
- plen = atoi(subnet_addr);
-
- if (plen < 0)
- return plen;
-
- error = fprintf(f, "address%d=%s/%d\n", ++i, (char *)addr,
- plen);
- if (error < 0)
- return error;
-
- memset(addr, 0, sizeof(addr));
- memset(subnet_addr, 0, sizeof(subnet_addr));
- }
-
- return 0;
-}
-
static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
{
int error = 0;
- char if_filename[PATH_MAX];
- char nm_filename[PATH_MAX];
- FILE *ifcfg_file, *nmfile;
+ char if_file[PATH_MAX];
+ FILE *file;
char cmd[PATH_MAX];
- int is_ipv6 = 0;
char *mac_addr;
int str_len;
@@ -1264,7 +1197,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
* in a given distro to configure the interface and so are free
* ignore information that may not be relevant.
*
- * Here is the ifcfg format of the ip configuration file:
+ * Here is the format of the ip configuration file:
*
* HWADDR=macaddr
* DEVICE=interface name
@@ -1287,32 +1220,6 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
* tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
* IPV6NETMASK.
*
- * Here is the keyfile format of the ip configuration file:
- *
- * [ethernet]
- * mac-address=macaddr
- * [connection]
- * interface-name=interface name
- *
- * [ipv4]
- * method=<protocol> (where <protocol> is "auto" if DHCP is configured
- * or "manual" if no boot-time protocol should be used)
- *
- * address1=ipaddr1/plen
- * address2=ipaddr2/plen
- *
- * gateway=gateway1;gateway2
- *
- * dns=dns1;dns2
- *
- * [ipv6]
- * address1=ipaddr1/plen
- * address2=ipaddr2/plen
- *
- * gateway=gateway1;gateway2
- *
- * dns=dns1;dns2
- *
* The host can specify multiple ipv4 and ipv6 addresses to be
* configured for the interface. Furthermore, the configuration
* needs to be persistent. A subsequent GET call on the interface
@@ -1320,29 +1227,14 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
* call.
*/
- /*
- * We are populating both ifcfg and nmconnection files
- */
- snprintf(if_filename, sizeof(if_filename), "%s%s%s", KVP_CONFIG_LOC,
- "/ifcfg-", if_name);
+ snprintf(if_file, sizeof(if_file), "%s%s%s", KVP_CONFIG_LOC,
+ "/ifcfg-", if_name);
- ifcfg_file = fopen(if_filename, "w");
+ file = fopen(if_file, "w");
- if (!ifcfg_file) {
+ if (file == NULL) {
syslog(LOG_ERR, "Failed to open config file; error: %d %s",
- errno, strerror(errno));
- return HV_E_FAIL;
- }
-
- snprintf(nm_filename, sizeof(nm_filename), "%s%s%s%s", KVP_CONFIG_LOC,
- "/", if_name, ".nmconnection");
-
- nmfile = fopen(nm_filename, "w");
-
- if (!nmfile) {
- syslog(LOG_ERR, "Failed to open config file; error: %d %s",
- errno, strerror(errno));
- fclose(ifcfg_file);
+ errno, strerror(errno));
return HV_E_FAIL;
}
@@ -1356,31 +1248,14 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
goto setval_error;
}
- error = kvp_write_file(ifcfg_file, "HWADDR", "", mac_addr);
- if (error < 0)
- goto setmac_error;
-
- error = kvp_write_file(ifcfg_file, "DEVICE", "", if_name);
- if (error < 0)
- goto setmac_error;
-
- error = fprintf(nmfile, "\n[connection]\n");
- if (error < 0)
- goto setmac_error;
-
- error = kvp_write_file(nmfile, "interface-name", "", if_name);
+ error = kvp_write_file(file, "HWADDR", "", mac_addr);
+ free(mac_addr);
if (error)
- goto setmac_error;
-
- error = fprintf(nmfile, "\n[ethernet]\n");
- if (error < 0)
- goto setmac_error;
+ goto setval_error;
- error = kvp_write_file(nmfile, "mac-address", "", mac_addr);
+ error = kvp_write_file(file, "DEVICE", "", if_name);
if (error)
- goto setmac_error;
-
- free(mac_addr);
+ goto setval_error;
/*
* The dhcp_enabled flag is only for IPv4. In the case the host only
@@ -1388,91 +1263,47 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
* proceed to parse and pass the IPv6 information to the
* disto-specific script hv_set_ifconfig.
*/
-
- /*
- * First populate the ifcfg file format
- */
if (new_val->dhcp_enabled) {
- error = kvp_write_file(ifcfg_file, "BOOTPROTO", "", "dhcp");
+ error = kvp_write_file(file, "BOOTPROTO", "", "dhcp");
if (error)
goto setval_error;
+
} else {
- error = kvp_write_file(ifcfg_file, "BOOTPROTO", "", "none");
+ error = kvp_write_file(file, "BOOTPROTO", "", "none");
if (error)
goto setval_error;
}
- error = process_ip_string(ifcfg_file, (char *)new_val->ip_addr,
- IPADDR);
- if (error)
- goto setval_error;
+ /*
+ * Write the configuration for ipaddress, netmask, gateway and
+ * name servers.
+ */
- error = process_ip_string(ifcfg_file, (char *)new_val->sub_net,
- NETMASK);
+ error = process_ip_string(file, (char *)new_val->ip_addr, IPADDR);
if (error)
goto setval_error;
- error = process_ip_string(ifcfg_file, (char *)new_val->gate_way,
- GATEWAY);
+ error = process_ip_string(file, (char *)new_val->sub_net, NETMASK);
if (error)
goto setval_error;
- error = process_ip_string(ifcfg_file, (char *)new_val->dns_addr, DNS);
+ error = process_ip_string(file, (char *)new_val->gate_way, GATEWAY);
if (error)
goto setval_error;
- if (new_val->addr_family == ADDR_FAMILY_IPV6) {
- error = fprintf(nmfile, "\n[ipv6]\n");
- if (error < 0)
- goto setval_error;
- is_ipv6 = 1;
- } else {
- error = fprintf(nmfile, "\n[ipv4]\n");
- if (error < 0)
- goto setval_error;
- }
-
- /*
- * Now we populate the keyfile format
- */
-
- if (new_val->dhcp_enabled) {
- error = kvp_write_file(nmfile, "method", "", "auto");
- if (error < 0)
- goto setval_error;
- } else {
- error = kvp_write_file(nmfile, "method", "", "manual");
- if (error < 0)
- goto setval_error;
- }
-
- /*
- * Write the configuration for ipaddress, netmask, gateway and
- * name services
- */
- error = process_ip_string_nm(nmfile, (char *)new_val->ip_addr,
- (char *)new_val->sub_net, is_ipv6);
- 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)
+ error = process_ip_string(file, (char *)new_val->dns_addr, DNS);
+ if (error)
goto setval_error;
- fclose(nmfile);
- fclose(ifcfg_file);
+ fclose(file);
/*
* Now that we have populated the configuration file,
* invoke the external script to do its magic.
*/
- str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s %s",
- "hv_set_ifconfig", if_filename, nm_filename);
+ str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s",
+ "hv_set_ifconfig", if_file);
/*
* This is a little overcautious, but it's necessary to suppress some
* false warnings from gcc 8.0.1.
@@ -1485,16 +1316,14 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
if (system(cmd)) {
syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s",
- cmd, errno, strerror(errno));
+ cmd, errno, strerror(errno));
return HV_E_FAIL;
}
return 0;
-setmac_error:
- free(mac_addr);
+
setval_error:
syslog(LOG_ERR, "Failed to write config file");
- fclose(ifcfg_file);
- fclose(nmfile);
+ fclose(file);
return error;
}
diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
index 35aae6f..fe7fccf 100644
--- a/hv_set_ifconfig.sh
+++ b/hv_set_ifconfig.sh
@@ -18,12 +18,12 @@
#
# This example script is based on a RHEL environment.
#
-# Here is the ifcfg format of the ip configuration file:
+# Here is the format of the ip configuration file:
#
# HWADDR=macaddr
# DEVICE=interface name
# BOOTPROTO=<protocol> (where <protocol> is "dhcp" if DHCP is configured
-# or "none" if no boot-time protocol should be used)
+# or "none" if no boot-time protocol should be used)
#
# IPADDR0=ipaddr1
# IPADDR1=ipaddr2
@@ -41,32 +41,6 @@
# tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
# IPV6NETMASK.
#
-# Here is the keyfile format of the ip configuration file:
-#
-# [ethernet]
-# mac-address=macaddr
-# [connection]
-# interface-name=interface name
-#
-# [ipv4]
-# method=<protocol> (where <protocol> is "auto" if DHCP is configured
-# or "manual" if no boot-time protocol should be used)
-#
-# address1=ipaddr1/plen
-# address=ipaddr2/plen
-#
-# gateway=gateway1;gateway2
-#
-# dns=dns1;
-#
-# [ipv6]
-# address1=ipaddr1/plen
-# address2=ipaddr1/plen
-#
-# gateway=gateway1;gateway2
-#
-# dns=dns1;dns2
-#
# The host can specify multiple ipv4 and ipv6 addresses to be
# configured for the interface. Furthermore, the configuration
# needs to be persistent. A subsequent GET call on the interface
--
2.41.0

View File

@ -0,0 +1,99 @@
From 0b5a275023d7779db38f3d944103419532f034f4 Mon Sep 17 00:00:00 2001
From: Ani Sinha <anisinha@redhat.com>
Date: Mon, 16 Oct 2023 19:03:33 +0530
Subject: [PATCH 2/3] hv/hv_kvp_daemon: Some small fixes for handling NM
keyfiles
RH-Author: Ani Sinha <None>
RH-MergeRequest: 13: hv/hv_kvp_daemon:Support for keyfile based connection profile
RH-Jira: RHEL-9901
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
RH-Commit: [2/3] a6969ec766ed16a85e06204e79a0f1d2d432b214
Some small fixes:
- lets make sure we are not adding ipv4 addresses in ipv6 section in
keyfile and vice versa.
- ADDR_FAMILY_IPV6 is a bit in addr_family. Test that bit instead of
checking the whole value of addr_family.
- Some trivial fixes in hv_set_ifconfig.sh.
These fixes are proposed after doing some internal testing at Red Hat.
Cherry-picked from upstream linux
kernel commit c3803203bc5ec910a ("hv/hv_kvp_daemon: Some small fixes for handling NM keyfiles")
CC: Shradha Gupta <shradhagupta@linux.microsoft.com>
CC: Saurabh Sengar <ssengar@linux.microsoft.com>
Fixes: 42999c904612 ("hv/hv_kvp_daemon:Support for keyfile based connection profile")
Signed-off-by: Ani Sinha <anisinha@redhat.com>
Reviewed-by: Shradha Gupta <Shradhagupta@linux.microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <20231016133122.2419537-1-anisinha@redhat.com>
---
hv_kvp_daemon.c | 20 ++++++++++++--------
hv_set_ifconfig.sh | 4 ++--
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
index 264eeb9..318e2da 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,14 +1455,18 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
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;
+ /* 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;
+ }
+ 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 35aae6f..9c2ee30 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
-# address=ipaddr2/plen
+# address2=ipaddr2/plen
#
# gateway=gateway1;gateway2
#
@@ -61,7 +61,7 @@
#
# [ipv6]
# address1=ipaddr1/plen
-# address2=ipaddr1/plen
+# address2=ipaddr2/plen
#
# gateway=gateway1;gateway2
#
--
2.41.0

View File

@ -0,0 +1,425 @@
From a360344134e075dfebc99c1551e141e2ec25a2fa Mon Sep 17 00:00:00 2001
From: Shradha Gupta <shradhagupta@linux.microsoft.com>
Date: Mon, 9 Oct 2023 03:38:40 -0700
Subject: [PATCH 1/3] hv/hv_kvp_daemon:Support for keyfile based connection
profile
RH-Author: Ani Sinha <None>
RH-MergeRequest: 13: hv/hv_kvp_daemon:Support for keyfile based connection profile
RH-Jira: RHEL-9901
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
RH-Commit: [1/3] b8937934d5aaa0305a1c8d19381aba5cf0cc185e
Ifcfg config file support in NetworkManger is deprecated. This patch
provides support for the new keyfile config format for connection
profiles in NetworkManager. The patch modifies the hv_kvp_daemon code
to generate the new network configuration in keyfile
format(.ini-style format) along with a ifcfg format configuration.
The ifcfg format configuration is also retained to support easy
backward compatibility for distro vendors. These configurations are
stored in temp files which are further translated using the
hv_set_ifconfig.sh script. This script is implemented by individual
distros based on the network management commands supported.
For example, RHEL's implementation could be found here:
https://gitlab.com/redhat/centos-stream/src/hyperv-daemons/-/blob/c9s/hv_set_ifconfig.sh
Debian's implementation could be found here:
https://github.com/endlessm/linux/blob/master/debian/cloud-tools/hv_set_ifconfig
The next part of this support is to let the Distro vendors consume
these modified implementations to the new configuration format.
Cherry-picked from upstream linux
kernel commit 42999c904612 ("hv/hv_kvp_daemon:Support for keyfile based connection profile")
Tested-on: Rhel9(Hyper-V, Azure)(nm and ifcfg files verified)
Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
Reviewed-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Reviewed-by: Ani Sinha <anisinha@redhat.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Link: https://lore.kernel.org/r/1696847920-31125-1-git-send-email-shradhagupta@linux.microsoft.com
---
hv_kvp_daemon.c | 233 +++++++++++++++++++++++++++++++++++++++------
hv_set_ifconfig.sh | 30 +++++-
2 files changed, 230 insertions(+), 33 deletions(-)
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
index 27f5e7d..264eeb9 100644
--- a/hv_kvp_daemon.c
+++ b/hv_kvp_daemon.c
@@ -1171,12 +1171,79 @@ static int process_ip_string(FILE *f, char *ip_string, int type)
return 0;
}
+/*
+ * Only IPv4 subnet strings needs to be converted to plen
+ * For IPv6 the subnet is already privided in plen format
+ */
+static int kvp_subnet_to_plen(char *subnet_addr_str)
+{
+ int plen = 0;
+ struct in_addr subnet_addr4;
+
+ /*
+ * Convert subnet address to binary representation
+ */
+ if (inet_pton(AF_INET, subnet_addr_str, &subnet_addr4) == 1) {
+ uint32_t subnet_mask = ntohl(subnet_addr4.s_addr);
+
+ while (subnet_mask & 0x80000000) {
+ plen++;
+ subnet_mask <<= 1;
+ }
+ } else {
+ return -1;
+ }
+
+ return plen;
+}
+
+static int process_ip_string_nm(FILE *f, char *ip_string, char *subnet,
+ int is_ipv6)
+{
+ char addr[INET6_ADDRSTRLEN];
+ char subnet_addr[INET6_ADDRSTRLEN];
+ int error, i = 0;
+ int ip_offset = 0, subnet_offset = 0;
+ int plen;
+
+ memset(addr, 0, sizeof(addr));
+ memset(subnet_addr, 0, sizeof(subnet_addr));
+
+ while (parse_ip_val_buffer(ip_string, &ip_offset, addr,
+ (MAX_IP_ADDR_SIZE * 2)) &&
+ parse_ip_val_buffer(subnet,
+ &subnet_offset,
+ subnet_addr,
+ (MAX_IP_ADDR_SIZE *
+ 2))) {
+ if (!is_ipv6)
+ plen = kvp_subnet_to_plen((char *)subnet_addr);
+ else
+ plen = atoi(subnet_addr);
+
+ if (plen < 0)
+ return plen;
+
+ error = fprintf(f, "address%d=%s/%d\n", ++i, (char *)addr,
+ plen);
+ if (error < 0)
+ return error;
+
+ memset(addr, 0, sizeof(addr));
+ memset(subnet_addr, 0, sizeof(subnet_addr));
+ }
+
+ return 0;
+}
+
static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
{
int error = 0;
- char if_file[PATH_MAX];
- FILE *file;
+ char if_filename[PATH_MAX];
+ char nm_filename[PATH_MAX];
+ FILE *ifcfg_file, *nmfile;
char cmd[PATH_MAX];
+ int is_ipv6 = 0;
char *mac_addr;
int str_len;
@@ -1197,7 +1264,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
* in a given distro to configure the interface and so are free
* ignore information that may not be relevant.
*
- * Here is the format of the ip configuration file:
+ * Here is the ifcfg format of the ip configuration file:
*
* HWADDR=macaddr
* DEVICE=interface name
@@ -1220,6 +1287,32 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
* tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
* IPV6NETMASK.
*
+ * Here is the keyfile format of the ip configuration file:
+ *
+ * [ethernet]
+ * mac-address=macaddr
+ * [connection]
+ * interface-name=interface name
+ *
+ * [ipv4]
+ * method=<protocol> (where <protocol> is "auto" if DHCP is configured
+ * or "manual" if no boot-time protocol should be used)
+ *
+ * address1=ipaddr1/plen
+ * address2=ipaddr2/plen
+ *
+ * gateway=gateway1;gateway2
+ *
+ * dns=dns1;dns2
+ *
+ * [ipv6]
+ * address1=ipaddr1/plen
+ * address2=ipaddr2/plen
+ *
+ * gateway=gateway1;gateway2
+ *
+ * dns=dns1;dns2
+ *
* The host can specify multiple ipv4 and ipv6 addresses to be
* configured for the interface. Furthermore, the configuration
* needs to be persistent. A subsequent GET call on the interface
@@ -1227,14 +1320,29 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
* call.
*/
- snprintf(if_file, sizeof(if_file), "%s%s%s", KVP_CONFIG_LOC,
- "/ifcfg-", if_name);
+ /*
+ * We are populating both ifcfg and nmconnection files
+ */
+ snprintf(if_filename, sizeof(if_filename), "%s%s%s", KVP_CONFIG_LOC,
+ "/ifcfg-", if_name);
- file = fopen(if_file, "w");
+ ifcfg_file = fopen(if_filename, "w");
- if (file == NULL) {
+ if (!ifcfg_file) {
syslog(LOG_ERR, "Failed to open config file; error: %d %s",
- errno, strerror(errno));
+ errno, strerror(errno));
+ return HV_E_FAIL;
+ }
+
+ snprintf(nm_filename, sizeof(nm_filename), "%s%s%s%s", KVP_CONFIG_LOC,
+ "/", if_name, ".nmconnection");
+
+ nmfile = fopen(nm_filename, "w");
+
+ if (!nmfile) {
+ syslog(LOG_ERR, "Failed to open config file; error: %d %s",
+ errno, strerror(errno));
+ fclose(ifcfg_file);
return HV_E_FAIL;
}
@@ -1248,14 +1356,31 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
goto setval_error;
}
- error = kvp_write_file(file, "HWADDR", "", mac_addr);
- free(mac_addr);
+ error = kvp_write_file(ifcfg_file, "HWADDR", "", mac_addr);
+ if (error < 0)
+ goto setmac_error;
+
+ error = kvp_write_file(ifcfg_file, "DEVICE", "", if_name);
+ if (error < 0)
+ goto setmac_error;
+
+ error = fprintf(nmfile, "\n[connection]\n");
+ if (error < 0)
+ goto setmac_error;
+
+ error = kvp_write_file(nmfile, "interface-name", "", if_name);
if (error)
- goto setval_error;
+ goto setmac_error;
- error = kvp_write_file(file, "DEVICE", "", if_name);
+ error = fprintf(nmfile, "\n[ethernet]\n");
+ if (error < 0)
+ goto setmac_error;
+
+ error = kvp_write_file(nmfile, "mac-address", "", mac_addr);
if (error)
- goto setval_error;
+ goto setmac_error;
+
+ free(mac_addr);
/*
* The dhcp_enabled flag is only for IPv4. In the case the host only
@@ -1263,47 +1388,91 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
* proceed to parse and pass the IPv6 information to the
* disto-specific script hv_set_ifconfig.
*/
+
+ /*
+ * First populate the ifcfg file format
+ */
if (new_val->dhcp_enabled) {
- error = kvp_write_file(file, "BOOTPROTO", "", "dhcp");
+ error = kvp_write_file(ifcfg_file, "BOOTPROTO", "", "dhcp");
if (error)
goto setval_error;
-
} else {
- error = kvp_write_file(file, "BOOTPROTO", "", "none");
+ error = kvp_write_file(ifcfg_file, "BOOTPROTO", "", "none");
if (error)
goto setval_error;
}
- /*
- * Write the configuration for ipaddress, netmask, gateway and
- * name servers.
- */
-
- error = process_ip_string(file, (char *)new_val->ip_addr, IPADDR);
+ error = process_ip_string(ifcfg_file, (char *)new_val->ip_addr,
+ IPADDR);
if (error)
goto setval_error;
- error = process_ip_string(file, (char *)new_val->sub_net, NETMASK);
+ error = process_ip_string(ifcfg_file, (char *)new_val->sub_net,
+ NETMASK);
if (error)
goto setval_error;
- error = process_ip_string(file, (char *)new_val->gate_way, GATEWAY);
+ error = process_ip_string(ifcfg_file, (char *)new_val->gate_way,
+ GATEWAY);
if (error)
goto setval_error;
- error = process_ip_string(file, (char *)new_val->dns_addr, DNS);
+ error = process_ip_string(ifcfg_file, (char *)new_val->dns_addr, DNS);
if (error)
goto setval_error;
- fclose(file);
+ if (new_val->addr_family == ADDR_FAMILY_IPV6) {
+ error = fprintf(nmfile, "\n[ipv6]\n");
+ if (error < 0)
+ goto setval_error;
+ is_ipv6 = 1;
+ } else {
+ error = fprintf(nmfile, "\n[ipv4]\n");
+ if (error < 0)
+ goto setval_error;
+ }
+
+ /*
+ * Now we populate the keyfile format
+ */
+
+ if (new_val->dhcp_enabled) {
+ error = kvp_write_file(nmfile, "method", "", "auto");
+ if (error < 0)
+ goto setval_error;
+ } else {
+ error = kvp_write_file(nmfile, "method", "", "manual");
+ if (error < 0)
+ goto setval_error;
+ }
+
+ /*
+ * Write the configuration for ipaddress, netmask, gateway and
+ * name services
+ */
+ error = process_ip_string_nm(nmfile, (char *)new_val->ip_addr,
+ (char *)new_val->sub_net, is_ipv6);
+ 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;
+
+ fclose(nmfile);
+ fclose(ifcfg_file);
/*
* Now that we have populated the configuration file,
* invoke the external script to do its magic.
*/
- str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s",
- "hv_set_ifconfig", if_file);
+ str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s %s",
+ "hv_set_ifconfig", if_filename, nm_filename);
/*
* This is a little overcautious, but it's necessary to suppress some
* false warnings from gcc 8.0.1.
@@ -1316,14 +1485,16 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
if (system(cmd)) {
syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s",
- cmd, errno, strerror(errno));
+ cmd, errno, strerror(errno));
return HV_E_FAIL;
}
return 0;
-
+setmac_error:
+ free(mac_addr);
setval_error:
syslog(LOG_ERR, "Failed to write config file");
- fclose(file);
+ fclose(ifcfg_file);
+ fclose(nmfile);
return error;
}
diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
index fe7fccf..35aae6f 100644
--- a/hv_set_ifconfig.sh
+++ b/hv_set_ifconfig.sh
@@ -18,12 +18,12 @@
#
# This example script is based on a RHEL environment.
#
-# Here is the format of the ip configuration file:
+# Here is the ifcfg format of the ip configuration file:
#
# HWADDR=macaddr
# DEVICE=interface name
# BOOTPROTO=<protocol> (where <protocol> is "dhcp" if DHCP is configured
-# or "none" if no boot-time protocol should be used)
+# or "none" if no boot-time protocol should be used)
#
# IPADDR0=ipaddr1
# IPADDR1=ipaddr2
@@ -41,6 +41,32 @@
# tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
# IPV6NETMASK.
#
+# Here is the keyfile format of the ip configuration file:
+#
+# [ethernet]
+# mac-address=macaddr
+# [connection]
+# interface-name=interface name
+#
+# [ipv4]
+# method=<protocol> (where <protocol> is "auto" if DHCP is configured
+# or "manual" if no boot-time protocol should be used)
+#
+# address1=ipaddr1/plen
+# address=ipaddr2/plen
+#
+# gateway=gateway1;gateway2
+#
+# dns=dns1;
+#
+# [ipv6]
+# address1=ipaddr1/plen
+# address2=ipaddr1/plen
+#
+# gateway=gateway1;gateway2
+#
+# dns=dns1;dns2
+#
# The host can specify multiple ipv4 and ipv6 addresses to be
# configured for the interface. Furthermore, the configuration
# needs to be persistent. A subsequent GET call on the interface
--
2.41.0

View File

@ -1,17 +1,17 @@
From 8acc8ecc93352bfb3d78e8d37c5ed03a4948a39d Mon Sep 17 00:00:00 2001 From 0a6bfc42945419eba5ed92c10ae722625a2ccb05 Mon Sep 17 00:00:00 2001
From: Mohammed Gamal <mgamal@redhat.com> From: Mohammed Gamal <mgamal@redhat.com>
Date: Tue, 8 Nov 2022 16:20:17 +0100 Date: Tue, 8 Nov 2022 16:20:17 +0100
Subject: [PATCH] redhat: hv_set_if_config: Workaround for gateway numbering in Subject: [PATCH 1/3] redhat: hv_set_if_config: Workaround for gateway
NetworkManager numbering in NetworkManager
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com> RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
RH-MergeRequest: 10: redhat: hv_set_if_config: Workaround for gateway numbering in NetworkManager RH-MergeRequest: 4: redhat: hv_set_if_config: Workaround for gateway numbering in NetworkManager
RH-Bugzilla: 2150255 RH-Bugzilla: 2142028
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
RH-Acked-by: Jon Maloy <jmaloy@redhat.com> RH-Acked-by: Cathy Avery <cavery@redhat.com>
RH-Commit: [1/1] a52af3c2a8c4365cbe6777fe1afe4ebcf81954d6 RH-Commit: [1/1] 85b28bc13239a64b7a200ca4edb83ac5d0fe5ebd
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2150255 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2142028
Unlike older sysconfig scripts, NetworkManager expects GATEWAYx=ipaddr for all values of x. 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. So the first gateway is GATEWAY0 instead of GATEWAY. Other values should remain unchanged.

View File

@ -0,0 +1,47 @@
From 2171b1e58d19b8af77aecc56fa7ce2529cb0ec97 Mon Sep 17 00:00:00 2001
From: Mohammed Gamal <mgamal@redhat.com>
Date: Thu, 17 Nov 2022 18:56:20 +0100
Subject: [PATCH 2/3] tools: hv: Remove an extraneous "the"
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
RH-MergeRequest: 5: Update hyperv-daemons for RHEL-8.8
RH-Bugzilla: 2139456
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Commit: [1/2] 7ae4fbcb80ed5795a43cbd355b8e8fe58ab78ba0
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2139456
commit f15f39fabed2248311607445ddfa6dba63abebb9
Author: Jason Wang <wangborong@cdjrlc.com>
Date: Thu Aug 11 21:34:33 2022 +0800
tools: hv: Remove an extraneous "the"
There are two "the" in the text. Remove one.
Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
Link: https://lore.kernel.org/r/20220811133433.10175-1-wangborong@cdjrlc.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
---
hv_kvp_daemon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
index 1e6fd6c..c97c12e 100644
--- a/hv_kvp_daemon.c
+++ b/hv_kvp_daemon.c
@@ -44,7 +44,7 @@
/*
* KVP protocol: The user mode component first registers with the
- * the kernel component. Subsequently, the kernel component requests, data
+ * kernel component. Subsequently, the kernel component requests, data
* for the specified keys. In response to this message the user mode component
* fills in the value corresponding to the specified key. We overload the
* sequence field in the cn_msg header to define our KVP message types.
--
2.37.3

View File

@ -0,0 +1,53 @@
From 0452c1c7a5f5f27aebefcc2816f3781c7bbb55e2 Mon Sep 17 00:00:00 2001
From: Mohammed Gamal <mgamal@redhat.com>
Date: Thu, 17 Nov 2022 18:58:31 +0100
Subject: [PATCH 3/3] tools: hv: kvp: remove unnecessary (void*) conversions
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
RH-MergeRequest: 5: Update hyperv-daemons for RHEL-8.8
RH-Bugzilla: 2139456
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Commit: [2/2] 739e447d4cff82f47cb60a14d8bd87ca3601a59b
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2139456
commit 2258954234db7530e9d86bb32cd6ad54485ff926
Author: Zhou jie <zhoujie@nfschina.com>
Date: Tue Aug 23 11:45:52 2022 +0800
tools: hv: kvp: remove unnecessary (void*) conversions
Remove unnecessary void* type casting.
Signed-off-by: Zhou jie <zhoujie@nfschina.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20220823034552.8596-1-zhoujie@nfschina.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
---
hv_kvp_daemon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
index c97c12e..27f5e7d 100644
--- a/hv_kvp_daemon.c
+++ b/hv_kvp_daemon.c
@@ -772,11 +772,11 @@ static int kvp_process_ip_address(void *addrp,
const char *str;
if (family == AF_INET) {
- addr = (struct sockaddr_in *)addrp;
+ addr = addrp;
str = inet_ntop(family, &addr->sin_addr, tmp, 50);
addr_length = INET_ADDRSTRLEN;
} else {
- addr6 = (struct sockaddr_in6 *)addrp;
+ addr6 = addrp;
str = inet_ntop(family, &addr6->sin6_addr.s6_addr, tmp, 50);
addr_length = INET6_ADDRSTRLEN;
}
--
2.37.3

View File

@ -13,7 +13,7 @@
Name: hyperv-daemons Name: hyperv-daemons
Version: 0 Version: 0
Release: 0.34%{?snapver}%{?dist} Release: 0.36%{?snapver}%{?dist}
Summary: Hyper-V daemons suite Summary: Hyper-V daemons suite
Group: System Environment/Daemons Group: System Environment/Daemons
@ -66,8 +66,24 @@ Patch7: hpvd-Use-filename-for-connection-profile.patch
Patch8: hpvd-hypervkvpd.service-ordering-fixes.patch Patch8: hpvd-hypervkvpd.service-ordering-fixes.patch
# For bz#2115761 - [Hyper-V][RHEL-8] hypervkvpd.service service ordering # For bz#2115761 - [Hyper-V][RHEL-8] hypervkvpd.service service ordering
Patch9: hpvd-redhat-Add-ConditionalVirtualization-to-the-rest-of-.patch Patch9: hpvd-redhat-Add-ConditionalVirtualization-to-the-rest-of-.patch
# For bz#2150255 - [Hyper-V][RHEL-8] Cannot set gateway properly when set static IPADDR0,NETMASK0,GATEWAY in ifcfg-eth0 [rhel-8.7.0.z] # For bz#2142028 - [Hyper-V][RHEL-8] Cannot set gateway properly when set static IPADDR0,NETMASK0,GATEWAY in ifcfg-eth0
Patch10: hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.patch Patch10: hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.patch
# For bz#2139456 - [Hyper-V][RHEL8.8] Update Hyper-V-Daemons
Patch11: hpvd-tools-hv-Remove-an-extraneous-the.patch
# For bz#2139456 - [Hyper-V][RHEL8.8] Update Hyper-V-Daemons
Patch12: hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.patch
# For RHEL-9901 - [Hyper-V][RHEL-8] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in connection configuration
Patch13: hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.patch
# For RHEL-9901 - [Hyper-V][RHEL-8] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in connection configuration
Patch14: hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.patch
# For RHEL-9901 - [Hyper-V][RHEL-8] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in connection configuration
Patch15: hpvd-Changes-for-adding-keyfile-support-in-RHEL-specific-.patch
# For RHEL-9901 - [Hyper-V][RHEL-8] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in connection configuration
Patch16: hpvd-Revert-Changes-for-adding-keyfile-support-in-RHEL-sp.patch
# For RHEL-9901 - [Hyper-V][RHEL-8] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in connection configuration
Patch17: hpvd-Revert-hv-hv_kvp_daemon-Some-small-fixes-for-handlin.patch
# For RHEL-9901 - [Hyper-V][RHEL-8] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in connection configuration
Patch18: hpvd-Revert-hv-hv_kvp_daemon-Support-for-keyfile-based-co.patch
# For bz#2020141 - [Hyper-V][RHEL8.6][ARM64] No hyperv-daemons package built for aarch64 platform # For bz#2020141 - [Hyper-V][RHEL8.6][ARM64] No hyperv-daemons package built for aarch64 platform
# Patch6: hpvd-Enable-build-on-aarch64.patch # Patch6: hpvd-Enable-build-on-aarch64.patch
@ -185,6 +201,14 @@ cp -pvL %{SOURCE4} hv_set_ifconfig.sh
%patch8 -p1 %patch8 -p1
%patch9 -p1 %patch9 -p1
%patch10 -p1 %patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%build %build
# HYPERV KVP DAEMON # HYPERV KVP DAEMON
@ -302,10 +326,28 @@ fi
%{_sbindir}/vmbus_testing %{_sbindir}/vmbus_testing
%changelog %changelog
* Mon Dec 05 2022 Jon Maloy <jmaloy@redhat.com> - 0-0.34.20180415git.el8_7 * Tue Jan 16 2024 Jon Maloy <jmaloy@redhat.com> - 0-0.36.20180415git
- hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.patch [bz#2150255] - hpvd-Revert-Changes-for-adding-keyfile-support-in-RHEL-sp.patch [RHEL-9901]
- Resolves: bz#2150255 - hpvd-Revert-hv-hv_kvp_daemon-Some-small-fixes-for-handlin.patch [RHEL-9901]
([Hyper-V][RHEL-8] Cannot set gateway properly when set static IPADDR0,NETMASK0,GATEWAY in ifcfg-eth0 [rhel-8.7.0.z]) - hpvd-Revert-hv-hv_kvp_daemon-Support-for-keyfile-based-co.patch [RHEL-9901]
- Resolves: RHEL-9901
([Hyper-V][RHEL-8] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in connection configuration)
* Thu Dec 21 2023 Jon Maloy <jmaloy@redhat.com> - 0-0.35.20180415git
- hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.patch [RHEL-9901]
- hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.patch [RHEL-9901]
- hpvd-Changes-for-adding-keyfile-support-in-RHEL-specific-.patch [RHEL-9901]
- Resolves: RHEL-9901
([Hyper-V][RHEL-8] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in connection configuration)
* Fri Dec 02 2022 Jon Maloy <jmaloy@redhat.com> - 0-0.34.20180415git
- hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.patch [bz#2142028]
- hpvd-tools-hv-Remove-an-extraneous-the.patch [bz#2139456]
- hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.patch [bz#2139456]
- Resolves: bz#2142028
([Hyper-V][RHEL-8] Cannot set gateway properly when set static IPADDR0,NETMASK0,GATEWAY in ifcfg-eth0)
- Resolves: bz#2139456
([Hyper-V][RHEL8.8] Update Hyper-V-Daemons)
* Tue Aug 16 2022 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.33.20180415git * Tue Aug 16 2022 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.33.20180415git
- hpvd-hypervkvpd.service-ordering-fixes.patch [bz#2115761] - hpvd-hypervkvpd.service-ordering-fixes.patch [bz#2115761]