* Tue Jun 30 2026 Jon Maloy <jmaloy@redhat.com> - 0-0.45.20190303git
- hpvd-hv-hv_kvp_daemon-Update-to-v6.16.patch [RHEL-186638] - Resolves: RHEL-186638 (Hyper-V host fails to display guest IP address in certain network configurations [rhel-9])
This commit is contained in:
parent
0a455d8ee9
commit
d8507232d7
205
hpvd-hv-hv_kvp_daemon-Update-to-v6.16.patch
Normal file
205
hpvd-hv-hv_kvp_daemon-Update-to-v6.16.patch
Normal file
@ -0,0 +1,205 @@
|
||||
From a46cb067ccde764e40b243cd30d33d526da4eb4d Mon Sep 17 00:00:00 2001
|
||||
From: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Date: Tue, 16 Jun 2026 14:35:22 +0200
|
||||
Subject: [PATCH] hv/hv_kvp_daemon: Update to v6.16
|
||||
|
||||
RH-Author: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
RH-MergeRequest: 14: hv/hv_kvp_daemon: properly parse routes
|
||||
RH-Jira: RHEL-186638
|
||||
RH-Acked-by: roverflow <None>
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [1/1] f3180a1134b6bdea7ac5883d0dc525567d47c7c4 (vkuznets/hyperv-daemons)
|
||||
|
||||
JIRA: https://redhat.atlassian.net/browse/RHEL-186638
|
||||
|
||||
Pick three commits from upstream:
|
||||
|
||||
commit 9bbb8a07fd65fca0f29a869ec3f2435761a6c676
|
||||
Author: Olaf Hering <olaf@aepfle.de>
|
||||
Date: Mon Dec 2 11:19:55 2024 +0100
|
||||
|
||||
tools/hv: update route parsing in kvp daemon
|
||||
|
||||
commit 175c71c2aceef173ae6d3dceb41edfc2ac0d5937
|
||||
Author: Olaf Hering <olaf@aepfle.de>
|
||||
Date: Sun Dec 8 23:47:17 2024 +0000
|
||||
|
||||
tools/hv: reduce resource usage in hv_kvp_daemon
|
||||
|
||||
commit 07dfa6e821e1c58cbd0f195173dddbd593721f9b
|
||||
Author: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Date: Tue Nov 12 16:04:01 2024 +0100
|
||||
|
||||
hv/hv_kvp_daemon: Pass NIC name to hv_get_dns_info as well
|
||||
|
||||
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
---
|
||||
hv_kvp_daemon.c | 117 ++++++++++++++++++++++++++++++++++++------------
|
||||
1 file changed, 89 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
|
||||
index c8a55c9..a901f71 100644
|
||||
--- a/hv_kvp_daemon.c
|
||||
+++ b/hv_kvp_daemon.c
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <sys/poll.h>
|
||||
#include <sys/utsname.h>
|
||||
+#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -723,6 +724,88 @@ static void kvp_process_ipconfig_file(char *cmd,
|
||||
pclose(file);
|
||||
}
|
||||
|
||||
+static bool kvp_verify_ip_address(const void *address_string)
|
||||
+{
|
||||
+ char verify_buf[sizeof(struct in6_addr)];
|
||||
+
|
||||
+ if (inet_pton(AF_INET, address_string, verify_buf) == 1)
|
||||
+ return true;
|
||||
+ if (inet_pton(AF_INET6, address_string, verify_buf) == 1)
|
||||
+ return true;
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+static void kvp_extract_routes(const char *line, void **output, size_t *remaining)
|
||||
+{
|
||||
+ static const char needle[] = "via ";
|
||||
+ const char *match, *haystack = line;
|
||||
+
|
||||
+ while ((match = strstr(haystack, needle))) {
|
||||
+ const char *address, *next_char;
|
||||
+
|
||||
+ /* Address starts after needle. */
|
||||
+ address = match + strlen(needle);
|
||||
+
|
||||
+ /* The char following address is a space or end of line. */
|
||||
+ next_char = strpbrk(address, " \t\\");
|
||||
+ if (!next_char)
|
||||
+ next_char = address + strlen(address) + 1;
|
||||
+
|
||||
+ /* Enough room for address and semicolon. */
|
||||
+ if (*remaining >= (next_char - address) + 1) {
|
||||
+ memcpy(*output, address, next_char - address);
|
||||
+ /* Terminate string for verification. */
|
||||
+ memcpy(*output + (next_char - address), "", 1);
|
||||
+ if (kvp_verify_ip_address(*output)) {
|
||||
+ /* Advance output buffer. */
|
||||
+ *output += next_char - address;
|
||||
+ *remaining -= next_char - address;
|
||||
+
|
||||
+ /* Each address needs a trailing semicolon. */
|
||||
+ memcpy(*output, ";", 1);
|
||||
+ *output += 1;
|
||||
+ *remaining -= 1;
|
||||
+ }
|
||||
+ }
|
||||
+ haystack = next_char;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void kvp_get_gateway(void *buffer, size_t buffer_len)
|
||||
+{
|
||||
+ static const char needle[] = "default ";
|
||||
+ FILE *f;
|
||||
+ void *output = buffer;
|
||||
+ char *line = NULL;
|
||||
+ size_t alloc_size = 0, remaining = buffer_len - 1;
|
||||
+ ssize_t num_chars;
|
||||
+
|
||||
+ /* Show route information in a single line, for each address family */
|
||||
+ f = popen("ip --oneline -4 route show;ip --oneline -6 route show", "r");
|
||||
+ if (!f) {
|
||||
+ /* Convert buffer into C-String. */
|
||||
+ memcpy(output, "", 1);
|
||||
+ return;
|
||||
+ }
|
||||
+ while ((num_chars = getline(&line, &alloc_size, f)) > 0) {
|
||||
+ /* Skip short lines. */
|
||||
+ if (num_chars <= strlen(needle))
|
||||
+ continue;
|
||||
+ /* Skip lines without default route. */
|
||||
+ if (memcmp(line, needle, strlen(needle)))
|
||||
+ continue;
|
||||
+ /* Remove trailing newline to simplify further parsing. */
|
||||
+ if (line[num_chars - 1] == '\n')
|
||||
+ line[num_chars - 1] = '\0';
|
||||
+ /* Search routes after match. */
|
||||
+ kvp_extract_routes(line + strlen(needle), &output, &remaining);
|
||||
+ }
|
||||
+ /* Convert buffer into C-String. */
|
||||
+ memcpy(output, "", 1);
|
||||
+ free(line);
|
||||
+ pclose(f);
|
||||
+}
|
||||
+
|
||||
static void kvp_get_ipconfig_info(char *if_name,
|
||||
struct hv_kvp_ipaddr_value *buffer)
|
||||
{
|
||||
@@ -731,30 +814,7 @@ static void kvp_get_ipconfig_info(char *if_name,
|
||||
char *p;
|
||||
FILE *file;
|
||||
|
||||
- /*
|
||||
- * Get the address of default gateway (ipv4).
|
||||
- */
|
||||
- sprintf(cmd, "%s %s", "ip route show dev", if_name);
|
||||
- strcat(cmd, " | awk '/default/ {print $3 }'");
|
||||
-
|
||||
- /*
|
||||
- * Execute the command to gather gateway info.
|
||||
- */
|
||||
- kvp_process_ipconfig_file(cmd, (char *)buffer->gate_way,
|
||||
- (MAX_GATEWAY_SIZE * 2), INET_ADDRSTRLEN, 0);
|
||||
-
|
||||
- /*
|
||||
- * Get the address of default gateway (ipv6).
|
||||
- */
|
||||
- sprintf(cmd, "%s %s", "ip -f inet6 route show dev", if_name);
|
||||
- strcat(cmd, " | awk '/default/ {print $3 }'");
|
||||
-
|
||||
- /*
|
||||
- * Execute the command to gather gateway info (ipv6).
|
||||
- */
|
||||
- kvp_process_ipconfig_file(cmd, (char *)buffer->gate_way,
|
||||
- (MAX_GATEWAY_SIZE * 2), INET6_ADDRSTRLEN, 1);
|
||||
-
|
||||
+ kvp_get_gateway(buffer->gate_way, sizeof(buffer->gate_way));
|
||||
|
||||
/*
|
||||
* Gather the DNS state.
|
||||
@@ -771,7 +831,7 @@ static void kvp_get_ipconfig_info(char *if_name,
|
||||
* .
|
||||
*/
|
||||
|
||||
- sprintf(cmd, KVP_SCRIPTS_PATH "%s", "hv_get_dns_info");
|
||||
+ sprintf(cmd, "exec %s %s", KVP_SCRIPTS_PATH "hv_get_dns_info", if_name);
|
||||
|
||||
/*
|
||||
* Execute the command to gather DNS info.
|
||||
@@ -788,7 +848,7 @@ static void kvp_get_ipconfig_info(char *if_name,
|
||||
* Enabled: DHCP enabled.
|
||||
*/
|
||||
|
||||
- sprintf(cmd, KVP_SCRIPTS_PATH "%s %s", "hv_get_dhcp_info", if_name);
|
||||
+ sprintf(cmd, "exec %s %s", KVP_SCRIPTS_PATH "hv_get_dhcp_info", if_name);
|
||||
|
||||
file = popen(cmd, "r");
|
||||
if (file == NULL)
|
||||
@@ -1652,8 +1712,9 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
* 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), "exec %s %s %s",
|
||||
+ KVP_SCRIPTS_PATH "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.
|
||||
--
|
||||
2.52.0
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
Name: hyperv-daemons
|
||||
Version: 0
|
||||
Release: 0.44%{?snapver}%{?dist}
|
||||
Release: 0.45%{?snapver}%{?dist}
|
||||
Summary: Hyper-V daemons suite
|
||||
|
||||
License: GPLv2
|
||||
@ -70,6 +70,8 @@ Patch15: hpvd-hv-hv_kvp_daemon-Handle-IPv4-and-Ipv6-combination-fo.patch
|
||||
Patch16: hpvd-Changes-for-adding-keyfile-support-in-RHEL-specific-.patch
|
||||
# For RHEL-95812 - [Hyper-V][RHEL-9]Backport tools: hv: Enable debug logs for hv_kvp_daemon for RHEL 9
|
||||
Patch17: hpvd-tools-hv-Enable-debug-logs-for-hv_kvp_daemon.patch
|
||||
# For RHEL-186638 - Hyper-V host fails to display guest IP address in certain network configurations [rhel-9]
|
||||
Patch18: hpvd-hv-hv_kvp_daemon-Update-to-v6.16.patch
|
||||
|
||||
# Source-git patches
|
||||
|
||||
@ -289,6 +291,11 @@ fi
|
||||
%{_sbindir}/vmbus_testing
|
||||
|
||||
%changelog
|
||||
* Tue Jun 30 2026 Jon Maloy <jmaloy@redhat.com> - 0-0.45.20190303git
|
||||
- hpvd-hv-hv_kvp_daemon-Update-to-v6.16.patch [RHEL-186638]
|
||||
- Resolves: RHEL-186638
|
||||
(Hyper-V host fails to display guest IP address in certain network configurations [rhel-9])
|
||||
|
||||
* Mon Jun 23 2025 Jon Maloy <jmaloy@redhat.com> - 0-0.44.20190303git
|
||||
- hpvd-tools-hv-Enable-debug-logs-for-hv_kvp_daemon.patch [RHEL-95812]
|
||||
- Resolves: RHEL-95812
|
||||
|
||||
Loading…
Reference in New Issue
Block a user