From 1f145e9ec0028e24426113f03c936f4edd926af99e80b871f7f5c07388e33a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Tesa=C5=99=C3=ADk?= Date: Fri, 5 Mar 2021 11:13:08 +0000 Subject: [PATCH] - kdump-query-systemd-network.service.patch: Query systemd network.service to find out if wicked is used (bsc#1182309). - kdump-check-explicit-ip-options.patch: Do not add network-related dracut options if ip= is set explicitly (bsc#1182309). OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=203 --- kdump-check-explicit-ip-options.patch | 62 +++++++++++ kdump-query-systemd-network.service.patch | 125 ++++++++++++++++++++++ kdump.changes | 9 ++ kdump.spec | 6 +- 4 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 kdump-check-explicit-ip-options.patch create mode 100644 kdump-query-systemd-network.service.patch diff --git a/kdump-check-explicit-ip-options.patch b/kdump-check-explicit-ip-options.patch new file mode 100644 index 0000000..4cd824c --- /dev/null +++ b/kdump-check-explicit-ip-options.patch @@ -0,0 +1,62 @@ +From: Petr Tesarik +Date: Fri Mar 5 11:06:35 2021 +0100 +Subject: Do not add network-related dracut options if ip= is set explicitly +References: bsc#1182309 +Upstream: merged +Git-commit: bbe9b1281cd6c26ec937c6fee622ad7a84da959d + +If the KDUMP_COMMANDLINE or KDUMP_COMMANDLINE_APPEND contain an +explicit ip= option, do not try to add anything automatically, +because it will clash with the admin's intention. + +Signed-off-by: Petr Tesarik + +--- + doc/man/kdump.5.txt.in | 8 ++++++-- + init/module-setup.sh | 15 +++++++++++++++ + 2 files changed, 21 insertions(+), 2 deletions(-) + +--- a/doc/man/kdump.5.txt.in ++++ b/doc/man/kdump.5.txt.in +@@ -580,8 +580,12 @@ _netdevice_ is for example "eth0". The _ + * use DHCP6 if it has a permanent IPv6 address (IPv4 not set up), + * use IPv6 auto-configuration if it has neither (IPv4 not set up). + +-You can set KDUMP_NETCONFIG to "" if you want no network in initrd, i.e. you use +-disk dumping. ++*Note:* If an _ip=_ option is found in KDUMP_COMMANDLINE or ++KDUMP_COMMANDLINE_APPEND, kdump does not add any other _ip=_ or _ifname=_ ++options. In other words, the value of KDUMP_NETCONFIG is effectively ignored. ++ ++Setting KDUMP_NETCONFIG to "" disables network completely. In this case, kdump ++does not even add the _network_ dracut module to the initrd. + + Default: "auto" + +--- a/init/module-setup.sh ++++ b/init/module-setup.sh +@@ -168,9 +168,24 @@ kdump_cmdline_zfcp() { + } | sort -u + } + ++kdump_ip_set_explicitly() { ++ local _opt ++ for _opt in $KDUMP_COMMANDLINE $KDUMP_COMMANDLINE_APPEND ++ do ++ if [ "${_opt%%=*}" = "ip" -a \ ++ "${_opt#*=}" != "$_opt" ] ++ then ++ return 0 ++ fi ++ done ++ return 1 ++} ++ + kdump_cmdline_ip() { + [ "$kdump_neednet" = y ] || return 0 + ++ kdump_ip_set_explicitly && return 0 ++ + local _cfg="${KDUMP_NETCONFIG%:force}" + if [ "$_cfg" = "auto" ] ; then + kdump_host_if=default diff --git a/kdump-query-systemd-network.service.patch b/kdump-query-systemd-network.service.patch new file mode 100644 index 0000000..6bc45f3 --- /dev/null +++ b/kdump-query-systemd-network.service.patch @@ -0,0 +1,125 @@ +From: Petr Tesarik +Date: Fri Mar 5 10:45:03 2021 +0100 +Subject: Query systemd network.service to find out if wicked is used +References: bsc#1182309 +Upstream: merged +Git-commit: 44a25927a0c234eb1c731b919d16cf282d168138 + +Even if wicked is installed on a system, network may still be +managed by NetworkManager. Improve the logic by checking the +actual Id of the currently configured network.service. + +Signed-off-by: Petr Tesarik + +--- + init/setup-kdump.functions | 49 ++++++++++++++++++++++++++++++--------------- + 1 file changed, 33 insertions(+), 16 deletions(-) + +--- a/init/setup-kdump.functions ++++ b/init/setup-kdump.functions +@@ -30,6 +30,21 @@ function kdump_route2dev() # {{{ + sed -n 's/.* dev \([^ ]*\) *.*/\1/p' + } # }}} + ++# Get network manager id ++# ++# Output: ++# network manager identifier ("wicked" or "NetworkManager") ++function kdump_net_manager() # {{{ ++{ ++ if [ -z "$kdump_cached_net_manager" ] ; then ++ local _id ++ _id=$(systemctl show --property=Id network.service) ++ _id="${_id#Id=}" ++ kdump_cached_net_manager="${_id%.service}" ++ fi ++ echo "$kdump_cached_net_manager" ++} # }}} ++ + # + # Get a wicked configuration value for a device + # +@@ -95,17 +110,19 @@ function kdump_netdev_mode() # { + local BOOTPROTO + + # get mode using wicked if possible +- if [ -n "$(type -P wicked)" -a \ +- "$(kdump_wicked_conf "$ifname" "%{name}")" = "$ifname" ] ++ if [ "$(kdump_net_manager)" = "wicked" ] + then +- local dhcpv4 dhcpv6 +- eval $( kdump_wicked_conf "$ifname" \ +- "dhcpv4=%{ipv4:dhcp/enabled}" \ +- "dhcpv6=%{ipv6:dhcp/enabled}" ) +- if [ "$dhcpv4" = true -o "$dhcpv6" = true ] ; then +- BOOTPROTO=dhcp +- else +- BOOTPROTO=static ++ if [ "$(kdump_wicked_conf "$ifname" "%{name}")" = "$ifname" ] ++ then ++ local dhcpv4 dhcpv6 ++ eval $( kdump_wicked_conf "$ifname" \ ++ "dhcpv4=%{ipv4:dhcp/enabled}" \ ++ "dhcpv6=%{ipv6:dhcp/enabled}" ) ++ if [ "$dhcpv4" = true -o "$dhcpv6" = true ] ; then ++ BOOTPROTO=dhcp ++ else ++ BOOTPROTO=static ++ fi + fi + fi + +@@ -153,7 +170,7 @@ function kdump_ifkind() # {{{ + echo ovs-system + + # get kind using wicked if possible +- elif [ -n "$(type -P wicked)" ] ++ elif [ "$(kdump_net_manager)" = "wicked" ] + then + local -a elems=( + infiniband +@@ -234,7 +251,7 @@ function kdump_bridge_config() # + local curslaves + + # use wicked to read VLAN configuration, if possible +- if [ -n "$(type -P wicked)" ] ++ if [ "$(kdump_net_manager)" = "wicked" ] + then + curslaves=$( kdump_wicked_conf "$bridge" "%{bridge/ports/port/device}" ) + fi +@@ -273,7 +290,7 @@ function kdump_bond_config() # { + local curslaves opts + + # use wicked to read bonding settings, if possible +- if [ -n "$(type -P wicked)" ] ++ if [ "$(kdump_net_manager)" = "wicked" ] + then + local -a optvars=( + mode arp_interval arp_validate arp_all_targets arp_ip_target +@@ -402,7 +419,7 @@ function kdump_vlan_config() # { + local vid + + # use wicked to read VLAN configuration, if possible +- if [ -n "$(type -P wicked)" ] ++ if [ "$(kdump_net_manager)" = "wicked" ] + then + eval $( kdump_wicked_conf "$if" \ + "vid=%{vlan/tag}; if=%{vlan/device}" ) +@@ -538,7 +555,7 @@ function kdump_ip_routes() # {{{ + local _addintf="s/\$/:${_bootif}/p" + + # get configured routes using wicked if possible +- if [ -n "$(type -P wicked)" ] ++ if [ "$(kdump_net_manager)" = "wicked" ] + then + wicked show-config | \ + wicked xpath --reference \ +@@ -619,7 +636,7 @@ function kdump_ip6_routes() # {{ + local _addintf="s/\$/:${_bootif}/p" + + # get configured routes using wicked if possible +- if [ -n "$(type -P wicked)" ] ++ if [ "$(kdump_net_manager)" = "wicked" ] + then + wicked show-config | \ + wicked xpath \ diff --git a/kdump.changes b/kdump.changes index d8c435e..5c910ec 100644 --- a/kdump.changes +++ b/kdump.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Fri Mar 5 11:02:51 UTC 2021 - Petr Tesařík + +- kdump-query-systemd-network.service.patch: Query systemd + network.service to find out if wicked is used (bsc#1182309). +- kdump-check-explicit-ip-options.patch: Do not add + network-related dracut options if ip= is set explicitly + (bsc#1182309). + ------------------------------------------------------------------- Tue Sep 22 05:51:13 UTC 2020 - Jiri Slaby diff --git a/kdump.spec b/kdump.spec index fe2c4e2..a5d3197 100644 --- a/kdump.spec +++ b/kdump.spec @@ -1,7 +1,7 @@ # # spec file for package kdump # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -65,6 +65,8 @@ Patch30: %{name}-calibrate-Update-values.patch Patch31: %{name}-activate-udev-rules-late-during-boot.patch Patch32: %{name}-make-sure-that-the-udev-runtime-directory-exists.patch Patch33: %{name}-make-sure-that-initrd.target.wants-directory-exists.patch +Patch34: %{name}-check-explicit-ip-options.patch +Patch35: %{name}-query-systemd-network.service.patch BuildRequires: asciidoc BuildRequires: cmake BuildRequires: gcc-c++ @@ -149,6 +151,8 @@ after a crash dump has occured. %patch31 -p1 %patch32 -p1 %patch33 -p1 +%patch34 -p1 +%patch35 -p1 %build export CXXFLAGS="%{optflags} -std=gnu++98"