]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
ifup: setup bridge, bonding and teaming only once
authorHarald Hoyer <harald@redhat.com>
Fri, 10 Jun 2016 12:34:13 +0000 (14:34 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 10 Jun 2016 14:24:24 +0000 (16:24 +0200)
if those assembled interfaces use dhcp "$iface.up" is created too late

modules.d/40network/ifup.sh

index 30551987345ae36b93c782adb000c1f91b32553c..f681336edfa3bf9197fcb14b2f54751cdcbc4da2 100755 (executable)
@@ -204,9 +204,12 @@ fi
 if [ -e /tmp/bond.${netif}.info ]; then
     . /tmp/bond.${netif}.info
 
-    if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
+    if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.setup ] ; then # We are master bond device
         modprobe bonding
-        echo "+$netif" >  /sys/class/net/bonding_masters
+        udevadm settle
+        if ! [ -e /sys/class/net/${netif} ]; then
+            echo "+$netif" >  /sys/class/net/bonding_masters
+        fi
         ip link set $netif down
 
         # Stolen from ifup-eth
@@ -244,12 +247,13 @@ if [ -e /tmp/bond.${netif}.info ]; then
                 echo $value > /sys/class/net/${netif}/bonding/$key
             fi
         done
+        > /tmp/net.$bondname.setup
     fi
 fi
 
 if [ -e /tmp/team.${netif}.info ]; then
     . /tmp/team.${netif}.info
-    if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.up ] ; then
+    if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.setup ] ; then
         # We shall only bring up those _can_ come up
         # in case of some slave is gone in active-backup mode
         working_slaves=""
@@ -285,6 +289,7 @@ if [ -e /tmp/team.${netif}.info ]; then
             teamdctl $teammaster port add $slave
         done
         ip link set dev $teammaster up
+        > /tmp/net.$teammaster.setup
     fi
 fi
 
@@ -293,7 +298,7 @@ fi
 if [ -e /tmp/bridge.info ]; then
     . /tmp/bridge.info
 # start bridge if necessary
-    if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
+    if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.setup ]; then
         brctl addbr $bridgename
         brctl setfd $bridgename 0
         for ethname in $bridgeslaves ; do
@@ -308,6 +313,7 @@ if [ -e /tmp/bridge.info ]; then
             fi
             brctl addif $bridgename $ethname
         done
+        > /tmp/net.$bridgename.setup
     fi
 fi