aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-09-18 22:24:58 +0000
committerRoy Marples <roy@marples.name>2008-09-18 22:24:58 +0000
commit2de401bca120f445d803f996e883d2e4da5d379d (patch)
treebecda1c9b61a967b3a7e6bad04257b62f2bc683b
parente368a4b4f89648713a5ff587b4c2eef3f32df05b (diff)
Enable bonding via sysfs, #104 thanks to Wolfram Schlich
-rw-r--r--doc/net.example.Linux.in3
-rw-r--r--net/bonding.sh19
2 files changed, 17 insertions, 5 deletions
diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index 28a2fb98..701e1b16 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -569,7 +569,8 @@
#-----------------------------------------------------------------------------
# Bonding
-# For link bonding/trunking emerge net-misc/ifenslave
+# For link bonding/trunking on 2.4 kernels, or kernels without sysfs
+# emerge net-misc/ifenslave
# To bond interfaces together
#slaves_bond0="eth0 eth1 eth2"
diff --git a/net/bonding.sh b/net/bonding.sh
index 69de32aa..99a85170 100644
--- a/net/bonding.sh
+++ b/net/bonding.sh
@@ -4,7 +4,6 @@
bonding_depend()
{
before interface macchanger
- program /sbin/ifenslave
}
_config_vars="$_config_vars slaves"
@@ -53,7 +52,7 @@ bonding_pre_start()
# Must force the slaves to a particular state before adding them
for IFACE in ${slaves}; do
_delete_addresses
- _up
+ _down
done
)
@@ -62,7 +61,13 @@ bonding_pre_start()
# finally add in slaves
eoutdent
- /sbin/ifenslave "${IFACE}" ${slaves} >/dev/null
+ if [ -d /sys/class/net ]; then
+ for s in ${slaves}; do
+ echo "+${s}" >/sys/class/net/"${IFACE}"/bonding/slaves
+ done
+ else
+ /sbin/ifenslave "${IFACE}" ${slaves} >/dev/null
+ fi
eend $?
return 0 #important
@@ -84,7 +89,13 @@ bonding_stop()
eindent
einfo "${slaves}"
eoutdent
- /sbin/ifenslave -d "${IFACE}" ${slaves}
+ if [ -d /sys/class/net ]; then
+ for s in ${slaves}; do
+ echo -"${s}" > /sys/class/net/"${IFACE}"/bonding/slaves
+ done
+ else
+ /sbin/ifenslave -d "${IFACE}" ${slaves}
+ fi
# reset all slaves
(