2012-05-15 14:21:14

by Eliad Peller

[permalink] [raw]
Subject: [PATCH] mac80211: retry auth and assoc on error 17

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 <[email protected]>
---
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



2012-05-15 14:30:29

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: retry auth and assoc on error 17

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


2012-05-15 15:16:33

by Jouni Malinen

[permalink] [raw]
Subject: Re: [PATCH] mac80211: retry auth and assoc on error 17

On Tue, May 15, 2012 at 05:40:17PM +0300, Eliad Peller wrote:
> On Tue, May 15, 2012 at 5:30 PM, Johannes Berg
> <[email protected]> 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

2012-05-15 14:40:18

by Eliad Peller

[permalink] [raw]
Subject: Re: [PATCH] mac80211: retry auth and assoc on error 17

On Tue, May 15, 2012 at 5:30 PM, Johannes Berg
<[email protected]> 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.

2012-05-15 15:18:44

by Eliad Peller

[permalink] [raw]
Subject: Re: [PATCH] mac80211: retry auth and assoc on error 17

On Tue, May 15, 2012 at 6:16 PM, Jouni Malinen <[email protected]> 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
>> <[email protected]> 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.