* Thu Nov 21 2024 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.49.20220731git
- hpvd-Use-NetworkManager-information-to-report-DHCP-settin.patch [RHEL-65434] - hpvd-Use-NetworkManager-information-to-report-DNS-setting.patch [RHEL-65434] - Resolves: RHEL-65434 ([Hyper-V][RHEL-10]KVP daemon inspects /etc/sysconfig/network-scripts/ifcfg-* files to get DHCP information)
This commit is contained in:
parent
94b6de4271
commit
711476e4cd
@ -0,0 +1,72 @@
|
||||
From 030b1f4b8b3ced6c1a034ddcf7a6ea9290077200 Mon Sep 17 00:00:00 2001
|
||||
From: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Date: Tue, 12 Nov 2024 15:27:29 +0100
|
||||
Subject: [PATCH 1/2] Use NetworkManager information to report DHCP settings
|
||||
|
||||
RH-Author: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
RH-MergeRequest: 11: Use NetworkManager information to report DNS/DHCP settings
|
||||
RH-Jira: RHEL-65434
|
||||
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Commit: [1/2] dae341621eafa6cad0db12118fa1b3d66dae8dcc (vkuznets/hyperv-daemons)
|
||||
|
||||
RHEL10 does not use ifcfg files so DHCP reporting does not work.
|
||||
Use NetworkManger information instead.
|
||||
|
||||
Note, it is a bit unclear what 'DHCP' means, is it IPv4, IPv6 or
|
||||
both as there's a single parameter. Report 'Enabled' if any of the
|
||||
methods are set to auto.
|
||||
|
||||
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
---
|
||||
hv_get_dhcp_info.sh | 25 ++++++++++++-------------
|
||||
1 file changed, 12 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/hv_get_dhcp_info.sh b/hv_get_dhcp_info.sh
|
||||
index 2f2a3c7..74f4be9 100644
|
||||
--- a/hv_get_dhcp_info.sh
|
||||
+++ b/hv_get_dhcp_info.sh
|
||||
@@ -1,28 +1,27 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
-# This example script retrieves the DHCP state of a given interface.
|
||||
-# In the interest of keeping the KVP daemon code free of distro specific
|
||||
-# information; the kvp daemon code invokes this external script to gather
|
||||
-# DHCP setting for the specific interface.
|
||||
-#
|
||||
# Input: Name of the interface
|
||||
#
|
||||
# Output: The script prints the string "Enabled" to stdout to indicate
|
||||
# that DHCP is enabled on the interface. If DHCP is not enabled,
|
||||
# the script prints the string "Disabled" to stdout.
|
||||
#
|
||||
-# Each Distro is expected to implement this script in a distro specific
|
||||
-# fashion. For instance, on Distros that ship with Network Manager enabled,
|
||||
-# this script can be based on the Network Manager APIs for retrieving DHCP
|
||||
-# information.
|
||||
+# RHEL specific implementation, use NetworkManager information.
|
||||
+
|
||||
+[ ! -z "$1" ] || exit 1
|
||||
|
||||
-if_file="/etc/sysconfig/network-scripts/ifcfg-"$1
|
||||
+nmcon=$(nmcli -g GENERAL.CONNECTION device show "$1" 2>/dev/null)
|
||||
+
|
||||
+if [ -z "$nmcon" ]; then
|
||||
+echo "Unknown"
|
||||
+exit 0
|
||||
+fi
|
||||
|
||||
-dhcp=$(grep "dhcp" $if_file 2>/dev/null)
|
||||
+ipv4=$(nmcli --fields ipv4.method connection show "$nmcon" 2>/dev/null | cut -d ':' -f 2 | xargs echo -n)
|
||||
+ipv6=$(nmcli --fields ipv6.method connection show "$nmcon" 2>/dev/null | cut -d ':' -f 2 | xargs echo -n)
|
||||
|
||||
-if [ "$dhcp" != "" ];
|
||||
-then
|
||||
+if [ "$ipv4" = "auto" ] || [ "$ipv6" = "auto" ]; then
|
||||
echo "Enabled"
|
||||
else
|
||||
echo "Disabled"
|
||||
--
|
||||
2.39.3
|
||||
|
@ -0,0 +1,69 @@
|
||||
From 3a208379d41f7d11409a1b41600412274ae908c3 Mon Sep 17 00:00:00 2001
|
||||
From: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Date: Tue, 12 Nov 2024 15:30:44 +0100
|
||||
Subject: [PATCH 2/2] Use NetworkManager information to report DNS settings
|
||||
|
||||
RH-Author: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
RH-MergeRequest: 11: Use NetworkManager information to report DNS/DHCP settings
|
||||
RH-Jira: RHEL-65434
|
||||
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Commit: [2/2] 369721a80574f03e708cc2bd8129e69dd12281d6 (vkuznets/hyperv-daemons)
|
||||
|
||||
Getting DNS information our of /etc/resolv.conf is not entirely correct as
|
||||
per-NIC settings may differ. NetworkManager information is more precise.
|
||||
|
||||
Note, KVP daemon need to pass NIC name to the script to make it work.
|
||||
|
||||
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
---
|
||||
hv_get_dns_info.sh | 20 ++++++++++++--------
|
||||
hv_kvp_daemon.c | 2 +-
|
||||
2 files changed, 13 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/hv_get_dns_info.sh b/hv_get_dns_info.sh
|
||||
index 058c17b..973b1be 100644
|
||||
--- a/hv_get_dns_info.sh
|
||||
+++ b/hv_get_dns_info.sh
|
||||
@@ -1,13 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This example script parses /etc/resolv.conf to retrive DNS information.
|
||||
-# In the interest of keeping the KVP daemon code free of distro specific
|
||||
-# information; the kvp daemon code invokes this external script to gather
|
||||
-# DNS information.
|
||||
# This script is expected to print the nameserver values to stdout.
|
||||
-# Each Distro is expected to implement this script in a distro specific
|
||||
-# fashion. For instance on Distros that ship with Network Manager enabled,
|
||||
-# this script can be based on the Network Manager APIs for retrieving DNS
|
||||
-# entries.
|
||||
+# RHEL specific implementation, use NetworkManager information.
|
||||
|
||||
-cat /etc/resolv.conf 2>/dev/null | awk '/^nameserver/ { print $2 }'
|
||||
+[ ! -z "$1" ] || exit 1
|
||||
+
|
||||
+nmcon=$(nmcli -g GENERAL.CONNECTION device show "$1" 2>/dev/null)
|
||||
+
|
||||
+if [ -z "$nmcon" ]; then
|
||||
+exit 0
|
||||
+fi
|
||||
+
|
||||
+nmcli -g IP4.DNS -e no connection show "$nmcon" 2>/dev/null | sed 's, | ,\n,g'
|
||||
+
|
||||
+nmcli -g IP6.DNS -e no connection show "$nmcon" 2>/dev/null | sed 's, | ,\n,g'
|
||||
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
|
||||
index ae57bf6..931eb53 100644
|
||||
--- a/hv_kvp_daemon.c
|
||||
+++ b/hv_kvp_daemon.c
|
||||
@@ -725,7 +725,7 @@ static void kvp_get_ipconfig_info(char *if_name,
|
||||
* .
|
||||
*/
|
||||
|
||||
- sprintf(cmd, KVP_SCRIPTS_PATH "%s", "hv_get_dns_info");
|
||||
+ sprintf(cmd, KVP_SCRIPTS_PATH "%s %s", "hv_get_dns_info", if_name);
|
||||
|
||||
/*
|
||||
* Execute the command to gather DNS info.
|
||||
--
|
||||
2.39.3
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
Name: hyperv-daemons
|
||||
Version: 0
|
||||
Release: 0.48%{?snapver}%{?dist}
|
||||
Release: 0.49%{?snapver}%{?dist}
|
||||
Summary: Hyper-V daemons suite
|
||||
|
||||
License: GPL-2.0-only
|
||||
@ -81,6 +81,10 @@ Patch11: hpvd-hv-hv_kvp_daemon-Handle-IPv4-and-Ipv6-combination-fo.patch
|
||||
# For RHEL-40107 - [Hyper-V][RHEL10] Request to update hypervkvpd related file /usr/libexec/hypervkvpd/hv_set_ifconfig same as RHEL 9.5 hv_set_ifconfig file.
|
||||
# For RHEL-40679 - [Hyper-V][RHEL10] Request to update hyperv-daemons vmbus_testing, hv_kvp_daemon.c, hv_vss_daemon.c files as same as RHEL 9.5
|
||||
Patch12: hpvd-Changes-for-adding-keyfile-support-in-RHEL-specific-.patch
|
||||
# For RHEL-65434 - [Hyper-V][RHEL-10]KVP daemon inspects /etc/sysconfig/network-scripts/ifcfg-* files to get DHCP information
|
||||
Patch13: hpvd-Use-NetworkManager-information-to-report-DHCP-settin.patch
|
||||
# For RHEL-65434 - [Hyper-V][RHEL-10]KVP daemon inspects /etc/sysconfig/network-scripts/ifcfg-* files to get DHCP information
|
||||
Patch14: hpvd-Use-NetworkManager-information-to-report-DNS-setting.patch
|
||||
|
||||
# Hyper-V is available only on x86 and aarch64 architectures
|
||||
# The base empty (a.k.a. virtual) package can not be noarch
|
||||
@ -312,6 +316,12 @@ fi
|
||||
%{_sbindir}/vmbus_testing
|
||||
|
||||
%changelog
|
||||
* Thu Nov 21 2024 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.49.20220731git
|
||||
- hpvd-Use-NetworkManager-information-to-report-DHCP-settin.patch [RHEL-65434]
|
||||
- hpvd-Use-NetworkManager-information-to-report-DNS-setting.patch [RHEL-65434]
|
||||
- Resolves: RHEL-65434
|
||||
([Hyper-V][RHEL-10]KVP daemon inspects /etc/sysconfig/network-scripts/ifcfg-* files to get DHCP information)
|
||||
|
||||
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 0-0.48.20220731git
|
||||
- Bump release for October 2024 mass rebuild:
|
||||
Resolves: RHEL-64018
|
||||
|
Loading…
Reference in New Issue
Block a user