aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Kaspar [Dee'Kej] <dkaspar@redhat.com>2017-07-21 12:13:00 +0200
committerDee'Kej <deekej@linuxmail.org>2017-10-31 12:36:19 +0100
commit75bf420df0f31cc79d1603c2b5a184ccdb151813 (patch)
tree69539d065d344e02aa6d9cd68147670e1a6d98b4
parent3e3ff2ac3d89cd626d88b3043c7f7234dec4d4e1 (diff)
downloadinitscripts-75bf420df0f31cc79d1603c2b5a184ccdb151813.tar
initscripts-75bf420df0f31cc79d1603c2b5a184ccdb151813.tar.gz
initscripts-75bf420df0f31cc79d1603c2b5a184ccdb151813.tar.bz2
initscripts-75bf420df0f31cc79d1603c2b5a184ccdb151813.tar.xz
initscripts-75bf420df0f31cc79d1603c2b5a184ccdb151813.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
-rwxr-xr-xsysconfig/network-scripts/ifup-eth25
1 files changed, 21 insertions, 4 deletions
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth
index a4efc389..47d15ec1 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