Blame SOURCES/0563-network-skip-already-enslaved-interfaces.patch

49e6a8
From e8a7c2a15215f73fff10358af7d9ecd0ab7b597f Mon Sep 17 00:00:00 2001
49e6a8
From: Harald Hoyer <harald@redhat.com>
49e6a8
Date: Tue, 21 Aug 2018 13:14:44 +0200
49e6a8
Subject: [PATCH] network: skip already enslaved interfaces
49e6a8
49e6a8
---
49e6a8
 modules.d/40network/ifup.sh    | 11 +++++++----
49e6a8
 modules.d/40network/net-lib.sh |  7 +++++++
49e6a8
 2 files changed, 14 insertions(+), 4 deletions(-)
49e6a8
49e6a8
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
49e6a8
index b3631648..181ab67c 100755
49e6a8
--- a/modules.d/40network/ifup.sh
49e6a8
+++ b/modules.d/40network/ifup.sh
49e6a8
@@ -377,10 +377,13 @@ for p in $(getargs ip=); do
49e6a8
     esac
49e6a8
 
49e6a8
     # If this option isn't directed at our interface, skip it
49e6a8
-    [ -n "$dev" ] && [ "$dev" != "$netif" ] && \
49e6a8
-    [ "$use_bridge" != 'true' ] && \
49e6a8
-    [ "$use_vlan" != 'true' ] && continue
49e6a8
-
49e6a8
+    if [ -n "$dev" ]; then
49e6a8
+        [ "$dev" != "$netif" ] && \
49e6a8
+        [ "$use_bridge" != 'true' ] && \
49e6a8
+        [ "$use_vlan" != 'true' ] && continue
49e6a8
+    else
49e6a8
+        iface_is_enslaved "$netif" && continue
49e6a8
+    fi
49e6a8
     # Store config for later use
49e6a8
     for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do
49e6a8
         eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
49e6a8
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
49e6a8
index 9e87aeab..35e6e833 100755
49e6a8
--- a/modules.d/40network/net-lib.sh
49e6a8
+++ b/modules.d/40network/net-lib.sh
49e6a8
@@ -731,6 +731,13 @@ iface_has_link() {
49e6a8
     iface_has_carrier "$@"
49e6a8
 }
49e6a8
 
49e6a8
+iface_is_enslaved() {
49e6a8
+    local _li
49e6a8
+    _li=$(ip -o link show dev $1)
49e6a8
+    strstr "$li" " master " || return 1
49e6a8
+    return 0
49e6a8
+}
49e6a8
+
49e6a8
 find_iface_with_link() {
49e6a8
     local iface_path="" iface=""
49e6a8
     for iface_path in /sys/class/net/*; do