From nobody Sun Dec 22 08:09:36 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 1734690813517335.3783219334978; Fri, 20 Dec 2024 02:33:33 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 792EC165D; Fri, 20 Dec 2024 05:33:32 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D16641554; Fri, 20 Dec 2024 05:33:07 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 0236815A2; 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 762C01550 for ; Fri, 20 Dec 2024 05:33:02 -0500 (EST) Received: from plato.solinno.co.uk (e.d.1.4.d.2.c.e.4.d.9.9.7.9.7.e.a.c.f.8.6.f.d.1.0.b.8.0.1.0.0.2.ip6.arpa [IPv6:2001:8b0:1df6:8fca:e797:99d4:ec2d:41de]) by doppler.solinno.uk (Postfix) with ESMTPSA id C863820B78; Fri, 20 Dec 2024 10:33:00 +0000 (GMT) Received: by plato.solinno.co.uk (Postfix, from userid 1000) id BDFAC45; 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=HRQvWtHa6tqYQmSI8IflpbkFRBZlMlDNyvROQZFNHp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mDifpnX1UuOwQua+9d0IRht+rzfc0eSsoS55ffmVL5ggFUDP1Uhe2LusFbWo66nxL +AOll+xzzWvPciXwemwl2WDaoAeh+lha83ONLb0RseSb/F5m1iNJBvB9hUwP9VuUTO K0Moh7WtkQPI4y3ij/Sf4izEJJQKOrM2ng647drs= From: Leigh Brown To: devel@lists.libvirt.org Subject: [RFC v2 PATCH 2/4] util: Add vlan support to virNetDevBridgeAddPort Date: Fri, 20 Dec 2024 10:33:02 +0000 Message-ID: <20241220103304.29496-3-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: USOIQTUVN27NFPTG2DNRYLJMRU5GHVBQ X-Message-ID-Hash: USOIQTUVN27NFPTG2DNRYLJMRU5GHVBQ 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: 1734690816362116600 Content-Type: text/plain; charset="utf-8" Add virVlan parameter to the Linux version of the virNetDevBridgeAddPort function. Update the function to call virNetDevBridgeSetupVlans to run the appropriate iproute2 bridge vlan commands to set up the required vlan configuration. Update callers of this function to pass NULL for now. Signed-off-by: Leigh Brown --- src/lxc/lxc_process.c | 2 +- src/util/virnetdevbridge.c | 11 +++++++---- src/util/virnetdevbridge.h | 4 +++- src/util/virnetdevtap.c | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index cd8bcfc282..2a91896328 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -290,7 +290,7 @@ virLXCProcessSetupInterfaceTap(virDomainDef *vm, vport, virDomainNetGetActualVl= an(net)) < 0) return NULL; } else { - if (virNetDevBridgeAddPort(brname, parentVeth) < 0) + if (virNetDevBridgeAddPort(brname, parentVeth, NULL) < 0) return NULL; =20 if (virDomainNetGetActualPortOptionsIsolated(net) =3D=3D VIR_T= RISTATE_BOOL_YES && diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c index 353f95b040..7d7440e7ab 100644 --- a/src/util/virnetdevbridge.c +++ b/src/util/virnetdevbridge.c @@ -650,7 +650,8 @@ int virNetDevBridgeDelete(const char *brname G_GNUC_UNU= SED) */ #if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRADDIF) int virNetDevBridgeAddPort(const char *brname, - const char *ifname) + const char *ifname, + const virNetDevVlan *virtVlan) { struct ifreq ifr; VIR_AUTOCLOSE fd =3D -1; @@ -670,11 +671,12 @@ int virNetDevBridgeAddPort(const char *brname, return -1; } =20 - return 0; + return virNetDevBridgeSetupVlans(ifname, virtVlan); } #elif defined(WITH_BSD_BRIDGE_MGMT) int virNetDevBridgeAddPort(const char *brname, - const char *ifname) + const char *ifname, + const virNetDevVlan *virtVlan) { struct ifbreq req =3D { 0 }; =20 @@ -695,7 +697,8 @@ int virNetDevBridgeAddPort(const char *brname, } #else int virNetDevBridgeAddPort(const char *brname, - const char *ifname) + const char *ifname, + const virNetDevVlan *virtVlan) { virReportSystemError(ENOSYS, _("Unable to add bridge %1$s port %2$s"), brname,= ifname); diff --git a/src/util/virnetdevbridge.h b/src/util/virnetdevbridge.h index db4099bf0b..5f51656abe 100644 --- a/src/util/virnetdevbridge.h +++ b/src/util/virnetdevbridge.h @@ -20,6 +20,7 @@ =20 #include "internal.h" #include "virmacaddr.h" +#include "virnetdevvlan.h" =20 int virNetDevBridgeCreate(const char *brname, const virMacAddr *mac) @@ -28,7 +29,8 @@ int virNetDevBridgeDelete(const char *brname) ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; =20 int virNetDevBridgeAddPort(const char *brname, - const char *ifname) + const char *ifname, + const virNetDevVlan *virtVlan) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; =20 int virNetDevBridgeRemovePort(const char *brname, diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c index 2701ba6dfc..a9573eb8e1 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) < 0) + if (virNetDevBridgeAddPort(brname, tapname, NULL) < 0) return -1; =20 if (isolatedPort =3D=3D VIR_TRISTATE_BOOL_YES && --=20 2.39.5