|
|
3e5111 |
From 39de2f3c6d425c6444cf1aea43baf203aacf5df4 Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <39de2f3c6d425c6444cf1aea43baf203aacf5df4@dist-git>
|
|
|
3e5111 |
From: Laine Stump <laine@laine.org>
|
|
|
3e5111 |
Date: Tue, 2 May 2017 12:33:12 -0400
|
|
|
3e5111 |
Subject: [PATCH] util: rename/move VIR_NET_GENERATED_PREFIX to be consistent
|
|
|
3e5111 |
|
|
|
3e5111 |
... with VIR_NET_GENERATED_MACV???_PREFIX, which is defined in
|
|
|
3e5111 |
util/virnetdevmacvlan.h.
|
|
|
3e5111 |
|
|
|
3e5111 |
Since VIR_NET_GENERATED_PREFIX is used for plain tap devices, it is
|
|
|
3e5111 |
renamed to VIR_NET_GENERATED_TAP_PREFIX and moved to virnetdev.h
|
|
|
3e5111 |
|
|
|
3e5111 |
(cherry picked from commit 30e672301dd16e0433e23864e21dcc9d0c311e8c)
|
|
|
3e5111 |
|
|
|
3e5111 |
https://bugzilla.redhat.com/1335798
|
|
|
3e5111 |
|
|
|
3e5111 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
---
|
|
|
3e5111 |
src/bhyve/bhyve_command.c | 4 ++--
|
|
|
3e5111 |
src/conf/domain_conf.c | 4 ++--
|
|
|
3e5111 |
src/conf/domain_conf.h | 4 ----
|
|
|
3e5111 |
src/interface/interface_backend_udev.c | 2 +-
|
|
|
3e5111 |
src/qemu/qemu_interface.c | 8 ++++----
|
|
|
3e5111 |
src/uml/uml_conf.c | 4 ++--
|
|
|
3e5111 |
src/util/virnetdev.h | 5 +++++
|
|
|
3e5111 |
7 files changed, 16 insertions(+), 15 deletions(-)
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
|
|
|
3e5111 |
index e9c072b9f..eae5cb3ca 100644
|
|
|
3e5111 |
--- a/src/bhyve/bhyve_command.c
|
|
|
3e5111 |
+++ b/src/bhyve/bhyve_command.c
|
|
|
3e5111 |
@@ -88,10 +88,10 @@ bhyveBuildNetArgStr(virConnectPtr conn,
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
if (!net->ifname ||
|
|
|
3e5111 |
- STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
|
|
|
3e5111 |
+ STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
|
|
|
3e5111 |
strchr(net->ifname, '%')) {
|
|
|
3e5111 |
VIR_FREE(net->ifname);
|
|
|
3e5111 |
- if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
|
|
|
3e5111 |
+ if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
3e5111 |
index 84a8a94e5..1653aa61d 100644
|
|
|
3e5111 |
--- a/src/conf/domain_conf.c
|
|
|
3e5111 |
+++ b/src/conf/domain_conf.c
|
|
|
3e5111 |
@@ -9733,7 +9733,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|
|
3e5111 |
ifname = virXMLPropString(cur, "dev");
|
|
|
3e5111 |
if (ifname &&
|
|
|
3e5111 |
(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
|
|
|
3e5111 |
- (STRPREFIX(ifname, VIR_NET_GENERATED_PREFIX) ||
|
|
|
3e5111 |
+ (STRPREFIX(ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
|
|
|
3e5111 |
(prefix && STRPREFIX(ifname, prefix)))) {
|
|
|
3e5111 |
/* An auto-generated target name, blank it out */
|
|
|
3e5111 |
VIR_FREE(ifname);
|
|
|
3e5111 |
@@ -22139,7 +22139,7 @@ virDomainNetDefFormat(virBufferPtr buf,
|
|
|
3e5111 |
|
|
|
3e5111 |
if (def->ifname &&
|
|
|
3e5111 |
!((flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) &&
|
|
|
3e5111 |
- (STRPREFIX(def->ifname, VIR_NET_GENERATED_PREFIX) ||
|
|
|
3e5111 |
+ (STRPREFIX(def->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
|
|
|
3e5111 |
(prefix && STRPREFIX(def->ifname, prefix))))) {
|
|
|
3e5111 |
/* Skip auto-generated target names for inactive config. */
|
|
|
3e5111 |
virBufferEscapeString(buf, "<target dev='%s'/>\n", def->ifname);
|
|
|
3e5111 |
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
|
3e5111 |
index c91791262..f1e9fc2ba 100644
|
|
|
3e5111 |
--- a/src/conf/domain_conf.h
|
|
|
3e5111 |
+++ b/src/conf/domain_conf.h
|
|
|
3e5111 |
@@ -1041,10 +1041,6 @@ struct _virDomainNetDef {
|
|
|
3e5111 |
virNetDevCoalescePtr coalesce;
|
|
|
3e5111 |
};
|
|
|
3e5111 |
|
|
|
3e5111 |
-/* Used for prefix of ifname of any network name generated dynamically
|
|
|
3e5111 |
- * by libvirt, and cannot be used for a persistent network name. */
|
|
|
3e5111 |
-# define VIR_NET_GENERATED_PREFIX "vnet"
|
|
|
3e5111 |
-
|
|
|
3e5111 |
typedef enum {
|
|
|
3e5111 |
VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT = 0,
|
|
|
3e5111 |
VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED,
|
|
|
3e5111 |
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
|
|
|
3e5111 |
index 18a45fa85..1cd84060a 100644
|
|
|
3e5111 |
--- a/src/interface/interface_backend_udev.c
|
|
|
3e5111 |
+++ b/src/interface/interface_backend_udev.c
|
|
|
3e5111 |
@@ -570,7 +570,7 @@ udevBridgeScanDirFilter(const struct dirent *entry)
|
|
|
3e5111 |
* vnet%d. Improvements to this check are welcome.
|
|
|
3e5111 |
*/
|
|
|
3e5111 |
if (strlen(entry->d_name) >= 5) {
|
|
|
3e5111 |
- if (STRPREFIX(entry->d_name, VIR_NET_GENERATED_PREFIX) &&
|
|
|
3e5111 |
+ if (STRPREFIX(entry->d_name, VIR_NET_GENERATED_TAP_PREFIX) &&
|
|
|
3e5111 |
c_isdigit(entry->d_name[4]))
|
|
|
3e5111 |
return 0;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
|
|
|
3e5111 |
index 2057ac929..c643b76ec 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_interface.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_interface.c
|
|
|
3e5111 |
@@ -428,10 +428,10 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def,
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
if (!net->ifname ||
|
|
|
3e5111 |
- STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
|
|
|
3e5111 |
+ STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
|
|
|
3e5111 |
strchr(net->ifname, '%')) {
|
|
|
3e5111 |
VIR_FREE(net->ifname);
|
|
|
3e5111 |
- if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
|
|
|
3e5111 |
+ if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
/* avoid exposing vnet%d in getXMLDesc or error outputs */
|
|
|
3e5111 |
template_ifname = true;
|
|
|
3e5111 |
@@ -528,10 +528,10 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
if (!net->ifname ||
|
|
|
3e5111 |
- STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
|
|
|
3e5111 |
+ STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
|
|
|
3e5111 |
strchr(net->ifname, '%')) {
|
|
|
3e5111 |
VIR_FREE(net->ifname);
|
|
|
3e5111 |
- if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
|
|
|
3e5111 |
+ if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
/* avoid exposing vnet%d in getXMLDesc or error outputs */
|
|
|
3e5111 |
template_ifname = true;
|
|
|
3e5111 |
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
|
|
|
3e5111 |
index bdef78324..9bd4f1187 100644
|
|
|
3e5111 |
--- a/src/uml/uml_conf.c
|
|
|
3e5111 |
+++ b/src/uml/uml_conf.c
|
|
|
3e5111 |
@@ -112,10 +112,10 @@ umlConnectTapDevice(virDomainDefPtr vm,
|
|
|
3e5111 |
int tapfd = -1;
|
|
|
3e5111 |
|
|
|
3e5111 |
if (!net->ifname ||
|
|
|
3e5111 |
- STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
|
|
|
3e5111 |
+ STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
|
|
|
3e5111 |
strchr(net->ifname, '%')) {
|
|
|
3e5111 |
VIR_FREE(net->ifname);
|
|
|
3e5111 |
- if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
|
|
|
3e5111 |
+ if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
|
|
|
3e5111 |
goto error;
|
|
|
3e5111 |
/* avoid exposing vnet%d in getXMLDesc or error outputs */
|
|
|
3e5111 |
template_ifname = true;
|
|
|
3e5111 |
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
|
|
|
3e5111 |
index cff8cb51c..97236c170 100644
|
|
|
3e5111 |
--- a/src/util/virnetdev.h
|
|
|
3e5111 |
+++ b/src/util/virnetdev.h
|
|
|
3e5111 |
@@ -37,6 +37,11 @@ typedef struct ifreq virIfreq;
|
|
|
3e5111 |
typedef void virIfreq;
|
|
|
3e5111 |
# endif
|
|
|
3e5111 |
|
|
|
3e5111 |
+/* Used for prefix of ifname of any tap device name generated
|
|
|
3e5111 |
+ * dynamically by libvirt, cannot be used for a persistent network name.
|
|
|
3e5111 |
+ */
|
|
|
3e5111 |
+# define VIR_NET_GENERATED_TAP_PREFIX "vnet"
|
|
|
3e5111 |
+
|
|
|
3e5111 |
typedef enum {
|
|
|
3e5111 |
VIR_NETDEV_RX_FILTER_MODE_NONE = 0,
|
|
|
3e5111 |
VIR_NETDEV_RX_FILTER_MODE_NORMAL,
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.12.2
|
|
|
3e5111 |
|