netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] d80211: Reset assoc and auth retry counters
@ 2006-11-28 19:56 Ivo van Doorn
  2006-11-29 14:09 ` Jiri Benc
  0 siblings, 1 reply; 5+ messages in thread
From: Ivo van Doorn @ 2006-11-28 19:56 UTC (permalink / raw)
  To: John Linville, Jiri Benc; +Cc: netdev

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 <IvDoorn@gmail.com>

---

diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index deebbc7..04bd5cd 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -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);
 }
 

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

* Re: [PATCH] d80211: Reset assoc and auth retry counters
  2006-11-28 19:56 [PATCH] d80211: Reset assoc and auth retry counters Ivo van Doorn
@ 2006-11-29 14:09 ` Jiri Benc
  2006-11-29 14:27   ` Ivo Van Doorn
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Benc @ 2006-11-29 14:09 UTC (permalink / raw)
  To: Ivo van Doorn; +Cc: John Linville, netdev

On Tue, 28 Nov 2006 20:56:05 +0100, Ivo van Doorn wrote:
> 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:

Signed-off-by: Jiri Benc <jbenc@suse.cz>

---
 net/d80211/ieee80211_sta.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

--- dscape.orig/net/d80211/ieee80211_sta.c
+++ dscape/net/d80211/ieee80211_sta.c
@@ -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(struct 
 		return -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 ne
 		return -1;
 
 	ieee80211_send_disassoc(dev, ifsta, reason);
-	ieee80211_set_associated(dev, ifsta, 0);
+	ieee80211_set_disassoc(dev, ifsta, 1);
 	return 0;
 }


-- 
Jiri Benc
SUSE Labs

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

* Re: [PATCH] d80211: Reset assoc and auth retry counters
  2006-11-29 14:09 ` Jiri Benc
@ 2006-11-29 14:27   ` Ivo Van Doorn
  2006-11-29 14:33     ` Jiri Benc
  0 siblings, 1 reply; 5+ messages in thread
From: Ivo Van Doorn @ 2006-11-29 14:27 UTC (permalink / raw)
  To: Jiri Benc; +Cc: John Linville, netdev

On 11/29/06, Jiri Benc <jbenc@suse.cz> wrote:
> On Tue, 28 Nov 2006 20:56:05 +0100, Ivo van Doorn wrote:
> > 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).

Sounds good to me, I was unsure where those counters should be reset anyway. :)

> I think this is a more correct fix:
> @@ -2858,7 +2866,7 @@ int ieee80211_sta_deauthenticate(struct
>  		return -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 ne
>  		return -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

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

* Re: [PATCH] d80211: Reset assoc and auth retry counters
  2006-11-29 14:27   ` Ivo Van Doorn
@ 2006-11-29 14:33     ` Jiri Benc
  2006-11-29 16:10       ` John W. Linville
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Benc @ 2006-11-29 14:33 UTC (permalink / raw)
  To: Ivo Van Doorn; +Cc: John Linville, netdev

On Wed, 29 Nov 2006 15:27:06 +0100, Ivo Van Doorn wrote:
> 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

-- 
Jiri Benc
SUSE Labs

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

* Re: [PATCH] d80211: Reset assoc and auth retry counters
  2006-11-29 14:33     ` Jiri Benc
@ 2006-11-29 16:10       ` John W. Linville
  0 siblings, 0 replies; 5+ messages in thread
From: John W. Linville @ 2006-11-29 16:10 UTC (permalink / raw)
  To: Jiri Benc; +Cc: Ivo Van Doorn, netdev

On Wed, Nov 29, 2006 at 03:33:07PM +0100, Jiri Benc wrote:
> On Wed, 29 Nov 2006 15:27:06 +0100, Ivo Van Doorn wrote:
> > 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
-- 
John W. Linville
linville@tuxdriver.com

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

end of thread, other threads:[~2006-11-29 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-28 19:56 [PATCH] d80211: Reset assoc and auth retry counters Ivo van Doorn
2006-11-29 14:09 ` Jiri Benc
2006-11-29 14:27   ` Ivo Van Doorn
2006-11-29 14:33     ` Jiri Benc
2006-11-29 16:10       ` John W. Linville

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).