File kdump-net-0007-query-correct-iface.patch of Package kdump
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu, 1 Sep 2016 10:40:54 +0200
Subject: Query the correct interface in kdump_ip_config
References: bsc#980328
Patch-mainline: v0.8.16
Git-commit: 023b8be6d04e645ee429acb61c4312b63b2e0c50
Since the initrd interface name may differ from the running kernel's,
the latter should be passed in the ip= dracut option. However, the
current interface name is also required in kdump_ip_config and
kdump_ip6_config to query the currently assigned IP address.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 11 +++++------
init/setup-kdump.functions | 12 ++++++++----
2 files changed, 13 insertions(+), 10 deletions(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -80,7 +80,6 @@ kdump_cmdline_ip() {
local iface
kdump_ifname_config "$_if"
- _if="$iface"
if [ "$_mode" = "auto" ] ; then
if [ -n $(kdump_ip_config "$_if") ] ; then
@@ -95,17 +94,17 @@ kdump_cmdline_ip() {
case "$_mode" in
static)
printf " %s" \
- $(kdump_ip_config "$_if") \
- $(kdump_ip6_config "$_if")
+ $(kdump_ip_config "$_if" "$iface") \
+ $(kdump_ip6_config "$_if" "$iface")
;;
dhcp|dhcp4)
- echo " ip=${_if}:dhcp"
+ echo " ip=${iface}:dhcp"
;;
dhcp6)
- echo " ip=${_if}:dhcp6"
+ echo " ip=${iface}:dhcp6"
;;
auto6)
- echo " ip=${_if}:auto6"
+ echo " ip=${iface}:auto6"
;;
*)
derror "Wrong KDUMP_NETCONFIG mode: $_mode"
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -359,12 +359,14 @@ kdump_prefix2netmask() { # {{{
# Get the IPv4 ip= parameter for a given device
#
# Parameters:
-# 1) device device name
+# 1) iface current interface name
+# 2) bootif interface name in initrd
# Output:
# ip configuration string that can be used for the ip= initrd parameter
function kdump_ip_config() # {{{
{
local iface="$1"
+ local bootif="$2"
local ipaddr peeraddr gwaddr netmask hostname
local family cidr rest
local prefix
@@ -389,19 +391,21 @@ function kdump_ip_config() # {{{
gwaddr=$(ip route show 0/0 | sed -n 's/.* via \([^ ]*\).*/\1/p')
hostname=$(hostname)
- echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$iface:none"
+ echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none"
} # }}}
#
# Get the IPv6 ip= parameter for a given device
#
# Parameters:
-# 1) device device name
+# 1) iface current interface name
+# 2) bootif interface name in initrd
# Output:
# ip configuration string that can be used for the ip= initrd parameter
function kdump_ip6_config() # {{{
{
local iface="$1"
+ local bootif="$2"
local ipaddr peeraddr gwaddr hostname
local family cidr rest prefix
@@ -425,7 +429,7 @@ function kdump_ip6_config() # {{
peeraddr=
fi
- echo "ip=$ipaddr:$peeraddr:$gwaddr::$hostname:$iface:none"
+ echo "ip=$ipaddr:$peeraddr:$gwaddr::$hostname:$bootif:none"
done < <(ip -6 address show dev "$iface" permanent scope global)
} # }}}