git: edab5a280e0b - main - LinuxKPI: 802.11: improve lladdr change to not use ifnet internals
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 09 Nov 2024 21:48:26 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=edab5a280e0b4a53d0f3e34957075c7efe048e8d
commit edab5a280e0b4a53d0f3e34957075c7efe048e8d
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-11-08 21:24:00 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-11-09 21:45:14 +0000
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
---
sys/compat/linuxkpi/common/src/linux_80211.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index ec471db21efd..9d0166829d52 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -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;
}