WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Patch fixing vlan handling when network-bridge script is use

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Patch fixing vlan handling when network-bridge script is used
From: Miroslav Rezanina <mrezanin@xxxxxxxxxx>
Date: Wed, 18 Aug 2010 07:43:48 -0400 (EDT)
Delivery-date: Wed, 18 Aug 2010 04:44:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <232221223.568081282131308987.JavaMail.root@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
We had problem using tagged vlans inside domU. Testing shows that this is 
caused by changing network interfaces in network-bridge script. Following patch 
should allow to use vlans in guest.

Testing scenario:
configure vlan network (e.g. vlan 1 on eth0 => eth0.1)
start xend
create domU and configure same vlan inside it

You can see that vlan is still <interface>.<vlan_id>. You can reach dom0 but 
not domU. After patch apply vlan is changed to <bridge>.<vlan_id> after xend 
start and you can reach both dom0 and domu.

Patch:
------
diff -r 9f49667fec71 tools/hotplug/Linux/network-bridge
--- a/tools/hotplug/Linux/network-bridge        Fri Jul 30 15:22:39 2010 +0100
+++ b/tools/hotplug/Linux/network-bridge        Wed Aug 18 13:33:05 2010 +0200
@@ -119,6 +119,36 @@
     fi
 }
 
+handle_vlan_start() {
+    for vlan in `ls /proc/net/vlan/${netdev}* 2>/dev/null`; do
+        vlan_id=$(echo ${vlan} | sed -e "s/.*${netdev}.\(.*\)/\1/")
+        vlan_if=${netdev}.${vlan_id}
+
+        get_ip_info ${vlan_if}
+
+        vconfig rem ${vlan_if}
+        sleep 1
+        vconfig add ${bridge} ${vlan_id}
+
+        do_ifup ${bridge}.${vlan_id}
+    done
+}
+
+handle_vlan_stop() {
+    for vlan in `ls /proc/net/vlan/${bridge}* 2>/dev/null`; do
+        vlan_id=$(echo ${vlan} | sed -e "s/.*${bridge}.\(.*\)/\1/")
+        vlan_if=${bridge}.${vlan_id}
+
+        get_ip_info ${vlan_if}
+
+        vconfig rem ${vlan_if}
+        sleep 1
+        vconfig add ${netdev} ${vlan_id}
+
+        do_ifup ${netdev}.${vlan_id}
+    done
+}
+
 # Usage: transfer_addrs src dst
 # Copy all IP addresses (including aliases) from device $src to device $dst.
 transfer_addrs () {
@@ -254,6 +284,8 @@
     add_to_bridge2 ${bridge} ${pdev}
     do_ifup ${bridge}
 
+    handle_vlan_start
+
     if [ ${antispoof} = 'yes' ] ; then
        antispoofing
     fi
@@ -289,6 +321,8 @@
     ip link set ${pdev} name ${netdev}
     do_ifup ${netdev}
 
+    handle_vlan_stop
+
     brctl delbr ${tdev}
 
     release_lock "network-bridge"
-- 
Miroslav Rezanina
Software Engineer - Virtualization Team - XEN kernel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel