[PATCH] Ignore the DEAUTH event from cfg80211 for cases where a local DEAUTH event is generated by supplicant. Signed-hostap: Jithu Jance <jithu at broadcom.com>
Jithu Jance
jithu
Tue May 28 06:07:23 PDT 2013
---
src/drivers/driver.h | 5 ++++-
src/drivers/driver_nl80211.c | 21 +++++++++++++--------
wpa_supplicant/driver_i.h | 2 +-
wpa_supplicant/sme.c | 4 ++--
wpa_supplicant/wpa_supplicant.c | 2 +-
5 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 0c1fd2f..3f5436f 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1269,11 +1269,14 @@ struct wpa_driver_ops {
* @priv: private driver interface data
* @addr: peer address (BSSID of the AP)
* @reason_code: 16-bit reason code to be sent in the deauthentication
+ * @ignore_disassoc_event: Ignore the disassoc event generated as a
+ * result of the local deauth.
* frame
*
* Returns: 0 on success, -1 on failure
*/
- int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
+ int (*deauthenticate)(void *priv, const u8 *addr,
+ int reason_code, int ignore_disassoc_event);
/**
* associate - Request driver to associate
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index f403189..6b13289 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4890,11 +4890,12 @@ nla_put_failure:
static int wpa_driver_nl80211_disconnect(struct wpa_driver_nl80211_data
*drv,
- int reason_code)
+ int reason_code, int ignore_disassoc_event)
{
wpa_printf(MSG_DEBUG, "%s(reason_code=%d)", __func__, reason_code);
nl80211_mark_disconnected(drv);
- drv->ignore_next_local_disconnect = 0;
+
+ drv->ignore_next_local_disconnect = ignore_disassoc_event;
/* Disconnect command doesn't need BSSID - it uses cached value */
return wpa_driver_nl80211_mlme(drv, NULL, NL80211_CMD_DISCONNECT,
reason_code, 0);
@@ -4902,11 +4903,14 @@ static int wpa_driver_nl80211_disconnect(struct
wpa_driver_nl80211_data *drv,
static int wpa_driver_nl80211_deauthenticate(struct i802_bss *bss,
- const u8 *addr, int reason_code)
+ const u8 *addr, int reason_code,
+ int ignore_disassoc_event)
{
struct wpa_driver_nl80211_data *drv = bss->drv;
if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME))
- return wpa_driver_nl80211_disconnect(drv, reason_code);
+ return wpa_driver_nl80211_disconnect(drv,
+ reason_code, ignore_disassoc_event);
+
wpa_printf(MSG_DEBUG, "%s(addr=" MACSTR " reason_code=%d)",
__func__, MAC2STR(addr), reason_code);
nl80211_mark_disconnected(drv);
@@ -5079,7 +5083,7 @@ retry:
"after forced deauthentication");
wpa_driver_nl80211_deauthenticate(
bss, params->bssid,
- WLAN_REASON_PREV_AUTH_NOT_VALID);
+ WLAN_REASON_PREV_AUTH_NOT_VALID, 0);
nlmsg_free(msg);
goto retry;
}
@@ -7510,7 +7514,7 @@ static int wpa_driver_nl80211_connect(
"disconnecting before reassociation "
"attempt");
if (wpa_driver_nl80211_disconnect(
- drv, WLAN_REASON_PREV_AUTH_NOT_VALID))
+ drv, WLAN_REASON_PREV_AUTH_NOT_VALID, 0))
return -1;
/* Ignore the next local disconnect message. */
drv->ignore_next_local_disconnect = 1;
@@ -9890,10 +9894,11 @@ static int driver_nl80211_scan2(void *priv,
static int driver_nl80211_deauthenticate(void *priv, const u8 *addr,
- int reason_code)
+ int reason_code, int ignore_disassoc_event)
{
struct i802_bss *bss = priv;
- return wpa_driver_nl80211_deauthenticate(bss, addr, reason_code);
+ return wpa_driver_nl80211_deauthenticate(bss, addr,
+ reason_code, ignore_disassoc_event);
}
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index 847600d..9c1e06d 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -130,7 +130,7 @@ static inline int wpa_drv_set_key(struct
wpa_supplicant *wpa_s,
}
static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
- const u8 *addr, int reason_code)
+ const u8 *addr, int reason_code, int ignore_disassoc_event)
{
if (wpa_s->driver->deauthenticate) {
return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 0371628..20e2d51 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -751,7 +751,7 @@ static void sme_deauth(struct wpa_supplicant *wpa_s)
bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
if (wpa_drv_deauthenticate(wpa_s, wpa_s->pending_bssid,
- WLAN_REASON_DEAUTH_LEAVING) < 0) {
+ WLAN_REASON_DEAUTH_LEAVING, 0) < 0) {
wpa_msg(wpa_s, MSG_INFO, "SME: Deauth request to the driver "
"failed");
}
@@ -818,7 +818,7 @@ void sme_event_disassoc(struct wpa_supplicant
*wpa_s,
wpa_dbg(wpa_s, MSG_DEBUG, "SME: Deauthenticate to clear "
"driver state");
wpa_drv_deauthenticate(wpa_s, wpa_s->sme.prev_bssid,
- WLAN_REASON_DEAUTH_LEAVING);
+ WLAN_REASON_DEAUTH_LEAVING, 0);
}
}
diff --git a/wpa_supplicant/wpa_supplicant.c
b/wpa_supplicant/wpa_supplicant.c
index 248bf0e..6330b9f 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1749,7 +1749,7 @@ void wpa_supplicant_deauthenticate(struct
wpa_supplicant *wpa_s,
#endif /* CONFIG_TDLS */
if (addr) {
- wpa_drv_deauthenticate(wpa_s, addr, reason_code);
+ wpa_drv_deauthenticate(wpa_s, addr, reason_code, 1);
os_memset(&event, 0, sizeof(event));
event.deauth_info.reason_code = (u16) reason_code;
event.deauth_info.locally_generated = 1;
--
1.7.9.5
--
Jithu Jance
More information about the Hostap
mailing list