From nobody Wed Feb 11 07:10:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1493146252773543.4827685581829; Tue, 25 Apr 2017 11:50:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 67287C03BD62; Tue, 25 Apr 2017 18:50:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DFFD7BE40; Tue, 25 Apr 2017 18:50:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E8CAE18523D4; Tue, 25 Apr 2017 18:50:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3PIoiiZ030939 for ; Tue, 25 Apr 2017 14:50:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E7D47F599; Tue, 25 Apr 2017 18:50:44 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-65.phx2.redhat.com [10.3.116.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2FF417CC1; Tue, 25 Apr 2017 18:50:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 67287C03BD62 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=laine.org Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 67287C03BD62 From: Laine Stump To: libvir-list@redhat.com Date: Tue, 25 Apr 2017 14:50:37 -0400 Message-Id: <20170425185037.14805-4-laine@laine.org> In-Reply-To: <20170425185037.14805-1-laine@laine.org> References: <20170425185037.14805-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Martin Kletzander Subject: [libvirt] [PATCH v2 3/3] util: rename/move VIR_NET_GENERATED_PREFIX to be consistent X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 25 Apr 2017 18:50:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" ... 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 --- src/bhyve/bhyve_command.c | 4 ++-- src/conf/domain_conf.c | 4 ++-- src/conf/domain_conf.h | 4 ---- src/interface/interface_backend_udev.c | 2 +- src/qemu/qemu_interface.c | 8 ++++---- src/uml/uml_conf.c | 4 ++-- src/util/virnetdev.h | 5 +++++ 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index e9c072b..eae5cb3 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -88,10 +88,10 @@ bhyveBuildNetArgStr(virConnectPtr conn, } =20 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; } =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 36644b8..236e028 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9745,7 +9745,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, ifname =3D 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); @@ -22150,7 +22150,7 @@ virDomainNetDefFormat(virBufferPtr buf, =20 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, "\n", def->ifname); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 3b6b174..95848f7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1040,10 +1040,6 @@ struct _virDomainNetDef { virNetDevCoalescePtr coalesce; }; =20 -/* 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 =3D 0, VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED, diff --git a/src/interface/interface_backend_udev.c b/src/interface/interfa= ce_backend_udev.c index 18a45fa..1cd8406 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -570,7 +570,7 @@ udevBridgeScanDirFilter(const struct dirent *entry) * vnet%d. Improvements to this check are welcome. */ if (strlen(entry->d_name) >=3D 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; } diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index d0850c0..d8a678b 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -428,10 +428,10 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def, } =20 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 =3D true; @@ -528,10 +528,10 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def, } =20 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 =3D true; diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index bdef783..9bd4f11 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -112,10 +112,10 @@ umlConnectTapDevice(virDomainDefPtr vm, int tapfd =3D -1; =20 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 =3D true; diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h index 19036cc..c7494cd 100644 --- a/src/util/virnetdev.h +++ b/src/util/virnetdev.h @@ -37,6 +37,11 @@ typedef struct ifreq virIfreq; typedef void virIfreq; # endif =20 +/* 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 =3D 0, VIR_NETDEV_RX_FILTER_MODE_NORMAL, --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list