linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: in ADHOC don't update last_rx if sta is not authorized
@ 2012-11-25 22:13 Antonio Quartulli
  2012-11-26 10:32 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2012-11-25 22:13 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Antonio Quartulli

It does not make sense to keep a station alive if it is not authorised
at all. If IBSS/RSN is used it could also be the case that something
went wrong during the keys exchange and the stations ended up in a not
recoverable state.

By not updating last_rx we are giving the station a chance to be
deleted and to start the key exchange once again from scratch.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
 net/mac80211/rx.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index ec15a49..7dee98b 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1338,13 +1338,17 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
 
 	/*
 	 * Update last_rx only for IBSS packets which are for the current
-	 * BSSID to avoid keeping the current IBSS network alive in cases
-	 * where other STAs start using different BSSID.
+	 * BSSID and for station already AUTHORIZED to avoid keeping the
+	 * current IBSS network alive in cases where other STAs start
+	 * using different BSSID. This will also give the station another
+	 * chance to restart the authentication/authorization in case
+	 * something went wrong the first time.
 	 */
 	if (rx->sdata->vif.type == NL80211_IFTYPE_ADHOC) {
 		u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len,
 						NL80211_IFTYPE_ADHOC);
-		if (ether_addr_equal(bssid, rx->sdata->u.ibss.bssid)) {
+		if (ether_addr_equal(bssid, rx->sdata->u.ibss.bssid) &&
+		    test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
 			sta->last_rx = jiffies;
 			if (ieee80211_is_data(hdr->frame_control)) {
 				sta->last_rx_rate_idx = status->rate_idx;
-- 
1.8.0


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

* Re: [PATCH] mac80211: in ADHOC don't update last_rx if sta is not authorized
  2012-11-25 22:13 [PATCH] mac80211: in ADHOC don't update last_rx if sta is not authorized Antonio Quartulli
@ 2012-11-26 10:32 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2012-11-26 10:32 UTC (permalink / raw)
  To: Antonio Quartulli; +Cc: linux-wireless

On Sun, 2012-11-25 at 23:13 +0100, Antonio Quartulli wrote:
> It does not make sense to keep a station alive if it is not authorised
> at all. If IBSS/RSN is used it could also be the case that something
> went wrong during the keys exchange and the stations ended up in a not
> recoverable state.
> 
> By not updating last_rx we are giving the station a chance to be
> deleted and to start the key exchange once again from scratch.

Applied.

johannes


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

end of thread, other threads:[~2012-11-26 10:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-25 22:13 [PATCH] mac80211: in ADHOC don't update last_rx if sta is not authorized Antonio Quartulli
2012-11-26 10:32 ` Johannes Berg

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).