From 8d0ef743e0df7a77b4c67f6a98363c1a92de4038 Mon Sep 17 00:00:00 2001 From: Kairui Song Date: Wed, 28 Apr 2021 15:00:12 +0800 Subject: [PATCH] Revert "get kdump ifname once in kdump_install_net" This reverts commit afda4f4961dbf09f7f64cadd936e01a4675ea31f. --- dracut-module-setup.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index c6c1a9b..066d0ce 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -480,7 +480,7 @@ kdump_get_remote_ip() # initramfs accessing giving destination # $1: destination host kdump_install_net() { - local _destaddr _srcaddr _route _netdev kdumpnic + local _destaddr _srcaddr _route _netdev local _static _proto _ip_conf _ip_opts _ifname_opts _destaddr=$(kdump_get_remote_ip $1) @@ -488,7 +488,6 @@ kdump_install_net() { _srcaddr=$(kdump_get_ip_route_field "$_route" "src") _netdev=$(kdump_get_ip_route_field "$_route" "dev") _netmac=$(kdump_get_mac_addr $_netdev) - kdumpnic=$(kdump_setup_ifname $_netdev) if [ "$(uname -m)" = "s390x" ]; then kdump_setup_znet $_netdev @@ -504,7 +503,7 @@ kdump_install_net() { fi _ip_conf="${initdir}/etc/cmdline.d/40ip.conf" - _ip_opts=" ip=${_static}$kdumpnic:${_proto}" + _ip_opts=" ip=${_static}$(kdump_setup_ifname $_netdev):${_proto}" # dracut doesn't allow duplicated configuration for same NIC, even they're exactly the same. # so we have to avoid adding duplicates @@ -524,7 +523,7 @@ kdump_install_net() { elif kdump_is_vlan "$_netdev"; then kdump_setup_vlan "$_netdev" else - _ifname_opts=" ifname=$kdumpnic:$_netmac" + _ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$_netmac" echo "$_ifname_opts" >> $_ip_conf fi @@ -544,8 +543,8 @@ kdump_install_net() { # gateway. if [ ! -f ${initdir}/etc/cmdline.d/60kdumpnic.conf ] && [ ! -f ${initdir}/etc/cmdline.d/70bootdev.conf ]; then - echo "kdumpnic=$kdumpnic" > ${initdir}/etc/cmdline.d/60kdumpnic.conf - echo "bootdev=$kdumpnic" > ${initdir}/etc/cmdline.d/70bootdev.conf + echo "kdumpnic=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/60kdumpnic.conf + echo "bootdev=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/70bootdev.conf fi }