From 52b2004285a82074ce74ff66230d61c2253d54f6 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 3 Apr 2012 16:17:38 +0300 Subject: Change reason code for AP mode BSS termination to 3 Use reason code 3 (Deauthenticated because sending STA is leaving) instead of reason code 2 (Previous authentication ot valid) in the Deauthentication frame sent at the time a BSS is terminated. This is more accurate reason for the message and allows the stations to get better understand on why they were disconnected. This can be useful especially for P2P clients that can use this as a signal that the P2P group session was ended per P2P specification section 3.2.9. Signed-hostap: Jouni Malinen --- src/ap/hostapd.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index bb8fea7..03917bc 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -33,7 +33,7 @@ #include "gas_serv.h" -static int hostapd_flush_old_stations(struct hostapd_data *hapd); +static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason); static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd); static int hostapd_broadcast_wep_clear(struct hostapd_data *hapd); @@ -123,7 +123,8 @@ int hostapd_reload_config(struct hostapd_iface *iface) * allow them to use the BSS anymore. */ for (j = 0; j < iface->num_bss; j++) { - hostapd_flush_old_stations(iface->bss[j]); + hostapd_flush_old_stations(iface->bss[j], + WLAN_REASON_PREV_AUTH_NOT_VALID); hostapd_broadcast_wep_clear(iface->bss[j]); #ifndef CONFIG_NO_RADIUS @@ -376,7 +377,7 @@ static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd) } -static int hostapd_flush_old_stations(struct hostapd_data *hapd) +static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason) { int ret = 0; u8 addr[ETH_ALEN]; @@ -392,7 +393,7 @@ static int hostapd_flush_old_stations(struct hostapd_data *hapd) } wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "Deauthenticate all stations"); os_memset(addr, 0xff, ETH_ALEN); - hostapd_drv_sta_deauth(hapd, addr, WLAN_REASON_PREV_AUTH_NOT_VALID); + hostapd_drv_sta_deauth(hapd, addr, reason); hostapd_free_stas(hapd); return ret; @@ -562,7 +563,7 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first) if (conf->wmm_enabled < 0) conf->wmm_enabled = hapd->iconf->ieee80211n; - hostapd_flush_old_stations(hapd); + hostapd_flush_old_stations(hapd, WLAN_REASON_PREV_AUTH_NOT_VALID); hostapd_set_privacy(hapd, 0); hostapd_broadcast_wep_clear(hapd); @@ -924,7 +925,7 @@ void hostapd_interface_deinit(struct hostapd_iface *iface) for (j = 0; j < iface->num_bss; j++) { struct hostapd_data *hapd = iface->bss[j]; hostapd_free_stas(hapd); - hostapd_flush_old_stations(hapd); + hostapd_flush_old_stations(hapd, WLAN_REASON_DEAUTH_LEAVING); hostapd_clear_wep(hapd); hostapd_cleanup(hapd); } -- cgit v1.1