From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-536825-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id A02A11381F3
	for <garchives@archives.gentoo.org>; Thu, 20 Dec 2012 21:29:16 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 4E24721C0B1;
	Thu, 20 Dec 2012 21:28:59 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 8271321C0B1
	for <gentoo-commits@lists.gentoo.org>; Thu, 20 Dec 2012 21:28:58 +0000 (UTC)
Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 9103B33D8BA
	for <gentoo-commits@lists.gentoo.org>; Thu, 20 Dec 2012 21:28:57 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id EB1FCE543C
	for <gentoo-commits@lists.gentoo.org>; Thu, 20 Dec 2012 21:28:55 +0000 (UTC)
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" <robbat2@gentoo.org>
Message-ID: <1356038903.e0bbe8d0bde82b14aa9a867707298c2040442151.robbat2@OpenRC>
Subject: [gentoo-commits] proj/openrc:master commit in: net/
X-VCS-Repository: proj/openrc
X-VCS-Files: net/bonding.sh
X-VCS-Directories: net/
X-VCS-Committer: robbat2
X-VCS-Committer-Name: Robin H. Johnson
X-VCS-Revision: e0bbe8d0bde82b14aa9a867707298c2040442151
X-VCS-Branch: master
Date: Thu, 20 Dec 2012 21:28:55 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: df0a4d40-c957-421a-b31c-04c0ac3603ed
X-Archives-Hash: 3cfff9ca02a724402671c2c32ca0f240

commit:     e0bbe8d0bde82b14aa9a867707298c2040442151
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 20 21:28:23 2012 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Thu Dec 20 21:28:23 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=e0bbe8d0

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 <AT> gentoo.org>

---
 net/bonding.sh |   24 ++++++++----------------
 1 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/net/bonding.sh b/net/bonding.sh
index c3e532a..fb00825 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}" || \