Blame 0062-network-support-vlan-tagged-bonding.patch

Harald Hoyer 53e990
From 472edf825e478826bc7735961961576fe7c94c5f Mon Sep 17 00:00:00 2001
Harald Hoyer 53e990
From: Cong Wang <xiyou.wangcong@gmail.com>
Harald Hoyer 53e990
Date: Thu, 21 Jun 2012 11:44:35 +0800
Harald Hoyer 53e990
Subject: [PATCH] network: support vlan tagged bonding
Harald Hoyer 53e990
Harald Hoyer 53e990
This patch adds support of vlan tagged bonding, for example,
Harald Hoyer 53e990
bond0.2. In case of regression, I also tested bond0 and eth0.2,
Harald Hoyer 53e990
all work fine.
Harald Hoyer 53e990
Harald Hoyer 53e990
Cc: Harald Hoyer <harald@redhat.com>
Harald Hoyer 53e990
Cc: Dave Young <dyoung@redhat.com>
Harald Hoyer 53e990
Cc: Vivek Goyal <vgoyal@redhat.com>
Harald Hoyer 53e990
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Harald Hoyer 53e990
---
Harald Hoyer 53e990
 modules.d/40network/ifup.sh         |    8 ++++++--
Harald Hoyer 53e990
 modules.d/40network/net-genrules.sh |    6 +++---
Harald Hoyer 53e990
 2 files changed, 9 insertions(+), 5 deletions(-)
Harald Hoyer 53e990
Harald Hoyer 53e990
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
Harald Hoyer 53e990
index 31eb966..316a21a 100755
Harald Hoyer 53e990
--- a/modules.d/40network/ifup.sh
Harald Hoyer 53e990
+++ b/modules.d/40network/ifup.sh
Harald Hoyer 53e990
@@ -188,7 +188,7 @@ if [ -e /tmp/bridge.info ]; then
Harald Hoyer 53e990
         brctl setfd $bridgename 0
Harald Hoyer 53e990
         for ethname in $ethnames ; do
Harald Hoyer 53e990
             if [ "$ethname" = "$bondname" ] ; then
Harald Hoyer 53e990
-                DO_BOND_SETUP=yes ifup $bondname
Harald Hoyer 53e990
+                DO_BOND_SETUP=yes ifup $bondname -m
Harald Hoyer 53e990
             else
Harald Hoyer 53e990
                 ip link set $ethname up
Harald Hoyer 53e990
             fi
Harald Hoyer 53e990
@@ -211,7 +211,11 @@ get_vid() {
Harald Hoyer 53e990
 
Harald Hoyer 53e990
 if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
Harald Hoyer 53e990
     modprobe 8021q
Harald Hoyer 53e990
-    ip link set "$phydevice" up
Harald Hoyer 53e990
+    if [ "$phydevice" = "$bondname" ] ; then
Harald Hoyer 53e990
+        DO_BOND_SETUP=yes ifup $phydevice -m
Harald Hoyer 53e990
+    else
Harald Hoyer 53e990
+        ip link set "$phydevice" up
Harald Hoyer 53e990
+    fi
Harald Hoyer 53e990
     wait_for_if_up "$phydevice"
Harald Hoyer 53e990
     ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname; echo $?)"
Harald Hoyer 53e990
 fi
Harald Hoyer 53e990
diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh
Harald Hoyer 53e990
index 99d0fe5..867abcf 100755
Harald Hoyer 53e990
--- a/modules.d/40network/net-genrules.sh
Harald Hoyer 53e990
+++ b/modules.d/40network/net-genrules.sh
Harald Hoyer 53e990
@@ -21,19 +21,19 @@ fix_bootif() {
Harald Hoyer 53e990
     # bridge: attempt only the defined interface
Harald Hoyer 53e990
     if [ -e /tmp/bridge.info ]; then
Harald Hoyer 53e990
         . /tmp/bridge.info
Harald Hoyer 53e990
-        IFACES=${ethnames%% *}
Harald Hoyer 53e990
+        IFACES+=" ${ethnames%% *}"
Harald Hoyer 53e990
     fi
Harald Hoyer 53e990
 
Harald Hoyer 53e990
     # bond: attempt only the defined interface (override bridge defines)
Harald Hoyer 53e990
     if [ -e /tmp/bond.info ]; then
Harald Hoyer 53e990
         . /tmp/bond.info
Harald Hoyer 53e990
         # It is enough to fire up only one
Harald Hoyer 53e990
-        IFACES=${bondslaves%% *}
Harald Hoyer 53e990
+        IFACES+=" ${bondslaves%% *}"
Harald Hoyer 53e990
     fi
Harald Hoyer 53e990
 
Harald Hoyer 53e990
     if [ -e /tmp/vlan.info ]; then
Harald Hoyer 53e990
         . /tmp/vlan.info
Harald Hoyer 53e990
-        IFACES=$phydevice
Harald Hoyer 53e990
+        IFACES+=" $phydevice"
Harald Hoyer 53e990
     fi
Harald Hoyer 53e990
 
Harald Hoyer 53e990
     ifup='/sbin/ifup $env{INTERFACE}'