* Thu Jun 27 2024 Miroslav Rezanina <mrezanin@redhat.com> - 0-1.45.20220731git
- hpvd-Add-support-for-patching-hyperv-daemons.patch [RHEL-40107 RHEL-40679] - hpvd-Do-not-set-NM_CONTROLLED-no.patch [RHEL-40107 RHEL-40679] - hpvd-Add-vmbus_testing-tool-build-files.patch [RHEL-40107 RHEL-40679] - hpvd-hv_set_ifconfig.sh-Use-nmcli-commands.patch [RHEL-40107 RHEL-40679] - hpvd-Use-filename-for-connection-profile.patch [RHEL-40107 RHEL-40679] - hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.patch [RHEL-40107 RHEL-40679] - hpvd-tools-hv-Remove-an-extraneous-the.patch [RHEL-40107 RHEL-40679] - hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.patch [RHEL-40107 RHEL-40679] - hpvd-vmbus_testing-fix-wrong-python-syntax-for-integer-va.patch [RHEL-40107 RHEL-40679] - hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.patch [RHEL-40107 RHEL-40679] - hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.patch [RHEL-40107 RHEL-40679] - hpvd-hv-hv_kvp_daemon-Handle-IPv4-and-Ipv6-combination-fo.patch [RHEL-40107 RHEL-40679] - hpvd-Changes-for-adding-keyfile-support-in-RHEL-specific-.patch [RHEL-40107 RHEL-40679] - hpvd-Remove-hyperv_fcopy_daemon-as-the-c10s-kernel-does-n.patch [RHEL-40107 RHEL-40679] - Resolves: 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.) - Resolves: 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)
This commit is contained in:
parent
3f67b89dd7
commit
d9314ddbc8
411
hpvd-Add-vmbus_testing-tool-build-files.patch
Normal file
411
hpvd-Add-vmbus_testing-tool-build-files.patch
Normal file
@ -0,0 +1,411 @@
|
||||
From e24f15d5aa258daabb2c34a7b9fed348ac63705d Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Thu, 6 May 2021 12:53:31 +0200
|
||||
Subject: [PATCH 03/14] Add vmbus_testing tool build files
|
||||
|
||||
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
|
||||
RH-Jira: RHEL-40107 RHEL-40679
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [3/14] 384e79f48e6f4665f90fd3b2b17fcaef2178a674 (mrezanin/centos-git-hyperv-daemons)
|
||||
|
||||
Add the vmbus_testing tool to redhat build dirs
|
||||
|
||||
(cherry-pick from rhel 8.4.0 commit d8ca5e0)
|
||||
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
|
||||
patch_name: 0005-Add-vmbus_testing-tool-build-files.patch
|
||||
present_in_specfile: true
|
||||
location_in_specfile: 5
|
||||
---
|
||||
.distro/hyperv-daemons.spec | 2 +
|
||||
vmbus_testing | 376 ++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 378 insertions(+)
|
||||
create mode 100755 vmbus_testing
|
||||
|
||||
diff --git a/vmbus_testing b/vmbus_testing
|
||||
new file mode 100755
|
||||
index 0000000..e721290
|
||||
--- /dev/null
|
||||
+++ b/vmbus_testing
|
||||
@@ -0,0 +1,376 @@
|
||||
+#!/usr/bin/env python3
|
||||
+# SPDX-License-Identifier: GPL-2.0
|
||||
+#
|
||||
+# Program to allow users to fuzz test Hyper-V drivers
|
||||
+# by interfacing with Hyper-V debugfs attributes.
|
||||
+# Current test methods available:
|
||||
+# 1. delay testing
|
||||
+#
|
||||
+# Current file/directory structure of hyper-V debugfs:
|
||||
+# /sys/kernel/debug/hyperv/UUID
|
||||
+# /sys/kernel/debug/hyperv/UUID/<test-state filename>
|
||||
+# /sys/kernel/debug/hyperv/UUID/<test-method sub-directory>
|
||||
+#
|
||||
+# author: Branden Bonaby <brandonbonaby94@gmail.com>
|
||||
+
|
||||
+import os
|
||||
+import cmd
|
||||
+import argparse
|
||||
+import glob
|
||||
+from argparse import RawDescriptionHelpFormatter
|
||||
+from argparse import RawTextHelpFormatter
|
||||
+from enum import Enum
|
||||
+
|
||||
+# Do not change unless, you change the debugfs attributes
|
||||
+# in /drivers/hv/debugfs.c. All fuzz testing
|
||||
+# attributes will start with "fuzz_test".
|
||||
+
|
||||
+# debugfs path for hyperv must exist before proceeding
|
||||
+debugfs_hyperv_path = "/sys/kernel/debug/hyperv"
|
||||
+if not os.path.isdir(debugfs_hyperv_path):
|
||||
+ print("{} doesn't exist/check permissions".format(debugfs_hyperv_path))
|
||||
+ exit(-1)
|
||||
+
|
||||
+class dev_state(Enum):
|
||||
+ off = 0
|
||||
+ on = 1
|
||||
+
|
||||
+# File names, that correspond to the files created in
|
||||
+# /drivers/hv/debugfs.c
|
||||
+class f_names(Enum):
|
||||
+ state_f = "fuzz_test_state"
|
||||
+ buff_f = "fuzz_test_buffer_interrupt_delay"
|
||||
+ mess_f = "fuzz_test_message_delay"
|
||||
+
|
||||
+# Both single_actions and all_actions are used
|
||||
+# for error checking and to allow for some subparser
|
||||
+# names to be abbreviated. Do not abbreviate the
|
||||
+# test method names, as it will become less intuitive
|
||||
+# as to what the user can do. If you do decide to
|
||||
+# abbreviate the test method name, make sure the main
|
||||
+# function reflects this change.
|
||||
+
|
||||
+all_actions = [
|
||||
+ "disable_all",
|
||||
+ "D",
|
||||
+ "enable_all",
|
||||
+ "view_all",
|
||||
+ "V"
|
||||
+]
|
||||
+
|
||||
+single_actions = [
|
||||
+ "disable_single",
|
||||
+ "d",
|
||||
+ "enable_single",
|
||||
+ "view_single",
|
||||
+ "v"
|
||||
+]
|
||||
+
|
||||
+def main():
|
||||
+
|
||||
+ file_map = recursive_file_lookup(debugfs_hyperv_path, dict())
|
||||
+ args = parse_args()
|
||||
+ if (not args.action):
|
||||
+ print ("Error, no options selected...exiting")
|
||||
+ exit(-1)
|
||||
+ arg_set = { k for (k,v) in vars(args).items() if v and k != "action" }
|
||||
+ arg_set.add(args.action)
|
||||
+ path = args.path if "path" in arg_set else None
|
||||
+ if (path and path[-1] == "/"):
|
||||
+ path = path[:-1]
|
||||
+ validate_args_path(path, arg_set, file_map)
|
||||
+ if (path and "enable_single" in arg_set):
|
||||
+ state_path = locate_state(path, file_map)
|
||||
+ set_test_state(state_path, dev_state.on.value, args.quiet)
|
||||
+
|
||||
+ # Use subparsers as the key for different actions
|
||||
+ if ("delay" in arg_set):
|
||||
+ validate_delay_values(args.delay_time)
|
||||
+ if (args.enable_all):
|
||||
+ set_delay_all_devices(file_map, args.delay_time,
|
||||
+ args.quiet)
|
||||
+ else:
|
||||
+ set_delay_values(path, file_map, args.delay_time,
|
||||
+ args.quiet)
|
||||
+ elif ("disable_all" in arg_set or "D" in arg_set):
|
||||
+ disable_all_testing(file_map)
|
||||
+ elif ("disable_single" in arg_set or "d" in arg_set):
|
||||
+ disable_testing_single_device(path, file_map)
|
||||
+ elif ("view_all" in arg_set or "V" in arg_set):
|
||||
+ get_all_devices_test_status(file_map)
|
||||
+ elif ("view_single" in arg_set or "v" in arg_set):
|
||||
+ get_device_test_values(path, file_map)
|
||||
+
|
||||
+# Get the state location
|
||||
+def locate_state(device, file_map):
|
||||
+ return file_map[device][f_names.state_f.value]
|
||||
+
|
||||
+# Validate delay values to make sure they are acceptable to
|
||||
+# enable delays on a device
|
||||
+def validate_delay_values(delay):
|
||||
+
|
||||
+ if (delay[0] == -1 and delay[1] == -1):
|
||||
+ print("\nError, At least 1 value must be greater than 0")
|
||||
+ exit(-1)
|
||||
+ for i in delay:
|
||||
+ if (i < -1 or i == 0 or i > 1000):
|
||||
+ print("\nError, Values must be equal to -1 "
|
||||
+ "or be > 0 and <= 1000")
|
||||
+ exit(-1)
|
||||
+
|
||||
+# Validate argument path
|
||||
+def validate_args_path(path, arg_set, file_map):
|
||||
+
|
||||
+ if (not path and any(element in arg_set for element in single_actions)):
|
||||
+ print("Error, path (-p) REQUIRED for the specified option. "
|
||||
+ "Use (-h) to check usage.")
|
||||
+ exit(-1)
|
||||
+ elif (path and any(item in arg_set for item in all_actions)):
|
||||
+ print("Error, path (-p) NOT REQUIRED for the specified option. "
|
||||
+ "Use (-h) to check usage." )
|
||||
+ exit(-1)
|
||||
+ elif (path not in file_map and any(item in arg_set
|
||||
+ for item in single_actions)):
|
||||
+ print("Error, path '{}' not a valid vmbus device".format(path))
|
||||
+ exit(-1)
|
||||
+
|
||||
+# display Testing status of single device
|
||||
+def get_device_test_values(path, file_map):
|
||||
+
|
||||
+ for name in file_map[path]:
|
||||
+ file_location = file_map[path][name]
|
||||
+ print( name + " = " + str(read_test_files(file_location)))
|
||||
+
|
||||
+# Create a map of the vmbus devices and their associated files
|
||||
+# [key=device, value = [key = filename, value = file path]]
|
||||
+def recursive_file_lookup(path, file_map):
|
||||
+
|
||||
+ for f_path in glob.iglob(path + '**/*'):
|
||||
+ if (os.path.isfile(f_path)):
|
||||
+ if (f_path.rsplit("/",2)[0] == debugfs_hyperv_path):
|
||||
+ directory = f_path.rsplit("/",1)[0]
|
||||
+ else:
|
||||
+ directory = f_path.rsplit("/",2)[0]
|
||||
+ f_name = f_path.split("/")[-1]
|
||||
+ if (file_map.get(directory)):
|
||||
+ file_map[directory].update({f_name:f_path})
|
||||
+ else:
|
||||
+ file_map[directory] = {f_name:f_path}
|
||||
+ elif (os.path.isdir(f_path)):
|
||||
+ recursive_file_lookup(f_path,file_map)
|
||||
+ return file_map
|
||||
+
|
||||
+# display Testing state of devices
|
||||
+def get_all_devices_test_status(file_map):
|
||||
+
|
||||
+ for device in file_map:
|
||||
+ if (get_test_state(locate_state(device, file_map)) is 1):
|
||||
+ print("Testing = ON for: {}"
|
||||
+ .format(device.split("/")[5]))
|
||||
+ else:
|
||||
+ print("Testing = OFF for: {}"
|
||||
+ .format(device.split("/")[5]))
|
||||
+
|
||||
+# read the vmbus device files, path must be absolute path before calling
|
||||
+def read_test_files(path):
|
||||
+ try:
|
||||
+ with open(path,"r") as f:
|
||||
+ file_value = f.readline().strip()
|
||||
+ return int(file_value)
|
||||
+
|
||||
+ except IOError as e:
|
||||
+ errno, strerror = e.args
|
||||
+ print("I/O error({0}): {1} on file {2}"
|
||||
+ .format(errno, strerror, path))
|
||||
+ exit(-1)
|
||||
+ except ValueError:
|
||||
+ print ("Element to int conversion error in: \n{}".format(path))
|
||||
+ exit(-1)
|
||||
+
|
||||
+# writing to vmbus device files, path must be absolute path before calling
|
||||
+def write_test_files(path, value):
|
||||
+
|
||||
+ try:
|
||||
+ with open(path,"w") as f:
|
||||
+ f.write("{}".format(value))
|
||||
+ except IOError as e:
|
||||
+ errno, strerror = e.args
|
||||
+ print("I/O error({0}): {1} on file {2}"
|
||||
+ .format(errno, strerror, path))
|
||||
+ exit(-1)
|
||||
+
|
||||
+# set testing state of device
|
||||
+def set_test_state(state_path, state_value, quiet):
|
||||
+
|
||||
+ write_test_files(state_path, state_value)
|
||||
+ if (get_test_state(state_path) is 1):
|
||||
+ if (not quiet):
|
||||
+ print("Testing = ON for device: {}"
|
||||
+ .format(state_path.split("/")[5]))
|
||||
+ else:
|
||||
+ if (not quiet):
|
||||
+ print("Testing = OFF for device: {}"
|
||||
+ .format(state_path.split("/")[5]))
|
||||
+
|
||||
+# get testing state of device
|
||||
+def get_test_state(state_path):
|
||||
+ #state == 1 - test = ON
|
||||
+ #state == 0 - test = OFF
|
||||
+ return read_test_files(state_path)
|
||||
+
|
||||
+# write 1 - 1000 microseconds, into a single device using the
|
||||
+# fuzz_test_buffer_interrupt_delay and fuzz_test_message_delay
|
||||
+# debugfs attributes
|
||||
+def set_delay_values(device, file_map, delay_length, quiet):
|
||||
+
|
||||
+ try:
|
||||
+ interrupt = file_map[device][f_names.buff_f.value]
|
||||
+ message = file_map[device][f_names.mess_f.value]
|
||||
+
|
||||
+ # delay[0]- buffer interrupt delay, delay[1]- message delay
|
||||
+ if (delay_length[0] >= 0 and delay_length[0] <= 1000):
|
||||
+ write_test_files(interrupt, delay_length[0])
|
||||
+ if (delay_length[1] >= 0 and delay_length[1] <= 1000):
|
||||
+ write_test_files(message, delay_length[1])
|
||||
+ if (not quiet):
|
||||
+ print("Buffer delay testing = {} for: {}"
|
||||
+ .format(read_test_files(interrupt),
|
||||
+ interrupt.split("/")[5]))
|
||||
+ print("Message delay testing = {} for: {}"
|
||||
+ .format(read_test_files(message),
|
||||
+ message.split("/")[5]))
|
||||
+ except IOError as e:
|
||||
+ errno, strerror = e.args
|
||||
+ print("I/O error({0}): {1} on files {2}{3}"
|
||||
+ .format(errno, strerror, interrupt, message))
|
||||
+ exit(-1)
|
||||
+
|
||||
+# enabling delay testing on all devices
|
||||
+def set_delay_all_devices(file_map, delay, quiet):
|
||||
+
|
||||
+ for device in (file_map):
|
||||
+ set_test_state(locate_state(device, file_map),
|
||||
+ dev_state.on.value,
|
||||
+ quiet)
|
||||
+ set_delay_values(device, file_map, delay, quiet)
|
||||
+
|
||||
+# disable all testing on a SINGLE device.
|
||||
+def disable_testing_single_device(device, file_map):
|
||||
+
|
||||
+ for name in file_map[device]:
|
||||
+ file_location = file_map[device][name]
|
||||
+ write_test_files(file_location, dev_state.off.value)
|
||||
+ print("ALL testing now OFF for {}".format(device.split("/")[-1]))
|
||||
+
|
||||
+# disable all testing on ALL devices
|
||||
+def disable_all_testing(file_map):
|
||||
+
|
||||
+ for device in file_map:
|
||||
+ disable_testing_single_device(device, file_map)
|
||||
+
|
||||
+def parse_args():
|
||||
+ parser = argparse.ArgumentParser(prog = "vmbus_testing",usage ="\n"
|
||||
+ "%(prog)s [delay] [-h] [-e|-E] -t [-p]\n"
|
||||
+ "%(prog)s [view_all | V] [-h]\n"
|
||||
+ "%(prog)s [disable_all | D] [-h]\n"
|
||||
+ "%(prog)s [disable_single | d] [-h|-p]\n"
|
||||
+ "%(prog)s [view_single | v] [-h|-p]\n"
|
||||
+ "%(prog)s --version\n",
|
||||
+ description = "\nUse lsvmbus to get vmbus device type "
|
||||
+ "information.\n" "\nThe debugfs root path is "
|
||||
+ "/sys/kernel/debug/hyperv",
|
||||
+ formatter_class = RawDescriptionHelpFormatter)
|
||||
+ subparsers = parser.add_subparsers(dest = "action")
|
||||
+ parser.add_argument("--version", action = "version",
|
||||
+ version = '%(prog)s 0.1.0')
|
||||
+ parser.add_argument("-q","--quiet", action = "store_true",
|
||||
+ help = "silence none important test messages."
|
||||
+ " This will only work when enabling testing"
|
||||
+ " on a device.")
|
||||
+ # Use the path parser to hold the --path attribute so it can
|
||||
+ # be shared between subparsers. Also do the same for the state
|
||||
+ # parser, as all testing methods will use --enable_all and
|
||||
+ # enable_single.
|
||||
+ path_parser = argparse.ArgumentParser(add_help=False)
|
||||
+ path_parser.add_argument("-p","--path", metavar = "",
|
||||
+ help = "Debugfs path to a vmbus device. The path "
|
||||
+ "must be the absolute path to the device.")
|
||||
+ state_parser = argparse.ArgumentParser(add_help=False)
|
||||
+ state_group = state_parser.add_mutually_exclusive_group(required = True)
|
||||
+ state_group.add_argument("-E", "--enable_all", action = "store_const",
|
||||
+ const = "enable_all",
|
||||
+ help = "Enable the specified test type "
|
||||
+ "on ALL vmbus devices.")
|
||||
+ state_group.add_argument("-e", "--enable_single",
|
||||
+ action = "store_const",
|
||||
+ const = "enable_single",
|
||||
+ help = "Enable the specified test type on a "
|
||||
+ "SINGLE vmbus device.")
|
||||
+ parser_delay = subparsers.add_parser("delay",
|
||||
+ parents = [state_parser, path_parser],
|
||||
+ help = "Delay the ring buffer interrupt or the "
|
||||
+ "ring buffer message reads in microseconds.",
|
||||
+ prog = "vmbus_testing",
|
||||
+ usage = "%(prog)s [-h]\n"
|
||||
+ "%(prog)s -E -t [value] [value]\n"
|
||||
+ "%(prog)s -e -t [value] [value] -p",
|
||||
+ description = "Delay the ring buffer interrupt for "
|
||||
+ "vmbus devices, or delay the ring buffer message "
|
||||
+ "reads for vmbus devices (both in microseconds). This "
|
||||
+ "is only on the host to guest channel.")
|
||||
+ parser_delay.add_argument("-t", "--delay_time", metavar = "", nargs = 2,
|
||||
+ type = check_range, default =[0,0], required = (True),
|
||||
+ help = "Set [buffer] & [message] delay time. "
|
||||
+ "Value constraints: -1 == value "
|
||||
+ "or 0 < value <= 1000.\n"
|
||||
+ "Use -1 to keep the previous value for that delay "
|
||||
+ "type, or a value > 0 <= 1000 to change the delay "
|
||||
+ "time.")
|
||||
+ parser_dis_all = subparsers.add_parser("disable_all",
|
||||
+ aliases = ['D'], prog = "vmbus_testing",
|
||||
+ usage = "%(prog)s [disable_all | D] -h\n"
|
||||
+ "%(prog)s [disable_all | D]\n",
|
||||
+ help = "Disable ALL testing on ALL vmbus devices.",
|
||||
+ description = "Disable ALL testing on ALL vmbus "
|
||||
+ "devices.")
|
||||
+ parser_dis_single = subparsers.add_parser("disable_single",
|
||||
+ aliases = ['d'],
|
||||
+ parents = [path_parser], prog = "vmbus_testing",
|
||||
+ usage = "%(prog)s [disable_single | d] -h\n"
|
||||
+ "%(prog)s [disable_single | d] -p\n",
|
||||
+ help = "Disable ALL testing on a SINGLE vmbus device.",
|
||||
+ description = "Disable ALL testing on a SINGLE vmbus "
|
||||
+ "device.")
|
||||
+ parser_view_all = subparsers.add_parser("view_all", aliases = ['V'],
|
||||
+ help = "View the test state for ALL vmbus devices.",
|
||||
+ prog = "vmbus_testing",
|
||||
+ usage = "%(prog)s [view_all | V] -h\n"
|
||||
+ "%(prog)s [view_all | V]\n",
|
||||
+ description = "This shows the test state for ALL the "
|
||||
+ "vmbus devices.")
|
||||
+ parser_view_single = subparsers.add_parser("view_single",
|
||||
+ aliases = ['v'],parents = [path_parser],
|
||||
+ help = "View the test values for a SINGLE vmbus "
|
||||
+ "device.",
|
||||
+ description = "This shows the test values for a SINGLE "
|
||||
+ "vmbus device.", prog = "vmbus_testing",
|
||||
+ usage = "%(prog)s [view_single | v] -h\n"
|
||||
+ "%(prog)s [view_single | v] -p")
|
||||
+
|
||||
+ return parser.parse_args()
|
||||
+
|
||||
+# value checking for range checking input in parser
|
||||
+def check_range(arg1):
|
||||
+
|
||||
+ try:
|
||||
+ val = int(arg1)
|
||||
+ except ValueError as err:
|
||||
+ raise argparse.ArgumentTypeError(str(err))
|
||||
+ if val < -1 or val > 1000:
|
||||
+ message = ("\n\nvalue must be -1 or 0 < value <= 1000. "
|
||||
+ "Value program received: {}\n").format(val)
|
||||
+ raise argparse.ArgumentTypeError(message)
|
||||
+ return val
|
||||
+
|
||||
+if __name__ == "__main__":
|
||||
+ main()
|
||||
--
|
||||
2.39.3
|
||||
|
@ -0,0 +1,68 @@
|
||||
From 935df801defcb3f459891e180e66065030d11612 Mon Sep 17 00:00:00 2001
|
||||
From: Ani Sinha <anisinha@redhat.com>
|
||||
Date: Tue, 10 Oct 2023 11:50:30 +0530
|
||||
Subject: [PATCH 13/14] Changes for adding keyfile support in RHEL specific
|
||||
script
|
||||
|
||||
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
|
||||
RH-Jira: RHEL-40107 RHEL-40679
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [13/14] 0dec80310c49a5ccbc6b030ba6c575046b21b60f (mrezanin/centos-git-hyperv-daemons)
|
||||
|
||||
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.
|
||||
|
||||
See also https://issues.redhat.com/browse/RHEL-14505
|
||||
|
||||
Signed-off-by: Ani Sinha <anisinha@redhat.com>
|
||||
|
||||
patch_name: hpvd-Changes-for-adding-keyfile-support-in-RHEL-specific-.patch
|
||||
present_in_specfile: true
|
||||
location_in_specfile: 16
|
||||
---
|
||||
hv_set_ifconfig.sh | 25 ++++++++++++++-----------
|
||||
1 file changed, 14 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
|
||||
index 9c2ee30..0bdf2bc 100644
|
||||
--- a/hv_set_ifconfig.sh
|
||||
+++ b/hv_set_ifconfig.sh
|
||||
@@ -74,19 +74,22 @@
|
||||
# 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##*/}"
|
||||
+chmod 600 $2
|
||||
+cp $2 /etc/NetworkManager/system-connections/
|
||||
|
||||
-cp $1 /etc/sysconfig/network-scripts/
|
||||
+nmcli connection load "/etc/NetworkManager/system-connections/${filename}"
|
||||
+nmcli connection up filename "/etc/NetworkManager/system-connections/${filename}"
|
||||
|
||||
-filename="${1##*/}"
|
||||
-nmcli connection load "/etc/sysconfig/network-scripts/${filename}"
|
||||
-nmcli connection up filename "/etc/sysconfig/network-scripts/${filename}"
|
||||
+exit 0
|
||||
--
|
||||
2.39.3
|
||||
|
33
hpvd-Do-not-set-NM_CONTROLLED-no.patch
Normal file
33
hpvd-Do-not-set-NM_CONTROLLED-no.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 45c529405a747e7be7cc229913393fa34f5cd4ff Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Thu, 14 Nov 2019 09:45:44 +0100
|
||||
Subject: [PATCH 02/14] Do not set NM_CONTROLLED=no
|
||||
|
||||
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
|
||||
RH-Jira: RHEL-40107 RHEL-40679
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [2/14] 3873d86dfc8a13e160b82cbdf3e9aaa52eedb37f (mrezanin/centos-git-hyperv-daemons)
|
||||
|
||||
patch_name: 0002-Do-not-set-NM_CONTROLLED-no.patch
|
||||
present_in_specfile: true
|
||||
location_in_specfile: 2
|
||||
---
|
||||
hv_set_ifconfig.sh | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
|
||||
index d10fe35..3dd064c 100644
|
||||
--- a/hv_set_ifconfig.sh
|
||||
+++ b/hv_set_ifconfig.sh
|
||||
@@ -51,7 +51,6 @@
|
||||
|
||||
|
||||
echo "IPV6INIT=yes" >> $1
|
||||
-echo "NM_CONTROLLED=no" >> $1
|
||||
echo "PEERDNS=yes" >> $1
|
||||
echo "ONBOOT=yes" >> $1
|
||||
|
||||
--
|
||||
2.39.3
|
||||
|
34
hpvd-Use-filename-for-connection-profile.patch
Normal file
34
hpvd-Use-filename-for-connection-profile.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From 71c04766e4b8a4edfa8c645d30cea48f825cc1e9 Mon Sep 17 00:00:00 2001
|
||||
From: Till Maas <timaas@redhat.com>
|
||||
Date: Tue, 14 Dec 2021 08:07:40 +0000
|
||||
Subject: [PATCH 05/14] Use filename for connection profile
|
||||
|
||||
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
|
||||
RH-Jira: RHEL-40107 RHEL-40679
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [5/14] e91a7aeb17973de8526f325b44cda5af733c43ee (mrezanin/centos-git-hyperv-daemons)
|
||||
|
||||
patch_name: hpvd-Use-filename-for-connection-profile.patch
|
||||
present_in_specfile: true
|
||||
location_in_specfile: 8
|
||||
---
|
||||
hv_set_ifconfig.sh | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
|
||||
index 5a64efe..146829b 100644
|
||||
--- a/hv_set_ifconfig.sh
|
||||
+++ b/hv_set_ifconfig.sh
|
||||
@@ -57,5 +57,6 @@ echo "ONBOOT=yes" >> $1
|
||||
|
||||
cp $1 /etc/sysconfig/network-scripts/
|
||||
|
||||
-nmcli connection load "/etc/sysconfig/network-scripts/$1"
|
||||
-nmcli connection up filename "/etc/sysconfig/network-scripts/$1"
|
||||
+filename="${1##*/}"
|
||||
+nmcli connection load "/etc/sysconfig/network-scripts/${filename}"
|
||||
+nmcli connection up filename "/etc/sysconfig/network-scripts/${filename}"
|
||||
--
|
||||
2.39.3
|
||||
|
338
hpvd-hv-hv_kvp_daemon-Handle-IPv4-and-Ipv6-combination-fo.patch
Normal file
338
hpvd-hv-hv_kvp_daemon-Handle-IPv4-and-Ipv6-combination-fo.patch
Normal file
@ -0,0 +1,338 @@
|
||||
From cc43c1ad250ed39ee7d5f5459049b29f1c4a6f42 Mon Sep 17 00:00:00 2001
|
||||
From: Shradha Gupta <shradhagupta@linux.microsoft.com>
|
||||
Date: Fri, 22 Mar 2024 06:46:02 -0700
|
||||
Subject: [PATCH 12/14] hv/hv_kvp_daemon: Handle IPv4 and Ipv6 combination for
|
||||
keyfile format
|
||||
|
||||
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
|
||||
RH-Jira: RHEL-40107 RHEL-40679
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [12/14] 936263af9ba1441d37661bfa356c45db782df926 (mrezanin/centos-git-hyperv-daemons)
|
||||
|
||||
If the network configuration strings are passed as a combination of IPv4
|
||||
and IPv6 addresses, the current KVP daemon does not handle processing for
|
||||
the keyfile configuration format.
|
||||
With these changes, the keyfile config generation logic scans through the
|
||||
list twice to generate IPv4 and IPv6 sections for the configuration files
|
||||
to handle this support.
|
||||
|
||||
Testcases ran:Rhel 9, Hyper-V VMs
|
||||
(IPv4 only, IPv6 only, IPv4 and IPv6 combination)
|
||||
|
||||
Cherry-picked from Linux kernel upstream commit
|
||||
f971f6dd3742d2 ("hv/hv_kvp_daemon: Handle IPv4 and Ipv6 combination for keyfile format")
|
||||
Co-developed-by: Ani Sinha <anisinha@redhat.com>
|
||||
Signed-off-by: Ani Sinha <anisinha@redhat.com>
|
||||
Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
|
||||
Reviewed-by: Easwar Hariharan <eahariha@linux.microsoft.com>
|
||||
Tested-by: Ani Sinha <anisinha@redhat.com>
|
||||
Reviewed-by: Ani Sinha <anisinha@redhat.com>
|
||||
Link: https://lore.kernel.org/r/1711115162-11629-1-git-send-email-shradhagupta@linux.microsoft.com
|
||||
Signed-off-by: Wei Liu <wei.liu@kernel.org>
|
||||
Message-ID: <1711115162-11629-1-git-send-email-shradhagupta@linux.microsoft.com>
|
||||
|
||||
patch_name: hpvd-hv-hv_kvp_daemon-Handle-IPv4-and-Ipv6-combination-fo.patch
|
||||
present_in_specfile: true
|
||||
location_in_specfile: 15
|
||||
---
|
||||
hv_kvp_daemon.c | 213 ++++++++++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 172 insertions(+), 41 deletions(-)
|
||||
|
||||
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
|
||||
index 318e2da..ae57bf6 100644
|
||||
--- a/hv_kvp_daemon.c
|
||||
+++ b/hv_kvp_daemon.c
|
||||
@@ -76,6 +76,12 @@ enum {
|
||||
DNS
|
||||
};
|
||||
|
||||
+enum {
|
||||
+ IPV4 = 1,
|
||||
+ IPV6,
|
||||
+ IP_TYPE_MAX
|
||||
+};
|
||||
+
|
||||
static int in_hand_shake;
|
||||
|
||||
static char *os_name = "";
|
||||
@@ -102,6 +108,11 @@ static struct utsname uts_buf;
|
||||
|
||||
#define MAX_FILE_NAME 100
|
||||
#define ENTRIES_PER_BLOCK 50
|
||||
+/*
|
||||
+ * Change this entry if the number of addresses increases in future
|
||||
+ */
|
||||
+#define MAX_IP_ENTRIES 64
|
||||
+#define OUTSTR_BUF_SIZE ((INET6_ADDRSTRLEN + 1) * MAX_IP_ENTRIES)
|
||||
|
||||
struct kvp_record {
|
||||
char key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
|
||||
@@ -1171,6 +1182,18 @@ static int process_ip_string(FILE *f, char *ip_string, int type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int ip_version_check(const char *input_addr)
|
||||
+{
|
||||
+ struct in6_addr addr;
|
||||
+
|
||||
+ if (inet_pton(AF_INET, input_addr, &addr))
|
||||
+ return IPV4;
|
||||
+ else if (inet_pton(AF_INET6, input_addr, &addr))
|
||||
+ return IPV6;
|
||||
+
|
||||
+ return -EINVAL;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Only IPv4 subnet strings needs to be converted to plen
|
||||
* For IPv6 the subnet is already privided in plen format
|
||||
@@ -1197,14 +1220,75 @@ static int kvp_subnet_to_plen(char *subnet_addr_str)
|
||||
return plen;
|
||||
}
|
||||
|
||||
+static int process_dns_gateway_nm(FILE *f, char *ip_string, int type,
|
||||
+ int ip_sec)
|
||||
+{
|
||||
+ char addr[INET6_ADDRSTRLEN], *output_str;
|
||||
+ int ip_offset = 0, error = 0, ip_ver;
|
||||
+ char *param_name;
|
||||
+
|
||||
+ if (type == DNS)
|
||||
+ param_name = "dns";
|
||||
+ else if (type == GATEWAY)
|
||||
+ param_name = "gateway";
|
||||
+ else
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ output_str = (char *)calloc(OUTSTR_BUF_SIZE, sizeof(char));
|
||||
+ if (!output_str)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ while (1) {
|
||||
+ memset(addr, 0, sizeof(addr));
|
||||
+
|
||||
+ if (!parse_ip_val_buffer(ip_string, &ip_offset, addr,
|
||||
+ (MAX_IP_ADDR_SIZE * 2)))
|
||||
+ break;
|
||||
+
|
||||
+ ip_ver = ip_version_check(addr);
|
||||
+ if (ip_ver < 0)
|
||||
+ continue;
|
||||
+
|
||||
+ if ((ip_ver == IPV4 && ip_sec == IPV4) ||
|
||||
+ (ip_ver == IPV6 && ip_sec == IPV6)) {
|
||||
+ /*
|
||||
+ * do a bound check to avoid out-of bound writes
|
||||
+ */
|
||||
+ if ((OUTSTR_BUF_SIZE - strlen(output_str)) >
|
||||
+ (strlen(addr) + 1)) {
|
||||
+ strncat(output_str, addr,
|
||||
+ OUTSTR_BUF_SIZE -
|
||||
+ strlen(output_str) - 1);
|
||||
+ strncat(output_str, ",",
|
||||
+ OUTSTR_BUF_SIZE -
|
||||
+ strlen(output_str) - 1);
|
||||
+ }
|
||||
+ } else {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (strlen(output_str)) {
|
||||
+ /*
|
||||
+ * This is to get rid of that extra comma character
|
||||
+ * in the end of the string
|
||||
+ */
|
||||
+ output_str[strlen(output_str) - 1] = '\0';
|
||||
+ error = fprintf(f, "%s=%s\n", param_name, output_str);
|
||||
+ }
|
||||
+
|
||||
+ free(output_str);
|
||||
+ return error;
|
||||
+}
|
||||
+
|
||||
static int process_ip_string_nm(FILE *f, char *ip_string, char *subnet,
|
||||
- int is_ipv6)
|
||||
+ int ip_sec)
|
||||
{
|
||||
char addr[INET6_ADDRSTRLEN];
|
||||
char subnet_addr[INET6_ADDRSTRLEN];
|
||||
- int error, i = 0;
|
||||
+ int error = 0, i = 0;
|
||||
int ip_offset = 0, subnet_offset = 0;
|
||||
- int plen;
|
||||
+ int plen, ip_ver;
|
||||
|
||||
memset(addr, 0, sizeof(addr));
|
||||
memset(subnet_addr, 0, sizeof(subnet_addr));
|
||||
@@ -1216,10 +1300,16 @@ static int process_ip_string_nm(FILE *f, char *ip_string, char *subnet,
|
||||
subnet_addr,
|
||||
(MAX_IP_ADDR_SIZE *
|
||||
2))) {
|
||||
- if (!is_ipv6)
|
||||
+ ip_ver = ip_version_check(addr);
|
||||
+ if (ip_ver < 0)
|
||||
+ continue;
|
||||
+
|
||||
+ if (ip_ver == IPV4 && ip_sec == IPV4)
|
||||
plen = kvp_subnet_to_plen((char *)subnet_addr);
|
||||
- else
|
||||
+ else if (ip_ver == IPV6 && ip_sec == IPV6)
|
||||
plen = atoi(subnet_addr);
|
||||
+ else
|
||||
+ continue;
|
||||
|
||||
if (plen < 0)
|
||||
return plen;
|
||||
@@ -1233,17 +1323,16 @@ static int process_ip_string_nm(FILE *f, char *ip_string, char *subnet,
|
||||
memset(subnet_addr, 0, sizeof(subnet_addr));
|
||||
}
|
||||
|
||||
- return 0;
|
||||
+ return error;
|
||||
}
|
||||
|
||||
static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
{
|
||||
- int error = 0;
|
||||
+ int error = 0, ip_ver;
|
||||
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;
|
||||
|
||||
@@ -1421,52 +1510,94 @@ 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) {
|
||||
- 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
|
||||
+ *
|
||||
+ * The keyfile format expects the IPv6 and IPv4 configuration in
|
||||
+ * different sections. Therefore we iterate through the list twice,
|
||||
+ * once to populate the IPv4 section and the next time for IPv6
|
||||
*/
|
||||
+ ip_ver = IPV4;
|
||||
+ do {
|
||||
+ if (ip_ver == IPV4) {
|
||||
+ error = fprintf(nmfile, "\n[ipv4]\n");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ } else {
|
||||
+ error = fprintf(nmfile, "\n[ipv6]\n");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ }
|
||||
|
||||
- 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");
|
||||
+ /*
|
||||
+ * 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,
|
||||
+ ip_ver);
|
||||
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;
|
||||
+ /*
|
||||
+ * As dhcp_enabled is only valid for ipv4, we do not set dhcp
|
||||
+ * methods for ipv6 based on dhcp_enabled flag.
|
||||
+ *
|
||||
+ * For ipv4, set method to manual only when dhcp_enabled is
|
||||
+ * false and specific ipv4 addresses are configured. If neither
|
||||
+ * dhcp_enabled is true and no ipv4 addresses are configured,
|
||||
+ * set method to 'disabled'.
|
||||
+ *
|
||||
+ * For ipv6, set method to manual when we configure ipv6
|
||||
+ * addresses. Otherwise set method to 'auto' so that SLAAC from
|
||||
+ * RA may be used.
|
||||
+ */
|
||||
+ if (ip_ver == IPV4) {
|
||||
+ if (new_val->dhcp_enabled) {
|
||||
+ error = kvp_write_file(nmfile, "method", "",
|
||||
+ "auto");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ } else if (error) {
|
||||
+ error = kvp_write_file(nmfile, "method", "",
|
||||
+ "manual");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ } else {
|
||||
+ error = kvp_write_file(nmfile, "method", "",
|
||||
+ "disabled");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ }
|
||||
+ } else if (ip_ver == IPV6) {
|
||||
+ if (error) {
|
||||
+ error = kvp_write_file(nmfile, "method", "",
|
||||
+ "manual");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ } else {
|
||||
+ error = kvp_write_file(nmfile, "method", "",
|
||||
+ "auto");
|
||||
+ 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);
|
||||
+ error = process_dns_gateway_nm(nmfile,
|
||||
+ (char *)new_val->gate_way,
|
||||
+ GATEWAY, ip_ver);
|
||||
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);
|
||||
+ error = process_dns_gateway_nm(nmfile,
|
||||
+ (char *)new_val->dns_addr, DNS,
|
||||
+ ip_ver);
|
||||
if (error < 0)
|
||||
goto setval_error;
|
||||
- }
|
||||
+
|
||||
+ ip_ver++;
|
||||
+ } while (ip_ver < IP_TYPE_MAX);
|
||||
+
|
||||
fclose(nmfile);
|
||||
fclose(ifcfg_file);
|
||||
|
||||
--
|
||||
2.39.3
|
||||
|
103
hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.patch
Normal file
103
hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.patch
Normal file
@ -0,0 +1,103 @@
|
||||
From a8335c9675d22f8ed51a98e2f6b0f6f684d07793 Mon Sep 17 00:00:00 2001
|
||||
From: Ani Sinha <anisinha@redhat.com>
|
||||
Date: Mon, 16 Oct 2023 19:03:33 +0530
|
||||
Subject: [PATCH 11/14] hv/hv_kvp_daemon: Some small fixes for handling NM
|
||||
keyfiles
|
||||
|
||||
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
|
||||
RH-Jira: RHEL-40107 RHEL-40679
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [11/14] 55156e8fdd215ce1308887ea463a17ba614b1837 (mrezanin/centos-git-hyperv-daemons)
|
||||
|
||||
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>
|
||||
|
||||
patch_name: hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.patch
|
||||
present_in_specfile: true
|
||||
location_in_specfile: 14
|
||||
---
|
||||
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.39.3
|
||||
|
429
hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.patch
Normal file
429
hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.patch
Normal file
@ -0,0 +1,429 @@
|
||||
From cdf838e027ed7b6438dc86df6329bf46a7541b4f 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 10/14] hv/hv_kvp_daemon:Support for keyfile based connection
|
||||
profile
|
||||
|
||||
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
|
||||
RH-Jira: RHEL-40107 RHEL-40679
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [10/14] 16745685ef5d6c90f95acdd665a348ce8f30a684 (mrezanin/centos-git-hyperv-daemons)
|
||||
|
||||
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
|
||||
|
||||
patch_name: hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.patch
|
||||
present_in_specfile: true
|
||||
location_in_specfile: 13
|
||||
---
|
||||
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.39.3
|
||||
|
41
hpvd-hv_set_ifconfig.sh-Use-nmcli-commands.patch
Normal file
41
hpvd-hv_set_ifconfig.sh-Use-nmcli-commands.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 5b1094b6e8d7b5314ff32cef741e22bf2904d81f Mon Sep 17 00:00:00 2001
|
||||
From: Till Maas <timaas@redhat.com>
|
||||
Date: Mon, 13 Dec 2021 16:08:42 +0000
|
||||
Subject: [PATCH 04/14] hv_set_ifconfig.sh: Use nmcli commands
|
||||
|
||||
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
|
||||
RH-Jira: RHEL-40107 RHEL-40679
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [4/14] 657c30ec2f7f3cf90cd0950e45b2441280ef2581 (mrezanin/centos-git-hyperv-daemons)
|
||||
|
||||
Instead of using deprecated ifup/ifdown commands, use nmcli commands.
|
||||
Taking the connection down is not necessary with NM, so don't do it.
|
||||
|
||||
Resolves: #2026371
|
||||
|
||||
patch_name: hpvd-hv_set_ifconfig.sh-Use-nmcli-commands.patch
|
||||
present_in_specfile: true
|
||||
location_in_specfile: 7
|
||||
---
|
||||
hv_set_ifconfig.sh | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
|
||||
index 3dd064c..5a64efe 100644
|
||||
--- a/hv_set_ifconfig.sh
|
||||
+++ b/hv_set_ifconfig.sh
|
||||
@@ -57,8 +57,5 @@ echo "ONBOOT=yes" >> $1
|
||||
|
||||
cp $1 /etc/sysconfig/network-scripts/
|
||||
|
||||
-
|
||||
-interface=$(echo $1 | awk -F - '{ print $2 }')
|
||||
-
|
||||
-/sbin/ifdown $interface 2>/dev/null
|
||||
-/sbin/ifup $interface 2>/dev/null
|
||||
+nmcli connection load "/etc/sysconfig/network-scripts/$1"
|
||||
+nmcli connection up filename "/etc/sysconfig/network-scripts/$1"
|
||||
--
|
||||
2.39.3
|
||||
|
@ -0,0 +1,47 @@
|
||||
From 039cd98452fcf585533455c28200d438cda8ed7a Mon Sep 17 00:00:00 2001
|
||||
From: Mohammed Gamal <mgamal@redhat.com>
|
||||
Date: Tue, 8 Nov 2022 16:20:17 +0100
|
||||
Subject: [PATCH 06/14] redhat: hv_set_if_config: Workaround for gateway
|
||||
numbering in NetworkManager
|
||||
|
||||
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
|
||||
RH-Jira: RHEL-40107 RHEL-40679
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [6/14] 984b946aea905b94672aead098e73368e6c65fc7 (mrezanin/centos-git-hyperv-daemons)
|
||||
|
||||
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=.
|
||||
|
||||
A proper fix however, would be to generate NetworkManager keyfiles instead of ifcfg files.
|
||||
That can be done eitter by changing hypervkvpd code to do that or to let the script parse
|
||||
ifcfg files and generate corresponding NetworkManager keyfiles
|
||||
|
||||
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
|
||||
|
||||
patch_name: hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.patch
|
||||
present_in_specfile: true
|
||||
location_in_specfile: 9
|
||||
---
|
||||
hv_set_ifconfig.sh | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
|
||||
index 146829b..fe7fccf 100644
|
||||
--- a/hv_set_ifconfig.sh
|
||||
+++ b/hv_set_ifconfig.sh
|
||||
@@ -54,6 +54,10 @@ echo "IPV6INIT=yes" >> $1
|
||||
echo "PEERDNS=yes" >> $1
|
||||
echo "ONBOOT=yes" >> $1
|
||||
|
||||
+#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 $1 /etc/sysconfig/network-scripts/
|
||||
|
||||
--
|
||||
2.39.3
|
||||
|
48
hpvd-tools-hv-Remove-an-extraneous-the.patch
Normal file
48
hpvd-tools-hv-Remove-an-extraneous-the.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From b4af57850a0f8171116eacb6e8a565ef009e9c4b Mon Sep 17 00:00:00 2001
|
||||
From: Mohammed Gamal <mgamal@redhat.com>
|
||||
Date: Thu, 17 Nov 2022 18:56:20 +0100
|
||||
Subject: [PATCH 07/14] tools: hv: Remove an extraneous "the"
|
||||
|
||||
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
|
||||
RH-Jira: RHEL-40107 RHEL-40679
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [7/14] 55fe13a9967894578468229dc925fb106bce7355 (mrezanin/centos-git-hyperv-daemons)
|
||||
|
||||
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>
|
||||
|
||||
patch_name: hpvd-tools-hv-Remove-an-extraneous-the.patch
|
||||
present_in_specfile: true
|
||||
location_in_specfile: 10
|
||||
---
|
||||
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.39.3
|
||||
|
54
hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.patch
Normal file
54
hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.patch
Normal file
@ -0,0 +1,54 @@
|
||||
From 1a616ef74b66a45c1e16ec12e46fabfc03613668 Mon Sep 17 00:00:00 2001
|
||||
From: Mohammed Gamal <mgamal@redhat.com>
|
||||
Date: Thu, 17 Nov 2022 18:58:31 +0100
|
||||
Subject: [PATCH 08/14] tools: hv: kvp: remove unnecessary (void*) conversions
|
||||
|
||||
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
|
||||
RH-Jira: RHEL-40107 RHEL-40679
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [8/14] 16a5e8f5c4799f6777600cd62b4621e450638f22 (mrezanin/centos-git-hyperv-daemons)
|
||||
|
||||
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>
|
||||
|
||||
patch_name: hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.patch
|
||||
present_in_specfile: true
|
||||
location_in_specfile: 11
|
||||
---
|
||||
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.39.3
|
||||
|
@ -0,0 +1,55 @@
|
||||
From 520bfb6b8bc7cedc2dcb602a708c1357faf638b8 Mon Sep 17 00:00:00 2001
|
||||
From: Ani Sinha <anisinha@redhat.com>
|
||||
Date: Wed, 5 Jul 2023 18:44:34 +0530
|
||||
Subject: [PATCH 09/14] vmbus_testing: fix wrong python syntax for integer
|
||||
value comparison
|
||||
|
||||
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
|
||||
RH-Jira: RHEL-40107 RHEL-40679
|
||||
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
|
||||
RH-Commit: [9/14] 261dfeef254265a966e7175766f366eaed782454 (mrezanin/centos-git-hyperv-daemons)
|
||||
|
||||
It is incorrect in python to compare integer values using the "is" keyword. The
|
||||
"is" keyword in python is used to compare references to two objects, not their
|
||||
values. Newer version of python3 (version 3.8) throws a warning when such
|
||||
incorrect comparison is made. For value comparison, "==" should be used.
|
||||
|
||||
Fix this in the code and suppress the following warning:
|
||||
|
||||
/usr/sbin/vmbus_testing:167: SyntaxWarning: "is" with a literal. Did you mean "=="?
|
||||
|
||||
Signed-off-by: Ani Sinha <anisinha@redhat.com>
|
||||
|
||||
patch_name: hpvd-vmbus_testing-fix-wrong-python-syntax-for-integer-va.patch
|
||||
present_in_specfile: true
|
||||
location_in_specfile: 12
|
||||
---
|
||||
vmbus_testing | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/vmbus_testing b/vmbus_testing
|
||||
index e721290..4467979 100755
|
||||
--- a/vmbus_testing
|
||||
+++ b/vmbus_testing
|
||||
@@ -164,7 +164,7 @@ def recursive_file_lookup(path, file_map):
|
||||
def get_all_devices_test_status(file_map):
|
||||
|
||||
for device in file_map:
|
||||
- if (get_test_state(locate_state(device, file_map)) is 1):
|
||||
+ if (get_test_state(locate_state(device, file_map)) == 1):
|
||||
print("Testing = ON for: {}"
|
||||
.format(device.split("/")[5]))
|
||||
else:
|
||||
@@ -203,7 +203,7 @@ def write_test_files(path, value):
|
||||
def set_test_state(state_path, state_value, quiet):
|
||||
|
||||
write_test_files(state_path, state_value)
|
||||
- if (get_test_state(state_path) is 1):
|
||||
+ if (get_test_state(state_path) == 1):
|
||||
if (not quiet):
|
||||
print("Testing = ON for device: {}"
|
||||
.format(state_path.split("/")[5]))
|
||||
--
|
||||
2.39.3
|
||||
|
@ -2,8 +2,6 @@
|
||||
%global hv_kvp_daemon hypervkvpd
|
||||
# Hyper-V VSS daemon binary name
|
||||
%global hv_vss_daemon hypervvssd
|
||||
# Hyper-V FCOPY daemon binary name
|
||||
%global hv_fcopy_daemon hypervfcopyd
|
||||
# snapshot version
|
||||
%global snapver .20220731git
|
||||
# use hardened build
|
||||
@ -13,7 +11,7 @@
|
||||
|
||||
Name: hyperv-daemons
|
||||
Version: 0
|
||||
Release: 0.45%{?snapver}%{?dist}
|
||||
Release: 0.46%{?snapver}%{?dist}
|
||||
Summary: Hyper-V daemons suite
|
||||
|
||||
License: GPL-2.0-only
|
||||
@ -36,14 +34,47 @@ Source100: hv_vss_daemon.c
|
||||
Source101: hypervvssd.service
|
||||
Source102: hypervvss.rules
|
||||
|
||||
# HYPERV FCOPY DAEMON
|
||||
Source200: hv_fcopy_daemon.c
|
||||
Source201: hypervfcopyd.service
|
||||
Source202: hypervfcopy.rules
|
||||
|
||||
# HYPERV TOOLS
|
||||
Source301: lsvmbus
|
||||
|
||||
# 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
|
||||
Patch1: hpvd-Do-not-set-NM_CONTROLLED-no.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
|
||||
Patch2: hpvd-Add-vmbus_testing-tool-build-files.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
|
||||
Patch3: hpvd-hv_set_ifconfig.sh-Use-nmcli-commands.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
|
||||
Patch4: hpvd-Use-filename-for-connection-profile.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
|
||||
Patch5: hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.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
|
||||
Patch6: hpvd-tools-hv-Remove-an-extraneous-the.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
|
||||
Patch7: hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.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
|
||||
Patch8: hpvd-vmbus_testing-fix-wrong-python-syntax-for-integer-va.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
|
||||
Patch9: hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.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
|
||||
Patch10: hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.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
|
||||
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
|
||||
|
||||
# Hyper-V is available only on x86 and aarch64 architectures
|
||||
# The base empty (a.k.a. virtual) package can not be noarch
|
||||
# due to http://www.rpm.org/ticket/78
|
||||
@ -51,7 +82,6 @@ ExclusiveArch: i686 x86_64 aarch64
|
||||
|
||||
Requires: hypervkvpd = %{version}-%{release}
|
||||
Requires: hypervvssd = %{version}-%{release}
|
||||
Requires: hypervfcopyd = %{version}-%{release}
|
||||
BuildRequires: gcc
|
||||
|
||||
%description
|
||||
@ -92,22 +122,6 @@ from Windows Host if to "freeze" or "thaw" the filesystem
|
||||
on the Linux Guest.
|
||||
|
||||
|
||||
%package -n hypervfcopyd
|
||||
Summary: Hyper-V FCOPY daemon
|
||||
Requires: %{name}-license = %{version}-%{release}
|
||||
BuildRequires: systemd, kernel-headers
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
|
||||
%description -n hypervfcopyd
|
||||
Hypervfcopyd is an implementation of file copy service functionality
|
||||
for Linux Guest running on Hyper-V. The daemon enables host to copy
|
||||
a file (over VMBUS) into the Linux Guest. The daemon first registers
|
||||
with the kernel driver. After this is done it waits for instructions
|
||||
from Windows Host.
|
||||
|
||||
|
||||
%package license
|
||||
Summary: License of the Hyper-V daemons suite
|
||||
BuildArch: noarch
|
||||
@ -127,11 +141,15 @@ Contains tools and scripts useful for Hyper-V guests.
|
||||
cp -pvL %{SOURCE0} COPYING
|
||||
|
||||
cp -pvL %{SOURCE1} hv_kvp_daemon.c
|
||||
cp -pvL %{SOURCE2} hv_get_dhcp_info.sh
|
||||
cp -pvL %{SOURCE3} hv_get_dns_info.sh
|
||||
cp -pvL %{SOURCE4} hv_set_ifconfig.sh
|
||||
cp -pvL %{SOURCE100} hv_vss_daemon.c
|
||||
cp -pvL %{SOURCE200} hv_fcopy_daemon.c
|
||||
|
||||
cp -pvL %{SOURCE301} lsvmbus
|
||||
|
||||
%autopatch -p1
|
||||
|
||||
%build
|
||||
# HYPERV KVP DAEMON
|
||||
%{__cc} $RPM_OPT_FLAGS -c hv_kvp_daemon.c
|
||||
@ -141,9 +159,6 @@ cp -pvL %{SOURCE301} lsvmbus
|
||||
%{__cc} $RPM_OPT_FLAGS -c hv_vss_daemon.c
|
||||
%{__cc} $RPM_LD_FLAGS hv_vss_daemon.o -o %{hv_vss_daemon}
|
||||
|
||||
# HYPERV FCOPY DAEMON
|
||||
%{__cc} $RPM_OPT_FLAGS -c hv_fcopy_daemon.c
|
||||
%{__cc} $RPM_LD_FLAGS hv_fcopy_daemon.o -o %{hv_fcopy_daemon}
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
@ -151,28 +166,26 @@ rm -rf %{buildroot}
|
||||
mkdir -p %{buildroot}%{_sbindir}
|
||||
install -p -m 0755 %{hv_kvp_daemon} %{buildroot}%{_sbindir}
|
||||
install -p -m 0755 %{hv_vss_daemon} %{buildroot}%{_sbindir}
|
||||
install -p -m 0755 %{hv_fcopy_daemon} %{buildroot}%{_sbindir}
|
||||
# Systemd unit file
|
||||
mkdir -p %{buildroot}%{_unitdir}
|
||||
install -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}
|
||||
install -p -m 0644 %{SOURCE101} %{buildroot}%{_unitdir}
|
||||
install -p -m 0644 %{SOURCE201} %{buildroot}%{_unitdir}
|
||||
# Udev rules
|
||||
mkdir -p %{buildroot}%{_udevrulesdir}
|
||||
install -p -m 0644 %{SOURCE6} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervkvp.rules
|
||||
install -p -m 0644 %{SOURCE102} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervvss.rules
|
||||
install -p -m 0644 %{SOURCE202} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervfcopy.rules
|
||||
# Shell scripts for the KVP daemon
|
||||
mkdir -p %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}
|
||||
install -p -m 0755 %{SOURCE2} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dhcp_info
|
||||
install -p -m 0755 %{SOURCE3} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dns_info
|
||||
install -p -m 0755 %{SOURCE4} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_set_ifconfig
|
||||
install -p -m 0755 hv_get_dhcp_info.sh %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dhcp_info
|
||||
install -p -m 0755 hv_get_dns_info.sh %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dns_info
|
||||
install -p -m 0755 hv_set_ifconfig.sh %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_set_ifconfig
|
||||
# Directory for pool files
|
||||
mkdir -p %{buildroot}%{_sharedstatedir}/hyperv
|
||||
|
||||
# Tools
|
||||
install -p -m 0755 lsvmbus %{buildroot}%{_sbindir}/
|
||||
sed -i 's,#!/usr/bin/env python,#!/usr/bin/python3,' %{buildroot}%{_sbindir}/lsvmbus
|
||||
install -p -m 0755 vmbus_testing %{buildroot}%{_sbindir}/
|
||||
|
||||
%post -n hypervkvpd
|
||||
if [ $1 -gt 1 ] ; then
|
||||
@ -205,19 +218,6 @@ fi
|
||||
%systemd_preun hypervvssd.service
|
||||
|
||||
|
||||
%post -n hypervfcopyd
|
||||
if [ $1 -gt 1 ] ; then
|
||||
# Upgrade
|
||||
systemctl --no-reload disable hypervfcopyd.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%postun -n hypervfcopyd
|
||||
%systemd_postun hypervfcopyd.service
|
||||
|
||||
%preun -n hypervfcopyd
|
||||
%systemd_preun hypervfcopyd.service
|
||||
|
||||
|
||||
%files
|
||||
# the base package does not contain any files.
|
||||
|
||||
@ -234,18 +234,34 @@ fi
|
||||
%{_unitdir}/hypervvssd.service
|
||||
%{_udevrulesdir}/%{udev_prefix}-hypervvss.rules
|
||||
|
||||
%files -n hypervfcopyd
|
||||
%{_sbindir}/%{hv_fcopy_daemon}
|
||||
%{_unitdir}/hypervfcopyd.service
|
||||
%{_udevrulesdir}/%{udev_prefix}-hypervfcopy.rules
|
||||
|
||||
%files license
|
||||
%doc COPYING
|
||||
|
||||
%files -n hyperv-tools
|
||||
%{_sbindir}/lsvmbus
|
||||
%{_sbindir}/vmbus_testing
|
||||
|
||||
%changelog
|
||||
* Thu Jun 27 2024 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.46.20220731git
|
||||
- hpvd-Add-support-for-patching-hyperv-daemons.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-Do-not-set-NM_CONTROLLED-no.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-Add-vmbus_testing-tool-build-files.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-hv_set_ifconfig.sh-Use-nmcli-commands.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-Use-filename-for-connection-profile.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-tools-hv-Remove-an-extraneous-the.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-vmbus_testing-fix-wrong-python-syntax-for-integer-va.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-hv-hv_kvp_daemon-Handle-IPv4-and-Ipv6-combination-fo.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-Changes-for-adding-keyfile-support-in-RHEL-specific-.patch [RHEL-40107 RHEL-40679]
|
||||
- hpvd-Remove-hyperv_fcopy_daemon-as-the-c10s-kernel-does-n.patch [RHEL-40107 RHEL-40679]
|
||||
- Resolves: 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.)
|
||||
- Resolves: 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)
|
||||
|
||||
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 0-0.45.20220731git
|
||||
- Bump release for June 2024 mass rebuild
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
SUBSYSTEM=="misc", KERNEL=="vmbus/hv_fcopy", TAG+="systemd", ENV{SYSTEMD_WANTS}+="hypervfcopyd.service"
|
@ -1,8 +0,0 @@
|
||||
[Unit]
|
||||
Description=Hyper-V FCOPY daemon
|
||||
ConditionVirtualization=microsoft
|
||||
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_fcopy.device
|
||||
IgnoreOnIsolate=1
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/hypervfcopyd -n
|
1
sources
1
sources
@ -3,6 +3,5 @@ SHA512 (hv_get_dns_info.sh) = 876effabea3ffe1daaa9c68dfa9b254d740003716f081aa524
|
||||
SHA512 (hv_kvp_daemon.c) = c2ef1903a2086bb86f25edae06db7d00c48417ec6cc1aa9e71134557a97c834d4a63303768e6093e0981f67b077f348e4577c66a72977fea3d460fa3a7db6409
|
||||
SHA512 (hv_set_ifconfig.sh) = 3dea16ca48ba9732e6dc0095d35c052cbf4664ba905ca492c01ff1df6085e63e6e7831b01804923dbe9fed4e402f2b0975cd1f00f79ec8da61e2ac404fcfc32f
|
||||
SHA512 (hv_vss_daemon.c) = 940ab279e706dc13438849253d59e58af9710c55fcd2a879715ccc59accfa0cc68e2299c5ec95fde82dd1d7baf0fb0c49d56c3cdf4a4a2c95e8685528497ea8b
|
||||
SHA512 (hv_fcopy_daemon.c) = 3306eed0a1da7599505a848bcef17a869366c2e1dc4e358b9d7ff1f1e0d58870e850275730e12d161e2fd4b1e8d2ad70f2af1181d1121d9053a037a169d0b6ef
|
||||
SHA512 (COPYING) = fbb1e0f29741e900a81ccbe76102103365423d310e9987dfc5858174999911037a9ad48270a3d0b86f245e91868ed73813ca273584be43816f53517858f3aabd
|
||||
SHA512 (lsvmbus) = 43be38dd1ef8b2864a3f37a29a440478a69879ea4882a7ded8e42c2464b7325c1b0da3c7e001154da5f892641b6f60d75e7dbab287a9e9cfcf9567ea9eeec8e0
|
||||
|
Loading…
Reference in New Issue
Block a user