[libvirt] [PATCH] network: get vlan info for Open vSwitch interfaces from proper source

Laine Stump laine at laine.org
Wed Aug 29 10:43:26 UTC 2012


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.
---

Since I'm not online in a regular fashion for the next few days (too
bad I wasn't online in the 12 hours or so *before* the 0.10.0 release
instead of after :-/), I would appreciate if whoever ACKs this could
push it. Thanks!

 src/qemu/qemu_command.c | 2 +-
 src/uml/uml_conf.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 8c32a4d..25f2451 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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) {
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 5461b42..410f3e2 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -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);
-- 
1.7.11.4




More information about the libvir-list mailing list