Fix bug #332181. Thanks Lutz Heermann.

This commit is contained in:
Anthony G. Basile 2010-08-13 17:32:31 -04:00
parent 14c95ae9a6
commit 6e3b3bfc53

View File

@ -15,7 +15,14 @@ _is_bond()
bonding_pre_start() bonding_pre_start()
{ {
local x= s= n= slaves="$(_get_array "slaves_${IFVAR}")" local x= s= n= slaves= primary=
slaves="$(_get_array "slaves_${IFVAR}")"
unset slaves_${IFVAR}
eval primary="\$primary_${IFVAR}"
unset primary_${IFVAR}
[ -z "${slaves}" ] && return 0 [ -z "${slaves}" ] && return 0
@ -46,6 +53,7 @@ bonding_pre_start()
n=${x##*/} n=${x##*/}
eval s=\$${n}_${IFVAR} eval s=\$${n}_${IFVAR}
if [ -n "${s}" ]; then if [ -n "${s}" ]; then
einfo "Setting ${n}: ${s}"
echo "${s}" >"${x}" || \ echo "${s}" >"${x}" || \
eerror "Failed to configure $n (${n}_${IFVAR})" eerror "Failed to configure $n (${n}_${IFVAR})"
fi fi
@ -74,6 +82,11 @@ bonding_pre_start()
# finally add in slaves # finally add in slaves
eoutdent eoutdent
if [ -d /sys/class/net ]; then if [ -d /sys/class/net ]; then
if [ -n "${primary}" ]; then
echo "+${primary}" >/sys/class/net/"${IFACE}"/bonding/slaves
echo "${primary}" >/sys/class/net/"${IFACE}"/bonding/primary
slaves="${slaves/${primary}/}"
fi
for s in ${slaves}; do for s in ${slaves}; do
echo "+${s}" >/sys/class/net/"${IFACE}"/bonding/slaves echo "+${s}" >/sys/class/net/"${IFACE}"/bonding/slaves
done done