Fix CTRL-EVENT-DISCONNECTED event for locally generated disconnection
When wpa_supplicant disconnects, e.g., due to authentication timeout, we need to go through the EVENT_DISASSOC/DEAUTH processing similarly to the driver triggered cases to get correct events delivered to the ctrl_iface. Fix this by calling wpa_supplicant_event() in these cases and by filtering out the confusing CTRL-EVENT-DISCONNECTED event with all zeros BSSID. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
75c208b9db
commit
ef48ff940b
2 changed files with 17 additions and 3 deletions
|
@ -1659,9 +1659,13 @@ static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s,
|
|||
if (wpa_s->wpa_state >= WPA_AUTHENTICATING)
|
||||
wpas_connection_failed(wpa_s, bssid);
|
||||
wpa_sm_notify_disassoc(wpa_s->wpa);
|
||||
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" MACSTR
|
||||
" reason=%d",
|
||||
MAC2STR(bssid), reason_code);
|
||||
if (!is_zero_ether_addr(bssid) ||
|
||||
wpa_s->wpa_state >= WPA_AUTHENTICATING) {
|
||||
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" MACSTR
|
||||
" reason=%d%s",
|
||||
MAC2STR(bssid), reason_code,
|
||||
locally_generated ? " locally_generated=1" : "");
|
||||
}
|
||||
if (wpa_supplicant_dynamic_keys(wpa_s)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - remove keys");
|
||||
wpa_s->keys_cleared = 0;
|
||||
|
|
|
@ -1507,10 +1507,15 @@ void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
|
|||
int reason_code)
|
||||
{
|
||||
u8 *addr = NULL;
|
||||
union wpa_event_data event;
|
||||
|
||||
if (!is_zero_ether_addr(wpa_s->bssid)) {
|
||||
wpa_drv_disassociate(wpa_s, wpa_s->bssid, reason_code);
|
||||
addr = wpa_s->bssid;
|
||||
os_memset(&event, 0, sizeof(event));
|
||||
event.disassoc_info.reason_code = (u16) reason_code;
|
||||
event.disassoc_info.locally_generated = 1;
|
||||
wpa_supplicant_event(wpa_s, EVENT_DISASSOC, &event);
|
||||
}
|
||||
|
||||
wpa_supplicant_clear_connection(wpa_s, addr);
|
||||
|
@ -1529,10 +1534,15 @@ void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
|
|||
int reason_code)
|
||||
{
|
||||
u8 *addr = NULL;
|
||||
union wpa_event_data event;
|
||||
|
||||
if (!is_zero_ether_addr(wpa_s->bssid)) {
|
||||
wpa_drv_deauthenticate(wpa_s, wpa_s->bssid, reason_code);
|
||||
addr = wpa_s->bssid;
|
||||
os_memset(&event, 0, sizeof(event));
|
||||
event.deauth_info.reason_code = (u16) reason_code;
|
||||
event.deauth_info.locally_generated = 1;
|
||||
wpa_supplicant_event(wpa_s, EVENT_DEAUTH, &event);
|
||||
}
|
||||
|
||||
wpa_supplicant_clear_connection(wpa_s, addr);
|
||||
|
|
Loading…
Reference in a new issue