712866
From 1472b5486b8f64a023ea33f9c1821279b153d04a Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Fri, 10 Jun 2016 14:34:13 +0200
712866
Subject: [PATCH] ifup: setup bridge, bonding and teaming only once
712866
712866
if those assembled interfaces use dhcp "$iface.up" is created too late
712866
---
712866
 modules.d/40network/ifup.sh | 14 ++++++++++----
712866
 1 file changed, 10 insertions(+), 4 deletions(-)
712866
712866
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
5c6c2a
index 30551987..f681336e 100755
712866
--- a/modules.d/40network/ifup.sh
712866
+++ b/modules.d/40network/ifup.sh
712866
@@ -204,9 +204,12 @@ fi
712866
 if [ -e /tmp/bond.${netif}.info ]; then
712866
     . /tmp/bond.${netif}.info
712866
 
712866
-    if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
712866
+    if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.setup ] ; then # We are master bond device
712866
         modprobe bonding
712866
-        echo "+$netif" >  /sys/class/net/bonding_masters
712866
+        udevadm settle
712866
+        if ! [ -e /sys/class/net/${netif} ]; then
712866
+            echo "+$netif" >  /sys/class/net/bonding_masters
712866
+        fi
712866
         ip link set $netif down
712866
 
712866
         # Stolen from ifup-eth
712866
@@ -244,12 +247,13 @@ if [ -e /tmp/bond.${netif}.info ]; then
712866
                 echo $value > /sys/class/net/${netif}/bonding/$key
712866
             fi
712866
         done
712866
+        > /tmp/net.$bondname.setup
712866
     fi
712866
 fi
712866
 
712866
 if [ -e /tmp/team.${netif}.info ]; then
712866
     . /tmp/team.${netif}.info
712866
-    if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.up ] ; then
712866
+    if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.setup ] ; then
712866
         # We shall only bring up those _can_ come up
712866
         # in case of some slave is gone in active-backup mode
712866
         working_slaves=""
712866
@@ -285,6 +289,7 @@ if [ -e /tmp/team.${netif}.info ]; then
712866
             teamdctl $teammaster port add $slave
712866
         done
712866
         ip link set dev $teammaster up
712866
+        > /tmp/net.$teammaster.setup
712866
     fi
712866
 fi
712866
 
712866
@@ -293,7 +298,7 @@ fi
712866
 if [ -e /tmp/bridge.info ]; then
712866
     . /tmp/bridge.info
712866
 # start bridge if necessary
712866
-    if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
712866
+    if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.setup ]; then
712866
         brctl addbr $bridgename
712866
         brctl setfd $bridgename 0
712866
         for ethname in $bridgeslaves ; do
712866
@@ -308,6 +313,7 @@ if [ -e /tmp/bridge.info ]; then
712866
             fi
712866
             brctl addif $bridgename $ethname
712866
         done
712866
+        > /tmp/net.$bridgename.setup
712866
     fi
712866
 fi
712866