LinuxKPI: 802.11: improve lladdr change to not use ifnet internals

The changes from 4aff4048 were based on net80211 which is still using
if_private.h details.  Adjust the code to no longer depend on internal
details of ifnet.  We also switch the "check"-functionn from if_init to
if_transmit which we can query.  Given we do have a per-vif eventhandler
we could do without that check but would still need to check
if_getflags() for IFF_UP.

Sponsored by:	The FreeBSD Foundation
Reported by:	jhibbits
Fixes:		4aff4048
MFC after:	3 days
Reviewed by:	jhibbits
Differential Revision: https://reviews.freebsd.org/D47490
This commit is contained in:
Bjoern A. Zeeb 2024-11-08 21:24:00 +00:00
parent 1bca58a1d4
commit edab5a280e

View File

@ -2763,6 +2763,10 @@ lkpi_ic_wme_update(struct ieee80211com *ic)
* we do use a per-[l]vif event handler to be sure we exist as we
* cannot assume that from every vap derives a vif and we have a hard
* time checking based on net80211 information.
* Should this ever become a real problem we could add a callback function
* to wlan_iflladdr() to be set optionally but that would be for a
* single-consumer (or needs a list) -- was just too complicated for an
* otherwise perfect mechanism FreeBSD already provides.
*/
static void
lkpi_vif_iflladdr(void *arg, struct ifnet *ifp)
@ -2771,8 +2775,9 @@ lkpi_vif_iflladdr(void *arg, struct ifnet *ifp)
struct ieee80211_vif *vif;
NET_EPOCH_ENTER(et);
/* NB: identify vap's by if_init; left as an extra check. */
if (ifp->if_init != ieee80211_init || (ifp->if_flags & IFF_UP) != 0) {
/* NB: identify vap's by if_transmit; left as an extra check. */
if (if_gettransmitfn(ifp) != ieee80211_vap_transmit ||
(if_getflags(ifp) & IFF_UP) != 0) {
NET_EPOCH_EXIT(et);
return;
}