From owner-p4-projects@FreeBSD.ORG Mon Nov 29 16:13:13 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 980F616A4D0; Mon, 29 Nov 2004 16:13:13 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5AED816A4CE for ; Mon, 29 Nov 2004 16:13:13 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3D70243D5A for ; Mon, 29 Nov 2004 16:13:13 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id iATGDDuu009224 for ; Mon, 29 Nov 2004 16:13:13 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iATGDDjB009221 for perforce@freebsd.org; Mon, 29 Nov 2004 16:13:13 GMT (envelope-from sam@freebsd.org) Date: Mon, 29 Nov 2004 16:13:13 GMT Message-Id: <200411291613.iATGDDjB009221@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 66036 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2004 16:13:14 -0000 http://perforce.freebsd.org/chv.cgi?CH=66036 Change 66036 by sam@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;