]> xenbits.xensource.com Git - libvirt.git/commitdiff
network: call proper start/stop functions for macvtap bridge-mode networks
authorLaine Stump <laine@laine.org>
Fri, 25 Mar 2016 17:17:28 +0000 (13:17 -0400)
committerLaine Stump <laine@laine.org>
Fri, 25 Mar 2016 17:28:34 +0000 (13:28 -0400)
networkStartNetwork() and networkShutdownNetwork() were calling the
wrong type-specific function in the case of networks that were
configured for macvtap ("direct") bridge mode - they were instead
calling the functions for a tap+bridge network. Currently none of
these functions does anything (they just return 0) so it hasn't
created any problems, but that could change in the future.

src/network/bridge_driver.c

index c2dbda6c0b20026eb0b6977e3fb4b62a9f958a5d..c673cc1515e24e138144d7fac8209577f29c834e 100644 (file)
@@ -2490,10 +2490,15 @@ networkStartNetwork(virNetworkDriverStatePtr driver,
         break;
 
     case VIR_NETWORK_FORWARD_BRIDGE:
-       if (networkStartNetworkBridge(network) < 0)
-          goto cleanup;
-       break;
-
+        if (network->def->bridge) {
+            if (networkStartNetworkBridge(network) < 0)
+                goto cleanup;
+            break;
+        }
+        /* intentionally fall through to the macvtap/direct case for
+         * VIR_NETWORK_FORWARD_BRIDGE with no bridge device defined
+         * (since that is macvtap bridge mode).
+         */
     case VIR_NETWORK_FORWARD_PRIVATE:
     case VIR_NETWORK_FORWARD_VEPA:
     case VIR_NETWORK_FORWARD_PASSTHROUGH:
@@ -2562,9 +2567,14 @@ networkShutdownNetwork(virNetworkDriverStatePtr driver,
         break;
 
     case VIR_NETWORK_FORWARD_BRIDGE:
-        ret = networkShutdownNetworkBridge(network);
-        break;
-
+        if (network->def->bridge) {
+            ret = networkShutdownNetworkBridge(network);
+            break;
+        }
+        /* intentionally fall through to the macvtap/direct case for
+         * VIR_NETWORK_FORWARD_BRIDGE with no bridge device defined
+         * (since that is macvtap bridge mode).
+         */
     case VIR_NETWORK_FORWARD_PRIVATE:
     case VIR_NETWORK_FORWARD_VEPA:
     case VIR_NETWORK_FORWARD_PASSTHROUGH:
@@ -4691,8 +4701,8 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
         if ((dev_name = netdef->bridge))
             break;
         /*
-         * fall through if netdef->bridge wasn't set, since this is
-         * also a direct-mode interface.
+         * fall through if netdef->bridge wasn't set, since that is
+         * macvtap bridge mode network.
          */
     case VIR_NETWORK_FORWARD_PRIVATE:
     case VIR_NETWORK_FORWARD_VEPA: