File kdump-net-0006-handle-bond.patch of Package kdump

From: Petr Tesarik <ptesarik@suse.com>
Date: Wed, 31 Aug 2016 17:17:34 +0200
Subject: Handle bonding interfaces in initrd
References: bsc#980328
Patch-mainline: v0.8.16
Git-commit: b0924f3d62f1e98e720e051519e1d33800e64476

When a bond interface is found, add appropriate options to the
command line.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 init/setup-kdump.functions |   41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -218,6 +218,44 @@ function kdump_bridge_config()						   #
 }									   # }}}
 
 #
+# Get the bond configuration options
+#
+# Parameters:
+#   1) iface  device name
+# Output:
+#   corresponding bond= initrd parameter and dependencies
+# Output variables:
+#   iface  device name in initrd
+function kdump_bond_config()						   # {{{
+{
+    local bond="$1"
+    local if slaves
+
+    for if in $(kdump_list_slaves "$bond")
+    do
+	kdump_ifname_config "$if" || continue
+	slaves="$slaves $iface"
+    done
+    iface="$bond"
+    [ -n "$slaves" ] || return 1
+
+    slaves="${slaves# }"
+    local ro_keys=(
+	ad_actor_key
+	ad_aggregator
+	ad_num_ports
+	ad_partner_key
+	ad_partner_mac
+    )
+    local ro_sed="s/,\(${ro_keys[@]}\)=[^,]*//g"
+    ro_sed="${ro_sed// /\|}"
+
+    local opts=$(ip -d link show "$bond" | \
+	sed -n '3{s/^ *bond//;s/ \([^ ]*\) \([^ ]*\)/,\1=\2/g;'"$ro_sed"';p}')
+    echo -n " bond=$iface:${slaves// /,}:${opts#,}"
+}									   # }}}
+
+#
 # Extract the VLAN tag ID from ip link output
 #
 # Input:
@@ -281,6 +319,9 @@ function kdump_ifname_config()						   #
 	    bridge)
 		kdump_bridge_config "$iface"
 		;;
+	    bond)
+		kdump_bond_config "$iface"
+		;;
 	    vlan)
 		kdump_vlan_config "$iface"
 		;;
openSUSE Build Service is sponsored by