Page MenuHomeFreeBSD

epair: deduplicate interface allocation code #1
ClosedPublic

Authored by melifaro on Sep 17 2022, 8:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 4:04 PM
Unknown Object (File)
Tue, Apr 16, 2:02 PM
Unknown Object (File)
Thu, Apr 11, 6:58 PM
Unknown Object (File)
Tue, Apr 9, 7:48 PM
Unknown Object (File)
Fri, Apr 5, 12:40 PM
Unknown Object (File)
Wed, Apr 3, 10:43 AM
Unknown Object (File)
Sat, Mar 30, 7:48 PM
Unknown Object (File)
Jan 26 2024, 9:13 AM
Subscribers

Details

Summary

Simplify epair_clone_create() and epair_clone_destroy() by factoring out epair_softc allocation / desctruction and ifp setup/teardown into separate functions.

Diff Detail

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

Event Timeline

melifaro retitled this revision from epair: deduplicate interface allocation code to epair: deduplicate interface allocation code #1.Sep 17 2022, 8:57 PM
melifaro edited the summary of this revision. (Show Details)
melifaro added reviewers: network, kp, glebius, bz.
This revision is now accepted and ready to land.Sep 18 2022, 12:50 PM
zlei requested changes to this revision.Sep 19 2022, 1:12 AM
zlei added a subscriber: zlei.
zlei added inline comments.
sys/net/if_epair.c
495

I think epair_alloc_sc() will prevent potential naming pollution.
Although it is modified with static but still a dedicated prefix epair_ looks consistent with current naming.

667

if (sca == NULL ^ scb == NULL), then free_sc(sca) or free_sc(scb) may trigger null pointer dereference.

This revision now requires changes to proceed.Sep 19 2022, 1:12 AM
sys/net/if_epair.c
667

Good catch!

A simple if (sc == NULL) return; in free_sc() should work, and matches the regular free() idiom.

This revision was not accepted when it landed; it landed in state Needs Revision.Sep 22 2022, 9:34 AM
This revision was automatically updated to reflect the committed changes.
melifaro marked 2 inline comments as done.
sys/net/if_epair.c
667

Yep, that's a good one!
It was my initial intention but I forgot to actually add it :-)