Allow configuration of bond via extra sysfs entries, #105.

This commit is contained in:
Roy Marples 2008-09-19 09:32:24 +00:00
parent 2de401bca1
commit 600d1f62fb
2 changed files with 16 additions and 1 deletions

View File

@ -576,6 +576,11 @@
#slaves_bond0="eth0 eth1 eth2" #slaves_bond0="eth0 eth1 eth2"
#config_bond0="null" # You may not want to assign an IP the the bond #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 # If any of the slaves require extra configuration - for example wireless or
# ppp devices - we need to depend function on the bonded interfaces # ppp devices - we need to depend function on the bonded interfaces
#rc_need_bond0="net.eth0 net.eth1" #rc_need_bond0="net.eth0 net.eth1"

View File

@ -15,7 +15,7 @@ _is_bond()
bonding_pre_start() bonding_pre_start()
{ {
local s= slaves="$(_get_array "slaves_${IFVAR}")" local x= s= slaves="$(_get_array "slaves_${IFVAR}")"
[ -z "${slaves}" ] && return 0 [ -z "${slaves}" ] && return 0
@ -39,6 +39,16 @@ bonding_pre_start()
return 1 return 1
fi 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}" ebegin "Adding slaves to ${IFACE}"
eindent eindent
einfo "${slaves}" einfo "${slaves}"