From nobody Fri May 3 09:38:51 2024 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 1490580766321147.43041229049584; Sun, 26 Mar 2017 19:12:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A7DCC03BD6C; Mon, 27 Mar 2017 02:12:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 40F91189CE; Mon, 27 Mar 2017 02:12:45 +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 4093F4E9BD; Mon, 27 Mar 2017 02:12:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2R25Nho014093 for ; Sun, 26 Mar 2017 22:05:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id A03C418B41; Mon, 27 Mar 2017 02:05:23 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B625189CE for ; Mon, 27 Mar 2017 02:05:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6A7DCC03BD6C 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 6A7DCC03BD6C From: Laine Stump To: libvir-list@redhat.com Date: Sun, 26 Mar 2017 22:05:18 -0400 Message-Id: <20170327020518.13560-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] conf: don't ignore for macvtap interfaces 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 27 Mar 2017 02:12:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The parser had been clearing out *all* suggested device names for type=3D'direct' (aka macvtap) interfaces. All of the code implementing macvtap allows for a user-specified device name, so we should allow it. In the case that an interface name starts with "macvtap" or "macvlan" though, we do still clear it out, just as we do with "vnet" (which is the prefix used for automatically generated tap device names), since those are the prefixes for the names we autogenerate for macvtap and macvlan devices. Resolves: https://bugzilla.redhat.com/1335798 --- docs/formatdomain.html.in | 6 +++--- src/conf/domain_conf.c | 6 +++++- src/conf/domain_conf.h | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 4a3123e..8a2294f 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5125,9 +5125,9 @@ qemu-kvm -net nic,model=3D? /dev/null If no target is specified, certain hypervisors will automatically generate a name for the created tun device. This name can be manually specified, however the name should not - start with either 'vnet' or 'vif', which are prefixes - reserved by libvirt and certain hypervisors. Manually specified - targets using these prefixes may be ignored. + start with either 'vnet', 'vif', 'macvtap', or 'macvlan', + which are prefixes reserved by libvirt and certain hypervisors. + Manually specified targets using these prefixes may be ignored.

=20

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2139ab0..4b80018 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9826,8 +9826,12 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, def->data.direct.linkdev =3D dev; dev =3D NULL; =20 - if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) + if (ifname && + flags & VIR_DOMAIN_DEF_PARSE_INACTIVE && + (STRPREFIX(ifname, VIR_NET_GENERATED_MACVTAP_PREFIX) || + STRPREFIX(ifname, VIR_NET_GENERATED_MACVTAP_PREFIX))) { VIR_FREE(ifname); + } =20 break; =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8e6d874..38a15f1 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1033,6 +1033,10 @@ struct _virDomainNetDef { * by libvirt, and cannot be used for a persistent network name. */ # define VIR_NET_GENERATED_PREFIX "vnet" =20 +/* except to macvtap/macvlan interfaces, which start with "macv(tap|lan) */ +# define VIR_NET_GENERATED_MACVTAP_PREFIX "macvtap" +# define VIR_NET_GENERATED_MACVLAN_PREFIX "macvlan" + typedef enum { VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT =3D 0, VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED, --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list