diff mbox

hostapd:Avoid disassociation getting in to a loop by moving timeout_next changes to hostapd_new_assoc_sta()

Message ID 1499271403-1519-2-git-send-email-dheeraj.km@globaledgesoft.com
State Changes Requested
Headers show

Commit Message

dheeraj.km@globaledgesoft.com July 5, 2017, 4:16 p.m. UTC
From: dheerajkm <dheeraj.km@globaledgesoft.com>

Problem:
STA's connectivity state machine gets into a loop of sending
disassociation, for previously disassociating STA when no ACK
is received for Association Response within ap_handle_timer timeout.

To Fix this issue, move the
    sta->timeout_next = STA_NULLFUNC;
from handle_assoc() to hostapd_new_assoc_sta().

sta->timeout_next is set to STA_NULLFUNC only when Ack is received
for the Association Response sent out. So if ACK is not received
within AP_DEAUTH_DELAY, STA is deauthenticated and STA context is
cleaned up. Due to which there needs to be a new session started
by STA with AUTH Req.
---
 src/ap/hostapd.c    | 4 ++++
 src/ap/ieee802_11.c | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Jouni Malinen July 8, 2017, 12:38 p.m. UTC | #1
On Wed, Jul 05, 2017 at 09:46:43PM +0530, dheeraj.km@globaledgesoft.com wrote:
> From: dheerajkm <dheeraj.km@globaledgesoft.com>
> 
> Problem:
> STA's connectivity state machine gets into a loop of sending
> disassociation, for previously disassociating STA when no ACK
> is received for Association Response within ap_handle_timer timeout.

Could you please provide more details on what you mean with "loop" here?
Do you mean that there is a continuous stream of Disassociation frames?

> To Fix this issue, move the
>     sta->timeout_next = STA_NULLFUNC;
> from handle_assoc() to hostapd_new_assoc_sta().
> 
> sta->timeout_next is set to STA_NULLFUNC only when Ack is received
> for the Association Response sent out. So if ACK is not received
> within AP_DEAUTH_DELAY, STA is deauthenticated and STA context is
> cleaned up. Due to which there needs to be a new session started
> by STA with AUTH Req.
> ---

Please read the toplevel CONTRIBUTIONS file (*) and resend the patch
with Signed-off-by: line added as described there.


(*) https://w1.fi/cgit/hostap/tree/CONTRIBUTIONS
diff mbox

Patch

diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 270e818..c167fcb 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2868,6 +2868,10 @@  void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
 	} else
 		wpa_auth_sta_associated(hapd->wpa_auth, sta->wpa_sm);
 
+	/* Make sure that the previously registered inactivity timer will not
+	 * remove the STA immediately. */
+	sta->timeout_next = STA_NULLFUNC;
+
 	if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_WIRED) {
 		if (eloop_cancel_timeout(ap_handle_timer, hapd, sta) > 0) {
 			wpa_printf(MSG_DEBUG,
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 3e0a2dd..69ed693 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -3120,10 +3120,6 @@  static void handle_assoc(struct hostapd_data *hapd,
 	}
 #endif /* CONFIG_IEEE80211W */
 
-	/* Make sure that the previously registered inactivity timer will not
-	 * remove the STA immediately. */
-	sta->timeout_next = STA_NULLFUNC;
-
 #ifdef CONFIG_TAXONOMY
 	taxonomy_sta_info_assoc_req(hapd, sta, pos, left);
 #endif /* CONFIG_TAXONOMY */