Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Feb 2008 16:56:41 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 135970 for review
Message-ID:  <200802221656.m1MGufPv030180@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=135970

Change 135970 by sam@sam_ebb on 2008/02/22 16:55:45

	pull check for being in RUN state on processing AUTH packets
	up into the caller so it can be done early; this guards against
	responding w/ an error packet before the bss channel is setup

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_hostap.c#14 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_hostap.c#14 (text+ko) ====

@@ -892,6 +892,8 @@
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 
+	KASSERT(vap->iv_state == IEEE80211_S_RUN, ("state %d", vap->iv_state));
+
 	if (ni->ni_authmode == IEEE80211_AUTH_SHARED) {
 		IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_AUTH,
 		    ni->ni_macaddr, "open auth",
@@ -912,8 +914,7 @@
 		    (seq + 1) | (IEEE80211_STATUS_ALG<<16));
 		return;
 	}
-	if (vap->iv_state != IEEE80211_S_RUN ||
-	    seq != IEEE80211_AUTH_OPEN_REQUEST) {
+	if (seq != IEEE80211_AUTH_OPEN_REQUEST) {
 		vap->iv_stats.is_rx_bad_auth++;
 		return;
 	}
@@ -967,6 +968,8 @@
 	uint8_t *challenge;
 	int allocbs, estatus;
 
+	KASSERT(vap->iv_state == IEEE80211_S_RUN, ("state %d", vap->iv_state));
+
 	/*
 	 * NB: this can happen as we allow pre-shared key
 	 * authentication to be enabled w/o wep being turned
@@ -1034,13 +1037,6 @@
 	default:
 		break;
 	}
-	if (vap->iv_state != IEEE80211_S_RUN) {
-		IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_AUTH,
-		    ni->ni_macaddr, "shared key auth",
-		    "bad state %u", vap->iv_state);
-		estatus = IEEE80211_STATUS_ALG;	/* XXX */
-		goto bad;
-	}
 	switch (seq) {
 	case IEEE80211_AUTH_SHARED_REQUEST:
 		if (ni == vap->iv_bss) {
@@ -1843,6 +1839,11 @@
 
 	case IEEE80211_FC0_SUBTYPE_AUTH: {
 		uint16_t algo, seq, status;
+
+		if (vap->iv_state != IEEE80211_S_RUN) {
+			vap->iv_stats.is_rx_mgtdiscard++;
+			return;
+		}
 		/*
 		 * auth frame format
 		 *	[2] algorithm



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