a56a5e
From ea6bc75ccbb626c62062bdf2d3ca2a90dbb9467d Mon Sep 17 00:00:00 2001
966cef
From: Harald Hoyer <harald@redhat.com>
966cef
Date: Tue, 25 Feb 2014 13:05:11 +0100
966cef
Subject: [PATCH] ifcfg/write-ifcfg.sh: do not bind s390 to MAC if SUBCHANNELS
966cef
 set
966cef
966cef
If SUBCHANNELS are set, do not specify HWADDR, because the SUBCHANNELS
966cef
are the identifier for the interface.
966cef
966cef
https://bugzilla.redhat.com/show_bug.cgi?id=1056438
966cef
---
966cef
 modules.d/45ifcfg/write-ifcfg.sh | 13 ++++++-------
966cef
 1 file changed, 6 insertions(+), 7 deletions(-)
966cef
966cef
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
1755ca
index dcb2aefa..d9e9f3af 100755
966cef
--- a/modules.d/45ifcfg/write-ifcfg.sh
966cef
+++ b/modules.d/45ifcfg/write-ifcfg.sh
966cef
@@ -55,9 +55,9 @@ print_s390() {
966cef
 
966cef
     SUBCHANNELS=${SUBCHANNELS%,}
966cef
     echo "SUBCHANNELS=\"${SUBCHANNELS}\""
966cef
-    CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
966cef
 
966cef
-    [ $? -ne 0 -o -z "$CONFIG_LINE" ] && return
966cef
+    CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
966cef
+    [ $? -ne 0 -o -z "$CONFIG_LINE" ] && return 0
966cef
 
966cef
     OLD_IFS=$IFS
966cef
     IFS=","
966cef
@@ -77,6 +77,7 @@ print_s390() {
966cef
     OPTIONS=${OPTIONS## }
966cef
     echo "NETTYPE=\"${NETTYPE}\""
966cef
     echo "OPTIONS=\"${OPTIONS}\""
966cef
+    return 0
966cef
 }
966cef
 
966cef
 for netup in /tmp/net.*.did-setup ; do
966cef
@@ -159,12 +160,10 @@ for netup in /tmp/net.*.did-setup ; do
966cef
     if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
966cef
         # standard interface
966cef
         {
966cef
-            if [ -n "$macaddr" ]; then
966cef
-                echo "MACADDR=\"$macaddr\""
966cef
-            else
966cef
-                echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
966cef
+            [ -n "$macaddr" ] && echo "MACADDR=\"$macaddr\""
966cef
+            if ! print_s390 $netif; then
966cef
+                [ -n "$macaddr" ] || echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
966cef
             fi
966cef
-            print_s390 $netif
966cef
             echo "TYPE=Ethernet"
966cef
             echo "NAME=\"$netif\""
966cef
             [ -n "$mtu" ] && echo "MTU=\"$mtu\""