From 2a537fe187fbca9d95816ffdd9db0327f70ae1be Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Fri, 11 Mar 2016 10:59:19 -0500 Subject: [PATCH] network: differentiate macvtap/bridge from host-bridge based networks 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index a09a7e474f..c2dbda6c0b 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -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; }