Page MenuHomeFreeBSD

net80211: move references to IF_LLADDR() into ieee80211_freebsd.c
ClosedPublic

Authored by adrian on Apr 25 2025, 6:29 PM.
Referenced Files
Unknown Object (File)
Sat, Jul 5, 12:01 PM
Unknown Object (File)
Sat, Jul 5, 3:29 AM
Unknown Object (File)
Fri, Jul 4, 3:44 PM
Unknown Object (File)
Thu, Jul 3, 9:27 AM
Unknown Object (File)
Wed, Jul 2, 11:20 PM
Unknown Object (File)
Tue, Jul 1, 9:04 AM
Unknown Object (File)
Tue, Jul 1, 8:55 AM
Unknown Object (File)
Mon, Jun 30, 10:06 PM

Details

Summary
  • Move references to IF_LLADDR() into ieee80211_freebsd.c
  • Add a comment on one that I need to verify before I move it
  • Implement ieee80211_vap_sync_mac_address() which syncs the VAP mac address from the network interface MAC address. This uses FreeBSD-isms (network epoch, IF_LLADDR()) so it shouldn't be in net80211 itself.

Diff Detail

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

Event Timeline

bz added inline comments.
sys/net80211/ieee80211_freebsd.c
1199

as a matter of fact if you'd want to handle that case you'd hook up an

EVENTHANDLER_REGISTER(iflladdr_event, ..

but that's not your use case. I am aware that the comment comes straight from elsewhere.

1202

If we do make it private and factor it out then let's start to remove if_private.h usage as well and write it like we'd write a driver these days.

1206

char *lladdr;

1214

lladdr = if_getlladdr(ifp);

1215

if (if_gettransmitfn(ifp) == ieee80211_vap_transmit &&

1216

if_getflags(ifp) & IFF_UP)

1217

lladdr

but I am not sure what comparing saves us rather than just copying.
If you don't compare you don't need the extra variable and you can just replace the IF_LLAdDR in the next line with if_getlladdr()

1218

lladdr

sys/net80211/ieee80211_freebsd.c
1202

oh yeah, i think a goal of "get rid of if_private.h in net80211" is a worthy clean-up goal!

1217

lladdr

but I am not sure what comparing saves us rather than just copying.
If you don't compare you don't need the extra variable and you can just replace the IF_LLAdDR in the next line with if_getlladdr()

Yeah, i agree. This is a straight refactor, i just copy/pasted what i saw.

Lemme go clean this up a little as suggested.

implement a separate copy routine, get rid of the last reference.

So I'm going to do the "clean up if_private.h abuse in net80211" work in different diffs, and I plan on just leaving this diff as a straight refactor.

Take a look at D50404, D50405, D50406, D50407 for the starting point of some of the cleanups.

This revision was not accepted when it landed; it landed in state Needs Review.May 25 2025, 3:24 PM
This revision was automatically updated to reflect the committed changes.