Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jun 2009 23:33:09 +0000 (UTC)
From:      Sam Leffler <sam@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r193414 - head/sys/net80211
Message-ID:  <200906032333.n53NX9C8070512@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sam
Date: Wed Jun  3 23:33:09 2009
New Revision: 193414
URL: http://svn.freebsd.org/changeset/base/193414

Log:
  When a channel switch is done to a channel with different operating
  characteristics force the stations to re-associate so protocol state
  is re-initialized.  Note that for 11h/DFS this is irrelevant as channel
  changes are never cross-band.
  
  Reviewed by:	ctlaw

Modified:
  head/sys/net80211/ieee80211_hostap.c

Modified: head/sys/net80211/ieee80211_hostap.c
==============================================================================
--- head/sys/net80211/ieee80211_hostap.c	Wed Jun  3 23:30:25 2009	(r193413)
+++ head/sys/net80211/ieee80211_hostap.c	Wed Jun  3 23:33:09 2009	(r193414)
@@ -127,6 +127,28 @@ sta_csa(void *arg, struct ieee80211_node
 		}
 }
 
+static void
+sta_drop(void *arg, struct ieee80211_node *ni)
+{
+	struct ieee80211vap *vap = arg;
+
+	if (ni->ni_vap == vap && ni->ni_associd != 0)
+		ieee80211_node_leave(ni);
+}
+
+/*
+ * Does a channel change require associated stations to re-associate
+ * so protocol state is correct.  This is used when doing CSA across
+ * bands or similar (e.g. HT -> legacy).
+ */
+static int
+isbandchange(struct ieee80211com *ic)
+{
+	return ((ic->ic_bsschan->ic_flags ^ ic->ic_csa_newchan->ic_flags) &
+	    (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HALF |
+	     IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HT)) != 0;
+}
+
 /*
  * IEEE80211_M_HOSTAP vap state machine handler.
  */
@@ -307,6 +329,18 @@ hostap_newstate(struct ieee80211vap *vap
 		}
 		ieee80211_node_authorize(vap->iv_bss);
 		break;
+	case IEEE80211_S_CSA:
+		if (ostate == IEEE80211_S_RUN && isbandchange(ic)) {
+			/*
+			 * On a ``band change'' silently drop associated
+			 * stations as they must re-associate before they
+			 * can pass traffic (as otherwise protocol state
+			 * such as capabilities and the negotiated rate
+			 * set may/will be wrong).
+			 */
+			ieee80211_iterate_nodes(&ic->ic_sta, sta_drop, vap);
+		}
+		break;
 	default:
 		break;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906032333.n53NX9C8070512>