xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Miroslav Rezanina <mrezanin@redhat.com>
To: xen-devel@lists.xensource.com
Subject: Patch fixing vlan handling when network-bridge script is used
Date: Wed, 18 Aug 2010 07:43:48 -0400 (EDT)	[thread overview]
Message-ID: <498751515.568541282131828529.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> (raw)
In-Reply-To: <232221223.568081282131308987.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>

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

       reply	other threads:[~2010-08-18 11:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <232221223.568081282131308987.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
2010-08-18 11:43 ` Miroslav Rezanina [this message]
2010-08-18 16:02   ` Patch fixing vlan handling when network-bridge script is used Ian Jackson
2010-08-19  4:20     ` Patch fixing vlan handling when network-bridge scriptis used James Harper
2010-08-19 13:25       ` Ian Jackson
2010-08-19 15:59       ` Michael Brade
2010-08-19 17:59         ` Ian Jackson
2010-08-19 18:35           ` Michael Brade
2010-08-19 23:11         ` Jeremy Fitzhardinge
2010-08-20 18:25           ` Michael Brade

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=498751515.568541282131828529.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com \
    --to=mrezanin@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).