ensure bonding interface is down before we attempt to configure, also

mode has to be configure before any other arguements are passed. Thanks
Ed Wildgoose <gentoo@wildgooses.com> for patch.
This commit is contained in:
Jory A. Pratt 2010-10-31 16:40:54 -05:00
parent 09bed967bf
commit 68c021c424

View File

@ -46,12 +46,27 @@ bonding_pre_start()
return 1 return 1
fi fi
# Configure the bond. # Interface must be down in order to configure
# Nice and dynamic :) _down
# Configure the bond mode, then we can reloop to ensure we configure
# All other options
for x in /sys/class/net/"${IFACE}"/bonding/mode; do
[ -f "${x}" ] || continue
n=${x##*/}
eval s=\$${n}_${IFVAR}
if [ -n "${s}" ]; then
einfo "Setting ${n}: ${s}"
echo "${s}" >"${x}" || \
eerror "Failed to configure $n (${n}_${IFVAR})"
fi
done
# Nice and dynamic for remaining options:)
for x in /sys/class/net/"${IFACE}"/bonding/*; do for x in /sys/class/net/"${IFACE}"/bonding/*; do
[ -f "${x}" ] || continue [ -f "${x}" ] || continue
n=${x##*/} n=${x##*/}
eval s=\$${n}_${IFVAR} eval s=\$${n}_${IFVAR}
[ "${n}" != "mode" ] || continue
if [ -n "${s}" ]; then if [ -n "${s}" ]; then
einfo "Setting ${n}: ${s}" einfo "Setting ${n}: ${s}"
echo "${s}" >"${x}" || \ echo "${s}" >"${x}" || \