Blob Blame History Raw
From 2e094b20a6875fdb0a7ef8772e3d7688ad91c036 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 4 Apr 2014 12:52:39 +0200
Subject: [PATCH] ifcfg: only bind to HWADDR, if addr_assign_type == 0

/sys/class/net/$netif/addr_assign_type is != 0 for random MAC address
interfaces
---
 modules.d/40network/net-lib.sh   | 3 ---
 modules.d/45ifcfg/write-ifcfg.sh | 2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index 5d4ae32cbb..d53e1a6ea9 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -518,9 +518,6 @@ find_iface_with_link() {
 }
 
 is_persistent_ethernet_name() {
-    [ -f /sys/class/net/$netif/addr_assign_type ] || return 1
-    [ "$(cat /sys/class/net/$netif/addr_assign_type)" = "0" ] || return 1
-
     case "$1" in
         # udev persistent interface names
         eth[0-9]|eth[0-9][0-9]|eth[0-9][0-9][0-9]*)
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index 2631fbe2ee..5dc351d584 100755
--- a/modules.d/45ifcfg/write-ifcfg.sh
+++ b/modules.d/45ifcfg/write-ifcfg.sh
@@ -166,6 +166,8 @@ for netup in /tmp/net.*.did-setup ; do
             if ! print_s390 $netif; then
                 if [ -z "$macaddr" ] && \
                     ! is_persistent_ethernet_name "$netif" && \
+                    [ -f /sys/class/net/$netif/addr_assign_type ] && \
+                    [ "$(cat /sys/class/net/$netif/addr_assign_type)" = "0" ] && \
                     [ -f /sys/class/net/$netif/address ]; then
                     echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
                 fi
-- 
1.9.3