]> xenbits.xensource.com Git - libvirt.git/commitdiff
network: differentiate macvtap/bridge from host-bridge based networks
authorLaine Stump <laine@laine.org>
Fri, 11 Mar 2016 15:59:19 +0000 (10:59 -0500)
committerLaine Stump <laine@laine.org>
Fri, 25 Mar 2016 17:21:29 +0000 (13:21 -0400)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1316465

An attempt to simplify the code for the VIR_NETWORK_FORWARD_BRIDGE
case of networkUpdateState in commit b61db335 (first in release
1.2.14) resulted in networks based on macvtap bridge mode being
erroneously marked as inactive any time libvirtd was restarted.

The problem is that the original code had differentiated between a
network using tap devices to connect to an existing host-bridge device
(forward mode of VIR_NETWORK_FORWARD_BRIDGE and a non-NULL
def->bridge), and one using macvtap bridge mode to connect to any
ethernet device (still forward mode VIR_NETWORK_FORWARD_BRIDGE, but
null def->bridge), but the changed code assumed that all networks with
VIR_NETWORK_FORWARD_BRIDGE were tap + host-bridge networks, so a null
def->bridge was interpreted as "inactive".

This patch restores the original code in networkUpdateState

src/network/bridge_driver.c

index a09a7e474fc57886e33cccb64cd7519d34ca7027..c2dbda6c0b20026eb0b6977e3fb4b62a9f958a5d 100644 (file)
@@ -405,7 +405,8 @@ networkUpdateState(virNetworkObjPtr obj,
         break;
 
     case VIR_NETWORK_FORWARD_BRIDGE:
-        if (!(obj->def->bridge && virNetDevExists(obj->def->bridge) == 1)) {
+        if (obj->def->bridge) {
+            if (virNetDevExists(obj->def->bridge) != 1)
                 obj->active = 0;
             break;
         }