From e0bbe8d0bde82b14aa9a867707298c2040442151 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Thu, 20 Dec 2012 21:28:23 +0000 Subject: 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 --- net/bonding.sh | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'net/bonding.sh') diff --git a/net/bonding.sh b/net/bonding.sh index c3e532a2..fb008256 100644 --- a/net/bonding.sh +++ b/net/bonding.sh @@ -62,22 +62,13 @@ bonding_pre_start() # Interface must be down in order to configure _down - # Configure the bond mode, then we can reloop to ensure we configure - # All other options - [ -d /sys/class/net ] && for x in /sys/class/net/"${IFACE}"/bonding/mode; do + # Configure the bond mode & link monitoring, then we can reloop to ensure + # we configure all other options + # 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 - 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} if [ -n "${s}" ]; then einfo "Setting ${n}: ${s}" @@ -90,7 +81,8 @@ bonding_pre_start() [ -f "${x}" ] || continue n=${x##*/} eval s=\$${n}_${IFVAR} - [ "${n}" != "mode" -o "${n}" != "miimon" ] || continue + # skip mode and miimon + [ "${n}" == "mode" -o "${n}" == "miimon" ] && continue if [ -n "${s}" ]; then einfo "Setting ${n}: ${s}" echo "${s}" >"${x}" || \ -- cgit v1.2.3