d80211: Reset assoc and auth retry counters
Subsystems (2)
PATCH 1/1 d80211: Reset assoc and auth retry counters
After a succesfull authentication and association the matching retry counter must be reset to 0.
Failure to do so will result in failure to authenticate after the interface has been deauthenticated. This does not always happen after the first deauthentication, but after the interface has been several times been deauthenticated it will refuse to authenticate.
Signed-off-by Ivo van Doorn <[email protected]>
---
net/d80211/ieee80211_sta.c +2 -0
@@ -694,6 +694,7 @@ static void ieee80211_associated(struct/* TODO: remove expired BSSes */ ifsta->state =IEEE80211_ASSOCIATED ; + ifsta->assoc_tries =0 ; sta =sta_info_get (local, ifsta->bssid);if (!sta) {
@@ -821,6 +822,7 @@ static void ieee80211_auth_completed(str {printk (KERN_DEBUG "%s: authenticated\n" , dev->name); ifsta->authenticated =1 ; + ifsta->auth_tries =0 ;ieee80211_associate (dev, ifsta); }
Quoted 6 lines · Ivo van Doorn
After a succesfull authentication and association the matching retry counter must be reset to 0.
Failure to do so will result in failure to authenticate after the interface has been deauthenticated. This does not always happen after the first deauthentication, but after the interface has been several times been deauthenticated it will refuse to authenticate.
Thanks for spotting this, but your fix makes statistics about authentication/association exported via sysfs useless. The counters should be reset before a new authentication/association attempt (as is done in ieee80211_sta_new_auth).
I think this is a more correct fix:
--- net/d80211/ieee80211_sta.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-)
net/d80211/ieee80211_sta.c +13 -5
@@ -382,6 +382,14 @@ static void ieee80211_set_associated(str ifsta->last_probe = jiffies; } +static void ieee80211_set_disassoc (struct net_device *dev, +struct ieee80211_if_sta *ifsta,int deauth) +{ +if (deauth) + ifsta->auth_tries =0 ; + ifsta->assoc_tries =0 ; +ieee80211_set_associated (dev, ifsta,0 ); +}static void ieee80211_sta_tx (struct net_device *dev,struct sk_buff *skb,int encrypt,int probe_resp)
@@ -1023,7 +1031,7 @@ static void ieee80211_rx_mgmt_deauth(str IEEE80211_RETRY_AUTH_INTERVAL); } -ieee80211_set_associated (dev, ifsta,0 ); +ieee80211_set_disassoc (dev, ifsta,1 ); ifsta->authenticated =0 ; }
@@ -1066,7 +1074,7 @@ static void ieee80211_rx_mgmt_disassoc(s IEEE80211_RETRY_AUTH_INTERVAL); } -ieee80211_set_associated (dev, ifsta,0 ); +ieee80211_set_disassoc (dev, ifsta,0 ); }
@@ -1882,7 +1890,7 @@ void ieee80211_sta_work(void *ptr) "mixed-cell disabled - disassociate\n", dev->name);ieee80211_send_disassoc (dev, ifsta,WLAN_REASON_UNSPECIFIED ); -ieee80211_set_associated (dev, ifsta,0 ); +ieee80211_set_disassoc (dev, ifsta,0 ); } }
@@ -2858,7 +2866,7 @@ int ieee80211_sta_deauthenticate(structreturn -EINVAL ;ieee80211_send_deauth (dev, ifsta, reason); -ieee80211_set_associated (dev, ifsta,0 ); +ieee80211_set_disassoc (dev, ifsta,1 );return 0 ; }
@@ -2878,6 +2886,6 @@ int ieee80211_sta_disassociate(struct nereturn -1 ;ieee80211_send_disassoc (dev, ifsta, reason); -ieee80211_set_associated (dev, ifsta,0 ); +ieee80211_set_disassoc (dev, ifsta,1 );return 0 ; }
Signature · 2 lines
Jiri Benc SUSE Labs
Quoted 6 lines · Jiri Benc
Quoted 1 line · Ivo van Doorn
After a succesfull authentication and association the matching retry
counter
Quoted 2 lines
must be reset to 0.
Failure to do so will result in failure to authenticate after theinterface
Quoted 8 lines
Quoted 3 lines
has been deauthenticated. This does not always happen after the first deauthentication, but after the interface has been several times been deauthenticated it will refuse to authenticate.
Thanks for spotting this, but your fix makes statistics about authentication/association exported via sysfs useless. The counters should be reset before a new authentication/association attempt (as is done in
ieee80211_sta_new_auth).
Sounds good to me, I was unsure where those counters should be reset anyway. :)
Quoted 12 lines
I think this is a more correct fix:
net/d80211/ieee80211_sta.c +1
-1@@ -2858,7 +2866,7 @@ int ieee80211_sta_deauthenticate(structreturn -EINVAL ;ieee80211_send_deauth (dev, ifsta, reason); -ieee80211_set_associated (dev, ifsta,0 ); +ieee80211_set_disassoc (dev, ifsta,1 );return 0 ; }
net/d80211/ieee80211_sta.c int ieee80211_sta_disassociate(struct ne · line 2891
Quoted 7 lines
net/d80211/ieee80211_sta.c +1
-1@@ -2878,6 +2886,6 @@ int ieee80211_sta_disassociate(struct nereturn -1 ;ieee80211_send_disassoc (dev, ifsta, reason); -ieee80211_set_associated (dev, ifsta,0 ); +ieee80211_set_disassoc (dev, ifsta,1 );return 0 ; }
Shouldn't this last one be:ieee80211_set_disassoc(dev, ifsta, 0)
This one is called from the IOCTL request to dissassociate, so the interface should still be authenticated (with a valid auth retry counter).
Ivo
Quoted 6 lines · Ivo Van Doorn
Shouldn't this last one be:
ieee80211_set_disassoc(dev, ifsta, 0)This one is called from the IOCTL request to dissassociate, so the interface should still be authenticated (with a valid auth retry counter).
Yes, of course. Thanks for being watchful :-)
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs
Quoted 9 lines · Jiri Benc
Quoted 6 lines · Ivo Van Doorn
Shouldn't this last one be:
ieee80211_set_disassoc(dev, ifsta, 0)This one is called from the IOCTL request to dissassociate, so the interface should still be authenticated (with a valid auth retry counter).
Yes, of course. Thanks for being watchful :-)
I'll massage this and apply it on top of wireless-dev, since I already applied Ivo's patch.
John
Signature · 2 lines
John W. Linville [email protected]