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