diff options
author | David Kaspar [Dee'Kej] <dkaspar@redhat.com> | 2017-07-21 12:13:00 +0200 |
---|---|---|
committer | Dee'Kej <deekej@linuxmail.org> | 2017-08-07 13:23:56 +0200 |
commit | 73304ce69feed9ee801c8c93bc6dc42aa2b6c1a3 (patch) | |
tree | f0938ebe70d178927a876bf82c1df90ea940fb96 /sysconfig/network-scripts/ifup-eth | |
parent | c54ab62d189a88e677aa0520df07da87363a8a61 (diff) | |
download | initscripts-73304ce69feed9ee801c8c93bc6dc42aa2b6c1a3.tar initscripts-73304ce69feed9ee801c8c93bc6dc42aa2b6c1a3.tar.gz initscripts-73304ce69feed9ee801c8c93bc6dc42aa2b6c1a3.tar.bz2 initscripts-73304ce69feed9ee801c8c93bc6dc42aa2b6c1a3.tar.xz initscripts-73304ce69feed9ee801c8c93bc6dc42aa2b6c1a3.zip |
ifup-eth: wait for STP to complete setup on bridge if $DELAY is not set
Otherwise obtaining IP from DHCP might fail. Based on patch from:
* Rich Alloway <richard.alloway@roguewave.com> | CentOS BZ #0011138
Diffstat (limited to 'sysconfig/network-scripts/ifup-eth')
-rwxr-xr-x | sysconfig/network-scripts/ifup-eth | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index 68171e16..bbdb0d0b 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -51,13 +51,16 @@ if [ "${TYPE}" = "Bridge" ]; then net_log $"Bridge support not available: brctl not found" exit 1 fi + if [ ! -d /sys/class/net/${DEVICE}/bridge ]; then /usr/sbin/brctl addbr -- ${DEVICE} || exit 1 fi + [ -n "${DELAY}" ] && /usr/sbin/brctl setfd -- ${DEVICE} ${DELAY} [ -n "${STP}" ] && /usr/sbin/brctl stp -- ${DEVICE} ${STP} [ -n "${PRIO}" ] && /usr/sbin/brctl setbridgeprio ${DEVICE} ${PRIO} [ -n "${AGEING}" ] && /usr/sbin/brctl setageing ${DEVICE} ${AGEING} + # add the bits to setup driver parameters here for arg in $BRIDGING_OPTS ; do key=${arg%%=*}; @@ -66,14 +69,28 @@ if [ "${TYPE}" = "Bridge" ]; then echo $value > /sys/class/net/${DEVICE}/bridge/$key fi done + # set LINKDELAY (used as timeout when calling check_link_down()) # to at least (${DELAY} * 2) + 7 if STP is enabled. This is the # minimum time required for /sys/class/net/$REALDEVICE/carrier to # become 1 after "ip link set dev $DEVICE up" is called. - if [ "${STP}" = "yes" -o "${STP}" = "on" ]; then - TMPD=7 - [ -n "${DELAY}" ] && TMPD=$(expr ${DELAY} \* 2 + ${TMPD}) - [ 0$LINKDELAY -lt $TMPD ] && LINKDELAY=$TMPD + if is_true "${STP}"; then + if [ -n "${DELAY}" ]; then + forward_delay="${DELAY}" + else + # If the ${DELAY} value is not set by the user, then we need to obtain + # the forward_delay value from kernel first, and convert it to seconds. + # Otherwise STP might not correctly complete the startup before trying + # to obtain an IP address from DHCP. + forward_delay="$(cat /sys/devices/virtual/net/${DEVICE}/bridge/forward_delay)" + forward_delay="$(convert2sec ${forward_delay} centi)" + fi + + forward_delay=$(expr ${forward_delay} \* 2 + 7) + + [ 0$LINKDELAY -lt $forward_delay ] && LINKDELAY=$forward_delay + + unset forward_delay fi fi |