diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2012-12-20 21:28:23 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2012-12-20 21:28:23 +0000 |
commit | e0bbe8d0bde82b14aa9a867707298c2040442151 (patch) | |
tree | 06dfbb314a3ef81e3e332e9a908d197af51f0d4f /net | |
parent | b44f96ac9bb6427c41480cc6ef2beb1818ca4f93 (diff) |
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/bonding.sh | 24 |
1 files changed, 8 insertions, 16 deletions
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}" || \ |