From nobody Tue Jan 21 07:25:04 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=solinno.co.uk Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 173636495060696.2995603642321; Wed, 8 Jan 2025 11:35:50 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id A505E1389; Wed, 8 Jan 2025 14:35:49 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 817DF132C; Wed, 8 Jan 2025 14:34:11 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id CAAA0E89; Wed, 8 Jan 2025 14:34:02 -0500 (EST) 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 874D311AC for ; Wed, 8 Jan 2025 14:34:01 -0500 (EST) Received: from plato.solinno.co.uk (plato.dyn.solinno.co.uk [192.168.2.203]) by doppler.solinno.uk (Postfix) with ESMTPSA id 9BFC562048; Wed, 8 Jan 2025 19:34:00 +0000 (GMT) Received: by plato.solinno.co.uk (Postfix, from userid 1000) id 65F4246; Wed, 08 Jan 2025 19:34:16 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=solinno.co.uk; s=mail; t=1736364840; bh=ckmnjWL4y8UMNhfcw/dicym2YVDGLCUCRE8pEIzUlzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S+B7WfqKwy0nDtN3pbdVAG1UFFu+lP6RjmDPEuAYVIkAAtBS5rwSL9c4pv3e3SeUx l1DkwPrNH/EX/t3yBa5K49BmGJFBU13y1VqTMOqB1xeH/yadDjscQbwSpG6Eawjic5 A8onWAFyWWQ6zEXpQ3uHya3yPHdY8iZUCksSconk= From: Leigh Brown To: devel@lists.libvirt.org, Laine Stump Subject: [PATCH v5 3/4] Enable vlan support for standard linux bridges Date: Wed, 8 Jan 2025 19:34:14 +0000 Message-ID: <20250108193415.200555-4-leigh@solinno.co.uk> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250108193415.200555-1-leigh@solinno.co.uk> References: <20250108193415.200555-1-leigh@solinno.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IJ5DUIP4BTU7IK2OOMPPP4UKTYUBQR55 X-Message-ID-Hash: IJ5DUIP4BTU7IK2OOMPPP4UKTYUBQR55 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 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: 1736364952514116600 Content-Type: text/plain; charset="utf-8" Adjust domain and network validation to permit standard linux bridges to allow vlan configuration. Update calls to virNetDevBridgeAddPort to pass the vlan configuration. Signed-off-by: Leigh Brown Reviewed-by: Laine Stump --- src/conf/domain_validate.c | 3 ++- src/lxc/lxc_process.c | 2 +- src/network/bridge_driver.c | 13 ++++++++----- src/util/virnetdevtap.c | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 1034bb57f5..61c83e25de 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -2077,7 +2077,8 @@ virDomainActualNetDefValidate(const virDomainNetDef *= net) (actualType =3D=3D VIR_DOMAIN_NET_TYPE_DIRECT && virDomainNetGetActualDirectMode(net) =3D=3D VIR_NETDEV_MACV= LAN_MODE_PASSTHRU) || (actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE && - vport && vport->virtPortType =3D=3D VIR_NETDEV_VPORT_PROFI= LE_OPENVSWITCH))) { + vport && vport->virtPortType =3D=3D VIR_NETDEV_VPORT_PROFIL= E_OPENVSWITCH) || + (!vport && actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("interface %1$s - vlan tag not supported for = this connection type"), macstr); diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 7c760cec40..d785244dde 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -289,7 +289,7 @@ virLXCProcessSetupInterfaceTap(virDomainDef *vm, vport, virDomainNetGetActualVl= an(net)) < 0) return NULL; } else { - if (virNetDevBridgeAddPort(brname, parentVeth, NULL) < 0) + if (virNetDevBridgeAddPort(brname, parentVeth, virDomainNetGet= ActualVlan(net)) < 0) return NULL; =20 if (virDomainNetGetActualPortOptionsIsolated(net) =3D=3D VIR_T= RISTATE_BOOL_YES && diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index ce793c12ef..8f47ef2574 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2999,7 +2999,8 @@ networkValidate(virNetworkDriverState *driver, =20 /* The only type of networks that currently support transparent * vlan configuration are those using hostdev sr-iov devices from - * a pool, and those using an Open vSwitch bridge. + * a pool, those using an Open vSwitch bridge, and standard linux + * bridges. */ =20 vlanAllowed =3D (def->forward.type =3D=3D VIR_NETWORK_FORWARD_HOSTDEV = || @@ -3007,15 +3008,17 @@ networkValidate(virNetworkDriverState *driver, (def->forward.type =3D=3D VIR_NETWORK_FORWARD_BRIDGE && def->virtPortProfile && def->virtPortProfile->virtPortType - =3D=3D VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)); + =3D=3D VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) || + (def->forward.type =3D=3D VIR_NETWORK_FORWARD_BRIDGE && + !def->virtPortProfile)); =20 vlanUsed =3D def->vlan.nTags > 0; for (i =3D 0; i < def->nPortGroups; i++) { if (vlanUsed || def->portGroups[i].vlan.nTags > 0) { /* anyone using this portgroup will get a vlan tag. Verify - * that they will also be using an openvswitch connection, - * as that is the only type of network that currently - * supports a vlan tag. + * that they will also be using an openvswitch connection + * or a standard linux bridge as they are the only types of + * network that currently support a vlan tag. */ if (def->portGroups[i].virtPortProfile) { if (def->forward.type !=3D VIR_NETWORK_FORWARD_BRIDGE || diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c index a9573eb8e1..1dc77f0f5c 100644 --- a/src/util/virnetdevtap.c +++ b/src/util/virnetdevtap.c @@ -483,7 +483,7 @@ virNetDevTapAttachBridge(const char *tapname, return -1; } } else { - if (virNetDevBridgeAddPort(brname, tapname, NULL) < 0) + if (virNetDevBridgeAddPort(brname, tapname, virtVlan) < 0) return -1; =20 if (isolatedPort =3D=3D VIR_TRISTATE_BOOL_YES && --=20 2.39.5