mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
util: rename/move VIR_NET_GENERATED_PREFIX to be consistent
... with VIR_NET_GENERATED_MACV???_PREFIX, which is defined in util/virnetdevmacvlan.h. Since VIR_NET_GENERATED_PREFIX is used for plain tap devices, it is renamed to VIR_NET_GENERATED_TAP_PREFIX and moved to virnetdev.h
This commit is contained in:
parent
9cb891141c
commit
30e672301d
@ -88,10 +88,10 @@ bhyveBuildNetArgStr(virConnectPtr conn,
|
||||
}
|
||||
|
||||
if (!net->ifname ||
|
||||
STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
|
||||
STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
|
||||
strchr(net->ifname, '%')) {
|
||||
VIR_FREE(net->ifname);
|
||||
if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
|
||||
if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -9746,7 +9746,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
ifname = virXMLPropString(cur, "dev");
|
||||
if (ifname &&
|
||||
(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
|
||||
(STRPREFIX(ifname, VIR_NET_GENERATED_PREFIX) ||
|
||||
(STRPREFIX(ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
|
||||
(prefix && STRPREFIX(ifname, prefix)))) {
|
||||
/* An auto-generated target name, blank it out */
|
||||
VIR_FREE(ifname);
|
||||
@ -22162,7 +22162,7 @@ virDomainNetDefFormat(virBufferPtr buf,
|
||||
|
||||
if (def->ifname &&
|
||||
!((flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) &&
|
||||
(STRPREFIX(def->ifname, VIR_NET_GENERATED_PREFIX) ||
|
||||
(STRPREFIX(def->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
|
||||
(prefix && STRPREFIX(def->ifname, prefix))))) {
|
||||
/* Skip auto-generated target names for inactive config. */
|
||||
virBufferEscapeString(buf, "<target dev='%s'/>\n", def->ifname);
|
||||
|
@ -1041,10 +1041,6 @@ struct _virDomainNetDef {
|
||||
virNetDevCoalescePtr coalesce;
|
||||
};
|
||||
|
||||
/* Used for prefix of ifname of any network name generated dynamically
|
||||
* by libvirt, and cannot be used for a persistent network name. */
|
||||
# define VIR_NET_GENERATED_PREFIX "vnet"
|
||||
|
||||
typedef enum {
|
||||
VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT = 0,
|
||||
VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED,
|
||||
|
@ -570,7 +570,7 @@ udevBridgeScanDirFilter(const struct dirent *entry)
|
||||
* vnet%d. Improvements to this check are welcome.
|
||||
*/
|
||||
if (strlen(entry->d_name) >= 5) {
|
||||
if (STRPREFIX(entry->d_name, VIR_NET_GENERATED_PREFIX) &&
|
||||
if (STRPREFIX(entry->d_name, VIR_NET_GENERATED_TAP_PREFIX) &&
|
||||
c_isdigit(entry->d_name[4]))
|
||||
return 0;
|
||||
}
|
||||
|
@ -428,10 +428,10 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
if (!net->ifname ||
|
||||
STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
|
||||
STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
|
||||
strchr(net->ifname, '%')) {
|
||||
VIR_FREE(net->ifname);
|
||||
if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
|
||||
if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
|
||||
goto cleanup;
|
||||
/* avoid exposing vnet%d in getXMLDesc or error outputs */
|
||||
template_ifname = true;
|
||||
@ -528,10 +528,10 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
if (!net->ifname ||
|
||||
STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
|
||||
STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
|
||||
strchr(net->ifname, '%')) {
|
||||
VIR_FREE(net->ifname);
|
||||
if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
|
||||
if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
|
||||
goto cleanup;
|
||||
/* avoid exposing vnet%d in getXMLDesc or error outputs */
|
||||
template_ifname = true;
|
||||
|
@ -112,10 +112,10 @@ umlConnectTapDevice(virDomainDefPtr vm,
|
||||
int tapfd = -1;
|
||||
|
||||
if (!net->ifname ||
|
||||
STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
|
||||
STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
|
||||
strchr(net->ifname, '%')) {
|
||||
VIR_FREE(net->ifname);
|
||||
if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
|
||||
if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
|
||||
goto error;
|
||||
/* avoid exposing vnet%d in getXMLDesc or error outputs */
|
||||
template_ifname = true;
|
||||
|
@ -37,6 +37,11 @@ typedef struct ifreq virIfreq;
|
||||
typedef void virIfreq;
|
||||
# endif
|
||||
|
||||
/* Used for prefix of ifname of any tap device name generated
|
||||
* dynamically by libvirt, cannot be used for a persistent network name.
|
||||
*/
|
||||
# define VIR_NET_GENERATED_TAP_PREFIX "vnet"
|
||||
|
||||
typedef enum {
|
||||
VIR_NETDEV_RX_FILTER_MODE_NONE = 0,
|
||||
VIR_NETDEV_RX_FILTER_MODE_NORMAL,
|
||||
|
Loading…
Reference in New Issue
Block a user