nl80211: Re-read MAC address on RTM_NEWLINK
Commit 97279d8d
(after hostap-2.0) dropped frame events from foreign
addresses. Unfortunately this commit did not handle the case where the
interface's MAC address might be changed externally, which other
wpa_supplicant code already handled. This causes the driver to reject
any MLME event because the address from the event doesn't match the
stale address in the driver data.
Changing an interface's MAC address requires that the interface be
down, the change made, and then the interface brought back up. This
triggers an RTM_NEWLINK event which driver_nl80211.c can use to
re-read the MAC address of the interface.
Signed-hostap: Dan Williams <dcbw@redhat.com>
This commit is contained in:
parent
5dfbd725a9
commit
3e0272ca00
1 changed files with 22 additions and 0 deletions
|
@ -1320,6 +1320,28 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
|
||||||
"event since interface %s is marked "
|
"event since interface %s is marked "
|
||||||
"removed", drv->first_bss->ifname);
|
"removed", drv->first_bss->ifname);
|
||||||
} else {
|
} else {
|
||||||
|
struct i802_bss *bss;
|
||||||
|
u8 addr[ETH_ALEN];
|
||||||
|
|
||||||
|
/* Re-read MAC address as it may have changed */
|
||||||
|
bss = get_bss_ifindex(drv, ifi->ifi_index);
|
||||||
|
if (bss &&
|
||||||
|
linux_get_ifhwaddr(drv->global->ioctl_sock,
|
||||||
|
bss->ifname, addr) < 0) {
|
||||||
|
wpa_printf(MSG_DEBUG,
|
||||||
|
"nl80211: %s: failed to re-read MAC address",
|
||||||
|
bss->ifname);
|
||||||
|
} else if (bss &&
|
||||||
|
os_memcmp(addr, bss->addr, ETH_ALEN) != 0) {
|
||||||
|
wpa_printf(MSG_DEBUG,
|
||||||
|
"nl80211: Own MAC address on ifindex %d (%s) changed from "
|
||||||
|
MACSTR " to " MACSTR,
|
||||||
|
ifi->ifi_index, bss->ifname,
|
||||||
|
MAC2STR(bss->addr),
|
||||||
|
MAC2STR(addr));
|
||||||
|
os_memcpy(bss->addr, addr, ETH_ALEN);
|
||||||
|
}
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "nl80211: Interface up");
|
wpa_printf(MSG_DEBUG, "nl80211: Interface up");
|
||||||
drv->if_disabled = 0;
|
drv->if_disabled = 0;
|
||||||
wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED,
|
wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED,
|
||||||
|
|
Loading…
Reference in a new issue