]> xenbits.xensource.com Git - libvirt.git/commitdiff
network: get vlan info for Open vSwitch interfaces from proper source
authorLaine Stump <laine@laine.org>
Thu, 30 Aug 2012 09:14:32 +0000 (05:14 -0400)
committerDaniel Veillard <veillard@redhat.com>
Thu, 30 Aug 2012 10:05:18 +0000 (18:05 +0800)
This bug was revealed by the crash described in

  https://bugzilla.redhat.com/show_bug.cgi?id=852383

The vlan info pointer sent to virNetDevOpenvswitchAddPort should never
be non-NULL unless there is at least one tag. The factthat such a vlan
info pointer was receveid pointed out that a caller was passing the
wrong pointer. Instead of sending &net->vlan, the result of
virDomainNetGetActualVlan(net) should be sent - that function will
look for vlan info in net->data.network.actual->vlan, and in cany case
return NULL instead of a pointer if the vlan info it finds has no
tags.

Aside from causing the crash, sending a hardcoded &net->vlan has the
effect of ignoring vlan info from a <network> or <portgroup> config.

src/lxc/lxc_process.c
src/qemu/qemu_command.c
src/uml/uml_conf.c

index cdbf14b19580e15abf72cd680fa70272b3abbff9..bcd59cb098de64f757cda511eee23cf220b3efe3 100644 (file)
@@ -325,7 +325,7 @@ static int virLXCProcessSetupInterfaceBridged(virConnectPtr conn,
 
     if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)
         ret = virNetDevOpenvswitchAddPort(brname, parentVeth, &net->mac,
-                                          vm->uuid, vport, &net->vlan);
+                                          vm->uuid, vport, virDomainNetGetActualVlan(net));
     else
         ret = virNetDevBridgeAddPort(brname, parentVeth);
     if (ret < 0)
index 8c32a4dcdcfcb97682cfc6e166f51c7afa66fae2..25f2451f9f814c66fe41b31697a4212ebf129534 100644 (file)
@@ -258,7 +258,7 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
     err = virNetDevTapCreateInBridgePort(brname, &net->ifname, &net->mac,
                                          def->uuid, &tapfd,
                                          virDomainNetGetActualVirtPortProfile(net),
-                                         &net->vlan,
+                                         virDomainNetGetActualVlan(net),
                                          tap_create_flags);
     virDomainAuditNetDevice(def, net, "/dev/net/tun", tapfd >= 0);
     if (err < 0) {
index 5461b42a8ec9c19eb12f229175a869bb0c59ac76..410f3e2690709436f1063e10480b5481f42bccb4 100644 (file)
@@ -141,7 +141,7 @@ umlConnectTapDevice(virConnectPtr conn,
     if (virNetDevTapCreateInBridgePort(bridge, &net->ifname, &net->mac,
                                        vm->uuid, NULL,
                                        virDomainNetGetActualVirtPortProfile(net),
-                                       &net->vlan,
+                                       virDomainNetGetActualVlan(net),
                                        VIR_NETDEV_TAP_CREATE_IFUP) < 0) {
         if (template_ifname)
             VIR_FREE(net->ifname);