Harald Hoyer 02dec6
From f6e3b59e5ea6f52a25631557badc7f4dfabbd7ee Mon Sep 17 00:00:00 2001
Harald Hoyer 02dec6
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 02dec6
Date: Tue, 21 Aug 2018 13:14:44 +0200
Harald Hoyer 02dec6
Subject: [PATCH] network: skip already enslaved interfaces
Harald Hoyer 02dec6
Harald Hoyer 02dec6
---
Harald Hoyer 02dec6
 modules.d/35network-legacy/ifup.sh | 6 +++++-
Harald Hoyer 02dec6
 modules.d/40network/net-lib.sh     | 7 +++++++
Harald Hoyer 02dec6
 2 files changed, 12 insertions(+), 1 deletion(-)
Harald Hoyer 02dec6
Harald Hoyer 02dec6
diff --git a/modules.d/35network-legacy/ifup.sh b/modules.d/35network-legacy/ifup.sh
Harald Hoyer 02dec6
index ea2a67ff..b4f5bf10 100755
Harald Hoyer 02dec6
--- a/modules.d/35network-legacy/ifup.sh
Harald Hoyer 02dec6
+++ b/modules.d/35network-legacy/ifup.sh
Harald Hoyer 02dec6
@@ -408,7 +408,11 @@ for p in $(getargs ip=); do
Harald Hoyer 02dec6
     esac
Harald Hoyer 02dec6
 
Harald Hoyer 02dec6
     # If this option isn't directed at our interface, skip it
Harald Hoyer 02dec6
-    [ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
Harald Hoyer 02dec6
+    if [ -n "$dev" ]; then
Harald Hoyer 02dec6
+        [ "$dev" != "$netif" ] && continue
Harald Hoyer 02dec6
+    else
Harald Hoyer 02dec6
+        iface_is_enslaved "$netif" && continue
Harald Hoyer 02dec6
+    fi
Harald Hoyer 02dec6
 
Harald Hoyer 02dec6
     # Store config for later use
Harald Hoyer 02dec6
     for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do
Harald Hoyer 02dec6
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
Harald Hoyer 02dec6
index 1e7f1b33..964ed3ab 100755
Harald Hoyer 02dec6
--- a/modules.d/40network/net-lib.sh
Harald Hoyer 02dec6
+++ b/modules.d/40network/net-lib.sh
Harald Hoyer 02dec6
@@ -745,6 +745,13 @@ iface_has_link() {
Harald Hoyer 02dec6
     iface_has_carrier "$@"
Harald Hoyer 02dec6
 }
Harald Hoyer 02dec6
 
Harald Hoyer 02dec6
+iface_is_enslaved() {
Harald Hoyer 02dec6
+    local _li
Harald Hoyer 02dec6
+    _li=$(ip -o link show dev $1)
Harald Hoyer 02dec6
+    strstr "$li" " master " || return 1
Harald Hoyer 02dec6
+    return 0
Harald Hoyer 02dec6
+}
Harald Hoyer 02dec6
+
Harald Hoyer 02dec6
 find_iface_with_link() {
Harald Hoyer 02dec6
     local iface_path="" iface=""
Harald Hoyer 02dec6
     for iface_path in /sys/class/net/*; do
Harald Hoyer 02dec6