summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick McLean <patrickm@gaikai.com>2014-12-10 13:58:26 -0800
committerPatrick McLean <patrickm@gaikai.com>2014-12-10 14:20:41 -0800
commita93c80793276a026eef5be351cf33377945d8518 (patch)
treec4db8de3cb445efaa0f9433775077c15b005b4e0
parentFix https://bugs.gentoo.org/show_bug.cgi?id=500942 (diff)
downloadnetifrc-a93c80793276a026eef5be351cf33377945d8518.tar.gz
netifrc-a93c80793276a026eef5be351cf33377945d8518.tar.bz2
netifrc-a93c80793276a026eef5be351cf33377945d8518.zip
bonding: use iproute2 rather than ifconfig if it is installed
Currently the bonding contains 2 calls to ifconfig for a couple of operations, this makes it use iproute2 instead if it is installed.
-rw-r--r--net/bonding.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/net/bonding.sh b/net/bonding.sh
index fb00825..ba75239 100644
--- a/net/bonding.sh
+++ b/net/bonding.sh
@@ -4,7 +4,7 @@
bonding_depend()
{
before interface macchanger
- program /sbin/ifconfig /bin/ifconfig
+ program ip /sbin/ifconfig /bin/ifconfig
# If you do not have sysfs, you MUST have this binary instead for ioctl
# Also you will loose some functionality that cannot be done via sysfs:
if [ ! -d /sys/class/net ]; then
@@ -124,7 +124,12 @@ bonding_pre_start()
unset oiface
eoutdent
# subsume (presumably kernel auto-)configured IP
- ifconfig ${IFACE} ${addr} up
+ if [ -x "$(command -v ip)" ]; then
+ ip link set ${IFACE} up
+ ip address add ${addr} dev ${IFACE}
+ else
+ ifconfig ${IFACE} ${addr} up
+ fi
else
# warn if root on nfs and no subsume interface supplied
local root_fs_type=$(mountinfo -s /)
@@ -179,7 +184,11 @@ bonding_stop()
# Wipe subsumed interface
if [ -n "${subsume}" ]; then
- ifconfig ${subsume} 0.0.0.0
+ if [ -x "$(command -v ip)" ]; then
+ ip address flush dev ${subsume}
+ else
+ ifconfig ${subsume} 0.0.0.0
+ fi
fi
local slaves= s=