From nobody Sun Feb 8 03:58:30 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1548279202255771.575643508521; Wed, 23 Jan 2019 13:33:22 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 698CB2CD80F; Wed, 23 Jan 2019 21:33:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C2BD26348; Wed, 23 Jan 2019 21:33:19 +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 9FC3E3F7D0; Wed, 23 Jan 2019 21:33:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXFl1032243 for ; Wed, 23 Jan 2019 16:33:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 88CA1BA50; Wed, 23 Jan 2019 21:33:15 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1AD167141; Wed, 23 Jan 2019 21:33:14 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:29 -0500 Message-Id: <3ef0b006becbb1912099ab98ce77f5b4de7232bf.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 01/25] conf: Set net->model earlier 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 23 Jan 2019 21:33:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" So later code can more easily access def->model Signed-off-by: Cole Robinson Reviewed-by: Andrea Bolognani --- src/conf/domain_conf.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 54d6364f4f..564248e021 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11305,6 +11305,22 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo= pt, goto error; } =20 + /* NIC model (see -net nic,model=3D?). We only check that it looks + * reasonable, not that it is a supported NIC type. FWIW kvm + * supports these types as of April 2008: + * i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio + * QEMU PPC64 supports spapr-vlan + */ + if (model !=3D NULL) { + if (strspn(model, NET_MODEL_CHARS) < strlen(model)) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Model name contains invalid characters")); + goto error; + } + def->model =3D model; + model =3D NULL; + } + switch (def->type) { case VIR_DOMAIN_NET_TYPE_NETWORK: if (network =3D=3D NULL) { @@ -11322,7 +11338,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop= t, break; =20 case VIR_DOMAIN_NET_TYPE_VHOSTUSER: - if (STRNEQ_NULLABLE(model, "virtio")) { + if (STRNEQ_NULLABLE(def->model, "virtio")) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Wrong or no 'type' attribute " "specified with . " @@ -11550,22 +11566,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo= pt, ifname_guest_actual =3D NULL; } =20 - /* NIC model (see -net nic,model=3D?). We only check that it looks - * reasonable, not that it is a supported NIC type. FWIW kvm - * supports these types as of April 2008: - * i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio - * QEMU PPC64 supports spapr-vlan - */ - if (model !=3D NULL) { - if (strspn(model, NET_MODEL_CHARS) < strlen(model)) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("Model name contains invalid characters")); - goto error; - } - def->model =3D model; - model =3D NULL; - } - if (def->type !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV && STREQ_NULLABLE(def->model, "virtio")) { if (backend !=3D NULL) { --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list