commit: a93c80793276a026eef5be351cf33377945d8518
Author: Patrick McLean <patrickm <AT> gaikai <DOT> com>
AuthorDate: Wed Dec 10 21:58:26 2014 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Wed Dec 10 22:20:41 2014 +0000
URL:
http://sources.gentoo.org/gitweb/?p=proj/netifrc.git;a=commit;h=a93c8079
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.
---
net/bonding.sh | 15 ++++++++++++---
1 file 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=