summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-09-19 09:32:24 +0000
committerRoy Marples <roy@marples.name>2008-09-19 09:32:24 +0000
commit600d1f62fbda7e66e6ba988cd6ecdd97c076e521 (patch)
tree9608fb396a167903f460475cd1d5d5a781c0c628
parent2de401bca120f445d803f996e883d2e4da5d379d (diff)
downloadopenrc-600d1f62fbda7e66e6ba988cd6ecdd97c076e521.tar.gz
openrc-600d1f62fbda7e66e6ba988cd6ecdd97c076e521.tar.bz2
openrc-600d1f62fbda7e66e6ba988cd6ecdd97c076e521.tar.xz
Allow configuration of bond via extra sysfs entries, #105.
-rw-r--r--doc/net.example.Linux.in5
-rw-r--r--net/bonding.sh12
2 files changed, 16 insertions, 1 deletions
diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index 701e1b1..a70b3cc 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -576,6 +576,11 @@
#slaves_bond0="eth0 eth1 eth2"
#config_bond0="null" # You may not want to assign an IP the the bond
+# You can also configure the bond here, which must be done via sysfs on 2.6
+# kernels or newer. See the kernel bonding documention for a description of
+# these options.
+#arp_ip_target_bond0="+26.0.0.0"
+
# If any of the slaves require extra configuration - for example wireless or
# ppp devices - we need to depend function on the bonded interfaces
#rc_need_bond0="net.eth0 net.eth1"
diff --git a/net/bonding.sh b/net/bonding.sh
index 99a8517..34a96e1 100644
--- a/net/bonding.sh
+++ b/net/bonding.sh
@@ -15,7 +15,7 @@ _is_bond()
bonding_pre_start()
{
- local s= slaves="$(_get_array "slaves_${IFVAR}")"
+ local x= s= slaves="$(_get_array "slaves_${IFVAR}")"
[ -z "${slaves}" ] && return 0
@@ -39,6 +39,16 @@ bonding_pre_start()
return 1
fi
+ # Configure the bond.
+ # Nice and dynamic :)
+ for x in /sys/class/net/"${IFACE}"/bonding/*; do
+ [ -f "${x}" ] || continue
+ eval s=\$${x##*/}_${IFVAR}
+ if [ -n "${s}" ]; then
+ echo "${s}" >"${x}"
+ fi
+ done
+
ebegin "Adding slaves to ${IFACE}"
eindent
einfo "${slaves}"