Page MenuHomeFreeBSD

if_vlan_var.h: fix value of DOT1Q_VID_MAX
ClosedPublic

Authored by ivy on May 28 2025, 3:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 9, 11:20 AM
Unknown Object (File)
Fri, Sep 26, 3:18 AM
Unknown Object (File)
Wed, Sep 17, 8:46 PM
Unknown Object (File)
Sat, Sep 13, 10:19 PM
Unknown Object (File)
Sep 8 2025, 3:22 AM
Unknown Object (File)
Sep 4 2025, 5:08 PM
Unknown Object (File)
Sep 2 2025, 9:49 PM
Unknown Object (File)
Sep 1 2025, 7:01 AM

Details

Summary

This should be 4094 (0xFFE), not 4095 (0xFFF), since 0xFFF is not a
valid VID.

MFC after: 3 days
Fixes: c59492025073 ("sys/net: add DOT1Q_VID_{MIN,MAX}")

Diff Detail

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

Event Timeline

ivy requested review of this revision.May 28 2025, 3:15 PM

We do use it in vlan_clone_create_nl() during validation, presumably to ensure we only create valid VLANs. That's a user-visible change, but it's a bug fix so I don't think that should stop us.

802.1Q says (about VID 0xffff): "Reserved for implementation use. This VID value shall not be configured as a PVID or a member of a VID Set, or transmitted in a tag header."

This revision is now accepted and ready to land.May 28 2025, 3:38 PM
In D50576#1154631, @kp wrote:

We do use it in vlan_clone_create_nl() during validation, presumably to ensure we only create valid VLANs. That's a user-visible change, but it's a bug fix so I don't think that should stop us.

i tested, you can't actually create such a vlan because there's an explicit check against 0xfff elsewhere.

test1# ifconfig epair1a.4095 create
ifconfig: invalid vlan tag
test1# ifconfig vlan4095 create vlandev epair1a vlan 4095
ifconfig: SIOCIFCREATE2 (vlan4095): Invalid argument

in fact this is checked in about 3 different places, which might be worth fixing at some point...

In D50576#1154637, @ivy wrote:
In D50576#1154631, @kp wrote:

We do use it in vlan_clone_create_nl() during validation, presumably to ensure we only create valid VLANs. That's a user-visible change, but it's a bug fix so I don't think that should stop us.

i tested, you can't actually create such a vlan because there's an explicit check against 0xfff elsewhere.

test1# ifconfig epair1a.4095 create
ifconfig: invalid vlan tag
test1# ifconfig vlan4095 create vlandev epair1a vlan 4095
ifconfig: SIOCIFCREATE2 (vlan4095): Invalid argument

Ah, indeed. I didn't read quite far enough in the code. So this isn't user-visible, which makes it even easier to change. It'll save us a lot of work in that case though, so it's still an improvement.

This revision was automatically updated to reflect the committed changes.