Page MenuHomeFreeBSD

allow vlan(4) interfaces to be created on a bridge(4)
ClosedPublic

Authored by ivy on May 24 2025, 12:11 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 8, 8:31 PM
Unknown Object (File)
Tue, Jul 8, 8:11 PM
Unknown Object (File)
Tue, Jul 8, 2:07 PM
Unknown Object (File)
Mon, Jul 7, 2:40 PM
Unknown Object (File)
Sun, Jul 6, 11:50 AM
Unknown Object (File)
Sat, Jul 5, 12:58 PM
Unknown Object (File)
Sat, Jul 5, 12:19 PM
Unknown Object (File)
Sat, Jul 5, 8:24 AM

Details

Summary

A vlan interface on top of a bridge will act as a layer 3 port for
bridge traffic on that vlan, sometimes called an "SVI". This allows
the host to send/receive traffic on that vlan without having to create
a separate epair(4) and vlan(4) to tag and untag the traffic.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ivy requested review of this revision.May 24 2025, 12:11 AM
sys/net/if_bridge.c
431

I think if_vlan_var.h is an appropriate spot for that. It already has vlan_trunkdev_p anyway.
if_ethersubr.c already includes it, so we're not going to be causing any include pollution.

2488

vlan = DOT1Q_VID_NULL ?

update for new vlan filtering behaviour

ivy marked 2 inline comments as done.May 28 2025, 9:42 AM
ivy added inline comments.
sys/net/if_bridge.c
431

done in D50567.

2488

this code was unnecessarily complicated, i've simplified it and removed the default assignment.

This revision is now accepted and ready to land.May 28 2025, 7:54 PM

Generally looks good to me.

sys/net/if_bridge.c
850

This appears to be redundant. In if_vlan.c you have already tested the interface type.

	if (p->if_type != IFT_ETHER &&
	    p->if_type != IFT_L2VLAN &&
+++	    p->if_type != IFT_BRIDGE &&
	    (p->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
ivy marked 2 inline comments as done.Wed, Jun 25, 2:33 PM
ivy added inline comments.
sys/net/if_bridge.c
850

i think we should still set the capability here in case some other interface wants to send us tagged frames. (epair perhaps? although i haven't checked this.)

in general, if_bridge does support "hardware" tagging, so the cap seems correct. perhaps the check could be removed from if_vlan though.

This revision was automatically updated to reflect the committed changes.