From nobody Fri Apr 4 21:21:40 2025 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZTs4L0kQFz5sRQ8 for ; Fri, 04 Apr 2025 21:21:54 +0000 (UTC) (envelope-from mgrooms@shrew.net) Received: from mx1.shrew.net (mx1.shrew.net [204.27.62.57]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZTs4J1JNcz3C7T for ; Fri, 04 Apr 2025 21:21:52 +0000 (UTC) (envelope-from mgrooms@shrew.net) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=shrew.net header.s=default header.b=RFtM7EWn; dmarc=none; spf=pass (mx1.freebsd.org: domain of mgrooms@shrew.net designates 204.27.62.57 as permitted sender) smtp.mailfrom=mgrooms@shrew.net Received: from mail.shrew.net (mail1.shrew.prv [10.26.2.18]) by mx1.shrew.net (8.18.1/8.18.1) with ESMTP id 534LLekr004137 for ; Fri, 4 Apr 2025 16:21:40 -0500 (CDT) (envelope-from mgrooms@shrew.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shrew.net; s=default; t=1743801700; 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: in-reply-to:in-reply-to:references:references; bh=ocQimNAYBYdEF4Bboxz4GqX0SmN9P8gC24uZTHtrHVM=; b=RFtM7EWnT5pcjaACf506AkPmPDw0xB5dSVCG6gdlfnO2qByk5FpzWan0rt7HXS+zlxsUzL fROZT/cCuWIiLoOwPhMB1sIhLiL89Szi085Pm4/JC6pO5LleYAfwZs2ieI6NAgltLrarcG m3L6ZQv21SDfi47g5QBRWzszei52KNPOPoFSG13VGk/DOQBQrb7L5JaGJCgGoefHndVtCT GCev0t6Ql5kRSg4YodSX960CfGrcSxt8ScUzYca2sr4imPFIXUSt1KIwpSlGYPnq4XWWX1 ckKsEfaLFA6QcJpNXVAhcMThBNIrFIx6SX+LqtayD3bUTaddL9QRtxgJbjJ9Ew== Received: from [10.22.200.32] (unknown [136.62.156.42]) by mail.shrew.net (Postfix) with ESMTPSA id ADF4E3B8AE for ; Fri, 04 Apr 2025 16:21:40 -0500 (CDT) Message-ID: <4b137357-a674-4fe3-82ea-7c1985fa0dd0@shrew.net> Date: Fri, 4 Apr 2025 16:21:40 -0500 List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bridge(4) VLAN filtering To: freebsd-net@freebsd.org References: Content-Language: en-US From: Matthew Grooms In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [2.08 / 15.00]; RBL_SENDERSCORE_REPUT_1(3.50)[204.27.62.57:from]; NEURAL_HAM_SHORT(-0.95)[-0.945]; NEURAL_HAM_LONG(-0.39)[-0.393]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_MEDIUM(-0.08)[-0.082]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ASN(0.00)[asn:19969, ipnet:204.27.56.0/21, country:US]; R_SPF_ALLOW(0.00)[+mx]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-net@freebsd.org]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DMARC_NA(0.00)[shrew.net]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_LAST(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; R_DKIM_ALLOW(0.00)[shrew.net:s=default]; DKIM_TRACE(0.00)[shrew.net:+] X-Rspamd-Queue-Id: 4ZTs4J1JNcz3C7T X-Spamd-Bar: ++ On 4/4/25 13:47, Lexi Winter wrote: > hello, > > over the last few days i have been doing a bit of work on VLAN filtering > for bridge(4), which i thought i'd mention here in case anyone is > interested. the purpose of this is to extend the existing bridge VLAN > support to make it more generally useful. > > the full changeset / diff is available at [0], including documentation > and basic ATF tests. > > a summary of the new features: > > - a bridge member's PVID may be configured using ifpvid: > > ifconfig bridge0 ifpvid ix0 20 > > setting a PVID enables VLAN filtering on the member interface and > restricts it to only send/receives frames on that specific VLAN. > untagged incoming frames will be assigned to the correct VLAN. > > - a bridge member's port type may be configured using iftype: > > ifconfig bridge0 iftype ix0 > > access ports may only send/receive untagged frames; trunk ports may > only send/receive frames with a non-zero .1q tag; hybrid ports may > send/receive either type of frame. > > - for trunk and hybrid ports, the list of permitted VLANs may be set > using +ifvlans/-ifvlans: > > ifconfig bridge0 +ifvlans ix0 100-599 > ifconfig bridge0 -ifvlans ix0 105,300 > > the port will only be allowed to communicate on the VLANs in its > access list (plus its PVID). > > - the VLAN configuration for a port is displayed in ifconfig: > > member: test2a flags=143 > ifmaxaddr 0 port 5 priority 128 path cost 2000 pvid 1 type trunk vlans 20 > > - when bridging between different port types (e.g. an access port and a > trunk port), the bridge will add or remove .1q tags as required. > > - an SVI for a particular vlan may be created on the bridge using > vlan(4): > > ifconfig vlan20 create vlan 20 vlandev bridge0 > > the SVI interface will send/receive traffic for that particular VLAN. > > to make review a bit easier, my plan is to submit this as smaller > changesets of self-contained features. to start with that's two minor > bug fixes: > > https://github.com/freebsd/freebsd-src/pull/1639 > https://github.com/freebsd/freebsd-src/pull/1637 > > and the first actual feature which is the ifconfig 'ifpvid' option: > > https://github.com/freebsd/freebsd-src/pull/1634 > > if anyone has any comments/questions or would like to review this (or > even commit it!) do feel free - obviously, this requires a fair amount > of testing and i certainly wouldn't recommend using it in production > yet. this is my first time writing any non-trivial kernel code, so it's > quite possible everything is completely wrong. > > [0] https://github.com/freebsd/freebsd-src/compare/main...llfw:freebsd-src:lf/dev/bridge-1q Looks awesome. Thanks for working on this. Any idea what the overhead is wrt packet forwarding rate? Any performance numbers comparing your bridge access port feature vs vlan + bridge? -Matthew