Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Mar 2007 13:30:12 GMT
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 115415 for review
Message-ID:  <200703061330.l26DUCOr007465@repoman.freebsd.org>

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

Change 115415 by sephe@sephe_zealot:sam_wifi on 2007/03/06 13:30:11

	Clean up 'arg' usage of ieee80211_new_state():
	- Feed error to S_SCAN, if assoc/auth failed, so scan modules can
	  know that error happens when joining current BSS and will choose
	  a better BSS to join next time.
	- Send assoc req instead of reassoc req, if we receive disassoc.
	- Send reassoc req instead of assoc req, if we already associated and
	  want to change some configuration.
	- Move comment near the commented code.
	
	Discussed with:	sam@
	Reviewed by:	sam@
	Approved by:	sam@

Affected files ...

.. //depot/projects/wifi/sys/net80211/ieee80211_input.c#93 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_node.c#86 edit

Differences ...

==== //depot/projects/wifi/sys/net80211/ieee80211_input.c#93 (text+ko) ====

@@ -1044,10 +1044,10 @@
 			if (ni != ic->ic_bss)
 				ni->ni_fails++;
 			ic->ic_stats.is_rx_auth_fail++;
-			ieee80211_new_state(ic, IEEE80211_S_SCAN, 0);
+			ieee80211_new_state(ic, IEEE80211_S_SCAN,
+			    IEEE80211_SCAN_FAIL_STATUS);
 		} else
-			ieee80211_new_state(ic, IEEE80211_S_ASSOC,
-			    wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK);
+			ieee80211_new_state(ic, IEEE80211_S_ASSOC, 0);
 		break;
 	}
 }
@@ -1286,8 +1286,7 @@
 				ic->ic_stats.is_rx_auth_fail++;
 				return;
 			}
-			ieee80211_new_state(ic, IEEE80211_S_ASSOC,
-			    wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK);
+			ieee80211_new_state(ic, IEEE80211_S_ASSOC, 0);
 			break;
 		case IEEE80211_AUTH_SHARED_CHALLENGE:
 			if (!alloc_challenge(ic, ni))
@@ -1322,7 +1321,8 @@
 		 * state transition.
 		 */
 		if (ic->ic_state == IEEE80211_S_AUTH)
-			ieee80211_new_state(ic, IEEE80211_S_SCAN, 0);
+			ieee80211_new_state(ic, IEEE80211_S_SCAN,
+			    IEEE80211_SCAN_FAIL_STATUS);
 	}
 }
 
@@ -2790,7 +2790,8 @@
 			if (ni != ic->ic_bss)	/* XXX never true? */
 				ni->ni_fails++;
 			ic->ic_stats.is_rx_assoc_norate++;
-			ieee80211_new_state(ic, IEEE80211_S_SCAN, 0);
+			ieee80211_new_state(ic, IEEE80211_S_SCAN,
+			    IEEE80211_SCAN_FAIL_STATUS);
 			return;
 		}
 
@@ -2913,8 +2914,7 @@
 		    ether_sprintf(ni->ni_macaddr), reason);
 		switch (ic->ic_opmode) {
 		case IEEE80211_M_STA:
-			ieee80211_new_state(ic, IEEE80211_S_ASSOC,
-			    wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK);
+			ieee80211_new_state(ic, IEEE80211_S_ASSOC, 0);
 			break;
 		case IEEE80211_M_HOSTAP:
 			if (ni != ic->ic_bss)

==== //depot/projects/wifi/sys/net80211/ieee80211_node.c#86 (text+ko) ====

@@ -581,16 +581,19 @@
 	ieee80211_wme_initparams(ic);
 
 	if (ic->ic_opmode == IEEE80211_M_STA) {
-		/*
-		 * Act as if we received a DEAUTH frame in case we are
-		 * invoked from the RUN state.  This will cause us to try
-		 * to re-authenticate if we are operating as a station.
-		 */
-		if (canreassoc)
-			ieee80211_new_state(ic, IEEE80211_S_ASSOC, 0);
-		else
+		if (canreassoc) {
+			/* Reassociate */
+			ieee80211_new_state(ic, IEEE80211_S_ASSOC, 1);
+		} else {
+			/*
+			 * Act as if we received a DEAUTH frame in case we
+			 * are invoked from the RUN state.  This will cause
+			 * us to try to re-authenticate if we are operating
+			 * as a station.
+			 */
 			ieee80211_new_state(ic, IEEE80211_S_AUTH,
 				IEEE80211_FC0_SUBTYPE_DEAUTH);
+		}
 	} else
 		ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
 	return 1;



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