mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
network: Use 'switch' control statement with virNetworkForwardType enum
With 'switch' we can utilize the compile time enum checks which we can't rely on with plain 'if' conditions. Signed-off-by: Shi Lei <shilei.massclouds@gmx.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
a1450d774f
commit
7564daca8a
@ -29975,40 +29975,49 @@ virDomainNetResolveActualType(virDomainNetDefPtr iface)
|
|||||||
if (!(def = virNetworkDefParseString(xml)))
|
if (!(def = virNetworkDefParseString(xml)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((def->forward.type == VIR_NETWORK_FORWARD_NONE) ||
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
(def->forward.type == VIR_NETWORK_FORWARD_NAT) ||
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
(def->forward.type == VIR_NETWORK_FORWARD_ROUTE) ||
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
(def->forward.type == VIR_NETWORK_FORWARD_OPEN)) {
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
|
case VIR_NETWORK_FORWARD_OPEN:
|
||||||
/* for these forward types, the actual net type really *is*
|
/* for these forward types, the actual net type really *is*
|
||||||
* NETWORK; we just keep the info from the portgroup in
|
* NETWORK; we just keep the info from the portgroup in
|
||||||
* iface->data.network.actual
|
* iface->data.network.actual
|
||||||
*/
|
*/
|
||||||
ret = VIR_DOMAIN_NET_TYPE_NETWORK;
|
ret = VIR_DOMAIN_NET_TYPE_NETWORK;
|
||||||
|
break;
|
||||||
|
|
||||||
} else if ((def->forward.type == VIR_NETWORK_FORWARD_BRIDGE) &&
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
def->bridge) {
|
|
||||||
|
|
||||||
/* <forward type='bridge'/> <bridge name='xxx'/>
|
|
||||||
* is VIR_DOMAIN_NET_TYPE_BRIDGE
|
|
||||||
*/
|
|
||||||
|
|
||||||
ret = VIR_DOMAIN_NET_TYPE_BRIDGE;
|
|
||||||
|
|
||||||
} else if (def->forward.type == VIR_NETWORK_FORWARD_HOSTDEV) {
|
|
||||||
|
|
||||||
ret = VIR_DOMAIN_NET_TYPE_HOSTDEV;
|
ret = VIR_DOMAIN_NET_TYPE_HOSTDEV;
|
||||||
|
break;
|
||||||
|
|
||||||
} else if ((def->forward.type == VIR_NETWORK_FORWARD_BRIDGE) ||
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
(def->forward.type == VIR_NETWORK_FORWARD_PRIVATE) ||
|
if (def->bridge) {
|
||||||
(def->forward.type == VIR_NETWORK_FORWARD_VEPA) ||
|
/* <forward type='bridge'/> <bridge name='xxx'/>
|
||||||
(def->forward.type == VIR_NETWORK_FORWARD_PASSTHROUGH)) {
|
* is VIR_DOMAIN_NET_TYPE_BRIDGE
|
||||||
|
*/
|
||||||
|
ret = VIR_DOMAIN_NET_TYPE_BRIDGE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* intentionally fall through to the direct case for
|
||||||
|
* VIR_NETWORK_FORWARD_BRIDGE with no bridge device defined
|
||||||
|
*/
|
||||||
|
ATTRIBUTE_FALLTHROUGH;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_PRIVATE:
|
||||||
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
|
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||||
/* <forward type='bridge|private|vepa|passthrough'> are all
|
/* <forward type='bridge|private|vepa|passthrough'> are all
|
||||||
* VIR_DOMAIN_NET_TYPE_DIRECT.
|
* VIR_DOMAIN_NET_TYPE_DIRECT.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = VIR_DOMAIN_NET_TYPE_DIRECT;
|
ret = VIR_DOMAIN_NET_TYPE_DIRECT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -1874,7 +1874,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
/* Validate some items in the main NetworkDef that need to align
|
/* Validate some items in the main NetworkDef that need to align
|
||||||
* with the chosen forward mode.
|
* with the chosen forward mode.
|
||||||
*/
|
*/
|
||||||
switch (def->forward.type) {
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
case VIR_NETWORK_FORWARD_NONE:
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1955,21 +1955,40 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(stp);
|
VIR_FREE(stp);
|
||||||
|
|
||||||
if (def->mtu &&
|
if (def->mtu) {
|
||||||
(def->forward.type != VIR_NETWORK_FORWARD_NONE &&
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
def->forward.type != VIR_NETWORK_FORWARD_NAT &&
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
def->forward.type != VIR_NETWORK_FORWARD_ROUTE &&
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
def->forward.type != VIR_NETWORK_FORWARD_OPEN)) {
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
case VIR_NETWORK_FORWARD_OPEN:
|
||||||
_("mtu size only allowed in open, route, nat, "
|
break;
|
||||||
"and isolated mode, not in %s (network '%s')"),
|
|
||||||
virNetworkForwardTypeToString(def->forward.type),
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
def->name);
|
case VIR_NETWORK_FORWARD_PRIVATE:
|
||||||
goto error;
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
|
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||||
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
|
_("mtu size only allowed in open, route, nat, "
|
||||||
|
"and isolated mode, not in %s (network '%s')"),
|
||||||
|
virNetworkForwardTypeToString(def->forward.type),
|
||||||
|
def->name);
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract custom metadata */
|
/* Extract custom metadata */
|
||||||
@ -2349,6 +2368,7 @@ virNetworkDefFormatBuf(virBufferPtr buf,
|
|||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
size_t i;
|
size_t i;
|
||||||
bool shortforward;
|
bool shortforward;
|
||||||
|
bool hasbridge = false;
|
||||||
|
|
||||||
virBufferAddLit(buf, "<network");
|
virBufferAddLit(buf, "<network");
|
||||||
if (!(flags & VIR_NETWORK_XML_INACTIVE) && (def->connections > 0))
|
if (!(flags & VIR_NETWORK_XML_INACTIVE) && (def->connections > 0))
|
||||||
@ -2469,22 +2489,33 @@ virNetworkDefFormatBuf(virBufferPtr buf,
|
|||||||
virBufferAddLit(buf, "</forward>\n");
|
virBufferAddLit(buf, "</forward>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
|
case VIR_NETWORK_FORWARD_OPEN:
|
||||||
|
hasbridge = true;
|
||||||
|
break;
|
||||||
|
|
||||||
if (def->forward.type == VIR_NETWORK_FORWARD_NONE ||
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_NAT ||
|
case VIR_NETWORK_FORWARD_PRIVATE:
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_ROUTE ||
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_OPEN ||
|
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||||
def->bridge || def->macTableManager) {
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasbridge || def->bridge || def->macTableManager) {
|
||||||
virBufferAddLit(buf, "<bridge");
|
virBufferAddLit(buf, "<bridge");
|
||||||
virBufferEscapeString(buf, " name='%s'", def->bridge);
|
virBufferEscapeString(buf, " name='%s'", def->bridge);
|
||||||
if (def->forward.type == VIR_NETWORK_FORWARD_NONE ||
|
if (hasbridge)
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_NAT ||
|
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_ROUTE ||
|
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_OPEN) {
|
|
||||||
virBufferAsprintf(buf, " stp='%s' delay='%ld'",
|
virBufferAsprintf(buf, " stp='%s' delay='%ld'",
|
||||||
def->stp ? "on" : "off", def->delay);
|
def->stp ? "on" : "off", def->delay);
|
||||||
}
|
|
||||||
if (def->macTableManager) {
|
if (def->macTableManager) {
|
||||||
virBufferAsprintf(buf, " macTableManager='%s'",
|
virBufferAsprintf(buf, " macTableManager='%s'",
|
||||||
virNetworkBridgeMACTableManagerTypeToString(def->macTableManager));
|
virNetworkBridgeMACTableManagerTypeToString(def->macTableManager));
|
||||||
|
@ -1009,19 +1009,31 @@ virNetworkLoadConfig(virNetworkObjListPtr nets,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->forward.type == VIR_NETWORK_FORWARD_NONE ||
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_NAT ||
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_ROUTE ||
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_OPEN) {
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
|
case VIR_NETWORK_FORWARD_OPEN:
|
||||||
if (!def->mac_specified) {
|
if (!def->mac_specified) {
|
||||||
virNetworkSetBridgeMacAddr(def);
|
virNetworkSetBridgeMacAddr(def);
|
||||||
virNetworkSaveConfig(configDir, def);
|
virNetworkSaveConfig(configDir, def);
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
|
case VIR_NETWORK_FORWARD_PRIVATE:
|
||||||
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
|
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||||
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
/* Throw away MAC address for other forward types,
|
/* Throw away MAC address for other forward types,
|
||||||
* which could have been generated by older libvirt RPMs */
|
* which could have been generated by older libvirt RPMs */
|
||||||
def->mac_specified = false;
|
def->mac_specified = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(obj = virNetworkObjAssignDef(nets, def, 0)))
|
if (!(obj = virNetworkObjAssignDef(nets, def, 0)))
|
||||||
|
@ -326,12 +326,27 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Add support for NAT */
|
/* FIXME: Add support for NAT */
|
||||||
if (def->forward.type != VIR_NETWORK_FORWARD_NONE &&
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
def->forward.type != VIR_NETWORK_FORWARD_BRIDGE) {
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
|
case VIR_NETWORK_FORWARD_OPEN:
|
||||||
|
case VIR_NETWORK_FORWARD_PRIVATE:
|
||||||
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
|
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||||
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Unsupported forward mode '%s'"),
|
_("Unsupported forward mode '%s'"),
|
||||||
virNetworkForwardTypeToString(def->forward.type));
|
virNetworkForwardTypeToString(def->forward.type));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Verify that specified HostPortGroups don't exist already */
|
/* Verify that specified HostPortGroups don't exist already */
|
||||||
|
@ -2369,6 +2369,7 @@ virNetDevMacVLanCreate;
|
|||||||
virNetDevMacVLanCreateWithVPortProfile;
|
virNetDevMacVLanCreateWithVPortProfile;
|
||||||
virNetDevMacVLanDelete;
|
virNetDevMacVLanDelete;
|
||||||
virNetDevMacVLanDeleteWithVPortProfile;
|
virNetDevMacVLanDeleteWithVPortProfile;
|
||||||
|
virNetDevMacVLanModeTypeFromString;
|
||||||
virNetDevMacVLanReleaseName;
|
virNetDevMacVLanReleaseName;
|
||||||
virNetDevMacVLanReserveName;
|
virNetDevMacVLanReserveName;
|
||||||
virNetDevMacVLanRestartWithVPortProfile;
|
virNetDevMacVLanRestartWithVPortProfile;
|
||||||
|
@ -446,7 +446,7 @@ networkUpdateState(virNetworkObjPtr obj,
|
|||||||
}
|
}
|
||||||
def = virNetworkObjGetDef(obj);
|
def = virNetworkObjGetDef(obj);
|
||||||
|
|
||||||
switch (def->forward.type) {
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
case VIR_NETWORK_FORWARD_NONE:
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
case VIR_NETWORK_FORWARD_NAT:
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
case VIR_NETWORK_FORWARD_ROUTE:
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
@ -485,6 +485,11 @@ networkUpdateState(virNetworkObjPtr obj,
|
|||||||
case VIR_NETWORK_FORWARD_HOSTDEV:
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
/* so far no extra checks */
|
/* so far no extra checks */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try and read dnsmasq/radvd pids of active networks */
|
/* Try and read dnsmasq/radvd pids of active networks */
|
||||||
@ -2088,20 +2093,37 @@ networkRefreshDaemonsHelper(virNetworkObjPtr obj,
|
|||||||
|
|
||||||
virObjectLock(obj);
|
virObjectLock(obj);
|
||||||
def = virNetworkObjGetDef(obj);
|
def = virNetworkObjGetDef(obj);
|
||||||
if (virNetworkObjIsActive(obj) &&
|
if (virNetworkObjIsActive(obj)) {
|
||||||
((def->forward.type == VIR_NETWORK_FORWARD_NONE) ||
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
(def->forward.type == VIR_NETWORK_FORWARD_NAT) ||
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
(def->forward.type == VIR_NETWORK_FORWARD_ROUTE) ||
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
(def->forward.type == VIR_NETWORK_FORWARD_OPEN))) {
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
/* Only the three L3 network types that are configured by
|
case VIR_NETWORK_FORWARD_OPEN:
|
||||||
* libvirt will have a dnsmasq or radvd daemon associated
|
/* Only the three L3 network types that are configured by
|
||||||
* with them. Here we send a SIGHUP to an existing
|
* libvirt will have a dnsmasq or radvd daemon associated
|
||||||
* dnsmasq and/or radvd, or restart them if they've
|
* with them. Here we send a SIGHUP to an existing
|
||||||
* disappeared.
|
* dnsmasq and/or radvd, or restart them if they've
|
||||||
*/
|
* disappeared.
|
||||||
networkRefreshDhcpDaemon(driver, obj);
|
*/
|
||||||
networkRefreshRadvd(driver, obj);
|
networkRefreshDhcpDaemon(driver, obj);
|
||||||
|
networkRefreshRadvd(driver, obj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
|
case VIR_NETWORK_FORWARD_PRIVATE:
|
||||||
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
|
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||||
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
virObjectUnlock(obj);
|
virObjectUnlock(obj);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2128,20 +2150,36 @@ networkReloadFirewallRulesHelper(virNetworkObjPtr obj,
|
|||||||
|
|
||||||
virObjectLock(obj);
|
virObjectLock(obj);
|
||||||
def = virNetworkObjGetDef(obj);
|
def = virNetworkObjGetDef(obj);
|
||||||
if (virNetworkObjIsActive(obj) &&
|
if (virNetworkObjIsActive(obj)) {
|
||||||
((def->forward.type == VIR_NETWORK_FORWARD_NONE) ||
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
(def->forward.type == VIR_NETWORK_FORWARD_NAT) ||
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
(def->forward.type == VIR_NETWORK_FORWARD_ROUTE))) {
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
/* Only three of the L3 network types that are configured by
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
* libvirt need to have iptables rules reloaded. The 4th L3
|
/* Only three of the L3 network types that are configured by
|
||||||
* network type, forward='open', doesn't need this because it
|
* libvirt need to have iptables rules reloaded. The 4th L3
|
||||||
* has no iptables rules.
|
* network type, forward='open', doesn't need this because it
|
||||||
*/
|
* has no iptables rules.
|
||||||
networkRemoveFirewallRules(def);
|
*/
|
||||||
if (networkAddFirewallRules(def) < 0) {
|
networkRemoveFirewallRules(def);
|
||||||
/* failed to add but already logged */
|
ignore_value(networkAddFirewallRules(def));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_OPEN:
|
||||||
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
|
case VIR_NETWORK_FORWARD_PRIVATE:
|
||||||
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
|
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||||
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
virObjectUnlock(obj);
|
virObjectUnlock(obj);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2687,7 +2725,7 @@ networkCreateInterfacePool(virNetworkDefPtr netdef)
|
|||||||
virNetworkForwardIfDefPtr thisIf
|
virNetworkForwardIfDefPtr thisIf
|
||||||
= &netdef->forward.ifs[netdef->forward.nifs];
|
= &netdef->forward.ifs[netdef->forward.nifs];
|
||||||
|
|
||||||
switch (netdef->forward.type) {
|
switch ((virNetworkForwardType) netdef->forward.type) {
|
||||||
case VIR_NETWORK_FORWARD_BRIDGE:
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
case VIR_NETWORK_FORWARD_PRIVATE:
|
case VIR_NETWORK_FORWARD_PRIVATE:
|
||||||
case VIR_NETWORK_FORWARD_VEPA:
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
@ -2719,9 +2757,13 @@ networkCreateInterfacePool(virNetworkDefPtr netdef)
|
|||||||
case VIR_NETWORK_FORWARD_NAT:
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
case VIR_NETWORK_FORWARD_ROUTE:
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
case VIR_NETWORK_FORWARD_OPEN:
|
case VIR_NETWORK_FORWARD_OPEN:
|
||||||
case VIR_NETWORK_FORWARD_LAST:
|
|
||||||
/* by definition these will never be encountered here */
|
/* by definition these will never be encountered here */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, netdef->forward.type);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2811,7 +2853,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver,
|
|||||||
VIR_HOOK_SUBOP_BEGIN) < 0)
|
VIR_HOOK_SUBOP_BEGIN) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
switch (def->forward.type) {
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
|
|
||||||
case VIR_NETWORK_FORWARD_NONE:
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
case VIR_NETWORK_FORWARD_NAT:
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
@ -2840,6 +2882,11 @@ networkStartNetwork(virNetworkDriverStatePtr driver,
|
|||||||
if (networkStartNetworkExternal(obj) < 0)
|
if (networkStartNetworkExternal(obj) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* finally we can call the 'started' hook script if any */
|
/* finally we can call the 'started' hook script if any */
|
||||||
@ -2893,7 +2940,7 @@ networkShutdownNetwork(virNetworkDriverStatePtr driver,
|
|||||||
unlink(stateFile);
|
unlink(stateFile);
|
||||||
VIR_FREE(stateFile);
|
VIR_FREE(stateFile);
|
||||||
|
|
||||||
switch (def->forward.type) {
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
|
|
||||||
case VIR_NETWORK_FORWARD_NONE:
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
case VIR_NETWORK_FORWARD_NAT:
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
@ -2919,6 +2966,11 @@ networkShutdownNetwork(virNetworkDriverStatePtr driver,
|
|||||||
case VIR_NETWORK_FORWARD_HOSTDEV:
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
ret = networkShutdownNetworkExternal(obj);
|
ret = networkShutdownNetworkExternal(obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now that we know it's stopped call the hook if present */
|
/* now that we know it's stopped call the hook if present */
|
||||||
@ -3273,11 +3325,11 @@ networkValidate(virNetworkDriverStatePtr driver,
|
|||||||
/* Only the three L3 network types that are configured by libvirt
|
/* Only the three L3 network types that are configured by libvirt
|
||||||
* need to have a bridge device name / mac address provided
|
* need to have a bridge device name / mac address provided
|
||||||
*/
|
*/
|
||||||
if (def->forward.type == VIR_NETWORK_FORWARD_NONE ||
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_NAT ||
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_ROUTE ||
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_OPEN) {
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
|
case VIR_NETWORK_FORWARD_OPEN:
|
||||||
/* if no bridge name was given in the config, find a name
|
/* if no bridge name was given in the config, find a name
|
||||||
* unused by any other libvirt networks and assign it.
|
* unused by any other libvirt networks and assign it.
|
||||||
*/
|
*/
|
||||||
@ -3285,7 +3337,13 @@ networkValidate(virNetworkDriverStatePtr driver,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virNetworkSetBridgeMacAddr(def);
|
virNetworkSetBridgeMacAddr(def);
|
||||||
} else {
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
|
case VIR_NETWORK_FORWARD_PRIVATE:
|
||||||
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
|
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||||
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
/* They are also the only types that currently support setting
|
/* They are also the only types that currently support setting
|
||||||
* a MAC or IP address for the host-side device (bridge), DNS
|
* a MAC or IP address for the host-side device (bridge), DNS
|
||||||
* configuration, or network-wide bandwidth limits.
|
* configuration, or network-wide bandwidth limits.
|
||||||
@ -3331,6 +3389,12 @@ networkValidate(virNetworkDriverStatePtr driver,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
bandwidthAllowed = false;
|
bandwidthAllowed = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we support configs with a single PF defined:
|
/* we support configs with a single PF defined:
|
||||||
@ -3755,9 +3819,10 @@ networkUpdate(virNetworkPtr net,
|
|||||||
/* Take care of anything that must be done before updating the
|
/* Take care of anything that must be done before updating the
|
||||||
* live NetworkDef.
|
* live NetworkDef.
|
||||||
*/
|
*/
|
||||||
if (def->forward.type == VIR_NETWORK_FORWARD_NONE ||
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_NAT ||
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
def->forward.type == VIR_NETWORK_FORWARD_ROUTE) {
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
switch (section) {
|
switch (section) {
|
||||||
case VIR_NETWORK_SECTION_FORWARD:
|
case VIR_NETWORK_SECTION_FORWARD:
|
||||||
case VIR_NETWORK_SECTION_FORWARD_INTERFACE:
|
case VIR_NETWORK_SECTION_FORWARD_INTERFACE:
|
||||||
@ -3768,14 +3833,26 @@ networkUpdate(virNetworkPtr net,
|
|||||||
* old rules (and remember to load new ones after the
|
* old rules (and remember to load new ones after the
|
||||||
* update).
|
* update).
|
||||||
*/
|
*/
|
||||||
if (def->forward.type != VIR_NETWORK_FORWARD_OPEN) {
|
networkRemoveFirewallRules(def);
|
||||||
networkRemoveFirewallRules(def);
|
needFirewallRefresh = true;
|
||||||
needFirewallRefresh = true;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_OPEN:
|
||||||
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
|
case VIR_NETWORK_FORWARD_PRIVATE:
|
||||||
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
|
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||||
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, def->forward.type);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4440,10 +4517,11 @@ networkAllocateActualDevice(virDomainDefPtr dom,
|
|||||||
iface->data.network.actual->trustGuestRxFilters
|
iface->data.network.actual->trustGuestRxFilters
|
||||||
= netdef->trustGuestRxFilters;
|
= netdef->trustGuestRxFilters;
|
||||||
|
|
||||||
if ((netdef->forward.type == VIR_NETWORK_FORWARD_NONE) ||
|
switch ((virNetworkForwardType) netdef->forward.type) {
|
||||||
(netdef->forward.type == VIR_NETWORK_FORWARD_NAT) ||
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
(netdef->forward.type == VIR_NETWORK_FORWARD_ROUTE) ||
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
(netdef->forward.type == VIR_NETWORK_FORWARD_OPEN)) {
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
|
case VIR_NETWORK_FORWARD_OPEN:
|
||||||
/* for these forward types, the actual net type really *is*
|
/* for these forward types, the actual net type really *is*
|
||||||
* NETWORK; we just keep the info from the portgroup in
|
* NETWORK; we just keep the info from the portgroup in
|
||||||
* iface->data.network.actual
|
* iface->data.network.actual
|
||||||
@ -4463,46 +4541,9 @@ networkAllocateActualDevice(virDomainDefPtr dom,
|
|||||||
|
|
||||||
if (networkPlugBandwidth(obj, iface) < 0)
|
if (networkPlugBandwidth(obj, iface) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
break;
|
||||||
|
|
||||||
} else if ((netdef->forward.type == VIR_NETWORK_FORWARD_BRIDGE) &&
|
case VIR_NETWORK_FORWARD_HOSTDEV: {
|
||||||
netdef->bridge) {
|
|
||||||
|
|
||||||
/* <forward type='bridge'/> <bridge name='xxx'/>
|
|
||||||
* is VIR_DOMAIN_NET_TYPE_BRIDGE
|
|
||||||
*/
|
|
||||||
|
|
||||||
iface->data.network.actual->type = actualType = VIR_DOMAIN_NET_TYPE_BRIDGE;
|
|
||||||
if (VIR_STRDUP(iface->data.network.actual->data.bridge.brname,
|
|
||||||
netdef->bridge) < 0)
|
|
||||||
goto error;
|
|
||||||
iface->data.network.actual->data.bridge.macTableManager
|
|
||||||
= netdef->macTableManager;
|
|
||||||
|
|
||||||
/* merge virtualports from interface, network, and portgroup to
|
|
||||||
* arrive at actual virtualport to use
|
|
||||||
*/
|
|
||||||
if (virNetDevVPortProfileMerge3(&iface->data.network.actual->virtPortProfile,
|
|
||||||
iface->virtPortProfile,
|
|
||||||
netdef->virtPortProfile,
|
|
||||||
portgroup
|
|
||||||
? portgroup->virtPortProfile : NULL) < 0) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
virtport = iface->data.network.actual->virtPortProfile;
|
|
||||||
if (virtport) {
|
|
||||||
/* only type='openvswitch' is allowed for bridges */
|
|
||||||
if (virtport->virtPortType != VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
_("<virtualport type='%s'> not supported for network "
|
|
||||||
"'%s' which uses a bridge device"),
|
|
||||||
virNetDevVPortTypeToString(virtport->virtPortType),
|
|
||||||
netdef->name);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (netdef->forward.type == VIR_NETWORK_FORWARD_HOSTDEV) {
|
|
||||||
|
|
||||||
virDomainHostdevSubsysPCIBackendType backend;
|
virDomainHostdevSubsysPCIBackendType backend;
|
||||||
|
|
||||||
iface->data.network.actual->type = actualType = VIR_DOMAIN_NET_TYPE_HOSTDEV;
|
iface->data.network.actual->type = actualType = VIR_DOMAIN_NET_TYPE_HOSTDEV;
|
||||||
@ -4575,32 +4616,67 @@ networkAllocateActualDevice(virDomainDefPtr dom,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
} else if ((netdef->forward.type == VIR_NETWORK_FORWARD_BRIDGE) ||
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
(netdef->forward.type == VIR_NETWORK_FORWARD_PRIVATE) ||
|
if (netdef->bridge) {
|
||||||
(netdef->forward.type == VIR_NETWORK_FORWARD_VEPA) ||
|
/* <forward type='bridge'/> <bridge name='xxx'/>
|
||||||
(netdef->forward.type == VIR_NETWORK_FORWARD_PASSTHROUGH)) {
|
* is VIR_DOMAIN_NET_TYPE_BRIDGE
|
||||||
|
*/
|
||||||
|
|
||||||
|
iface->data.network.actual->type = actualType = VIR_DOMAIN_NET_TYPE_BRIDGE;
|
||||||
|
if (VIR_STRDUP(iface->data.network.actual->data.bridge.brname,
|
||||||
|
netdef->bridge) < 0)
|
||||||
|
goto error;
|
||||||
|
iface->data.network.actual->data.bridge.macTableManager
|
||||||
|
= netdef->macTableManager;
|
||||||
|
|
||||||
|
/* merge virtualports from interface, network, and portgroup to
|
||||||
|
* arrive at actual virtualport to use
|
||||||
|
*/
|
||||||
|
if (virNetDevVPortProfileMerge3(&iface->data.network.actual->virtPortProfile,
|
||||||
|
iface->virtPortProfile,
|
||||||
|
netdef->virtPortProfile,
|
||||||
|
portgroup
|
||||||
|
? portgroup->virtPortProfile : NULL) < 0) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
virtport = iface->data.network.actual->virtPortProfile;
|
||||||
|
if (virtport) {
|
||||||
|
/* only type='openvswitch' is allowed for bridges */
|
||||||
|
if (virtport->virtPortType != VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("<virtualport type='%s'> not supported for network "
|
||||||
|
"'%s' which uses a bridge device"),
|
||||||
|
virNetDevVPortTypeToString(virtport->virtPortType),
|
||||||
|
netdef->name);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* intentionally fall through to the direct case for
|
||||||
|
* VIR_NETWORK_FORWARD_BRIDGE with no bridge device defined
|
||||||
|
*/
|
||||||
|
ATTRIBUTE_FALLTHROUGH;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_PRIVATE:
|
||||||
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
|
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||||
/* <forward type='bridge|private|vepa|passthrough'> are all
|
/* <forward type='bridge|private|vepa|passthrough'> are all
|
||||||
* VIR_DOMAIN_NET_TYPE_DIRECT.
|
* VIR_DOMAIN_NET_TYPE_DIRECT.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Set type=direct and appropriate <source mode='xxx'/> */
|
/* Set type=direct and appropriate <source mode='xxx'/> */
|
||||||
iface->data.network.actual->type = actualType = VIR_DOMAIN_NET_TYPE_DIRECT;
|
iface->data.network.actual->type = actualType = VIR_DOMAIN_NET_TYPE_DIRECT;
|
||||||
switch (netdef->forward.type) {
|
|
||||||
case VIR_NETWORK_FORWARD_BRIDGE:
|
/* NO need to check the value returned from virNetDevMacVLanModeTypeFromString
|
||||||
iface->data.network.actual->data.direct.mode = VIR_NETDEV_MACVLAN_MODE_BRIDGE;
|
* it must be valid for these forward type(bridge|private|vepa|passthrough)
|
||||||
break;
|
*/
|
||||||
case VIR_NETWORK_FORWARD_PRIVATE:
|
iface->data.network.actual->data.direct.mode =
|
||||||
iface->data.network.actual->data.direct.mode = VIR_NETDEV_MACVLAN_MODE_PRIVATE;
|
virNetDevMacVLanModeTypeFromString(virNetworkForwardTypeToString(netdef->forward.type));
|
||||||
break;
|
|
||||||
case VIR_NETWORK_FORWARD_VEPA:
|
|
||||||
iface->data.network.actual->data.direct.mode = VIR_NETDEV_MACVLAN_MODE_VEPA;
|
|
||||||
break;
|
|
||||||
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
|
||||||
iface->data.network.actual->data.direct.mode = VIR_NETDEV_MACVLAN_MODE_PASSTHRU;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* merge virtualports from interface, network, and portgroup to
|
/* merge virtualports from interface, network, and portgroup to
|
||||||
* arrive at actual virtualport to use
|
* arrive at actual virtualport to use
|
||||||
@ -4680,6 +4756,12 @@ networkAllocateActualDevice(virDomainDefPtr dom,
|
|||||||
dev->device.dev) < 0)
|
dev->device.dev) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, netdef->forward.type);
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virNetworkObjMacMgrAdd(obj, driver->dnsmasqStateDir,
|
if (virNetworkObjMacMgrAdd(obj, driver->dnsmasqStateDir,
|
||||||
@ -5037,13 +5119,27 @@ networkReleaseActualDevice(virDomainDefPtr dom,
|
|||||||
}
|
}
|
||||||
netdef = virNetworkObjGetDef(obj);
|
netdef = virNetworkObjGetDef(obj);
|
||||||
|
|
||||||
if (iface->data.network.actual &&
|
switch ((virNetworkForwardType) netdef->forward.type) {
|
||||||
(netdef->forward.type == VIR_NETWORK_FORWARD_NONE ||
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
netdef->forward.type == VIR_NETWORK_FORWARD_NAT ||
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
netdef->forward.type == VIR_NETWORK_FORWARD_ROUTE ||
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
netdef->forward.type == VIR_NETWORK_FORWARD_OPEN) &&
|
case VIR_NETWORK_FORWARD_OPEN:
|
||||||
networkUnplugBandwidth(obj, iface) < 0)
|
if (iface->data.network.actual && networkUnplugBandwidth(obj, iface) < 0)
|
||||||
|
goto error;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
|
case VIR_NETWORK_FORWARD_PRIVATE:
|
||||||
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
|
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||||
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, netdef->forward.type);
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if ((!iface->data.network.actual) ||
|
if ((!iface->data.network.actual) ||
|
||||||
((actualType != VIR_DOMAIN_NET_TYPE_DIRECT) &&
|
((actualType != VIR_DOMAIN_NET_TYPE_DIRECT) &&
|
||||||
|
@ -4545,7 +4545,7 @@ qemuProcessGetNetworkAddress(const char *netname,
|
|||||||
if (!netdef)
|
if (!netdef)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
switch (netdef->forward.type) {
|
switch ((virNetworkForwardType) netdef->forward.type) {
|
||||||
case VIR_NETWORK_FORWARD_NONE:
|
case VIR_NETWORK_FORWARD_NONE:
|
||||||
case VIR_NETWORK_FORWARD_NAT:
|
case VIR_NETWORK_FORWARD_NAT:
|
||||||
case VIR_NETWORK_FORWARD_ROUTE:
|
case VIR_NETWORK_FORWARD_ROUTE:
|
||||||
@ -4582,6 +4582,14 @@ qemuProcessGetNetworkAddress(const char *netname,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_HOSTDEV:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NETWORK_FORWARD_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virNetworkForwardType, netdef->forward.type);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev_name) {
|
if (dev_name) {
|
||||||
|
Loading…
Reference in New Issue
Block a user