66c682fbd39c4cad25590534236da3261743ab70
[oweals/openwrt.git] /
1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
2 Date: Mon, 11 Jan 2016 19:18:06 +0100
3 Subject: [PATCH] nl80211: Report disassociated STA / lost peer for the correct
4  BSS
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 We shouldn't use drv->ctx as it always points to the first BSS. When
10 using FullMAC driver with multi-BSS support it resulted in incorrect
11 treating nl80211 events. I noticed with with brcmfmac and BCM43602.
12
13 Before my change I was getting "disassociated" on a wrong interface:
14 wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
15 wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
16 wlan0: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
17
18 With this patch it works as expected:
19 wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
20 wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
21 wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
22
23 This doesn't apply to hostapd dealing with SoftMAC drivers when handling
24 AP SME & MLME is done it hostapd not the firmware.
25
26 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
27 ---
28  src/drivers/driver_nl80211_event.c | 7 ++++---
29  1 file changed, 4 insertions(+), 3 deletions(-)
30
31 --- a/src/drivers/driver_nl80211_event.c
32 +++ b/src/drivers/driver_nl80211_event.c
33 @@ -1154,6 +1154,7 @@ static void nl80211_new_station_event(st
34  
35  
36  static void nl80211_del_station_event(struct wpa_driver_nl80211_data *drv,
37 +                                     struct i802_bss *bss,
38                                       struct nlattr **tb)
39  {
40         u8 *addr;
41 @@ -1166,7 +1167,7 @@ static void nl80211_del_station_event(st
42                    MAC2STR(addr));
43  
44         if (is_ap_interface(drv->nlmode) && drv->device_ap_sme) {
45 -               drv_event_disassoc(drv->ctx, addr);
46 +               drv_event_disassoc(bss->ctx, addr);
47                 return;
48         }
49  
50 @@ -1175,7 +1176,7 @@ static void nl80211_del_station_event(st
51  
52         os_memset(&data, 0, sizeof(data));
53         os_memcpy(data.ibss_peer_lost.peer, addr, ETH_ALEN);
54 -       wpa_supplicant_event(drv->ctx, EVENT_IBSS_PEER_LOST, &data);
55 +       wpa_supplicant_event(bss->ctx, EVENT_IBSS_PEER_LOST, &data);
56  }
57  
58  
59 @@ -1939,7 +1940,7 @@ static void do_process_drv_event(struct
60                 nl80211_new_station_event(drv, bss, tb);
61                 break;
62         case NL80211_CMD_DEL_STATION:
63 -               nl80211_del_station_event(drv, tb);
64 +               nl80211_del_station_event(drv, bss, tb);
65                 break;
66         case NL80211_CMD_SET_REKEY_OFFLOAD:
67                 nl80211_rekey_offload_event(drv, tb);