net/bonding: ensure mode & miimon are handled correctly.
miimon & mode must be set before other parameters, and then not changed
again. Prior commit f671e0a28
per bug #421757 introduced a small logic
error. Fixed & refactored to prevent it happening as easily.
X-Gentoo-Bug: 447790
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=447790
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
parent
b44f96ac9b
commit
e0bbe8d0bd
@ -62,22 +62,13 @@ bonding_pre_start()
|
|||||||
# Interface must be down in order to configure
|
# Interface must be down in order to configure
|
||||||
_down
|
_down
|
||||||
|
|
||||||
# Configure the bond mode, then we can reloop to ensure we configure
|
# Configure the bond mode & link monitoring, then we can reloop to ensure
|
||||||
# All other options
|
# we configure all other options
|
||||||
[ -d /sys/class/net ] && for x in /sys/class/net/"${IFACE}"/bonding/mode; do
|
# mode needs to be done before all other options.
|
||||||
|
# miimon needs to be done BEFORE downdelay
|
||||||
|
[ -d /sys/class/net ] && for n in mode miimon; do
|
||||||
|
x=/sys/class/net/"${IFACE}"/bonding/$n
|
||||||
[ -f "${x}" ] || continue
|
[ -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
|
|
||||||
# Configure link monitoring
|
|
||||||
for x in /sys/class/net/"${IFACE}"/bonding/miimon; do
|
|
||||||
[ -f "${x}" ] || continue
|
|
||||||
n=${x##*/}
|
|
||||||
eval s=\$${n}_${IFVAR}
|
eval s=\$${n}_${IFVAR}
|
||||||
if [ -n "${s}" ]; then
|
if [ -n "${s}" ]; then
|
||||||
einfo "Setting ${n}: ${s}"
|
einfo "Setting ${n}: ${s}"
|
||||||
@ -90,7 +81,8 @@ bonding_pre_start()
|
|||||||
[ -f "${x}" ] || continue
|
[ -f "${x}" ] || continue
|
||||||
n=${x##*/}
|
n=${x##*/}
|
||||||
eval s=\$${n}_${IFVAR}
|
eval s=\$${n}_${IFVAR}
|
||||||
[ "${n}" != "mode" -o "${n}" != "miimon" ] || continue
|
# skip mode and miimon
|
||||||
|
[ "${n}" == "mode" -o "${n}" == "miimon" ] && continue
|
||||||
if [ -n "${s}" ]; then
|
if [ -n "${s}" ]; then
|
||||||
einfo "Setting ${n}: ${s}"
|
einfo "Setting ${n}: ${s}"
|
||||||
echo "${s}" >"${x}" || \
|
echo "${s}" >"${x}" || \
|
||||||
|
Loading…
Reference in New Issue
Block a user