2008-11-19 10:29:55

by Vivek Natarajan

[permalink] [raw]
Subject: [PATCH] mac80211: Look out for some other AP when disassoc is received.

When a disassoc packet is received with a reason code of 'AP leaving the BSS',
mac80211 should start looking for some other AP instead of trying to
associate with the same AP.

Signed-off-by: Vivek Natarajan <[email protected]>
---
net/mac80211/mlme.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 6d5ed9c..8d0f995 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -855,7 +855,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,

ieee80211_sta_send_apinfo(sdata, ifsta);

- if (self_disconnected)
+ if (self_disconnected || reason == WLAN_REASON_DISASSOC_STA_HAS_LEFT)
ifsta->state = IEEE80211_STA_MLME_DISABLED;

sta_info_unlink(&sta);
@@ -1174,7 +1174,7 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
IEEE80211_RETRY_AUTH_INTERVAL);
}

- ieee80211_set_disassoc(sdata, ifsta, false, false, 0);
+ ieee80211_set_disassoc(sdata, ifsta, false, false, reason_code);
}


--
1.6.0.1



2008-11-19 11:55:57

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: Look out for some other AP when disassoc is received.

On Wed, 2008-11-19 at 16:03 -0800, Vivek Natarajan wrote:
> When a disassoc packet is received with a reason code of 'AP leaving the BSS',
> mac80211 should start looking for some other AP instead of trying to
> associate with the same AP.

Umm, it doesn't try to associated with the same AP. And the patch you're
doing is kinda pointless, the reason codes are very often simply wrong
or "due to some local policy decision". Also, the reason code that's
being passed is the one we send ourselves, not the one we received.

> Signed-off-by: Vivek Natarajan <[email protected]>
> ---
> net/mac80211/mlme.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 6d5ed9c..8d0f995 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -855,7 +855,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
>
> ieee80211_sta_send_apinfo(sdata, ifsta);
>
> - if (self_disconnected)
> + if (self_disconnected || reason == WLAN_REASON_DISASSOC_STA_HAS_LEFT)
> ifsta->state = IEEE80211_STA_MLME_DISABLED;
>
> sta_info_unlink(&sta);
> @@ -1174,7 +1174,7 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
> IEEE80211_RETRY_AUTH_INTERVAL);
> }
>
> - ieee80211_set_disassoc(sdata, ifsta, false, false, 0);
> + ieee80211_set_disassoc(sdata, ifsta, false, false, reason_code);
> }
>
>


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2008-11-19 12:33:39

by Vivek Natarajan

[permalink] [raw]
Subject: Re: [PATCH] mac80211: Look out for some other AP when disassoc is received.

On Wed, Nov 19, 2008 at 5:25 PM, Johannes Berg
<[email protected]> wrote:
> On Wed, 2008-11-19 at 16:03 -0800, Vivek Natarajan wrote:
>> When a disassoc packet is received with a reason code of 'AP leaving the BSS',
>> mac80211 should start looking for some other AP instead of trying to
>> associate with the same AP.
>
> Umm, it doesn't try to associated with the same AP. And the patch you're
> doing is kinda pointless, the reason codes are very often simply wrong
> or "due to some local policy decision".

Here is the test scenario that exposed this issue:
* There are two APs with the same SSID so that the sta can roam if one is down.
* When the AP to which the station is connected is brought down or restarted,
it sends( should send according to 802.11 spec) a disassoc frame with a
reason code of 8 which means the sender is leaving the BSS.
* After receiving a disassoc, mac80211 moves to ASSOCIATE state in
which scanning
is disabled. So, for the first scan request from
wpa_supplicant(scan duration of 30sec),
it tries to send probe request to the same AP instead of scanning
for other APs.
Then it moves to DISABLED state since there will be no probe response.
* The next scan request comes only after 30sec and now it will scan
for all available APs
since scanning is supported in DISABLED state.
So, it takes atleast 30sec to connect to some other AP.

> Also, the reason code that's being passed is the one we send ourselves,
> not the one we received.

I have passed the reason code from ieee80211_rx_mgmt_disassoc which is called
only after we receive a disassoc frame from the AP.

--
Vivek.