PERFORCE change 87546 for review
Sam Leffler
sam at FreeBSD.org
Wed Nov 30 22:31:51 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=87546
Change 87546 by sam at sam_ebb on 2005/11/30 22:30:48
be more careful about how we respond to a deauth; don't
pound the ap if it's not going allow us in
Affected files ...
.. //depot/projects/wifi/sys/net80211/ieee80211_input.c#72 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_proto.c#41 edit
Differences ...
==== //depot/projects/wifi/sys/net80211/ieee80211_input.c#72 (text+ko) ====
@@ -2780,7 +2780,7 @@
switch (ic->ic_opmode) {
case IEEE80211_M_STA:
ieee80211_new_state(ic, IEEE80211_S_AUTH,
- wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK);
+ (reason << 8) | IEEE80211_FC0_SUBTYPE_DEAUTH);
break;
case IEEE80211_M_HOSTAP:
if (ni != ic->ic_bss)
==== //depot/projects/wifi/sys/net80211/ieee80211_proto.c#41 (text+ko) ====
@@ -1021,6 +1021,34 @@
IEEE80211_REASON_ASSOC_LEAVE);
}
+/*
+ * Handle deauth with reason. We retry only for
+ * the cases where we might succeed. Otherwise
+ * we downgrade the ap and scan.
+ */
+static void
+sta_authretry(struct ieee80211com *ic, struct ieee80211_node *ni, int reason)
+{
+ switch (reason) {
+ case IEEE80211_STATUS_TIMEOUT:
+ case IEEE80211_REASON_ASSOC_EXPIRE:
+ case IEEE80211_REASON_NOT_AUTHED:
+ case IEEE80211_REASON_NOT_ASSOCED:
+ case IEEE80211_REASON_ASSOC_LEAVE:
+ case IEEE80211_REASON_ASSOC_NOT_AUTHED:
+ IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_AUTH, 1);
+ break;
+ default:
+ ieee80211_scan_assoc_fail(ic, ic->ic_bss->ni_macaddr, reason);
+ if (ic->ic_roaming == IEEE80211_ROAMING_AUTO)
+ ieee80211_check_scan(ic,
+ IEEE80211_SCAN_ACTIVE,
+ IEEE80211_SCAN_FOREVER,
+ ic->ic_des_nssid, ic->ic_des_ssid);
+ break;
+ }
+}
+
static int
ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
{
@@ -1163,20 +1191,19 @@
break;
case IEEE80211_S_AUTH:
case IEEE80211_S_ASSOC:
- switch (arg) {
+ switch (arg & 0xff) {
case IEEE80211_FC0_SUBTYPE_AUTH:
/* ??? */
IEEE80211_SEND_MGMT(ic, ni,
IEEE80211_FC0_SUBTYPE_AUTH, 2);
break;
case IEEE80211_FC0_SUBTYPE_DEAUTH:
- IEEE80211_SEND_MGMT(ic, ni,
- IEEE80211_FC0_SUBTYPE_AUTH, 1);
+ sta_authretry(ic, ni, arg>>8);
break;
}
break;
case IEEE80211_S_RUN:
- switch (arg) {
+ switch (arg & 0xff) {
case IEEE80211_FC0_SUBTYPE_AUTH:
IEEE80211_SEND_MGMT(ic, ni,
IEEE80211_FC0_SUBTYPE_AUTH, 2);
More information about the p4-projects
mailing list