]> TLD Linux GIT Repositories - rc-scripts.git/blobdiff - lib/ifup
- use ip command for configuring bond interfaces
[rc-scripts.git] / lib / ifup
index 5d6fc21ed944b02ddf6ead4236f70edb79252527..b8536af55959af9953e55f6662a8e0e9fff06881 100755 (executable)
--- a/lib/ifup
+++ b/lib/ifup
@@ -125,11 +125,13 @@ if [ -n "$ETHTOOL_OPTS" ] ; then
 fi
 
 if is_yes "$SLAVE" && [ -n "$MASTER" ] ; then
-       if ! grep -wq "${DEVICE}" /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null; then
-               nls "Enslaving %s to %s" "$DEVICE" "$MASTER"
-               ip link set dev ${DEVICE} down
-               echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
-       fi
+       # create master if it doesn't exist yet
+       [ ! -d "/sys/class/net/${MASTER}" ] && ip link add "${MASTER}" type bond
+
+       nls "Enslaving %s to %s" "${DEVICE}" "${MASTER}"
+       ip link set "${DEVICE}" master "${MASTER}"
+       ip link set "${DEVICE}" up
+
        exit 0
 fi