Linux wireless drivers development
 help / color / mirror / Atom feed
From: Eliad Peller <eliad@wizery.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: <linux-wireless@vger.kernel.org>
Subject: [PATCH] mac80211: retry auth and assoc on error 17
Date: Tue, 15 May 2012 17:21:16 +0300	[thread overview]
Message-ID: <1337091676-29441-1-git-send-email-eliad@wizery.com> (raw)

In some congested environments APs return
WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA on auth/assoc
attempt. Instead of failing immediately, retry again
in 200 msec.

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
depends on "mac80211: fail authentication when AP denied authentication"

 net/mac80211/mlme.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2b5235e..6b3ce84 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1790,6 +1790,19 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
 	if (status_code != WLAN_STATUS_SUCCESS) {
 		printk(KERN_DEBUG "%s: %pM denied authentication (status %d)\n",
 		       sdata->name, mgmt->sa, status_code);
+
+		if (status_code == WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA) {
+			/* can't auth right now, try again in 200 ms */
+			u32 ms = 200;
+			printk(KERN_DEBUG "%s: %pM rejected authentication; "
+			       "try again in %u ms\n",
+			       sdata->name, mgmt->sa, ms);
+			ifmgd->auth_data->timeout = jiffies +
+						    msecs_to_jiffies(ms);
+			run_again(ifmgd, ifmgd->auth_data->timeout);
+			return RX_MGMT_NONE;
+		}
+
 		ieee80211_destroy_auth_data(sdata, false);
 		return RX_MGMT_CFG80211_RX_AUTH;
 	}
@@ -2152,6 +2165,17 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
 		return RX_MGMT_NONE;
 	}
 
+	if (status_code == WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA) {
+		/* can't assoc us right now, try again in 200 ms */
+		u32 ms = 200;
+		printk(KERN_DEBUG "%s: %pM rejected association; "
+		       "try again in %u ms\n",
+		       sdata->name, mgmt->sa, ms);
+		assoc_data->timeout = jiffies + msecs_to_jiffies(ms);
+		run_again(ifmgd, assoc_data->timeout);
+		return RX_MGMT_NONE;
+	}
+
 	*bss = assoc_data->bss;
 
 	if (status_code != WLAN_STATUS_SUCCESS) {
-- 
1.7.6.401.g6a319


             reply	other threads:[~2012-05-15 14:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-15 14:21 Eliad Peller [this message]
2012-05-15 14:30 ` [PATCH] mac80211: retry auth and assoc on error 17 Johannes Berg
2012-05-15 14:40   ` Eliad Peller
2012-05-15 15:16     ` Jouni Malinen
2012-05-15 15:18       ` Eliad Peller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1337091676-29441-1-git-send-email-eliad@wizery.com \
    --to=eliad@wizery.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox