[projects/rc-scripts] Fix bonding and actually enable ETHTOOL_OPTS
mmazur
mmazur at pld-linux.org
Thu Jan 22 16:57:21 CET 2015
commit 8eae0d9c80f5755f141cdb9622ae3673c81fe25f
Author: Mariusz Mazur <mmazur at axeos.com>
Date: Thu Jan 22 16:39:12 2015 +0100
Fix bonding and actually enable ETHTOOL_OPTS
1. Applying ETHTOOL_OPTS was inside a code block only run for bond
slaves. This is now fixed.
2. Dependency on 'ifenslave' for bonding device configuration was
dropped. Use iproute2 instead.
3. ifup/ifdown behavior for bondX and enslaved devices was fixed. Both
commands should be symmetrical: running 'ifdown SOMEIF; ifup SOMEIF'
should get SOMEIF as close to what its state was before ifdown as is
possible. This was very not the case.
lib/ifdown | 20 +++-----------------
lib/ifup | 31 ++++++++++++-------------------
2 files changed, 15 insertions(+), 36 deletions(-)
---
diff --git a/lib/ifdown b/lib/ifdown
index 55af267..73df490 100755
--- a/lib/ifdown
+++ b/lib/ifdown
@@ -119,23 +119,9 @@ if [ -n "${SUBDEVICE}" ]; then
else
LC_ALL=C ip addr flush dev ${DEVICE} 2>&1 | grep -v "Nothing to flush"
- if [ ${DEVICETYPE} = "bond" ]; then
- if [ ! -x /sbin/ifenslave ]; then
- nls "%s is missing. Can't continue." "/sbin/ifenslave"
- exit 1
- fi
-
- # get up the bonding device before enslaving
- if ! check_device_down "${DEVICE}"; then
- ip link set ${DEVICE} up
- fi
-
- for BSVAR in $(awk '/Slave Interface:/{ print $3}' /proc/net/bonding/${DEVICE}); do
- if [ "${BSVAR}" ]; then
- ifenslave -d ${DEVICE} $BSVAR
- fi
- done
- fi
+ if is_yes "$SLAVE"; then
+ ip link set ${DEVICE} nomaster
+ fi
ip link set ${DEVICE} down
fi
diff --git a/lib/ifup b/lib/ifup
index b0c6756..c534442 100755
--- a/lib/ifup
+++ b/lib/ifup
@@ -89,25 +89,6 @@ if ! /sbin/ip link set multicast ${MULTICAST} dev ${DEVICE} > /dev/null 2>&1; th
exit 1
fi
-if is_yes "$SLAVE" && [ ! -x /sbin/ifenslave ]; then
- nls "%s is missing. Can't continue." "/sbin/ifenslave"
- exit 1
-fi
-
-if is_yes "$SLAVE" && [ -n "$MASTER" -a -x /sbin/ifenslave ]; then
- RFLAG="" && is_yes "${RECIEVE-ONLY}" && RFLAG="-r"
-
- ip link set ${DEVICE} down
- nls "Enslaving %s to %s" "$DEVICE" "$MASTER"
- ifenslave $RFLAG "$MASTER" "$DEVICE"
-
- if [ -n "$ETHTOOL_OPTS" ] ; then
- /sbin/ethtool -s $DEVICE $ETHTOOL_OPTS
- fi
-
- exit 0
-fi
-
if [ -n "$MACADDR" ]; then
ip link set ${DEVICE} address ${MACADDR}
fi
@@ -134,6 +115,18 @@ if is_yes "${WLAN_WPA}"; then
check_link_down ${DEVICE} $(( $WLAN_WPA_WAIT_TIMEOUT * 2 ))
fi
+if [ -n "$ETHTOOL_OPTS" ] ; then
+ /sbin/ethtool -s $DEVICE $ETHTOOL_OPTS
+fi
+
+if is_yes "$SLAVE" && [ -n "$MASTER" ] ; then
+ nls "Enslaving %s to %s" "$DEVICE" "$MASTER"
+ ip link set "$DEVICE" master "$MASTER"
+ ip link set "$DEVICE" up
+
+ exit 0
+fi
+
if [ "$HANDLING" = "2" ]; then
exit 0
fi
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/8eae0d9c80f5755f141cdb9622ae3673c81fe25f
More information about the pld-cvs-commit
mailing list