PERFORCE change 77113 for review
Sam Leffler
sam at FreeBSD.org
Tue May 17 16:32:39 PDT 2005
http://perforce.freebsd.org/chv.cgi?CH=77113
Change 77113 by sam at sam_ebb on 2005/05/17 23:32:15
When receiving a NAK to an AUTH or ASSOC request frame explicitly
kick the state machine rather than waiting for the tx timeout to fire.
Affected files ...
.. //depot/projects/vap/sys/net80211/ieee80211_input.c#12 edit
Differences ...
==== //depot/projects/vap/sys/net80211/ieee80211_input.c#12 (text+ko) ====
@@ -1138,13 +1138,10 @@
IEEE80211_NOTE(vap,
IEEE80211_MSG_DEBUG | IEEE80211_MSG_AUTH, ni,
"open auth failed (reason %d)", status);
- /* XXX can this happen? */
- if (ni != vap->iv_bss)
- ni->ni_fails++;
vap->iv_stats.is_rx_auth_fail++;
- return;
- }
- ieee80211_new_state(vap, IEEE80211_S_ASSOC, 0);
+ ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
+ } else
+ ieee80211_new_state(vap, IEEE80211_S_ASSOC, 0);
break;
case IEEE80211_M_MONITOR:
break;
@@ -1211,6 +1208,7 @@
* ordering in which case this check would just be
* for sanity/consistency.
*/
+ estatus = 0; /* NB: silence compiler */
if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) {
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_AUTH,
ni->ni_macaddr, "shared key auth",
@@ -1375,17 +1373,14 @@
ieee80211_getbssid(vap, wh),
"shared key auth failed (reason %d)",
status);
- /* XXX can this happen? */
- if (ni != vap->iv_bss)
- ni->ni_fails++;
vap->iv_stats.is_rx_auth_fail++;
- return;
+ goto bad;
}
ieee80211_new_state(vap, IEEE80211_S_ASSOC, 0);
break;
case IEEE80211_AUTH_SHARED_CHALLENGE:
if (!alloc_challenge(ni))
- return;
+ goto bad;
/* XXX could optimize by passing recvd challenge */
memcpy(ni->ni_challenge, &challenge[2], challenge[1]);
IEEE80211_SEND_MGMT(ni,
@@ -1395,20 +1390,28 @@
IEEE80211_DISCARD(vap, IEEE80211_MSG_AUTH,
wh, "shared key auth", "bad seq %d", seq);
vap->iv_stats.is_rx_bad_auth++;
- return;
+ goto bad;
}
break;
}
return;
bad:
- /*
- * Send an error response; but only when operating as an AP.
- */
if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
+ /*
+ * Send an error response.
+ */
/* XXX hack to workaround calling convention */
ieee80211_send_error(ni, wh->i_addr2,
IEEE80211_FC0_SUBTYPE_AUTH,
(seq + 1) | (estatus<<16));
+ } else if (vap->iv_opmode == IEEE80211_M_STA) {
+ /*
+ * Kick the state machine. This short-circuits
+ * using the mgt frame timeout to trigger the
+ * state transition.
+ */
+ if (vap->iv_state == IEEE80211_S_AUTH)
+ ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
}
}
@@ -2749,9 +2752,8 @@
wh->i_addr2,
"%sassoc failed (reason %d)",
ISREASSOC(subtype) ? "re" : "", status);
- if (ni != vap->iv_bss) /* XXX never true? */
- ni->ni_fails++;
vap->iv_stats.is_rx_auth_fail++; /* XXX */
+ ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
return;
}
associd = le16toh(*(u_int16_t *)frm);
@@ -2783,9 +2785,8 @@
wh->i_addr2,
"%sassoc failed (rate set mismatch)",
ISREASSOC(subtype) ? "re" : "");
- if (ni != vap->iv_bss) /* XXX never true? */
- ni->ni_fails++;
vap->iv_stats.is_rx_assoc_norate++;
+ ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
return;
}
More information about the p4-projects
mailing list