File kdump-net-0004-handle-iface-renames.patch of Package kdump
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 19 Aug 2016 19:56:34 +0200
Subject: Handle interface changes for VLAN interfaces
References: bsc#980328
Patch-mainline: v0.8.16
Git-commit: ad1597c92a917655e72b096ce48cbf9377a4c057
Since dracut does not allow to specify an arbitrary vlan interface
name, the initrd name may differ from the original name.
Let's set the "iface" variable to the resulting interface name on
exit of each function that handles interfaces and also use it for
the final ip configuration.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 4 +++-
init/setup-kdump.functions | 29 ++++++++++++++++++++---------
2 files changed, 23 insertions(+), 10 deletions(-)
mode change 100644 => 100755 init/module-setup.sh
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -78,7 +78,9 @@ kdump_cmdline_ip() {
[ "$_if" = "default" ] && _if=$(kdump_default_netdev)
- printf " %s" $(kdump_ifname_config "$_if")
+ local iface
+ kdump_ifname_config "$_if"
+ _if="$iface"
if [ "$_mode" = "auto" ] ; then
if [ -n $(kdump_ip_config "$_if") ] ; then
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -198,16 +198,19 @@ function kdump_list_slaves() # {
# 1) iface device name
# Output:
# corresponding bridge= initrd parameter and dependencies
+# Output variables:
+# iface device name in initrd
function kdump_bridge_config() # {{{
{
- local iface="$1"
+ local bridge="$1"
local if slaves
- for if in $(kdump_list_slaves "$iface")
+ for if in $(kdump_list_slaves "$bridge")
do
kdump_ifname_config "$if" || continue
- slaves="$slaves $if"
+ slaves="$slaves $iface"
done
+ iface="$bridge"
[ -n "$slaves" ] || return 1
slaves="${slaves# }"
@@ -233,14 +236,20 @@ function kdump_link2vlan()
# 1) iface device name
# Output:
# corresponding vlan= initrd parameter and dependencies
+# Output variables:
+# iface device name in initrd
+#
+# Because of dracut limitations for vlan interface naming, the initrd
+# interface name may be different from the original name.
function kdump_vlan_config() # {{{
{
- local iface="$1"
- local vid=$(ip -d link show "$iface" | kdump_link2vlan)
- local slaves=$(kdump_list_slaves "$iface")
- local if="${slaves# }"
+ local if="$1"
+ local vid=$(ip -d link show "$if" | kdump_link2vlan)
+ local slaves=$(kdump_list_slaves "$if")
+ if="${slaves# }"
kdump_ifname_config "$if"
- echo -n " vlan=$if.$vid:$if"
+ iface="$if.$vid"
+ echo -n " vlan=$iface:$if"
} # }}}
# Get the ifname parameter for a given device
@@ -249,9 +258,11 @@ function kdump_vlan_config() # {
# 1) device device name
# Output:
# ifname corresponding ifname= initrd parameter (or empty)
+# Output variables:
+# iface device name in initrd
function kdump_ifname_config() # {{{
{
- local iface="$1"
+ iface="$1"
local ifkind=$(kdump_ifkind "$iface")
if [ -z "$ifkind" ]