summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2015-01-06 18:50:06 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2015-01-12 15:43:55 +0100
commitd2cf9ae99834de3b8338008cae6273b967c353cd (patch)
tree3e0eaa69b496e50149254c61a29411d9e7831a78
parent9a1ca23b6089eff590056fca12ea8ca07c80014a (diff)
downloadnetctl-d2cf9ae99834de3b8338008cae6273b967c353cd.tar.gz
netctl-d2cf9ae99834de3b8338008cae6273b967c353cd.tar.xz
Add policy support to bonding connections
-rw-r--r--docs/examples/bonding1
-rw-r--r--docs/netctl.profile.5.txt8
-rw-r--r--src/lib/connections/bond5
3 files changed, 9 insertions, 5 deletions
diff --git a/docs/examples/bonding b/docs/examples/bonding
index 3ad5de2..e428aee 100644
--- a/docs/examples/bonding
+++ b/docs/examples/bonding
@@ -4,3 +4,4 @@ Connection=bond
BindsToInterfaces=(eth0 eth2)
IP=static
Address="10.0.0.1/8"
+#Mode=balance-rr
diff --git a/docs/netctl.profile.5.txt b/docs/netctl.profile.5.txt
index 9956c24..c4982fc 100644
--- a/docs/netctl.profile.5.txt
+++ b/docs/netctl.profile.5.txt
@@ -303,8 +303,12 @@ of the `wireless' type:
OPTIONS FOR `bond' CONNECTIONS
------------------------------
The interfaces of 'BindsToInterfaces' are bound together in the
-interface named by 'Interface'. All *ip options* are understood for
-connections of the `bond' type.
+interface named by 'Interface'. Next to the *ip options*, the following
+is understood for connections of the `bond' type:
+
+'Mode='::
+ The bonding policy. See the kernel documentation on bonding for
+ details.
OPTIONS FOR `bridge' CONNECTIONS
diff --git a/src/lib/connections/bond b/src/lib/connections/bond
index 7e4112f..64b0285 100644
--- a/src/lib/connections/bond
+++ b/src/lib/connections/bond
@@ -9,11 +9,10 @@ bond_up() {
if is_interface "$Interface"; then
report_error "Interface '$Interface' already exists"
return 1
- else
- interface_add bond "$Interface"
fi
- bring_interface_up "$Interface"
+ interface_add bond "$Interface" "" ${Mode:+mode "$Mode"}
+ bring_interface_up "$Interface"
for slave in "${BindsToInterfaces[@]}"; do
ip link set dev "$slave" master "$Interface"
done