File kdump-net-0005-use-permanent-hwaddr.patch of Package kdump

From: Petr Tesarik <ptesarik@suse.com>
Date: Wed, 31 Aug 2016 06:15:57 +0200
Subject: Use the permanent hardware address for physical interfaces
References: bsc#980328
Patch-mainline: v0.8.16
Git-commit: d2c7707a1ab4866e35a6fbbe7a228853c17a340e

The MAC address of a network interface may change (e.g. when the
interface is enslaved in a bond), but its permanent address is
restored after kexec (in kdump environment).

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

--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -267,7 +267,14 @@ function kdump_ifname_config()						   #
 
     if [ -z "$ifkind" ]
     then
-	local hwaddr=$(<"/sys/class/net/$iface/address")
+	local hwaddr
+	local addrtype=$(<"/sys/class/net/$iface/addr_assign_type")
+	if [ "$addrtype" -eq 0 ]
+	then
+	    hwaddr=$(<"/sys/class/net/$iface/address")
+	else
+	    hwaddr=$(ethtool -P "$iface" | sed 's/^[^:]*: *//')
+	fi
 	[ -n "$hwaddr" ] && echo -n " ifname=$iface:$hwaddr"
     else
 	case "$ifkind" in
openSUSE Build Service is sponsored by