From nobody Sun Dec 22 08:11:13 2024 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 173469086146362.19629989117027; Fri, 20 Dec 2024 02:34:21 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 66B3217AA; Fri, 20 Dec 2024 05:34:20 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 40824176D; Fri, 20 Dec 2024 05:33:10 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 76FC01548; Fri, 20 Dec 2024 05:33:04 -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 7791312A3 for ; Fri, 20 Dec 2024 05:33:02 -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 9CFF120B77; Fri, 20 Dec 2024 10:33:00 +0000 (GMT) Received: by plato.solinno.co.uk (Postfix, from userid 1000) id C09C646; Fri, 20 Dec 2024 10:33:05 +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=1734690780; bh=KFTVjX6iyuexa1uYuWJHDYsYSmK85FMLH88eP6KBrXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R8gcm2EncFvot/bZrQZshCAKRlS2/9kF462xBQ3O0B/m+jRpTZRWoOA2DrjEOAIni 8pW8ESr+JpZYOll/nt7CiDuNZWQsfuY8K/6sv8nEhPeMyqjnLouDT+sIefHh5Lz1Ib /8iX/UEyRYOs5Dd4cuZPxbrJBR/bGM/9K/ZOHC8k= From: Leigh Brown To: devel@lists.libvirt.org Subject: [RFC v2 PATCH 3/4] Enable vlan support for standard linux bridges Date: Fri, 20 Dec 2024 10:33:03 +0000 Message-ID: <20241220103304.29496-4-leigh@solinno.co.uk> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241220103304.29496-1-leigh@solinno.co.uk> References: <20241220103304.29496-1-leigh@solinno.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: VWTUKEOIGLIZKBGHGSSVT5QMQSEZY25F X-Message-ID-Hash: VWTUKEOIGLIZKBGHGSSVT5QMQSEZY25F 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: 1734690862118116600 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 --- src/conf/domain_validate.c | 3 ++- src/lxc/lxc_process.c | 3 ++- src/network/bridge_driver.c | 13 ++++++++----- src/util/virnetdevtap.c | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 1034bb57f5..c7a79a0277 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_PROFI= LE_OPENVSWITCH) || + (actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE && !vport))) { 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 2a91896328..7c8dc703ca 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -290,7 +290,8 @@ virLXCProcessSetupInterfaceTap(virDomainDef *vm, vport, virDomainNetGetActualVl= an(net)) < 0) return NULL; } else { - if (virNetDevBridgeAddPort(brname, parentVeth, NULL) < 0) + if (virNetDevBridgeAddPort(brname, parentVeth, + virDomainNetGetActualVlan(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 e700a614a9..7ce943aabc 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2997,7 +2997,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 = || @@ -3005,15 +3006,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