|
Harald Hoyer |
ab11ed |
From 0c5ccb35c7db77caf6317e1946387504b44132e5 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
ab11ed |
From: WANG Chao <chaowang@redhat.com>
|
|
Harald Hoyer |
ab11ed |
Date: Tue, 9 Apr 2013 18:56:40 +0800
|
|
Harald Hoyer |
ab11ed |
Subject: [PATCH] ifup.sh: Add support for bridge over a vlan tagged interface
|
|
Harald Hoyer |
ab11ed |
|
|
Harald Hoyer |
ab11ed |
This patch add support for bridge a vlan tagged interface, like
|
|
Harald Hoyer |
ab11ed |
br0 -> bond0.7 -> bond0 -> eth0
|
|
Harald Hoyer |
ab11ed |
|
|
Harald Hoyer |
ab11ed |
Signed-off-by: WANG Chao <chaowang@redhat.com>
|
|
Harald Hoyer |
ab11ed |
---
|
|
Harald Hoyer |
ab11ed |
modules.d/40network/ifup.sh | 33 +++++++++++++++++++--------------
|
|
Harald Hoyer |
ab11ed |
1 file changed, 19 insertions(+), 14 deletions(-)
|
|
Harald Hoyer |
ab11ed |
|
|
Harald Hoyer |
ab11ed |
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
|
|
Harald Hoyer |
ab11ed |
index 593f387..526251f 100755
|
|
Harald Hoyer |
ab11ed |
--- a/modules.d/40network/ifup.sh
|
|
Harald Hoyer |
ab11ed |
+++ b/modules.d/40network/ifup.sh
|
|
Harald Hoyer |
ab11ed |
@@ -43,6 +43,20 @@ if [ -e /tmp/team.info ]; then
|
|
Harald Hoyer |
ab11ed |
done
|
|
Harald Hoyer |
ab11ed |
fi
|
|
Harald Hoyer |
ab11ed |
|
|
Harald Hoyer |
ab11ed |
+if [ -e /tmp/vlan.info ]; then
|
|
Harald Hoyer |
ab11ed |
+ . /tmp/vlan.info
|
|
Harald Hoyer |
ab11ed |
+ if [ "$netif" = "$phydevice" ]; then
|
|
Harald Hoyer |
ab11ed |
+ if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
|
Harald Hoyer |
ab11ed |
+ : # We need to really setup bond (recursive call)
|
|
Harald Hoyer |
ab11ed |
+ elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
|
Harald Hoyer |
ab11ed |
+ : # We need to really setup team (recursive call)
|
|
Harald Hoyer |
ab11ed |
+ else
|
|
Harald Hoyer |
ab11ed |
+ netif="$vlanname"
|
|
Harald Hoyer |
ab11ed |
+ use_vlan='true'
|
|
Harald Hoyer |
ab11ed |
+ fi
|
|
Harald Hoyer |
ab11ed |
+ fi
|
|
Harald Hoyer |
ab11ed |
+fi
|
|
Harald Hoyer |
ab11ed |
+
|
|
Harald Hoyer |
ab11ed |
# bridge this interface?
|
|
Harald Hoyer |
ab11ed |
if [ -e /tmp/bridge.info ]; then
|
|
Harald Hoyer |
ab11ed |
. /tmp/bridge.info
|
|
Harald Hoyer |
ab11ed |
@@ -52,6 +66,8 @@ if [ -e /tmp/bridge.info ]; then
|
|
Harald Hoyer |
ab11ed |
: # We need to really setup bond (recursive call)
|
|
Harald Hoyer |
ab11ed |
elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
|
Harald Hoyer |
ab11ed |
: # We need to really setup team (recursive call)
|
|
Harald Hoyer |
ab11ed |
+ elif [ "$netif" = "$vlanname" ] && [ -n "$DO_VLAN_SETUP" ]; then
|
|
Harald Hoyer |
ab11ed |
+ : # We need to really setup vlan (recursive call)
|
|
Harald Hoyer |
ab11ed |
else
|
|
Harald Hoyer |
ab11ed |
netif="$bridgename"
|
|
Harald Hoyer |
ab11ed |
use_bridge='true'
|
|
Harald Hoyer |
ab11ed |
@@ -60,20 +76,6 @@ if [ -e /tmp/bridge.info ]; then
|
|
Harald Hoyer |
ab11ed |
done
|
|
Harald Hoyer |
ab11ed |
fi
|
|
Harald Hoyer |
ab11ed |
|
|
Harald Hoyer |
ab11ed |
-if [ -e /tmp/vlan.info ]; then
|
|
Harald Hoyer |
ab11ed |
- . /tmp/vlan.info
|
|
Harald Hoyer |
ab11ed |
- if [ "$netif" = "$phydevice" ]; then
|
|
Harald Hoyer |
ab11ed |
- if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
|
Harald Hoyer |
ab11ed |
- : # We need to really setup bond (recursive call)
|
|
Harald Hoyer |
ab11ed |
- elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
|
|
Harald Hoyer |
ab11ed |
- : # We need to really setup team (recursive call)
|
|
Harald Hoyer |
ab11ed |
- else
|
|
Harald Hoyer |
ab11ed |
- netif="$vlanname"
|
|
Harald Hoyer |
ab11ed |
- use_vlan='true'
|
|
Harald Hoyer |
ab11ed |
- fi
|
|
Harald Hoyer |
ab11ed |
- fi
|
|
Harald Hoyer |
ab11ed |
-fi
|
|
Harald Hoyer |
ab11ed |
-
|
|
Harald Hoyer |
ab11ed |
# disable manual ifup while netroot is set for simplifying our logic
|
|
Harald Hoyer |
ab11ed |
# in netroot case we prefer netroot to bringup $netif automaticlly
|
|
Harald Hoyer |
ab11ed |
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
|
|
Harald Hoyer |
ab11ed |
@@ -223,6 +225,8 @@ if [ -e /tmp/bridge.info ]; then
|
|
Harald Hoyer |
ab11ed |
DO_BOND_SETUP=yes ifup $bondname -m
|
|
Harald Hoyer |
ab11ed |
elif [ "$ethname" = "$teammaster" ] ; then
|
|
Harald Hoyer |
ab11ed |
DO_TEAM_SETUP=yes ifup $teammaster -m
|
|
Harald Hoyer |
ab11ed |
+ elif [ "$ethname" = "$vlanname" ]; then
|
|
Harald Hoyer |
ab11ed |
+ DO_VLAN_SETUP=yes ifup $vlanname -m
|
|
Harald Hoyer |
ab11ed |
else
|
|
Harald Hoyer |
ab11ed |
linkup $ethname
|
|
Harald Hoyer |
ab11ed |
fi
|
|
Harald Hoyer |
ab11ed |
@@ -252,6 +256,7 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
|
|
Harald Hoyer |
ab11ed |
linkup "$phydevice"
|
|
Harald Hoyer |
ab11ed |
fi
|
|
Harald Hoyer |
ab11ed |
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
|
|
Harald Hoyer |
ab11ed |
+ ip link set "$vlanname" up
|
|
Harald Hoyer |
ab11ed |
fi
|
|
Harald Hoyer |
ab11ed |
|
|
Harald Hoyer |
ab11ed |
# setup nameserver
|