Lines Matching +full:no +full:- +full:scan +full:- +full:on +full:- +full:init

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
82 ic->ic_vattach[IEEE80211_M_IBSS] = adhoc_vattach; in ieee80211_adhoc_attach()
83 ic->ic_vattach[IEEE80211_M_AHDEMO] = adhoc_vattach; in ieee80211_adhoc_attach()
99 vap->iv_newstate = adhoc_newstate; in adhoc_vattach()
100 vap->iv_input = adhoc_input; in adhoc_vattach()
101 if (vap->iv_opmode == IEEE80211_M_IBSS) in adhoc_vattach()
102 vap->iv_recv_mgmt = adhoc_recv_mgmt; in adhoc_vattach()
104 vap->iv_recv_mgmt = ahdemo_recv_mgmt; in adhoc_vattach()
105 vap->iv_recv_ctl = adhoc_recv_ctl; in adhoc_vattach()
106 vap->iv_opdetach = adhoc_vdetach; in adhoc_vattach()
111 * on top of us. in adhoc_vattach()
113 if (vap->iv_caps & IEEE80211_C_TDMA) in adhoc_vattach()
121 struct ieee80211vap *vap = ni->ni_vap; in sta_leave()
123 if (ni != vap->iv_bss) in sta_leave()
133 struct ieee80211com *ic = vap->iv_ic; in adhoc_newstate()
137 IEEE80211_LOCK_ASSERT(vap->iv_ic); in adhoc_newstate()
139 ostate = vap->iv_state; in adhoc_newstate()
140 IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n", in adhoc_newstate()
143 vap->iv_state = nstate; /* state transition */ in adhoc_newstate()
145 ieee80211_cancel_scan(vap); /* background scan */ in adhoc_newstate()
146 ni = vap->iv_bss; /* NB: no reference held */ in adhoc_newstate()
157 /* NB: optimize INIT -> INIT case */ in adhoc_newstate()
165 ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, in adhoc_newstate()
169 if (vap->iv_des_chan != IEEE80211_CHAN_ANYC && in adhoc_newstate()
170 !IEEE80211_IS_CHAN_RADAR(vap->iv_des_chan)) { in adhoc_newstate()
173 * scan and startup immediately. in adhoc_newstate()
177 vap->iv_des_chan, vap->iv_flags_ht)); in adhoc_newstate()
181 * Initiate a scan. We can come here as a result in adhoc_newstate()
184 * and the scan request parameters will be present in adhoc_newstate()
187 if (vap->iv_flags_ext & IEEE80211_FEXT_SCANREQ) { in adhoc_newstate()
189 vap->iv_scanreq_flags, in adhoc_newstate()
190 vap->iv_scanreq_duration, in adhoc_newstate()
191 vap->iv_scanreq_mindwell, in adhoc_newstate()
192 vap->iv_scanreq_maxdwell, in adhoc_newstate()
193 vap->iv_scanreq_nssid, vap->iv_scanreq_ssid); in adhoc_newstate()
194 vap->iv_flags_ext &= ~IEEE80211_FEXT_SCANREQ; in adhoc_newstate()
201 * that requires a reset. Trigger a new scan in adhoc_newstate()
205 if (vap->iv_roaming == IEEE80211_ROAMING_AUTO) in adhoc_newstate()
213 if (vap->iv_flags & IEEE80211_F_WPA) { in adhoc_newstate()
220 * scan and startup immediately. in adhoc_newstate()
222 * back to do a RUN->RUN state change. in adhoc_newstate()
226 ic->ic_curchan, vap->iv_flags_ht)); in adhoc_newstate()
227 /* NB: iv_bss is changed on return */ in adhoc_newstate()
228 ni = vap->iv_bss; in adhoc_newstate()
235 ether_sprintf(ni->ni_bssid)); in adhoc_newstate()
236 ieee80211_print_essid(vap->iv_bss->ni_essid, in adhoc_newstate()
237 ni->ni_esslen); in adhoc_newstate()
239 ieee80211_chan2ieee(ic, ic->ic_curchan), in adhoc_newstate()
253 if (ni->ni_authmode != IEEE80211_AUTH_8021X) in adhoc_newstate()
258 if (!IEEE80211_ADDR_EQ(ni->ni_macaddr, vap->iv_myaddr) && in adhoc_newstate()
259 ic->ic_newassoc != NULL) in adhoc_newstate()
260 ic->ic_newassoc(ni, ostate != IEEE80211_S_RUN); in adhoc_newstate()
263 vap->iv_sta_ps(vap, 0); in adhoc_newstate()
268 "%s: unexpected state transition %s -> %s\n", __func__, in adhoc_newstate()
286 return (vap->iv_ic->ic_flags & IEEE80211_F_SCAN); in doprint()
307 struct ieee80211vap *vap = ni->ni_vap; in adhoc_input()
308 struct ieee80211com *ic = ni->ni_ic; in adhoc_input()
309 struct ifnet *ifp = vap->iv_ifp; in adhoc_input()
324 if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_DECRYPTED)) in adhoc_input()
327 if (m->m_flags & M_AMPDU_MPDU) { in adhoc_input()
329 * Fastpath for A-MPDU reorder q resubmission. Frames in adhoc_input()
331 * here but were received out of order and been held on in adhoc_input()
338 dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK; in adhoc_input()
345 ni->ni_inact = ni->ni_inact_reload; in adhoc_input()
347 type = -1; /* undefined */ in adhoc_input()
349 if (m->m_pkthdr.len < sizeof(struct ieee80211_frame_min)) { in adhoc_input()
351 ni->ni_macaddr, NULL, in adhoc_input()
352 "too short (1): len %u", m->m_pkthdr.len); in adhoc_input()
353 vap->iv_stats.is_rx_tooshort++; in adhoc_input()
357 * Bit of a cheat here, we use a pointer for a 3-address in adhoc_input()
366 ni->ni_macaddr, NULL, "wrong version, fc %02x:%02x", in adhoc_input()
367 wh->i_fc[0], wh->i_fc[1]); in adhoc_input()
368 vap->iv_stats.is_rx_badversion++; in adhoc_input()
372 dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK; in adhoc_input()
373 type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; in adhoc_input()
374 subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; in adhoc_input()
375 if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) { in adhoc_input()
377 bssid = wh->i_addr1; in adhoc_input()
379 bssid = wh->i_addr1; in adhoc_input()
381 if (m->m_pkthdr.len < sizeof(struct ieee80211_frame)) { in adhoc_input()
383 IEEE80211_MSG_ANY, ni->ni_macaddr, in adhoc_input()
385 m->m_pkthdr.len); in adhoc_input()
386 vap->iv_stats.is_rx_tooshort++; in adhoc_input()
389 bssid = wh->i_addr3; in adhoc_input()
397 !IEEE80211_ADDR_EQ(bssid, vap->iv_bss->ni_bssid) && in adhoc_input()
398 !IEEE80211_ADDR_EQ(bssid, ifp->if_broadcastaddr)) { in adhoc_input()
402 vap->iv_stats.is_rx_wrongbss++; in adhoc_input()
410 ni == vap->iv_bss && in adhoc_input()
411 !IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) { in adhoc_input()
415 * entries will blow up because there is no bss in adhoc_input()
418 if (vap->iv_state != IEEE80211_S_RUN) { in adhoc_input()
421 ieee80211_state_name[vap->iv_state]); in adhoc_input()
422 vap->iv_stats.is_rx_badstate++; in adhoc_input()
433 ni = ieee80211_fakeup_adhoc_node(vap, wh->i_addr2); in adhoc_input()
439 IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi); in adhoc_input()
440 ni->ni_noise = nf; in adhoc_input()
442 IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) { in adhoc_input()
446 ic->ic_wme.wme_hipri_traffic++; in adhoc_input()
455 if (m->m_len < hdrspace && in adhoc_input()
458 ni->ni_macaddr, NULL, in adhoc_input()
460 vap->iv_stats.is_rx_tooshort++; in adhoc_input()
466 vap->iv_stats.is_rx_wrongdir++; in adhoc_input()
469 /* XXX no power-save support */ in adhoc_input()
472 * Handle A-MPDU re-ordering. If the frame is to be in adhoc_input()
477 if ((m->m_flags & M_AMPDU) && in adhoc_input()
493 if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) { in adhoc_input()
499 vap->iv_stats.is_rx_noprivacy++; in adhoc_input()
509 wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; in adhoc_input()
517 * Save QoS bits for use below--before we strip the header. in adhoc_input()
527 if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { in adhoc_input()
534 wh = NULL; /* no longer valid, catch any uses */ in adhoc_input()
541 ni->ni_macaddr, "data", "%s", "demic error"); in adhoc_input()
542 vap->iv_stats.is_rx_demicfail++; in adhoc_input()
563 ni->ni_macaddr, "data", "%s", "decap error"); in adhoc_input()
564 vap->iv_stats.is_rx_decap++; in adhoc_input()
574 * Deny any non-PAE frames received prior to in adhoc_input()
575 * authorization. For open/shared-key in adhoc_input()
582 eh->ether_type != htons(ETHERTYPE_PAE)) { in adhoc_input()
584 ni->ni_macaddr, "data", "unauthorized or " in adhoc_input()
586 eh == NULL ? -1 : eh->ether_type, in adhoc_input()
587 m->m_pkthdr.len); in adhoc_input()
588 vap->iv_stats.is_rx_unauth++; in adhoc_input()
595 * any non-PAE frames received without encryption. in adhoc_input()
597 if ((vap->iv_flags & IEEE80211_F_DROPUNENC) && in adhoc_input()
598 ((has_decrypted == 0) && (m->m_flags & M_WEP) == 0) && in adhoc_input()
601 eh->ether_type != htons(ETHERTYPE_PAE))) { in adhoc_input()
605 vap->iv_stats.is_rx_unencrypted++; in adhoc_input()
622 if (dir == IEEE80211_FC1_DIR_DSTODS && ni->ni_wdsvap != NULL) in adhoc_input()
623 ieee80211_deliver_data(ni->ni_wdsvap, ni, m); in adhoc_input()
629 vap->iv_stats.is_rx_mgmt++; in adhoc_input()
634 vap->iv_stats.is_rx_wrongdir++; in adhoc_input()
637 if (m->m_pkthdr.len < sizeof(struct ieee80211_frame)) { in adhoc_input()
639 ni->ni_macaddr, "mgt", "too short: len %u", in adhoc_input()
640 m->m_pkthdr.len); in adhoc_input()
641 vap->iv_stats.is_rx_tooshort++; in adhoc_input()
649 ether_sprintf(wh->i_addr2), rssi); in adhoc_input()
655 vap->iv_stats.is_rx_mgtdiscard++; /* XXX */ in adhoc_input()
658 vap->iv_recv_mgmt(ni, m, subtype, rxs, rssi, nf); in adhoc_input()
662 vap->iv_stats.is_rx_ctl++; in adhoc_input()
664 vap->iv_recv_ctl(ni, m, subtype); in adhoc_input()
705 struct ieee80211vap *vap = ni->ni_vap; in adhoc_recv_mgmt()
706 struct ieee80211com *ic = ni->ni_ic; in adhoc_recv_mgmt()
707 struct ieee80211_channel *rxchan = ic->ic_curchan; in adhoc_recv_mgmt()
717 efrm = mtod(m0, uint8_t *) + m0->m_len; in adhoc_recv_mgmt()
722 wh->i_addr2, ":", in adhoc_recv_mgmt()
724 ni->ni_macaddr, ":", in adhoc_recv_mgmt()
725 wh->i_fc[0], in adhoc_recv_mgmt()
726 wh->i_fc[1]); in adhoc_recv_mgmt()
730 struct ieee80211_scanparams scan; in adhoc_recv_mgmt() local
741 if (ieee80211_parse_beacon(ni, m0, rxchan, &scan) != 0) in adhoc_recv_mgmt()
747 vap->iv_stats.is_rx_beacon++; /* XXX remove */ in adhoc_recv_mgmt()
752 * If scanning, just pass information to the scan module. in adhoc_recv_mgmt()
754 if (ic->ic_flags & IEEE80211_F_SCAN) { in adhoc_recv_mgmt()
755 if (ic->ic_flags_ext & IEEE80211_FEXT_PROBECHAN) { in adhoc_recv_mgmt()
765 ic->ic_flags_ext &= ~IEEE80211_FEXT_PROBECHAN; in adhoc_recv_mgmt()
767 ieee80211_add_scan(vap, rxchan, &scan, wh, in adhoc_recv_mgmt()
771 if (scan.capinfo & IEEE80211_CAPINFO_IBSS) { in adhoc_recv_mgmt()
772 if (!IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) { in adhoc_recv_mgmt()
780 * Otherwise this code will match on all IBSS in adhoc_recv_mgmt()
785 if (ieee80211_ibss_node_check_new(ni, &scan)) { in adhoc_recv_mgmt()
786 ni = ieee80211_add_neighbor(vap, wh, &scan); in adhoc_recv_mgmt()
792 vap->iv_myaddr, /* SA */ in adhoc_recv_mgmt()
793 ni->ni_macaddr, /* DA */ in adhoc_recv_mgmt()
794 vap->iv_bss->ni_bssid, /* BSSID */ in adhoc_recv_mgmt()
795 vap->iv_bss->ni_essid, in adhoc_recv_mgmt()
796 vap->iv_bss->ni_esslen); /* SSID */ in adhoc_recv_mgmt()
806 if (! (ic->ic_flags & IEEE80211_F_SCAN)) in adhoc_recv_mgmt()
808 vap->iv_myaddr, /* SA */ in adhoc_recv_mgmt()
809 ni->ni_macaddr, /* DA */ in adhoc_recv_mgmt()
810 vap->iv_bss->ni_bssid, /* BSSID */ in adhoc_recv_mgmt()
811 vap->iv_bss->ni_essid, in adhoc_recv_mgmt()
812 vap->iv_bss->ni_esslen); /* SSID */ in adhoc_recv_mgmt()
814 } else if (ni->ni_capinfo == 0) { in adhoc_recv_mgmt()
816 * Update faked node created on transmit. in adhoc_recv_mgmt()
819 ieee80211_init_neighbor(ni, wh, &scan); in adhoc_recv_mgmt()
826 vap->iv_myaddr, /* SA */ in adhoc_recv_mgmt()
827 ni->ni_macaddr, /* DA */ in adhoc_recv_mgmt()
828 vap->iv_bss->ni_bssid, /* BSSID */ in adhoc_recv_mgmt()
829 vap->iv_bss->ni_essid, in adhoc_recv_mgmt()
830 vap->iv_bss->ni_esslen); /* SSID */ in adhoc_recv_mgmt()
835 memcpy(ni->ni_tstamp.data, scan.tstamp, in adhoc_recv_mgmt()
836 sizeof(ni->ni_tstamp)); in adhoc_recv_mgmt()
839 * This isn't enabled yet - otherwise it would in adhoc_recv_mgmt()
846 if (scan.htcap != NULL && scan.htinfo != NULL && in adhoc_recv_mgmt()
847 (vap->iv_flags_ht & IEEE80211_FHT_HT)) { in adhoc_recv_mgmt()
849 scan.htcap, scan.htinfo)); in adhoc_recv_mgmt()
851 scan.htcap, scan.htinfo)) in adhoc_recv_mgmt()
858 IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi); in adhoc_recv_mgmt()
859 ni->ni_noise = nf; in adhoc_recv_mgmt()
862 * Same here - the channel width change should in adhoc_recv_mgmt()
869 * Since there's no (current) way to inform in adhoc_recv_mgmt()
883 if (vap->iv_state != IEEE80211_S_RUN) { in adhoc_recv_mgmt()
886 ieee80211_state_name[vap->iv_state]); in adhoc_recv_mgmt()
887 vap->iv_stats.is_rx_mgtdiscard++; in adhoc_recv_mgmt()
890 if (IEEE80211_IS_MULTICAST(wh->i_addr2)) { in adhoc_recv_mgmt()
894 vap->iv_stats.is_rx_mgtdiscard++; /* XXX stat */ in adhoc_recv_mgmt()
905 while (efrm - frm > 1) { in adhoc_recv_mgmt()
906 IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return); in adhoc_recv_mgmt()
923 IEEE80211_RATE_MAXSIZE - rates[1], return); in adhoc_recv_mgmt()
925 IEEE80211_VERIFY_SSID(vap->iv_bss, ssid, return); in adhoc_recv_mgmt()
926 if ((vap->iv_flags & IEEE80211_F_HIDESSID) && ssid[1] == 0) { in adhoc_recv_mgmt()
929 "%s", "no ssid with ssid suppression enabled"); in adhoc_recv_mgmt()
930 vap->iv_stats.is_rx_ssidmismatch++; /*XXX*/ in adhoc_recv_mgmt()
935 IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_INPUT, wh->i_addr2, in adhoc_recv_mgmt()
940 * only a bare-bones rate set, communicate this to in adhoc_recv_mgmt()
943 ieee80211_send_proberesp(vap, wh->i_addr2, in adhoc_recv_mgmt()
955 if ((ni == vap->iv_bss) && in adhoc_recv_mgmt()
956 !IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) { in adhoc_recv_mgmt()
959 vap->iv_stats.is_rx_mgtdiscard++; in adhoc_recv_mgmt()
960 } else if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr1) && in adhoc_recv_mgmt()
961 !IEEE80211_IS_MULTICAST(wh->i_addr1)) { in adhoc_recv_mgmt()
964 vap->iv_stats.is_rx_mgtdiscard++; in adhoc_recv_mgmt()
965 } else if (vap->iv_state != IEEE80211_S_RUN) { in adhoc_recv_mgmt()
968 ieee80211_state_name[vap->iv_state]); in adhoc_recv_mgmt()
969 vap->iv_stats.is_rx_mgtdiscard++; in adhoc_recv_mgmt()
972 (void)ic->ic_recv_action(ni, wh, frm, efrm); in adhoc_recv_mgmt()
987 vap->iv_stats.is_rx_mgtdiscard++; in adhoc_recv_mgmt()
993 vap->iv_stats.is_rx_badsubtype++; in adhoc_recv_mgmt()
1004 struct ieee80211vap *vap = ni->ni_vap; in ahdemo_recv_mgmt()
1005 struct ieee80211com *ic = ni->ni_ic; in ahdemo_recv_mgmt()
1009 * a site-survey. in ahdemo_recv_mgmt()
1011 if (ic->ic_flags & IEEE80211_F_SCAN) in ahdemo_recv_mgmt()
1036 vap->iv_stats.is_rx_mgtdiscard++; in ahdemo_recv_mgmt()
1041 vap->iv_stats.is_rx_badsubtype++; in ahdemo_recv_mgmt()