PERFORCE change 66036 for review
Sam Leffler
sam at FreeBSD.org
Mon Nov 29 08:13:14 PST 2004
http://perforce.freebsd.org/chv.cgi?CH=66036
Change 66036 by sam at sam_ebb on 2004/11/29 16:12:47
o handle probe response frames in other than station mode
o handle probe request frames in station mode at any time
Affected files ...
.. //depot/projects/wifi/sys/net80211/ieee80211_input.c#19 edit
Differences ...
==== //depot/projects/wifi/sys/net80211/ieee80211_input.c#19 (text+ko) ====
@@ -1803,12 +1803,10 @@
* Be careful to ignore beacons received while doing a
* background scan. We consider only 11g/WMM stuff right now.
*/
- if (ni->ni_associd != 0 &&
+ if (ic->ic_opmode == IEEE80211_M_STA &&
+ ni->ni_associd != 0 &&
((ic->ic_flags & IEEE80211_F_SCAN) == 0 ||
IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_bssid))) {
- KASSERT(ic->ic_opmode == IEEE80211_M_STA,
- ("beacon in %u mode with associd 0x%x?",
- ic->ic_opmode, ni->ni_associd));
if (ni->ni_erp != erp) {
IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC,
"erp change from %s: was 0x%x, now 0x%x\n",
@@ -1921,14 +1919,16 @@
break;
}
- case IEEE80211_FC0_SUBTYPE_PROBE_REQ: {
- u_int8_t rate;
-
- if (ic->ic_opmode == IEEE80211_M_STA ||
- ic->ic_state != IEEE80211_S_RUN) {
+ case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
+ if (ic->ic_state != IEEE80211_S_RUN) {
ic->ic_stats.is_rx_mgtdiscard++;
return;
}
+ if (IEEE80211_IS_MULTICAST(wh->i_addr2)) {
+ /* frame must be directed */
+ ic->ic_stats.is_rx_mgtdiscard++; /* XXX stat */
+ return;
+ }
/*
* prreq frame format
@@ -1955,43 +1955,59 @@
IEEE80211_VERIFY_ELEMENT(ssid, IEEE80211_NWID_LEN);
IEEE80211_VERIFY_SSID(ic->ic_bss, ssid, "probe");
- if (ni == ic->ic_bss) {
- if (ic->ic_opmode == IEEE80211_M_IBSS) {
- /*
- * XXX Cannot tell if the sender is operating
- * in ibss mode. But we need a new node to
- * send the response so blindly add them to the
- * neighbor table.
- */
+ allocbs = 0;
+ switch (ic->ic_opmode) {
+ case IEEE80211_M_IBSS:
+ case IEEE80211_M_AHDEMO:
+ /*
+ * XXX Cannot tell if the sender is operating
+ * in ibss mode. But we need a new node to
+ * send the response so blindly add them to the
+ * neighbor table.
+ */
+ if (ni == ic->ic_bss) {
ni = ieee80211_fakeup_adhoc_node(ic->ic_sta,
- wh->i_addr2);
- } else
+ wh->i_addr2);
+ if (ni == NULL)
+ return;
+ allocbs = 1;
+ }
+ break;
+ case IEEE80211_M_HOSTAP:
+ if (ni == ic->ic_bss) {
ni = ieee80211_dup_bss(ic->ic_sta, wh->i_addr2);
- if (ni == NULL)
- return;
- IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC,
- "%s: new probe req from %s\n",
- __func__, ether_sprintf(wh->i_addr2));
- allocbs = 1;
- } else
- allocbs = 0;
+ if (ni == NULL)
+ return;
+ allocbs = 1;
+ }
+ break;
+ default: /* silence compiler */
+ break;
+ }
+ IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC,
+ "%s: %sprobe req from %s\n", __func__,
+ allocbs ? "new" : "", ether_sprintf(wh->i_addr2));
ni->ni_rssi = rssi;
ni->ni_rstamp = rstamp;
- rate = ieee80211_setup_rates(ic, ni, rates, xrates,
- IEEE80211_F_DOSORT | IEEE80211_F_DOFRATE
+ if (ic->ic_opmode != IEEE80211_M_STA) {
+ u_int8_t rate;
+ /*
+ * Calculate rate set for response.
+ */
+ rate = ieee80211_setup_rates(ic, ni, rates, xrates,
+ IEEE80211_F_DOSORT | IEEE80211_F_DOFRATE
| IEEE80211_F_DONEGO | IEEE80211_F_DODEL);
- if (rate & IEEE80211_RATE_BASIC) {
- IEEE80211_DPRINTF(ic, IEEE80211_MSG_XRATE,
- "%s: rate negotiation failed: %s\n",
- __func__,ether_sprintf(wh->i_addr2));
- if (allocbs) /* reclaim immediately */
- ieee80211_free_node(ni);
- } else {
- IEEE80211_SEND_MGMT(ic, ni,
- IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0);
+ if (rate & IEEE80211_RATE_BASIC) {
+ IEEE80211_DPRINTF(ic, IEEE80211_MSG_XRATE,
+ "[%s] received rate set invalid\n",
+ ether_sprintf(wh->i_addr2));
+ if (allocbs) /* reclaim immediately */
+ ieee80211_free_node(ni);
+ }
}
+ IEEE80211_SEND_MGMT(ic, ni,
+ IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0);
break;
- }
case IEEE80211_FC0_SUBTYPE_AUTH: {
u_int16_t algo, seq, status;
More information about the p4-projects
mailing list