]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
Fix bonding and actually enable ETHTOOL_OPTS
authorMariusz Mazur <mmazur@axeos.com>
Thu, 22 Jan 2015 15:39:12 +0000 (16:39 +0100)
committerMariusz Mazur <mmazur@axeos.com>
Thu, 22 Jan 2015 15:49:40 +0000 (16:49 +0100)
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
lib/ifup

index 55af267d3d21c5d22ce5755fabc3977c230282fa..73df49060c9d023dd6f36bea0be1db6e2280f57f 100755 (executable)
@@ -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
index b0c67564cbecd12c652ce1ef0a2326cc5e03f0b4..c53444235e1b2f49ee6c3cbdc073e686e48afa35 100755 (executable)
--- 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
This page took 0.108821 seconds and 4 git commands to generate.