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
F136563170: D50504.diff
Tue, Nov 18, 8:47 AM
Unknown Object (File)
Wed, Nov 5, 7:38 AM
Unknown Object (File)
Wed, Nov 5, 5:36 AM
Unknown Object (File)
Sat, Nov 1, 6:22 AM
Unknown Object (File)
Thu, Oct 30, 9:46 PM
Unknown Object (File)
Thu, Oct 23, 12:23 AM
Unknown Object (File)
Oct 19 2025, 8:41 PM
Unknown Object (File)
Oct 18 2025, 3:46 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 64494
Build 61378: arc lint + arc unit

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.

2495

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.

2495

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.Jun 25 2025, 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.