Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] mac80211: retry auth and assoc on error 17
@ 2012-05-15 14:21 Eliad Peller
  2012-05-15 14:30 ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Eliad Peller @ 2012-05-15 14:21 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mac80211: retry auth and assoc on error 17
  2012-05-15 14:21 [PATCH] mac80211: retry auth and assoc on error 17 Eliad Peller
@ 2012-05-15 14:30 ` Johannes Berg
  2012-05-15 14:40   ` Eliad Peller
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2012-05-15 14:30 UTC (permalink / raw)
  To: Eliad Peller; +Cc: linux-wireless

On Tue, 2012-05-15 at 17:21 +0300, Eliad Peller wrote:
> 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.

I think this should be in wpa_supplicant?

johannes


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mac80211: retry auth and assoc on error 17
  2012-05-15 14:30 ` Johannes Berg
@ 2012-05-15 14:40   ` Eliad Peller
  2012-05-15 15:16     ` Jouni Malinen
  0 siblings, 1 reply; 5+ messages in thread
From: Eliad Peller @ 2012-05-15 14:40 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On Tue, May 15, 2012 at 5:30 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2012-05-15 at 17:21 +0300, Eliad Peller wrote:
>> 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.
>
> I think this should be in wpa_supplicant?
>
it behaves similarly to WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY, which
handled by mac80211, so i thought it would be fine to handle it as
well (and this way it can also be used by iw).

Eliad.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mac80211: retry auth and assoc on error 17
  2012-05-15 14:40   ` Eliad Peller
@ 2012-05-15 15:16     ` Jouni Malinen
  2012-05-15 15:18       ` Eliad Peller
  0 siblings, 1 reply; 5+ messages in thread
From: Jouni Malinen @ 2012-05-15 15:16 UTC (permalink / raw)
  To: Eliad Peller; +Cc: Johannes Berg, linux-wireless

On Tue, May 15, 2012 at 05:40:17PM +0300, Eliad Peller wrote:
> On Tue, May 15, 2012 at 5:30 PM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > On Tue, 2012-05-15 at 17:21 +0300, Eliad Peller wrote:
> >> 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.
> >
> > I think this should be in wpa_supplicant?
> >
> it behaves similarly to WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY, which
> handled by mac80211, so i thought it would be fine to handle it as
> well (and this way it can also be used by iw).

WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY is a special case in which the AP
provides a clear expectation of the association succeeding after the
specified amount of time. WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA is
quite different since it can be used by APs to enforce load balancing.
It does not sound like a good idea to enforce mac80211 to retry
association with the same AP unconditionally in this case. I would also
leave this for wpa_supplicant which has already been optimized to handle
the load balancing case without this type of extra latency added.
Disabling this functionality would not be good for many enterprise
networks.

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mac80211: retry auth and assoc on error 17
  2012-05-15 15:16     ` Jouni Malinen
@ 2012-05-15 15:18       ` Eliad Peller
  0 siblings, 0 replies; 5+ messages in thread
From: Eliad Peller @ 2012-05-15 15:18 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: Johannes Berg, linux-wireless

On Tue, May 15, 2012 at 6:16 PM, Jouni Malinen <j@w1.fi> wrote:
> On Tue, May 15, 2012 at 05:40:17PM +0300, Eliad Peller wrote:
>> On Tue, May 15, 2012 at 5:30 PM, Johannes Berg
>> <johannes@sipsolutions.net> wrote:
>> > On Tue, 2012-05-15 at 17:21 +0300, Eliad Peller wrote:
>> >> 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.
>> >
>> > I think this should be in wpa_supplicant?
>> >
>> it behaves similarly to WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY, which
>> handled by mac80211, so i thought it would be fine to handle it as
>> well (and this way it can also be used by iw).
>
> WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY is a special case in which the AP
> provides a clear expectation of the association succeeding after the
> specified amount of time. WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA is
> quite different since it can be used by APs to enforce load balancing.
> It does not sound like a good idea to enforce mac80211 to retry
> association with the same AP unconditionally in this case. I would also
> leave this for wpa_supplicant which has already been optimized to handle
> the load balancing case without this type of extra latency added.
> Disabling this functionality would not be good for many enterprise
> networks.
>
ok.
thanks for the detailed answer.

Eliad.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-15 15:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-15 14:21 [PATCH] mac80211: retry auth and assoc on error 17 Eliad Peller
2012-05-15 14:30 ` Johannes Berg
2012-05-15 14:40   ` Eliad Peller
2012-05-15 15:16     ` Jouni Malinen
2012-05-15 15:18       ` Eliad Peller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox