From 7c4027f60411aca6e90a0074499c5427c8268baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sat, 6 Dec 2014 16:06:35 +0100 Subject: [PATCH] nl80211: Report new station / assoc event for the correct BSS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drv->ctx always points to the first BSS and we should report event using BSS related to the interface we got NL80211_CMD_NEW_STATION from. This fixes STA association for drivers using NL80211_CMD_NEW_STATION and multiple virtual interfaces. Before: nl80211: Drv Event 19 (NL80211_CMD_NEW_STATION) received for wlan0-1 (ifindex:7) nl80211: New station 02:00:00:00:01:00 wlan0: STA 02:00:00:00:01:00 IEEE 802.11: associated After: nl80211: Drv Event 19 (NL80211_CMD_NEW_STATION) received for wlan0-1 (ifindex:7) nl80211: New station 02:00:00:00:01:00 wlan0-1: STA 02:00:00:00:01:00 IEEE 802.11: associated This is not applicable to the cases where authentication (AP SME & MLME) is in hostapd and hostapd_assoc_cb() instead of hostapd_notif_assoc() handles BSS selection. Signed-off-by: Rafał Miłecki --- src/drivers/driver_nl80211_event.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index f4221740c..5c8b294a3 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -1123,6 +1123,7 @@ static void nl80211_new_peer_candidate(struct wpa_driver_nl80211_data *drv, static void nl80211_new_station_event(struct wpa_driver_nl80211_data *drv, + struct i802_bss *bss, struct nlattr **tb) { u8 *addr; @@ -1141,7 +1142,7 @@ static void nl80211_new_station_event(struct wpa_driver_nl80211_data *drv, ies_len = nla_len(tb[NL80211_ATTR_IE]); } wpa_hexdump(MSG_DEBUG, "nl80211: Assoc Req IEs", ies, ies_len); - drv_event_assoc(drv->ctx, addr, ies, ies_len, 0); + drv_event_assoc(bss->ctx, addr, ies, ies_len, 0); return; } @@ -1150,7 +1151,7 @@ static void nl80211_new_station_event(struct wpa_driver_nl80211_data *drv, os_memset(&data, 0, sizeof(data)); os_memcpy(data.ibss_rsn_start.peer, addr, ETH_ALEN); - wpa_supplicant_event(drv->ctx, EVENT_IBSS_RSN_START, &data); + wpa_supplicant_event(bss->ctx, EVENT_IBSS_RSN_START, &data); } @@ -1824,7 +1825,7 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd, &data); break; case NL80211_CMD_NEW_STATION: - nl80211_new_station_event(drv, tb); + nl80211_new_station_event(drv, bss, tb); break; case NL80211_CMD_DEL_STATION: nl80211_del_station_event(drv, tb);