Page MenuHomeFreeBSD

if_vlan: handle VID conflicts
ClosedPublic

Authored by kp on May 21 2024, 12:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Sep 25, 12:27 AM
Unknown Object (File)
Tue, Sep 24, 5:49 PM
Unknown Object (File)
Tue, Sep 24, 1:26 AM
Unknown Object (File)
Tue, Sep 24, 1:26 AM
Unknown Object (File)
Mon, Sep 23, 10:34 PM
Unknown Object (File)
Mon, Sep 23, 8:53 AM
Unknown Object (File)
Fri, Sep 20, 1:08 PM
Unknown Object (File)
Tue, Sep 17, 6:24 AM

Details

Summary

If we fail to change the vlan id we have to undo the removal (and vlan id
change) in the error path. Otherwise we'll have removed the vlan object from the
hash table, and have the wrong vlan id as well. Subsequent modification attempts
will then try to remove an entry which doesn't exist, and panic.

Undo the vlan id modification if the insertion in the hash table fails, and
re-insert it under the original vlan id.

PR: 279195
MFC atfer: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

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

Event Timeline

kp requested review of this revision.May 21 2024, 12:25 PM

Looks good to me.

sys/net/if_vlan.c
1727

Shall we assert check the return value of the re-inserting ? That should never fail.

This revision is now accepted and ready to land.May 21 2024, 2:20 PM
kp marked an inline comment as done.May 21 2024, 2:34 PM
kp added inline comments.
sys/net/if_vlan.c
1727

Yeah, good idea. I'll do that and push.

tests/sys/net/if_vlan.sh
318

${epair}a is not used by this test case, I think this line can be removed, only to reduce a little time for running tests...

This revision was automatically updated to reflect the committed changes.
kp marked an inline comment as done.