From nobody Mon Feb 9 00:43:48 2026 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=solinno.co.uk Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1745509919825307.1343610939648; Thu, 24 Apr 2025 08:51:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id DBF48B39; Thu, 24 Apr 2025 11:51:58 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 470ECAD4; Thu, 24 Apr 2025 11:51:40 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2412AA2A; Thu, 24 Apr 2025 11:51:36 -0400 (EDT) Received: from doppler.solinno.uk (doppler.solinno.uk [81.2.106.178]) (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 D93A4A17 for ; Thu, 24 Apr 2025 11:51:34 -0400 (EDT) Received: from plato.solinno.co.uk (2.0.0.0.3.7.0.0.3.1.0.0.0.1.0.0.0.5.4.f.6.f.d.1.0.b.8.0.1.0.0.2.ip6.arpa [IPv6:2001:8b0:1df6:f450:10:13:73:2]) by doppler.solinno.uk (Postfix) with ESMTPSA id D734660FD2; Thu, 24 Apr 2025 16:44:12 +0100 (BST) Received: by plato.solinno.co.uk (Postfix, from userid 1000) id 8917B43; Thu, 24 Apr 2025 16:44:12 +0100 (BST) 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_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 X-Greylist: delayed 440 seconds by postgrey-1.37 at lists.libvirt.org; Thu, 24 Apr 2025 11:51:34 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=solinno.co.uk; s=mail; t=1745509452; bh=pA6d4sJ2e6i+uTZpMybKIjTx3BwO1IZiI4WWupaYQpc=; h=From:To:Cc:Subject:Date:From; b=hrPYgAfqKRSmWafII8elo+XQCBw1i4lh3we66LLUSCmeCfkWyd7XbHX+q8noNXhdw exa+RwoSvdYVEFGfHyFEzaNThc8VlOcgkFlfPhkA5pdzVFvAjXIYvmLNKEzbfCkEb7 o9Q1MXQV+Z45P5ZCaN7cX7qDRF8qxg3ei/Kt02rA= From: Leigh Brown To: devel@lists.libvirt.org Subject: [PATCH] conf: Fix handling of vlan with one tagged vlan id Date: Thu, 24 Apr 2025 16:43:44 +0100 Message-ID: <20250424154346.36884-1-leigh@solinno.co.uk> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NPBYV4D6VC46RLSY5T332LIODBGFARFT X-Message-ID-Hash: NPBYV4D6VC46RLSY5T332LIODBGFARFT X-MailFrom: leigh@solinno.co.uk 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 CC: Leigh Brown , Laine Stump , Yanqiu Zhang 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 (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1745509923382019100 Content-Type: text/plain; charset="utf-8" Yanqiu Zhang reported [1] that when a vlan is defined with a single vlan id and native mode set to tagged, the vlan was not setup correctly using the standard Linux bridge functionality. This is due a conflict between the XML validation and the bridge functionality. The XML validation will allow a single vlan id to be configured with native mode set to tagged without setting the vlan mode to trunked. If the vlan is explicitly set to "trunk=3D'no'" then the validation will correctly reject the configuration. Rather than force the user to specify "trunk=3D'yes'", update the code to infer trunk=3D'yes' if a single vlan id is configured with native mode set to a non-default value. It already infers trunk=3D'yes' if more than one vlan id is specified. Reported-by: Yanqiu Zhang Closes: https://gitlab.com/libvirt/libvirt/-/issues/767 [1] Signed-off-by: Leigh Brown --- src/conf/netdev_vlan_conf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/conf/netdev_vlan_conf.c b/src/conf/netdev_vlan_conf.c index 1ac66aec54..300d0d8e86 100644 --- a/src/conf/netdev_vlan_conf.c +++ b/src/conf/netdev_vlan_conf.c @@ -87,12 +87,13 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr = ctxt, virNetDevVlan *def) =20 def->nTags =3D nTags; =20 - /* now that we know how many tags there are, look for an explicit - * trunk setting. + /* In case the trunk attribute is not specified, infer it from + * the number of tags or use of native vlan mode. */ - if (nTags > 1) + if (nTags > 1 || def->nativeMode !=3D 0) def->trunk =3D true; =20 + /* Look for and validate an explicit trunk setting. */ ctxt->node =3D node; if ((trunk =3D virXPathString("string(./@trunk)", ctxt)) !=3D NULL) { def->trunk =3D STRCASEEQ(trunk, "yes"); --=20 2.49.0