[PATCH] nl80211: re-read MAC address on RTM_NEWLINK
Dan Williams
dcbw
Thu Oct 2 08:30:05 PDT 2014
97279d8d (after hostap-2.0) dropped frames from foreign addresses.
Unfortunately this commit did not handle the case where the
interface's MAC address might be changed externally, which other
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 at redhat.com>
---
src/drivers/driver_nl80211.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 5c922a0..0a9f866 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1302,14 +1302,30 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
"event since interface %s does not exist",
drv->first_bss->ifname);
} else if (drv->if_removed) {
wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up "
"event since interface %s is marked "
"removed", drv->first_bss->ifname);
} else {
+ struct i802_bss *bss;
+
+ /* Re-read MAC address as it may have changed */
+ for (bss = drv->first_bss; bss; bss = bss->next) {
+ if (ifi->ifi_index == bss->ifindex) {
+ if (linux_get_ifhwaddr(drv->global->ioctl_sock,
+ bss->ifname,
+ bss->addr)) {
+ wpa_printf(MSG_DEBUG, "nl80211:"
+ " %s: failed to re-"
+ "read MAC address",
+ bss->ifname);
+ }
+ }
+ }
+
wpa_printf(MSG_DEBUG, "nl80211: Interface up");
drv->if_disabled = 0;
wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED,
NULL);
}
}
--
1.9.3
More information about the Hostap
mailing list