From nobody Wed Mar 12 13:36:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 174163749569361.04234641043206; Mon, 10 Mar 2025 13:11:35 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id AB6A11B72; Mon, 10 Mar 2025 16:11:34 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A8BCD182A; Mon, 10 Mar 2025 16:11:14 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 579C6A27; Mon, 10 Mar 2025 16:11:11 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 95CC21B6F for ; Mon, 10 Mar 2025 16:11:07 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-612-At_hLXjsOnKp_h_ltItovw-1; Mon, 10 Mar 2025 16:11:05 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EDF58180AF50 for ; Mon, 10 Mar 2025 20:11:04 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.64.149]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7C90319560B9 for ; Mon, 10 Mar 2025 20:11:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741637467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R47lwR1aLWOipUTfVkBkSo41ClufqxH8iykCKxr2+Ug=; b=a1oCA3GEEuQgONxTsGrMOelvyCy6r6mNdtYKX2jd4tXvCWUkERaiixwSO0sLv96WY5bIYX yVN/aNWJIH9tW/THM+37+e10Q8l12yo3j1o2dBlAJ6AXauEGVElO+yo3qOHWD52FJzpSwQ NWD66AdfCDuJTmtGum0UM/lPu6qn270= X-MC-Unique: At_hLXjsOnKp_h_ltItovw-1 X-Mimecast-MFC-AGG-ID: At_hLXjsOnKp_h_ltItovw_1741637465 From: Laine Stump To: devel@lists.libvirt.org Subject: [PATCH] conf: parse interface/source/@dev for all interface types (with backend type='passt') Date: Mon, 10 Mar 2025 16:11:03 -0400 Message-ID: <20250310201103.488730-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 8aW3xig6mD4JFP6CElQYFQQi081RN7iYa_DRSid-7QU_1741637465 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BM2JUS4LQDIQGWEXNFI4TYVUYXBUDPN5 X-Message-ID-Hash: BM2JUS4LQDIQGWEXNFI4TYVUYXBUDPN5 X-MailFrom: laine@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1741637498100019000 Content-Type: text/plain; charset="utf-8"; x-default="true" The original implementation of the passt backend for vhost-user interfaces erroneously forgot to parse: for interface type=3D'vhostuser', so it wasn't being added to the passt commandline, and also wasn't being saved to the domain config. Now we parse it no matter what the interface type, and then throw an error during validation if source/@dev was specified and backend type !=3D 'passt' (or if interface type !=3D 'user|vhostuser'). Fixes: 1e9054b9c79d721a55f413c2983c5370044f8f60 Resolves: https://issues.redhat.com/browse/RHEL-82539 Signed-off-by: Laine Stump Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 10 +++++++--- src/conf/domain_validate.c | 5 +++++ .../net-vhostuser-passt.x86_64-latest.xml | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d555873848..5daa1f89e8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9938,14 +9938,18 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, break; =20 case VIR_DOMAIN_NET_TYPE_USER: - def->sourceDev =3D virXMLPropString(source_node, "dev"); - break; - case VIR_DOMAIN_NET_TYPE_NULL: case VIR_DOMAIN_NET_TYPE_LAST: break; } =20 + /* source/@dev is used for two different interface types and *not* + * stored inside the union, so we can parse it out always, and + * then log an error during validation if it was specified for one + * of the interface types that doesn't support it. + */ + def->sourceDev =3D virXMLPropString(source_node, "dev"); + if ((virtualport_node =3D virXPathNode("./virtualport", ctxt))) { if (virtualport_flags =3D=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index f2a98f143d..9de442d7d7 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -2196,6 +2196,11 @@ virDomainNetDefValidate(const virDomainNetDef *net) } } =20 + if (net->sourceDev && net->backend.type !=3D VIR_DOMAIN_NET_BACKEND_PA= SST) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("The 'dev' attribute of the element can = only be used with interface type=3D'user' or type=3D'vhostuser' and backend= =3D'passt'.")); + } + if (net->nPortForwards > 0) { size_t p; =20 diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml b/= tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml index a1f9366722..529aff11f8 100644 --- a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml +++ b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml @@ -33,6 +33,7 @@ + @@ -63,6 +64,7 @@ +
--=20 2.48.1