[PATCH] nl80211: Make nl80211_get_macaddr() reusable
Arowa Suliman
arowa at chromium.org
Fri Oct 2 18:52:56 PDT 2026
On Fri, Oct 02, 2026 at 01:46:26PM +0000, Jouni Malinen wrote:
> On Fri, Oct 02, 2026 at 12:06:49AM +0000, Arowa Suliman wrote:
> > Return the MAC address in a caller provided buffer instead of writing
> > it into bss->addr and declare the function in driver_nl80211.h so that
> > driver extensions can use it instead of maintaining private copies.
>
> Is there a planned patch that would use this function from outside
> driver_nl80211.c? What is that "driver extensions" referring to?
Not at the moment. "Driver extensions" referred to the Android vendor
implementations of wpa_driver_nl80211_driver_cmd() (the ANDROID
driver_cmd hook declared in driver_nl80211.h), which are currently
maintained out-of-tree. One of them has a private copy of
nl80211_get_macaddr() for the "DRIVER MACADDR" command. We plan to
upstream that code at some point and can then send everything it needs
from driver_nl80211.c together with it.
> > -static int nl80211_get_macaddr(struct i802_bss *bss)
> > +/*
> > + * Do not pass in bss->addr for a netdev since that would prevent
> > + * nl80211_refresh_mac() from reporting EVENT_INTERFACE_MAC_CHANGED.
> > + */
> > +int nl80211_get_macaddr(struct i802_bss *bss, u8 *addr)
>
> What is that comment about nl80211_refresh_mac() about? That function
> does not use nl80211_get_macaddr() and this patch does not seem to make
> any functional change in behavior since the only caller of
> nl80211_get_macaddr() is modified to use bss->addr as the addr parameter
> to this function.
Correct, there is no functional change in hostap.git. The comment was
about the out-of-tree copy, which writes the result into bss->addr of
the station netdev. If it runs after an external MAC address change but
before the RTM_NEWLINK for that change is processed,
nl80211_refresh_mac() sees no change and does not report
EVENT_INTERFACE_MAC_CHANGED. The RSN state machine then keeps the old
own address, and the 4-way handshake fails with "RSN: PMKID mismatch"
because the AP uses the new address.
The Android code will read the address with linux_get_ifhwaddr() into a
local buffer instead, as nl80211_refresh_mac() does. Sorry for the
noise. Please ignore and drop this patch.
Thanks for the review.
--
Arowa
More information about the Hostap
mailing list