The main goal of this patch set is to fix bz1854037 which happens because rd.route doesn't use the name from kdump_setup_ifname which in turn causes NetworkManger to get an IP for the slave NIC and then time out. Meanwhile, I think it's better to avoid repeatedly calling kdump_setup_ifname.
v1->v2: - pass kdumpnic to kdump_handle_mulitpath_route [Kairui] - drop the patch "pass kdumpnic to kdump_setup_/bond/bridge/vlan directly" - fix the explanation why bz1854037 occurs
Coiby Xu (2): get kdump ifname once in kdump_install_net rd.route should use the name from kdump_setup_ifname
dracut-module-setup.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
Signed-off-by: Coiby Xu coxu@redhat.com --- dracut-module-setup.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index eb8adfd..3657b35 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -477,7 +477,7 @@ kdump_get_remote_ip() # initramfs accessing giving destination # $1: destination host kdump_install_net() { - local _destaddr _srcaddr _route _netdev + local _destaddr _srcaddr _route _netdev kdumpnic local _static _proto _ip_conf _ip_opts _ifname_opts
_destaddr=$(kdump_get_remote_ip $1) @@ -485,6 +485,7 @@ 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 @@ -500,7 +501,7 @@ kdump_install_net() { fi
_ip_conf="${initdir}/etc/cmdline.d/40ip.conf" - _ip_opts=" ip=${_static}$(kdump_setup_ifname $_netdev):${_proto}" + _ip_opts=" ip=${_static}$kdumpnic:${_proto}"
# dracut doesn't allow duplicated configuration for same NIC, even they're exactly the same. # so we have to avoid adding duplicates @@ -520,7 +521,7 @@ kdump_install_net() { elif kdump_is_vlan "$_netdev"; then kdump_setup_vlan "$_netdev" else - _ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$_netmac" + _ifname_opts=" ifname=$kdumpnic:$_netmac" echo "$_ifname_opts" >> $_ip_conf fi
@@ -540,8 +541,8 @@ kdump_install_net() { # gateway. if [ ! -f ${initdir}/etc/cmdline.d/60kdumpnic.conf ] && [ ! -f ${initdir}/etc/cmdline.d/70bootdev.conf ]; then - echo "kdumpnic=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/60kdumpnic.conf - echo "bootdev=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/70bootdev.conf + echo "kdumpnic=$kdumpnic" > ${initdir}/etc/cmdline.d/60kdumpnic.conf + echo "bootdev=$kdumpnic" > ${initdir}/etc/cmdline.d/70bootdev.conf fi }
This fixes bz1854037 which happens because kexec-tools generates rd.route for eth0 instead of for kdump-eth0, 1. "rd.route=168.63.129.16:10.0.0.1:eth0 rd.route=169.254.169.254:10.0.0.1:eth0" is passed to the dracut cmdline by kexec-tools 2. In the 2rd kernel, dracut/modules.d/35network-manager/nm-config.sh calls /usr/libexec/nm-initrd-generator to generate two .nmconnection files based on the dracut cmdline, i.e. kdump-eth0.nmconnection and eth0.nmconnection, - /run/NetworkManager/system-connections/kdump-eth0.nmconnection [connection] id=kdump-eth0 uuid=3ef53b1b-3908-437e-a15f-cf1f3ea2678b type=ethernet autoconnect-retries=1 interface-name=kdump-eth0 multi-connect=1 permissions= wait-device-timeout=60000 [ethernet] mac-address-blacklist= [ipv4] address1=10.0.0.4/24,10.0.0.1 dhcp-timeout=90 dns=168.63.129.16; dns-search= may-fail=false method=manual [ipv6] addr-gen-mode=eui64 dhcp-timeout=90 dns-search= method=disabled [proxy]
- /run/NetworkManager/system-connections/eth0.nmconnection [connection] id=eth0 uuid=f224dc22-2891-4d7b-8f66-745029df4b53 type=ethernet autoconnect-retries=1 interface-name=eth0 multi-connect=1 permissions= [ethernet] mac-address-blacklist= [ipv4] dhcp-timeout=90 dns=168.63.129.16; dns-search= method=auto route1=168.63.129.16/32,10.0.0.1 route2=169.254.169.254/32,10.0.0.1 [ipv6] addr-gen-mode=eui64 dhcp-timeout=90 dns-search= method=auto [proxy]
3. Since there's eth0.nmconnection, NetworkManager will try to get an IP for eth0 regardless of the fact it's a slave NIC and time out ``` $ ip link show 2: kdump-eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether 00:0d:3a:11:86:8b brd ff:ff:ff:ff:ff:ff 3: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master kdump-eth0 state UP mode DEFAULT group default qlen 1000 ```
Reported-by: Huijing Hei hhei@redhat.com Signed-off-by: Coiby Xu coxu@redhat.com --- dracut-module-setup.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 3657b35..a8bfe53 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -232,7 +232,7 @@ cal_netmask_by_prefix() { #$2: srcaddr #if it use static ip echo it, or echo null kdump_static_ip() { - local _netdev="$1" _srcaddr="$2" _ipv6_flag + local _netdev="$1" _srcaddr="$2" kdumpnic="$3" _ipv6_flag local _netmask _gateway _ipaddr _target _nexthop _prefix
_ipaddr=$(ip addr show dev $_netdev permanent | awk "/ $_srcaddr/.* /{print $2}") @@ -270,14 +270,14 @@ kdump_static_ip() { _target="[$_target]" _nexthop="[$_nexthop]" fi - echo "rd.route=$_target:$_nexthop:$_netdev" + echo "rd.route=$_target:$_nexthop:$kdumpnic" done >> ${initdir}/etc/cmdline.d/45route-static.conf
- kdump_handle_mulitpath_route $_netdev $_srcaddr + kdump_handle_mulitpath_route $_netdev $_srcaddr $kdumpnic }
kdump_handle_mulitpath_route() { - local _netdev="$1" _srcaddr="$2" _ipv6_flag + local _netdev="$1" _srcaddr="$2" kdumpnic="$3" _ipv6_flag local _target _nexthop _route _weight _max_weight _rule
if is_ipv6_address $_srcaddr; then @@ -296,9 +296,9 @@ kdump_handle_mulitpath_route() { _nexthop=`echo "$_route" | cut -d ' ' -f3` _max_weight=$_weight if [ "x" != "x"$_ipv6_flag ]; then - _rule="rd.route=[$_target]:[$_nexthop]:$_netdev" + _rule="rd.route=[$_target]:[$_nexthop]:$kdumpnic" else - _rule="rd.route=$_target:$_nexthop:$_netdev" + _rule="rd.route=$_target:$_nexthop:$kdumpnic" fi fi else @@ -491,7 +491,7 @@ kdump_install_net() { kdump_setup_znet $_netdev fi
- _static=$(kdump_static_ip $_netdev $_srcaddr) + _static=$(kdump_static_ip $_netdev $_srcaddr $kdumpnic) if [ -n "$_static" ]; then _proto=none elif is_ipv6_address $_srcaddr; then
Hi Coiby,
On Thu, May 6, 2021 at 11:50 AM Coiby Xu coxu@redhat.com wrote:
The main goal of this patch set is to fix bz1854037 which happens because rd.route doesn't use the name from kdump_setup_ifname which in turn causes NetworkManger to get an IP for the slave NIC and then time out. Meanwhile, I think it's better to avoid repeatedly calling kdump_setup_ifname.
v1->v2:
- pass kdumpnic to kdump_handle_mulitpath_route [Kairui]
- drop the patch "pass kdumpnic to kdump_setup_/bond/bridge/vlan directly"
- fix the explanation why bz1854037 occurs
Coiby Xu (2): get kdump ifname once in kdump_install_net rd.route should use the name from kdump_setup_ifname
Thanks for the update, this series looks good to me. Acked-by: Kairui Song kasong@redhat.com
dracut-module-setup.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
-- 2.31.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure