Re: how to bridge "native" vlan?

From: Lutz Donnerhacke <lutz_at_donnerhacke.de>
Date: Sat, 23 Apr 2022 21:20:02 UTC
On Thu, Apr 21, 2022 at 02:11:54PM +0200, Patrick M. Hausen wrote:
> > Am 21.04.2022 um 11:29 schrieb Benoit Chesneau <benoitc@enki-multimedia.eu>:
> > I have an interface on which multiple vlans are connected. I would like to bridge the vlan 100 and 200 but also have a bridge for the "native" vlan 1. I Can setup a bridge for vlan 100 and 200 the way below I think but how to create a bridge for  the "native" vlan?
> 
> I don't have any experience with netgraph but I do know that
> you cannot do that with if_bridge(4). If you make the physical
> interface the member of a bridge, you cannot use additional
> VLANs on that interface, anymore.
> 
> Does anybody know if the same restriction applies to ng_bridge(4)?

ng_bridge does not inspect the ethertypes only the mac addresses of the frames.
So you can split the VLANs using ng_vlan and connect them to the three bridges:

: mkpeer em0: vlan lower downstream
: name em0:lower vlan0
: mkpeer vlan0: bridge 100 0
: mkpeer vlan0: bridge 200 0
: mkpeer vlan0: bridge nomatch 0
: msg vlan0: addfilter { vid=100 hook="100" }
: msg vlan0: addfilter { vid=200 hook="200" }
: name vlan0:100 bridge100
: name vlan0:200 bridge200

: mkpeer em1: vlan lower downstream
: name em1:lower vlan1
: connect vlan1: bridge100: 100 1
: connect vlan1: bridge200: 200 1
: connect vlan1: bridge_untagged: nomatch 1
: msg vlan1: addfilter { vid=100 hook="100" }
: msg vlan1: addfilter { vid=200 hook="200" }

: mkpeer em2: vlan lower downstream
: name em2:lower vlan2
: connect vlan2: bridge100: 100 2
: connect vlan2: bridge200: 200 2
: connect vlan2: bridge_untagged: nomatch 2
: msg vlan2: addfilter { vid=100 hook="100" }
: msg vlan2: addfilter { vid=200 hook="200" }