Bug#456952: please support bonding options

2007-12-20 Thread Guus Sliepen
On Wed, Dec 19, 2007 at 09:38:46AM +0100, Guido Guenther wrote:

  Ah, that would be nice! However your email did not contain the patch.
  Perhaps you forgot to attach it?
 It's attached now.

Applied it with only minor changes: more quoting around environment
variables, and changed grep to \\$IFACE\\, so it really matches
complete words. Thanks!

-- 
Met vriendelijke groet / with kind regards,
  Guus Sliepen [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Bug#456952: please support bonding options

2007-12-20 Thread Guido Guenther
Hi Guus,
On Thu, Dec 20, 2007 at 02:48:17PM +0100, Guus Sliepen wrote:
 Applied it with only minor changes: more quoting around environment
 variables, and changed grep to \\$IFACE\\, so it really matches
Yes, this looks much better. Thanks for fixing this up.
 -- Guido


signature.asc
Description: Digital signature


Bug#456952: please support bonding options

2007-12-19 Thread Guido Guenther
On Tue, Dec 18, 2007 at 09:09:18PM +0100, Guus Sliepen wrote:
 On Tue, Dec 18, 2007 at 06:53:20PM +0100, Guido Guenther wrote:
 
  since bonding can be configured via sysfs it's very convenient to
  set the bonding options in /etc/network/interfaces instead of at module
  load time. This is especially handy when you have multiple bonding
  interfaces. This patch adds support for the bond, miimon and primary
  options. More can easily be added, just let me know. I've prefixed all
  the options with bond_ to avoid namespace clashes.
  Please apply,
 
 Ah, that would be nice! However your email did not contain the patch.
 Perhaps you forgot to attach it?
It's attached now.
 -- Guido
commit ce009a7cfc4b67a3a13381d27557297dc5ae43fd
Author: Guido Guenther [EMAIL PROTECTED]
Date:   Wed Dec 19 09:36:31 2007 +0100

support bonding options via /etc/network/interfaces

diff --git a/debian/README.debian b/debian/README.debian
index 1492fd5..7f639a0 100644
--- a/debian/README.debian
+++ b/debian/README.debian
@@ -18,6 +18,15 @@ iface bond0 inet static
 
 The slaves option can take a list of network interfaces, the keyword none
 (with obvious results) and the keyword all (which selects all interfaces with
-eth in their name).
+eth in their name). Additionally you can set bonding options by adding them
+to the interface section:
+
+	bond_modeactive-backup
+	bond_primary eth0
+
+This would run the bonding device in active backup mode with eth0 as primary.
+Supported options are bond_mode, bond_miimon, bond_primary, bond_updelay,
+bond_downdelay, bond_arp_ip_target, bond_arp_interval, bond_xmit_hash_policy
+and bond_lacp_rate.
 
 Guus Sliepen [EMAIL PROTECTED], Fri, 30 Sep 2005 14:33:06 +0200
diff --git a/debian/pre-up b/debian/pre-up
index 854010a..44783b4 100644
--- a/debian/pre-up
+++ b/debian/pre-up
@@ -2,11 +2,25 @@
 
 IFENSLAVE=/sbin/ifenslave
 IFSTATE=/etc/network/run/ifstate
+BOND_PARAMS=/sys/class/net/$IFACE/bonding/
 
 if [ ! -x $IFENSLAVE ] ; then
 	exit 0
 fi
 
+
+add_master()
+{
+if [ ! -r /sys/class/net/bonding_masters ]; then
+modprobe bonding /dev/null 21 || true
+fi
+
+if ! grep -sq $IFACE[[:space:]] /sys/class/net/bonding_masters; then
+echo +$IFACE  /sys/class/net/bonding_masters
+fi
+}
+
+
 case $IF_SLAVES in
 	)
 		exit 0
@@ -22,7 +36,34 @@ case $IF_SLAVES in
 		;;
 esac
 
+
 if [ -n $INTERFACES ] ; then
+		add_master
+
+		if [ $IF_BOND_MODE ]; then
+			echo $IF_BOND_MODE  $BOND_PARAMS/mode
+	fi
+		if [ $IF_BOND_MIIMON ]; then
+			echo $IF_BOND_MIIMON  $BOND_PARAMS/miimon
+	fi
+		if [ $IF_BOND_UPDELAY ]; then
+			echo $IF_BOND_UPDELAY  $BOND_PARAMS/updelay
+	fi
+		if [ $IF_BOND_DOWNDELAY ]; then
+			echo $IF_BOND_DOWNDELAY  $BOND_PARAMS/downdelay
+	fi
+		if [ $IF_BOND_ARP_IP_TARGET ]; then
+			echo $IF_BOND_ARP_IP_TARGET  $BOND_PARAMS/arp_ip_target
+	fi
+		if [ $IF_BOND_ARP_INTERVAL ]; then
+			echo $IF_BOND_ARP_INTERVAL  $BOND_PARAMS/arp_interval
+	fi
+		if [ $IF_BOND_XMIT_HASH_POLICY ]; then
+			echo $IF_BOND_XMIT_HASH_POLICY  $BOND_PARAMS/xmit_hash_policy
+	fi
+		if [ $IF_BOND_LACP_RATE ]; then
+			echo $IF_BOND_LACP_RATE  $BOND_PARAMS/lacp_rate
+	fi
 		ifconfig $IFACE up
 		for slave in $INTERFACES ; do
 if grep -q ^$slave= $IFSTATE ; then
@@ -32,4 +73,7 @@ if [ -n $INTERFACES ] ; then
 	$IFENSLAVE $IFACE $slave
 fi
 		done
+		if [ $IF_BOND_PRIMARY ]; then
+			echo $IF_BOND_PRIMARY  $BOND_PARAMS/primary
+	fi
 fi


Bug#456952: please support bonding options

2007-12-18 Thread Guido Guenther
Package: ifenslave-2.6
Severity: wishlist

Hi,
since bonding can be configured via sysfs it's very convenient to
set the bonding options in /etc/network/interfaces instead of at module
load time. This is especially handy when you have multiple bonding
interfaces. This patch adds support for the bond, miimon and primary
options. More can easily be added, just let me know. I've prefixed all
the options with bond_ to avoid namespace clashes.
Please apply,
 -- Guido



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#456952: please support bonding options

2007-12-18 Thread Guus Sliepen
On Tue, Dec 18, 2007 at 06:53:20PM +0100, Guido Guenther wrote:

 since bonding can be configured via sysfs it's very convenient to
 set the bonding options in /etc/network/interfaces instead of at module
 load time. This is especially handy when you have multiple bonding
 interfaces. This patch adds support for the bond, miimon and primary
 options. More can easily be added, just let me know. I've prefixed all
 the options with bond_ to avoid namespace clashes.
 Please apply,

Ah, that would be nice! However your email did not contain the patch.
Perhaps you forgot to attach it?

-- 
Met vriendelijke groet / with kind regards,
  Guus Sliepen [EMAIL PROTECTED]


signature.asc
Description: Digital signature