Lines Matching +full:mode +full:- +full:xxx

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
5 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
69 CTASSERT((IEEE80211_NODE_HASHSIZE & (IEEE80211_NODE_HASHSIZE-1)) == 0);
75 ((_vap)->iv_aid_bitmap[IEEE80211_AID(b) / 32] |= \
78 ((_vap)->iv_aid_bitmap[IEEE80211_AID(b) / 32] &= \
81 ((_vap)->iv_aid_bitmap[IEEE80211_AID(b) / 32] & (1 << (IEEE80211_AID(b) % 32)))
117 /* XXX really want maxlen enforced per-sta */ in ieee80211_node_attach()
118 ieee80211_ageq_init(&ic->ic_stageq, ic->ic_max_keyix * 8, in ieee80211_node_attach()
120 ieee80211_node_table_init(ic, &ic->ic_sta, "station", in ieee80211_node_attach()
121 IEEE80211_INACT_INIT, ic->ic_max_keyix); in ieee80211_node_attach()
122 callout_init(&ic->ic_inact, 1); in ieee80211_node_attach()
123 callout_reset(&ic->ic_inact, IEEE80211_INACT_WAIT*hz, in ieee80211_node_attach()
126 ic->ic_node_alloc = node_alloc; in ieee80211_node_attach()
127 ic->ic_node_init = node_init; in ieee80211_node_attach()
128 ic->ic_node_free = node_free; in ieee80211_node_attach()
129 ic->ic_node_cleanup = node_cleanup; in ieee80211_node_attach()
130 ic->ic_node_age = node_age; in ieee80211_node_attach()
131 ic->ic_node_drain = node_age; /* NB: same as age */ in ieee80211_node_attach()
132 ic->ic_node_getrssi = node_getrssi; in ieee80211_node_attach()
133 ic->ic_node_getsignal = node_getsignal; in ieee80211_node_attach()
134 ic->ic_node_getmimoinfo = node_getmimoinfo; in ieee80211_node_attach()
140 ic->ic_flags_ext |= IEEE80211_FEXT_INACT; /* inactivity processing */ in ieee80211_node_attach()
147 callout_drain(&ic->ic_inact); in ieee80211_node_detach()
148 ieee80211_node_table_cleanup(&ic->ic_sta); in ieee80211_node_detach()
149 ieee80211_ageq_drain(&ic->ic_stageq); in ieee80211_node_detach()
150 ieee80211_ageq_cleanup(&ic->ic_stageq); in ieee80211_node_detach()
157 vap->iv_max_aid = IEEE80211_AID_DEF; in ieee80211_node_vattach()
160 vap->iv_inact_init = IEEE80211_INACT_INIT; in ieee80211_node_vattach()
161 vap->iv_inact_auth = IEEE80211_INACT_AUTH; in ieee80211_node_vattach()
162 vap->iv_inact_run = IEEE80211_INACT_RUN; in ieee80211_node_vattach()
163 vap->iv_inact_probe = IEEE80211_INACT_PROBE; in ieee80211_node_vattach()
167 vap->iv_inact_init, vap->iv_inact_auth, in ieee80211_node_vattach()
168 vap->iv_inact_run, vap->iv_inact_probe); in ieee80211_node_vattach()
175 /* XXX should ieee80211_vap_attach(), our only caller hold the lock? */ in ieee80211_node_latevattach()
176 IEEE80211_UNLOCK_ASSERT(vap->iv_ic); in ieee80211_node_latevattach()
178 if (vap->iv_opmode == IEEE80211_M_HOSTAP) { in ieee80211_node_latevattach()
179 /* XXX should we allow max aid to be zero? */ in ieee80211_node_latevattach()
180 if (vap->iv_max_aid < IEEE80211_AID_MIN) { in ieee80211_node_latevattach()
181 vap->iv_max_aid = IEEE80211_AID_MIN; in ieee80211_node_latevattach()
182 if_printf(vap->iv_ifp, in ieee80211_node_latevattach()
184 vap->iv_max_aid); in ieee80211_node_latevattach()
186 vap->iv_aid_bitmap = (uint32_t *) IEEE80211_MALLOC( in ieee80211_node_latevattach()
187 howmany(vap->iv_max_aid, 32) * sizeof(uint32_t), in ieee80211_node_latevattach()
190 if (vap->iv_aid_bitmap == NULL) { in ieee80211_node_latevattach()
191 /* XXX no way to recover */ in ieee80211_node_latevattach()
193 __func__, vap->iv_max_aid); in ieee80211_node_latevattach()
194 vap->iv_max_aid = 0; in ieee80211_node_latevattach()
198 IEEE80211_LOCK(vap->iv_ic); in ieee80211_node_latevattach()
200 IEEE80211_UNLOCK(vap->iv_ic); in ieee80211_node_latevattach()
202 vap->iv_auth = ieee80211_authenticator_get(vap->iv_bss->ni_authmode); in ieee80211_node_latevattach()
208 struct ieee80211com *ic = vap->iv_ic; in ieee80211_node_vdetach()
210 /* XXX should ieee80211_vap_detach(), our only caller hold the lock? */ in ieee80211_node_vdetach()
211 IEEE80211_UNLOCK_ASSERT(vap->iv_ic); in ieee80211_node_vdetach()
213 ieee80211_node_table_reset(&ic->ic_sta, vap); in ieee80211_node_vdetach()
215 if (vap->iv_bss != NULL) { in ieee80211_node_vdetach()
216 ieee80211_free_node(vap->iv_bss); in ieee80211_node_vdetach()
217 vap->iv_update_bss(vap, NULL); in ieee80211_node_vdetach()
220 if (vap->iv_aid_bitmap != NULL) { in ieee80211_node_vdetach()
221 IEEE80211_FREE(vap->iv_aid_bitmap, M_80211_NODE); in ieee80211_node_vdetach()
222 vap->iv_aid_bitmap = NULL; in ieee80211_node_vdetach()
233 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_authorize()
235 ni->ni_flags |= IEEE80211_NODE_AUTH; in ieee80211_node_authorize()
236 ni->ni_inact_reload = vap->iv_inact_run; in ieee80211_node_authorize()
237 ni->ni_inact = ni->ni_inact_reload; in ieee80211_node_authorize()
240 "%s: inact_reload %u", __func__, ni->ni_inact_reload); in ieee80211_node_authorize()
246 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_unauthorize()
248 ni->ni_flags &= ~IEEE80211_NODE_AUTH; in ieee80211_node_unauthorize()
249 ni->ni_inact_reload = vap->iv_inact_auth; in ieee80211_node_unauthorize()
250 if (ni->ni_inact > ni->ni_inact_reload) in ieee80211_node_unauthorize()
251 ni->ni_inact = ni->ni_inact_reload; in ieee80211_node_unauthorize()
255 ni->ni_inact_reload, ni->ni_inact); in ieee80211_node_unauthorize()
264 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_setuptxparms()
265 enum ieee80211_phymode mode; in ieee80211_node_setuptxparms() local
267 if (ni->ni_flags & IEEE80211_NODE_VHT) { in ieee80211_node_setuptxparms()
268 if (IEEE80211_IS_CHAN_5GHZ(ni->ni_chan)) in ieee80211_node_setuptxparms()
269 mode = IEEE80211_MODE_VHT_5GHZ; in ieee80211_node_setuptxparms()
271 mode = IEEE80211_MODE_VHT_2GHZ; in ieee80211_node_setuptxparms()
272 } else if (ni->ni_flags & IEEE80211_NODE_HT) { in ieee80211_node_setuptxparms()
273 if (IEEE80211_IS_CHAN_5GHZ(ni->ni_chan)) in ieee80211_node_setuptxparms()
274 mode = IEEE80211_MODE_11NA; in ieee80211_node_setuptxparms()
276 mode = IEEE80211_MODE_11NG; in ieee80211_node_setuptxparms()
278 if (IEEE80211_IS_CHAN_ST(ni->ni_chan)) in ieee80211_node_setuptxparms()
279 mode = IEEE80211_MODE_STURBO_A; in ieee80211_node_setuptxparms()
280 else if (IEEE80211_IS_CHAN_HALF(ni->ni_chan)) in ieee80211_node_setuptxparms()
281 mode = IEEE80211_MODE_HALF; in ieee80211_node_setuptxparms()
282 else if (IEEE80211_IS_CHAN_QUARTER(ni->ni_chan)) in ieee80211_node_setuptxparms()
283 mode = IEEE80211_MODE_QUARTER; in ieee80211_node_setuptxparms()
285 else if (IEEE80211_IS_CHAN_A(ni->ni_chan)) in ieee80211_node_setuptxparms()
286 mode = IEEE80211_MODE_11A; in ieee80211_node_setuptxparms()
287 else if (IEEE80211_IS_CHAN_108G(ni->ni_chan) || in ieee80211_node_setuptxparms()
288 (ni->ni_flags & IEEE80211_NODE_ERP)) in ieee80211_node_setuptxparms()
289 mode = IEEE80211_MODE_11G; in ieee80211_node_setuptxparms()
291 mode = IEEE80211_MODE_11B; in ieee80211_node_setuptxparms()
293 ni->ni_txparms = &vap->iv_txparms[mode]; in ieee80211_node_setuptxparms()
299 * XXX should be private but hostap needs it to deal with CSA
305 struct ieee80211com *ic = ni->ni_ic; in ieee80211_node_set_chan()
306 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_set_chan()
307 enum ieee80211_phymode mode; in ieee80211_node_set_chan() local
311 ni->ni_chan = chan; in ieee80211_node_set_chan()
312 mode = ieee80211_chan2mode(chan); in ieee80211_node_set_chan()
318 ni->ni_htrates = *ieee80211_get_suphtrates(ic, chan); in ieee80211_node_set_chan()
320 * Setup bss tx parameters based on operating mode. We in ieee80211_node_set_chan()
321 * use legacy rates when operating in a mixed HT+non-HT bss in ieee80211_node_set_chan()
322 * and non-ERP rates in 11g for mixed ERP+non-ERP bss. in ieee80211_node_set_chan()
324 if (mode == IEEE80211_MODE_11NA && in ieee80211_node_set_chan()
325 (vap->iv_flags_ht & IEEE80211_FHT_PUREN) == 0) in ieee80211_node_set_chan()
326 mode = IEEE80211_MODE_11A; in ieee80211_node_set_chan()
327 else if (mode == IEEE80211_MODE_11NG && in ieee80211_node_set_chan()
328 (vap->iv_flags_ht & IEEE80211_FHT_PUREN) == 0) in ieee80211_node_set_chan()
329 mode = IEEE80211_MODE_11G; in ieee80211_node_set_chan()
330 if (mode == IEEE80211_MODE_11G && in ieee80211_node_set_chan()
331 (vap->iv_flags & IEEE80211_F_PUREG) == 0) in ieee80211_node_set_chan()
332 mode = IEEE80211_MODE_11B; in ieee80211_node_set_chan()
334 ni->ni_txparms = &vap->iv_txparms[mode]; in ieee80211_node_set_chan()
335 ni->ni_rates = *ieee80211_get_suprates(ic, chan); in ieee80211_node_set_chan()
342 nbss->ni_authmode = obss->ni_authmode; in copy_bss()
343 nbss->ni_txpower = obss->ni_txpower; in copy_bss()
344 nbss->ni_vlan = obss->ni_vlan; in copy_bss()
345 /* XXX statistics? */ in copy_bss()
346 /* XXX legacy WDS bssid? */ in copy_bss()
352 struct ieee80211com *ic = vap->iv_ic; in ieee80211_create_ibss()
357 ieee80211_opmode_name[vap->iv_opmode], in ieee80211_create_ibss()
360 chan->ic_flags); in ieee80211_create_ibss()
362 ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr, in ieee80211_create_ibss()
365 /* XXX recovery? */ in ieee80211_create_ibss()
368 IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_myaddr); in ieee80211_create_ibss()
369 ni->ni_esslen = vap->iv_des_ssid[0].len; in ieee80211_create_ibss()
370 memcpy(ni->ni_essid, vap->iv_des_ssid[0].ssid, ni->ni_esslen); in ieee80211_create_ibss()
371 if (vap->iv_bss != NULL) in ieee80211_create_ibss()
372 copy_bss(ni, vap->iv_bss); in ieee80211_create_ibss()
373 ni->ni_intval = ic->ic_bintval; in ieee80211_create_ibss()
374 if (vap->iv_flags & IEEE80211_F_PRIVACY) in ieee80211_create_ibss()
375 ni->ni_capinfo |= IEEE80211_CAPINFO_PRIVACY; in ieee80211_create_ibss()
376 if (ic->ic_phytype == IEEE80211_T_FH) { in ieee80211_create_ibss()
377 ni->ni_fhdwell = 200; /* XXX */ in ieee80211_create_ibss()
378 ni->ni_fhindex = 1; in ieee80211_create_ibss()
380 if (vap->iv_opmode == IEEE80211_M_IBSS) { in ieee80211_create_ibss()
381 ni->ni_capinfo |= IEEE80211_CAPINFO_IBSS; /* XXX */ in ieee80211_create_ibss()
382 if (vap->iv_flags & IEEE80211_F_DESBSSID) in ieee80211_create_ibss()
383 IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_des_bssid); in ieee80211_create_ibss()
385 net80211_get_random_bytes(ni->ni_bssid, in ieee80211_create_ibss()
388 ni->ni_bssid[0] = (ni->ni_bssid[0] &~ 0x01) | 0x02; in ieee80211_create_ibss()
390 } else if (vap->iv_opmode == IEEE80211_M_AHDEMO) { in ieee80211_create_ibss()
391 if (vap->iv_flags & IEEE80211_F_DESBSSID) in ieee80211_create_ibss()
392 IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_des_bssid); in ieee80211_create_ibss()
395 if ((vap->iv_caps & IEEE80211_C_TDMA) == 0) in ieee80211_create_ibss()
397 memset(ni->ni_bssid, 0, IEEE80211_ADDR_LEN); in ieee80211_create_ibss()
399 } else if (vap->iv_opmode == IEEE80211_M_MBSS) { in ieee80211_create_ibss()
400 ni->ni_meshidlen = vap->iv_mesh->ms_idlen; in ieee80211_create_ibss()
401 memcpy(ni->ni_meshid, vap->iv_mesh->ms_id, ni->ni_meshidlen); in ieee80211_create_ibss()
408 if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && in ieee80211_create_ibss()
409 ic->ic_bsschan->ic_freq != chan->ic_freq && in ieee80211_create_ibss()
410 IEEE80211_IS_CHAN_CACDONE(ic->ic_bsschan)) in ieee80211_create_ibss()
411 ieee80211_dfs_cac_clear(ic, ic->ic_bsschan); in ieee80211_create_ibss()
412 ic->ic_bsschan = chan; in ieee80211_create_ibss()
414 ic->ic_curmode = ieee80211_chan2mode(chan); in ieee80211_create_ibss()
416 * Do mode-specific setup. in ieee80211_create_ibss()
423 ieee80211_setbasicrates(&ni->ni_rates, in ieee80211_create_ibss()
425 if (vap->iv_flags & IEEE80211_F_PUREG) { in ieee80211_create_ibss()
430 ieee80211_addbasicrates(&ni->ni_rates, in ieee80211_create_ibss()
437 ieee80211_setbasicrates(&ni->ni_rates, in ieee80211_create_ibss()
442 /* XXX TODO: other bits and pieces - eg fast-frames? */ in ieee80211_create_ibss()
445 if (IEEE80211_IS_CHAN_VHT(ni->ni_chan)) { in ieee80211_create_ibss()
446 /* XXX what else? */ in ieee80211_create_ibss()
449 } else if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { in ieee80211_create_ibss()
450 /* XXX what else? */ in ieee80211_create_ibss()
466 struct ieee80211com *ic = vap->iv_ic; in ieee80211_reset_bss()
471 ieee80211_node_table_reset(&ic->ic_sta, vap); in ieee80211_reset_bss()
472 /* XXX multi-bss: wrong */ in ieee80211_reset_bss()
475 ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr, in ieee80211_reset_bss()
478 obss = vap->iv_update_bss(vap, ieee80211_ref_node(ni)); in ieee80211_reset_bss()
481 ni->ni_intval = ic->ic_bintval; in ieee80211_reset_bss()
484 IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_myaddr); in ieee80211_reset_bss()
494 if (ni->ni_esslen == ssids[i].len && in match_ssid()
495 memcmp(ni->ni_essid, ssids[i].ssid, ni->ni_esslen) == 0) in match_ssid()
507 struct ieee80211com *ic = ni->ni_ic; in check_bss()
510 if (isclr(ic->ic_chan_active, ieee80211_chan2ieee(ic, ni->ni_chan))) in check_bss()
512 if (vap->iv_opmode == IEEE80211_M_IBSS) { in check_bss()
513 if ((ni->ni_capinfo & IEEE80211_CAPINFO_IBSS) == 0) in check_bss()
516 if ((ni->ni_capinfo & IEEE80211_CAPINFO_ESS) == 0) in check_bss()
519 if (vap->iv_flags & IEEE80211_F_PRIVACY) { in check_bss()
520 if ((ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY) == 0) in check_bss()
523 /* XXX does this mean privacy is supported or required? */ in check_bss()
524 if (ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY) in check_bss()
527 rate = ieee80211_fix_rate(ni, &ni->ni_rates, in check_bss()
531 if (vap->iv_des_nssid != 0 && in check_bss()
532 !match_ssid(ni, vap->iv_des_nssid, vap->iv_des_ssid)) in check_bss()
534 if ((vap->iv_flags & IEEE80211_F_DESBSSID) && in check_bss()
535 !IEEE80211_ADDR_EQ(vap->iv_des_bssid, ni->ni_bssid)) in check_bss()
547 struct ieee80211com *ic = ni->ni_ic; in check_bss_debug()
552 if (isclr(ic->ic_chan_active, ieee80211_chan2ieee(ic, ni->ni_chan))) in check_bss_debug()
554 if (vap->iv_opmode == IEEE80211_M_IBSS) { in check_bss_debug()
555 if ((ni->ni_capinfo & IEEE80211_CAPINFO_IBSS) == 0) in check_bss_debug()
558 if ((ni->ni_capinfo & IEEE80211_CAPINFO_ESS) == 0) in check_bss_debug()
561 if (vap->iv_flags & IEEE80211_F_PRIVACY) { in check_bss_debug()
562 if ((ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY) == 0) in check_bss_debug()
565 /* XXX does this mean privacy is supported or required? */ in check_bss_debug()
566 if (ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY) in check_bss_debug()
569 rate = ieee80211_fix_rate(ni, &ni->ni_rates, in check_bss_debug()
573 if (vap->iv_des_nssid != 0 && in check_bss_debug()
574 !match_ssid(ni, vap->iv_des_nssid, vap->iv_des_ssid)) in check_bss_debug()
576 if ((vap->iv_flags & IEEE80211_F_DESBSSID) && in check_bss_debug()
577 !IEEE80211_ADDR_EQ(vap->iv_des_bssid, ni->ni_bssid)) in check_bss_debug()
580 printf(" %c %s", fail ? '-' : '+', ether_sprintf(ni->ni_macaddr)); in check_bss_debug()
581 printf(" %s%c", ether_sprintf(ni->ni_bssid), fail & 0x20 ? '!' : ' '); in check_bss_debug()
583 ieee80211_chan2ieee(ic, ni->ni_chan), fail & 0x01 ? '!' : ' '); in check_bss_debug()
587 (ni->ni_capinfo & IEEE80211_CAPINFO_ESS) ? "ess" : in check_bss_debug()
588 (ni->ni_capinfo & IEEE80211_CAPINFO_IBSS) ? "ibss" : in check_bss_debug()
592 (ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY) ? "wep" : "no", in check_bss_debug()
594 ieee80211_print_essid(ni->ni_essid, ni->ni_esslen); in check_bss_debug()
602 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_ibss_merge_check()
604 if (ni == vap->iv_bss || in ieee80211_ibss_merge_check()
605 IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) { in ieee80211_ibss_merge_check()
618 vap->iv_stats.is_ibss_capmismatch++; in ieee80211_ibss_merge_check()
628 * We need to be in "see all beacons for all ssids" mode in order
639 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_ibss_node_check_new()
645 if (vap->iv_des_nssid == 0 && scan->ssid == NULL) in ieee80211_ibss_node_check_new()
651 if (!! (vap->iv_des_nssid == 0) != !! (scan->ssid == NULL)) in ieee80211_ibss_node_check_new()
655 * Double-check - we need scan SSID. in ieee80211_ibss_node_check_new()
657 if (scan->ssid == NULL) in ieee80211_ibss_node_check_new()
663 for (i = 0; i < vap->iv_des_nssid; i++) { in ieee80211_ibss_node_check_new()
665 if (vap->iv_des_ssid[i].len != scan->ssid[1]) in ieee80211_ibss_node_check_new()
669 if (memcmp(vap->iv_des_ssid[i].ssid, scan->ssid + 2, in ieee80211_ibss_node_check_new()
670 vap->iv_des_ssid[i].len) == 0) in ieee80211_ibss_node_check_new()
696 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_ibss_merge()
704 ether_sprintf(ni->ni_bssid), in ieee80211_ibss_merge()
705 vap->iv_flags&IEEE80211_F_SHPREAMBLE ? "short" : "long", in ieee80211_ibss_merge()
706 vap->iv_flags&IEEE80211_F_SHSLOT ? "short" : "long", in ieee80211_ibss_merge()
707 vap->iv_flags&IEEE80211_F_USEPROT ? ", protection" : "" in ieee80211_ibss_merge()
723 /* XXX locking */ in gethtadjustflags()
724 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { in gethtadjustflags()
725 if (vap->iv_state < IEEE80211_S_RUN) in gethtadjustflags()
727 switch (vap->iv_opmode) { in gethtadjustflags()
734 flags |= ieee80211_htchanflags(vap->iv_bss->ni_chan); in gethtadjustflags()
754 /* XXX locking */ in getvhtadjustflags()
755 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { in getvhtadjustflags()
756 if (vap->iv_state < IEEE80211_S_RUN) in getvhtadjustflags()
758 switch (vap->iv_opmode) { in getvhtadjustflags()
765 flags |= ieee80211_vhtchanflags(vap->iv_bss->ni_chan); in getvhtadjustflags()
786 c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, gethtadjustflags(ic)); in ieee80211_sync_curchan()
789 if (c != ic->ic_curchan) { in ieee80211_sync_curchan()
790 ic->ic_curchan = c; in ieee80211_sync_curchan()
791 ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan); in ieee80211_sync_curchan()
792 ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan); in ieee80211_sync_curchan()
794 ic->ic_set_channel(ic); in ieee80211_sync_curchan()
807 if (ic->ic_htcaps & IEEE80211_HTC_HT) { in ieee80211_setupcurchan()
814 /* XXX VHT? */ in ieee80211_setupcurchan()
821 * VHT promotion - this will at least promote to VHT20/40 in ieee80211_setupcurchan()
825 if (ic->ic_vht_cap.vht_cap_info != 0) { in ieee80211_setupcurchan()
831 ic->ic_bsschan = ic->ic_curchan = c; in ieee80211_setupcurchan()
832 ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan); in ieee80211_setupcurchan()
833 ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan); in ieee80211_setupcurchan()
844 ieee80211_runtask(ic, &ic->ic_chan_task); in ieee80211_setcurchan()
851 ieee80211_setupcurchan(ic, ic->ic_curchan); in ieee80211_update_chw()
852 ieee80211_runtask(ic, &ic->ic_chw_task); in ieee80211_update_chw()
862 struct ieee80211vap *vap = selbs->ni_vap; in ieee80211_sta_join1()
863 struct ieee80211com *ic = selbs->ni_ic; in ieee80211_sta_join1()
870 IEEE80211_LOCK(ic); /* XXX may recurse here, check callers. */ in ieee80211_sta_join1()
871 obss = vap->iv_update_bss(vap, selbs); /* NB: caller assumed to bump refcnt */ in ieee80211_sta_join1()
875 * case we can reassociate when operating in sta mode. in ieee80211_sta_join1()
877 /* XXX We'll not be in RUN anymore as iv_state got updated already? */ in ieee80211_sta_join1()
879 vap->iv_state == IEEE80211_S_RUN && in ieee80211_sta_join1()
880 IEEE80211_ADDR_EQ(obss->ni_macaddr, selbs->ni_macaddr)); in ieee80211_sta_join1()
882 struct ieee80211_node_table *nt = obss->ni_table; in ieee80211_sta_join1()
901 ieee80211_fix_rate(vap->iv_bss, &vap->iv_bss->ni_rates, in ieee80211_sta_join1()
904 ieee80211_setcurchan(ic, selbs->ni_chan); in ieee80211_sta_join1()
907 * the auto-select case; this should be redundant if the in ieee80211_sta_join1()
908 * mode is locked. in ieee80211_sta_join1()
913 if (vap->iv_opmode == IEEE80211_M_STA) { in ieee80211_sta_join1()
921 * us to try to re-authenticate if we are operating in ieee80211_sta_join1()
925 "%s %p<%s> %s -> AUTH, FC0_SUBTYPE_DEAUTH\n", in ieee80211_sta_join1()
926 __func__, selbs, ether_sprintf(selbs->ni_macaddr), in ieee80211_sta_join1()
927 ieee80211_state_name[vap->iv_state]); in ieee80211_sta_join1()
932 ieee80211_new_state(vap, IEEE80211_S_RUN, -1); in ieee80211_sta_join1()
940 struct ieee80211com *ic = vap->iv_ic; in ieee80211_sta_join()
944 ni = ieee80211_alloc_node(&ic->ic_sta, vap, se->se_macaddr, in ieee80211_sta_join()
947 /* XXX msg */ in ieee80211_sta_join()
953 * XXX may not need all this stuff in ieee80211_sta_join()
955 IEEE80211_ADDR_COPY(ni->ni_bssid, se->se_bssid); in ieee80211_sta_join()
956 ni->ni_esslen = se->se_ssid[1]; in ieee80211_sta_join()
957 memcpy(ni->ni_essid, se->se_ssid+2, ni->ni_esslen); in ieee80211_sta_join()
958 ni->ni_tstamp.tsf = se->se_tstamp.tsf; in ieee80211_sta_join()
959 ni->ni_intval = se->se_intval; in ieee80211_sta_join()
960 ni->ni_capinfo = se->se_capinfo; in ieee80211_sta_join()
961 ni->ni_chan = chan; in ieee80211_sta_join()
962 ni->ni_timoff = se->se_timoff; in ieee80211_sta_join()
963 ni->ni_fhdwell = se->se_fhdwell; in ieee80211_sta_join()
964 ni->ni_fhindex = se->se_fhindex; in ieee80211_sta_join()
965 ni->ni_erp = se->se_erp; in ieee80211_sta_join()
966 IEEE80211_RSSI_LPF(ni->ni_avgrssi, se->se_rssi); in ieee80211_sta_join()
967 ni->ni_noise = se->se_noise; in ieee80211_sta_join()
968 if (vap->iv_opmode == IEEE80211_M_STA) { in ieee80211_sta_join()
969 /* NB: only infrastructure mode requires an associd */ in ieee80211_sta_join()
970 ni->ni_flags |= IEEE80211_NODE_ASSOCID; in ieee80211_sta_join()
973 if (ieee80211_ies_init(&ni->ni_ies, se->se_ies.data, se->se_ies.len)) { in ieee80211_sta_join()
974 ieee80211_ies_expand(&ni->ni_ies); in ieee80211_sta_join()
976 if (ni->ni_ies.ath_ie != NULL) in ieee80211_sta_join()
977 ieee80211_parse_ath(ni, ni->ni_ies.ath_ie); in ieee80211_sta_join()
979 if (ni->ni_ies.htcap_ie != NULL) in ieee80211_sta_join()
980 ieee80211_parse_htcap(ni, ni->ni_ies.htcap_ie); in ieee80211_sta_join()
981 if (ni->ni_ies.htinfo_ie != NULL) in ieee80211_sta_join()
982 ieee80211_parse_htinfo(ni, ni->ni_ies.htinfo_ie); in ieee80211_sta_join()
984 if (ni->ni_ies.meshid_ie != NULL) in ieee80211_sta_join()
985 ieee80211_parse_meshid(ni, ni->ni_ies.meshid_ie); in ieee80211_sta_join()
988 if (ni->ni_ies.tdma_ie != NULL) in ieee80211_sta_join()
989 ieee80211_parse_tdma(ni, ni->ni_ies.tdma_ie); in ieee80211_sta_join()
991 if (ni->ni_ies.vhtcap_ie != NULL) in ieee80211_sta_join()
992 ieee80211_parse_vhtcap(ni, ni->ni_ies.vhtcap_ie); in ieee80211_sta_join()
993 if (ni->ni_ies.vhtopmode_ie != NULL) in ieee80211_sta_join()
994 ieee80211_parse_vhtopmode(ni, ni->ni_ies.vhtopmode_ie); in ieee80211_sta_join()
996 /* XXX parse BSSLOAD IE */ in ieee80211_sta_join()
997 /* XXX parse TXPWRENV IE */ in ieee80211_sta_join()
998 /* XXX parse APCHANREP IE */ in ieee80211_sta_join()
1001 vap->iv_dtim_period = se->se_dtimperiod; in ieee80211_sta_join()
1002 vap->iv_dtim_count = 0; in ieee80211_sta_join()
1005 ieee80211_setup_rates(ni, se->se_rates, se->se_xrates, in ieee80211_sta_join()
1007 if (ieee80211_iserp_rateset(&ni->ni_rates)) in ieee80211_sta_join()
1008 ni->ni_flags |= IEEE80211_NODE_ERP; in ieee80211_sta_join()
1012 * non-STA modes won't pick this state up. in ieee80211_sta_join()
1018 if (ni->ni_ies.htinfo_ie != NULL && in ieee80211_sta_join()
1019 ni->ni_ies.htcap_ie != NULL && in ieee80211_sta_join()
1020 vap->iv_flags_ht & IEEE80211_FHT_HT) { in ieee80211_sta_join()
1023 ni->ni_ies.htcap_ie, in ieee80211_sta_join()
1024 ni->ni_ies.htinfo_ie); in ieee80211_sta_join()
1034 if (ni->ni_ies.vhtopmode_ie != NULL && in ieee80211_sta_join()
1035 ni->ni_ies.vhtcap_ie != NULL && in ieee80211_sta_join()
1036 vap->iv_vht_flags & IEEE80211_FVHT_VHT) { in ieee80211_sta_join()
1037 if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) { in ieee80211_sta_join()
1040 ni->ni_macaddr, in ieee80211_sta_join()
1045 ni->ni_ies.vhtcap_ie, in ieee80211_sta_join()
1046 ni->ni_ies.vhtopmode_ie); in ieee80211_sta_join()
1047 ieee80211_setup_vht_rates(ni, ni->ni_ies.vhtcap_ie, in ieee80211_sta_join()
1048 ni->ni_ies.vhtopmode_ie); in ieee80211_sta_join()
1055 ieee80211_ht_updateparams_final(ni, ni->ni_ies.htcap_ie, in ieee80211_sta_join()
1056 ni->ni_ies.htinfo_ie); in ieee80211_sta_join()
1057 ieee80211_setup_htrates(ni, ni->ni_ies.htcap_ie, in ieee80211_sta_join()
1059 ieee80211_setup_basic_htrates(ni, ni->ni_ies.htinfo_ie); in ieee80211_sta_join()
1062 /* XXX else check for ath FF? */ in ieee80211_sta_join()
1063 /* XXX QoS? Difficult given that WME config is specific to a master */ in ieee80211_sta_join()
1078 struct ieee80211com *ic = ni->ni_ic; in ieee80211_sta_leave()
1080 ic->ic_node_cleanup(ni); in ieee80211_sta_leave()
1092 if (ni->ni_associd != 0) in ieee80211_node_deauth()
1116 * data exists re-use the data block. As a side effect we clear
1125 if (ies->data != NULL && ies->len != len) { in ieee80211_ies_init()
1127 IEEE80211_FREE(ies->data, M_80211_NODE_IE); in ieee80211_ies_init()
1128 ies->data = NULL; in ieee80211_ies_init()
1130 if (ies->data == NULL) { in ieee80211_ies_init()
1131 ies->data = (uint8_t *) IEEE80211_MALLOC(len, M_80211_NODE_IE, in ieee80211_ies_init()
1133 if (ies->data == NULL) { in ieee80211_ies_init()
1134 ies->len = 0; in ieee80211_ies_init()
1139 memcpy(ies->data, data, len); in ieee80211_ies_init()
1140 ies->len = len; in ieee80211_ies_init()
1150 if (ies->data != NULL) in ieee80211_ies_cleanup()
1151 IEEE80211_FREE(ies->data, M_80211_NODE_IE); in ieee80211_ies_cleanup()
1156 * ie pointers. The data blob is assumed to be well-formed;
1165 ie = ies->data; in ieee80211_ies_expand()
1166 ielen = ies->len; in ieee80211_ies_expand()
1172 __func__, ies, ies->data, ies->len, in ieee80211_ies_expand()
1179 ies->wpa_ie = ie; in ieee80211_ies_expand()
1181 ies->wme_ie = ie; in ieee80211_ies_expand()
1184 ies->ath_ie = ie; in ieee80211_ies_expand()
1188 ies->tdma_ie = ie; in ieee80211_ies_expand()
1192 ies->rsn_ie = ie; in ieee80211_ies_expand()
1195 ies->htcap_ie = ie; in ieee80211_ies_expand()
1198 ies->htinfo_ie = ie; in ieee80211_ies_expand()
1202 ies->meshid_ie = ie; in ieee80211_ies_expand()
1206 ies->vhtcap_ie = ie; in ieee80211_ies_expand()
1209 ies->vhtopmode_ie = ie; in ieee80211_ies_expand()
1212 ies->vhtpwrenv_ie = ie; in ieee80211_ies_expand()
1215 ies->bssload_ie = ie; in ieee80211_ies_expand()
1218 ies->apchanrep_ie = ie; in ieee80211_ies_expand()
1221 ielen -= 2 + ie[1]; in ieee80211_ies_expand()
1235 struct ieee80211vap *vap = ni->ni_vap; in node_cleanup()
1236 struct ieee80211com *ic = ni->ni_ic; in node_cleanup()
1240 if (ni->ni_flags & IEEE80211_NODE_PWR_MGT) { in node_cleanup()
1241 if (vap->iv_opmode != IEEE80211_M_STA) in node_cleanup()
1242 vap->iv_ps_sta--; in node_cleanup()
1243 ni->ni_flags &= ~IEEE80211_NODE_PWR_MGT; in node_cleanup()
1245 "power save mode off, %u sta's in ps mode", vap->iv_ps_sta); in node_cleanup()
1248 * Cleanup any VHT and HT-related state. in node_cleanup()
1250 if (ni->ni_flags & IEEE80211_NODE_VHT) in node_cleanup()
1252 if (ni->ni_flags & IEEE80211_NODE_HT) in node_cleanup()
1255 /* Always do FF node cleanup; for A-MSDU */ in node_cleanup()
1260 * Cleanup any mesh-related state. in node_cleanup()
1262 if (vap->iv_opmode == IEEE80211_M_MBSS) in node_cleanup()
1268 ieee80211_ageq_drain_node(&ic->ic_stageq, ni); in node_cleanup()
1278 ni->ni_flags &= ~(IEEE80211_NODE_AREF | IEEE80211_NODE_ASSOCID); in node_cleanup()
1283 if (ieee80211_node_psq_drain(ni) != 0 && vap->iv_set_tim != NULL) in node_cleanup()
1284 vap->iv_set_tim(ni, 0); in node_cleanup()
1286 ni->ni_associd = 0; in node_cleanup()
1287 if (ni->ni_challenge != NULL) { in node_cleanup()
1288 IEEE80211_FREE(ni->ni_challenge, M_80211_NODE); in node_cleanup()
1289 ni->ni_challenge = NULL; in node_cleanup()
1293 * reusable during a re-auth/re-assoc state transition. in node_cleanup()
1295 * because they come from a probe-response or beacon frame in node_cleanup()
1296 * which cannot be expected prior to the association-response. in node_cleanup()
1301 * XXX does this leave us open to inheriting old state? in node_cleanup()
1303 for (i = 0; i < nitems(ni->ni_rxfrag); i++) in node_cleanup()
1304 if (ni->ni_rxfrag[i] != NULL) { in node_cleanup()
1305 m_freem(ni->ni_rxfrag[i]); in node_cleanup()
1306 ni->ni_rxfrag[i] = NULL; in node_cleanup()
1317 struct ieee80211com *ic = ni->ni_ic; in node_free()
1320 ic->ic_node_cleanup(ni); in node_free()
1321 ieee80211_ies_cleanup(&ni->ni_ies); in node_free()
1322 ieee80211_psq_cleanup(&ni->ni_psq); in node_free()
1329 struct ieee80211vap *vap = ni->ni_vap; in node_age()
1335 ni->ni_psq.psq_len == 0 && vap->iv_set_tim != NULL) in node_age()
1336 vap->iv_set_tim(ni, 0); in node_age()
1339 * A-MPDU reorder queues). in node_age()
1341 if (ni->ni_associd != 0 && (ni->ni_flags & IEEE80211_NODE_HT)) in node_age()
1348 uint32_t avgrssi = ni->ni_avgrssi; in node_getrssi()
1361 *noise = ni->ni_noise; in node_getsignal()
1374 for (i = 0; i < MIN(IEEE80211_MAX_CHAINS, ni->ni_mimo_chains); i++) { in node_getmimoinfo()
1376 avgrssi = ni->ni_mimo_rssi_ctl[i]; in node_getmimoinfo()
1378 info->ch[i].rssi[0] = 0; in node_getmimoinfo()
1381 info->ch[i].rssi[0] = rssi < 0 ? 0 : rssi > 127 ? 127 : rssi; in node_getmimoinfo()
1383 info->ch[i].noise[0] = ni->ni_mimo_noise_ctl[i]; in node_getmimoinfo()
1386 /* XXX ext radios? */ in node_getmimoinfo()
1388 /* XXX EVM? */ in node_getmimoinfo()
1395 struct ieee80211com *ic = nt->nt_ic; in ieee80211_add_node_nt()
1400 hash = IEEE80211_NODE_HASH(ic, ni->ni_macaddr); in ieee80211_add_node_nt()
1401 (void) ic; /* XXX IEEE80211_NODE_HASH */ in ieee80211_add_node_nt()
1402 TAILQ_INSERT_TAIL(&nt->nt_node, ni, ni_list); in ieee80211_add_node_nt()
1403 LIST_INSERT_HEAD(&nt->nt_hash[hash], ni, ni_hash); in ieee80211_add_node_nt()
1404 nt->nt_count++; in ieee80211_add_node_nt()
1405 ni->ni_table = nt; in ieee80211_add_node_nt()
1415 TAILQ_REMOVE(&nt->nt_node, ni, ni_list); in ieee80211_del_node_nt()
1417 nt->nt_count--; in ieee80211_del_node_nt()
1418 KASSERT(nt->nt_count >= 0, in ieee80211_del_node_nt()
1419 ("nt_count is negative (%d)!\n", nt->nt_count)); in ieee80211_del_node_nt()
1420 ni->ni_table = NULL; in ieee80211_del_node_nt()
1428 struct ieee80211com *ic = nt->nt_ic; in ieee80211_alloc_node()
1431 ni = ic->ic_node_alloc(vap, macaddr); in ieee80211_alloc_node()
1433 vap->iv_stats.is_rx_nodealloc++; in ieee80211_alloc_node()
1439 ether_sprintf(macaddr), nt->nt_name); in ieee80211_alloc_node()
1441 IEEE80211_ADDR_COPY(ni->ni_macaddr, macaddr); in ieee80211_alloc_node()
1446 ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)); in ieee80211_alloc_node()
1448 ni->ni_chan = IEEE80211_CHAN_ANYC; in ieee80211_alloc_node()
1449 ni->ni_authmode = IEEE80211_AUTH_OPEN; in ieee80211_alloc_node()
1450 ni->ni_txpower = ic->ic_txpowlimit; /* max power */ in ieee80211_alloc_node()
1451 ni->ni_txparms = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; in ieee80211_alloc_node()
1452 ieee80211_crypto_resetkey(vap, &ni->ni_ucastkey, IEEE80211_KEYIX_NONE); in ieee80211_alloc_node()
1453 ni->ni_avgrssi = IEEE80211_RSSI_DUMMY_MARKER; in ieee80211_alloc_node()
1454 ni->ni_inact_reload = nt->nt_inact_init; in ieee80211_alloc_node()
1455 ni->ni_inact = ni->ni_inact_reload; in ieee80211_alloc_node()
1456 ni->ni_ath_defkeyix = 0x7fff; in ieee80211_alloc_node()
1457 ieee80211_psq_init(&ni->ni_psq, "unknown"); in ieee80211_alloc_node()
1459 if (vap->iv_opmode == IEEE80211_M_MBSS) in ieee80211_alloc_node()
1464 ni->ni_vap = vap; in ieee80211_alloc_node()
1465 ni->ni_ic = ic; in ieee80211_alloc_node()
1469 if (ic->ic_node_init(ni) != 0) { in ieee80211_alloc_node()
1470 vap->iv_stats.is_rx_nodealloc++; in ieee80211_alloc_node()
1471 ieee80211_psq_cleanup(&ni->ni_psq); in ieee80211_alloc_node()
1478 "%s: inact_reload %u", __func__, ni->ni_inact_reload); in ieee80211_alloc_node()
1493 struct ieee80211com *ic = vap->iv_ic; in ieee80211_tmp_node()
1496 ni = ic->ic_node_alloc(vap, macaddr); in ieee80211_tmp_node()
1498 struct ieee80211_node *bss = vap->iv_bss; in ieee80211_tmp_node()
1503 ni->ni_table = NULL; /* NB: pedantic */ in ieee80211_tmp_node()
1504 ni->ni_ic = ic; /* NB: needed to set channel */ in ieee80211_tmp_node()
1505 ni->ni_vap = vap; in ieee80211_tmp_node()
1507 IEEE80211_ADDR_COPY(ni->ni_macaddr, macaddr); in ieee80211_tmp_node()
1508 IEEE80211_ADDR_COPY(ni->ni_bssid, bss->ni_bssid); in ieee80211_tmp_node()
1513 "%s (%s:%u) %p<%s> refcnt %d\n", __func__, "", -1, ni, in ieee80211_tmp_node()
1514 ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)); in ieee80211_tmp_node()
1517 ieee80211_node_set_chan(ni, bss->ni_chan); in ieee80211_tmp_node()
1518 ieee80211_crypto_resetkey(vap, &ni->ni_ucastkey, in ieee80211_tmp_node()
1520 ni->ni_txpower = bss->ni_txpower; in ieee80211_tmp_node()
1521 /* XXX optimize away */ in ieee80211_tmp_node()
1522 ieee80211_psq_init(&ni->ni_psq, "unknown"); in ieee80211_tmp_node()
1527 if (ic->ic_node_init(ni) != 0) { in ieee80211_tmp_node()
1528 vap->iv_stats.is_rx_nodealloc++; in ieee80211_tmp_node()
1529 ieee80211_psq_cleanup(&ni->ni_psq); in ieee80211_tmp_node()
1536 /* XXX msg */ in ieee80211_tmp_node()
1537 vap->iv_stats.is_rx_nodealloc++; in ieee80211_tmp_node()
1546 struct ieee80211com *ic = vap->iv_ic; in ieee80211_dup_bss()
1549 ni = ieee80211_alloc_node(&ic->ic_sta, vap, macaddr, __func__, __LINE__); in ieee80211_dup_bss()
1551 struct ieee80211_node *bss = vap->iv_bss; in ieee80211_dup_bss()
1556 IEEE80211_ADDR_COPY(ni->ni_bssid, bss->ni_bssid); in ieee80211_dup_bss()
1557 ieee80211_node_set_chan(ni, bss->ni_chan); in ieee80211_dup_bss()
1573 struct ieee80211com *ic = vap->iv_ic; in ieee80211_node_create_wds()
1576 /* XXX check if node already in sta table? */ in ieee80211_node_create_wds()
1577 ni = ieee80211_alloc_node(&ic->ic_sta, vap, bssid, __func__, __LINE__); in ieee80211_node_create_wds()
1579 ni->ni_wdsvap = vap; in ieee80211_node_create_wds()
1580 IEEE80211_ADDR_COPY(ni->ni_bssid, bssid); in ieee80211_node_create_wds()
1584 copy_bss(ni, vap->iv_bss); in ieee80211_node_create_wds()
1587 ni->ni_esslen = vap->iv_des_ssid[0].len; in ieee80211_node_create_wds()
1588 memcpy(ni->ni_essid, vap->iv_des_ssid[0].ssid, ni->ni_esslen); in ieee80211_node_create_wds()
1595 if (vap->iv_flags & IEEE80211_F_WME) in ieee80211_node_create_wds()
1596 ni->ni_flags |= IEEE80211_NODE_QOS; in ieee80211_node_create_wds()
1598 if (vap->iv_flags & IEEE80211_F_FF) in ieee80211_node_create_wds()
1599 ni->ni_flags |= IEEE80211_NODE_FF; in ieee80211_node_create_wds()
1601 /* XXX VHT */ in ieee80211_node_create_wds()
1602 if ((ic->ic_htcaps & IEEE80211_HTC_HT) && in ieee80211_node_create_wds()
1603 (vap->iv_flags_ht & IEEE80211_FHT_HT)) { in ieee80211_node_create_wds()
1605 * Device is HT-capable and HT is enabled for in ieee80211_node_create_wds()
1610 if (vap->iv_vht_flags & IEEE80211_FVHT_VHT) { in ieee80211_node_create_wds()
1614 struct ieee80211_channel *c = ni->ni_chan; in ieee80211_node_create_wds()
1619 c->ic_freq, c->ic_flags &~ IEEE80211_CHAN_HT); in ieee80211_node_create_wds()
1621 ni->ni_chan->ic_freq, ni->ni_chan->ic_flags)); in ieee80211_node_create_wds()
1622 ni->ni_chan = c; in ieee80211_node_create_wds()
1638 hash = IEEE80211_NODE_HASH(nt->nt_ic, macaddr); in _ieee80211_find_node_locked()
1639 LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) { in _ieee80211_find_node_locked()
1640 if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) { in _ieee80211_find_node_locked()
1643 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, in _ieee80211_find_node_locked()
1646 ni, ether_sprintf(ni->ni_macaddr), in _ieee80211_find_node_locked()
1678 hash = IEEE80211_NODE_HASH(nt->nt_ic, macaddr); in _ieee80211_find_vap_node_locked()
1679 LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) { in _ieee80211_find_vap_node_locked()
1680 if (ni->ni_vap == vap && in _ieee80211_find_vap_node_locked()
1681 IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) { in _ieee80211_find_vap_node_locked()
1684 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, in _ieee80211_find_vap_node_locked()
1687 ni, ether_sprintf(ni->ni_macaddr), in _ieee80211_find_vap_node_locked()
1710 * Fake up a node; this handles node discovery in adhoc mode.
1725 struct ieee80211com *ic = vap->iv_ic; in ieee80211_fakeup_adhoc_node()
1727 /* XXX no rate negotiation; just dup */ in ieee80211_fakeup_adhoc_node()
1728 ni->ni_rates = vap->iv_bss->ni_rates; in ieee80211_fakeup_adhoc_node()
1729 if (ieee80211_iserp_rateset(&ni->ni_rates)) in ieee80211_fakeup_adhoc_node()
1730 ni->ni_flags |= IEEE80211_NODE_ERP; in ieee80211_fakeup_adhoc_node()
1731 if (vap->iv_opmode == IEEE80211_M_AHDEMO) { in ieee80211_fakeup_adhoc_node()
1733 * In adhoc demo mode there are no management in ieee80211_fakeup_adhoc_node()
1740 * XXX TODO: 11n? in ieee80211_fakeup_adhoc_node()
1742 if (vap->iv_flags & IEEE80211_F_WME) in ieee80211_fakeup_adhoc_node()
1743 ni->ni_flags |= IEEE80211_NODE_QOS; in ieee80211_fakeup_adhoc_node()
1745 if (vap->iv_flags & IEEE80211_F_FF) in ieee80211_fakeup_adhoc_node()
1746 ni->ni_flags |= IEEE80211_NODE_FF; in ieee80211_fakeup_adhoc_node()
1753 * XXX TODO: 11n? At least 20MHz, at least A-MPDU RX, in ieee80211_fakeup_adhoc_node()
1754 * not A-MPDU TX; not 11n rates, etc. We'll cycle in ieee80211_fakeup_adhoc_node()
1762 if (ic->ic_newassoc != NULL) in ieee80211_fakeup_adhoc_node()
1763 ic->ic_newassoc(ni, 1); in ieee80211_fakeup_adhoc_node()
1770 * XXX TODO: this isn't guaranteed, and until we get in ieee80211_fakeup_adhoc_node()
1780 if (vap->iv_opmode == IEEE80211_M_IBSS) { in ieee80211_fakeup_adhoc_node()
1782 vap->iv_myaddr, /* SA */ in ieee80211_fakeup_adhoc_node()
1783 ni->ni_macaddr, /* DA */ in ieee80211_fakeup_adhoc_node()
1784 vap->iv_bss->ni_bssid, /* BSSID */ in ieee80211_fakeup_adhoc_node()
1785 vap->iv_bss->ni_essid, in ieee80211_fakeup_adhoc_node()
1786 vap->iv_bss->ni_esslen); /* SSID */ in ieee80211_fakeup_adhoc_node()
1789 /* XXX not right for 802.1x/WPA */ in ieee80211_fakeup_adhoc_node()
1802 ni->ni_esslen = sp->ssid[1]; in ieee80211_init_neighbor()
1803 memcpy(ni->ni_essid, sp->ssid + 2, sp->ssid[1]); in ieee80211_init_neighbor()
1804 IEEE80211_ADDR_COPY(ni->ni_bssid, wh->i_addr3); in ieee80211_init_neighbor()
1805 memcpy(ni->ni_tstamp.data, sp->tstamp, sizeof(ni->ni_tstamp)); in ieee80211_init_neighbor()
1806 ni->ni_intval = sp->bintval; in ieee80211_init_neighbor()
1807 ni->ni_capinfo = sp->capinfo; in ieee80211_init_neighbor()
1808 ni->ni_chan = ni->ni_ic->ic_curchan; in ieee80211_init_neighbor()
1809 ni->ni_fhdwell = sp->fhdwell; in ieee80211_init_neighbor()
1810 ni->ni_fhindex = sp->fhindex; in ieee80211_init_neighbor()
1811 ni->ni_erp = sp->erp; in ieee80211_init_neighbor()
1812 ni->ni_timoff = sp->timoff; in ieee80211_init_neighbor()
1814 if (ni->ni_vap->iv_opmode == IEEE80211_M_MBSS) in ieee80211_init_neighbor()
1817 if (ieee80211_ies_init(&ni->ni_ies, sp->ies, sp->ies_len)) { in ieee80211_init_neighbor()
1818 ieee80211_ies_expand(&ni->ni_ies); in ieee80211_init_neighbor()
1819 if (ni->ni_ies.wme_ie != NULL) in ieee80211_init_neighbor()
1820 ni->ni_flags |= IEEE80211_NODE_QOS; in ieee80211_init_neighbor()
1822 ni->ni_flags &= ~IEEE80211_NODE_QOS; in ieee80211_init_neighbor()
1824 if (ni->ni_ies.ath_ie != NULL) in ieee80211_init_neighbor()
1825 ieee80211_parse_ath(ni, ni->ni_ies.ath_ie); in ieee80211_init_neighbor()
1827 if (ni->ni_ies.htcap_ie != NULL) in ieee80211_init_neighbor()
1828 ieee80211_parse_htcap(ni, ni->ni_ies.htcap_ie); in ieee80211_init_neighbor()
1829 if (ni->ni_ies.htinfo_ie != NULL) in ieee80211_init_neighbor()
1830 ieee80211_parse_htinfo(ni, ni->ni_ies.htinfo_ie); in ieee80211_init_neighbor()
1832 if (ni->ni_ies.vhtcap_ie != NULL) in ieee80211_init_neighbor()
1833 ieee80211_parse_vhtcap(ni, ni->ni_ies.vhtcap_ie); in ieee80211_init_neighbor()
1834 if (ni->ni_ies.vhtopmode_ie != NULL) in ieee80211_init_neighbor()
1835 ieee80211_parse_vhtopmode(ni, ni->ni_ies.vhtopmode_ie); in ieee80211_init_neighbor()
1837 if ((ni->ni_ies.htcap_ie != NULL) && in ieee80211_init_neighbor()
1838 (ni->ni_ies.htinfo_ie != NULL) && in ieee80211_init_neighbor()
1839 (ni->ni_vap->iv_flags_ht & IEEE80211_FHT_HT)) { in ieee80211_init_neighbor()
1843 if ((ni->ni_ies.vhtcap_ie != NULL) && in ieee80211_init_neighbor()
1844 (ni->ni_ies.vhtopmode_ie != NULL) && in ieee80211_init_neighbor()
1845 (ni->ni_vap->iv_vht_flags & IEEE80211_FVHT_VHT)) { in ieee80211_init_neighbor()
1851 ieee80211_setup_rates(ni, sp->rates, sp->xrates, in ieee80211_init_neighbor()
1859 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_ASSOC, in ieee80211_init_neighbor()
1863 ni->ni_ies.htcap_ie, in ieee80211_init_neighbor()
1864 ni->ni_ies.htinfo_ie); in ieee80211_init_neighbor()
1867 if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) { in ieee80211_init_neighbor()
1870 ni->ni_macaddr, in ieee80211_init_neighbor()
1875 ni->ni_ies.vhtcap_ie, in ieee80211_init_neighbor()
1876 ni->ni_ies.vhtopmode_ie); in ieee80211_init_neighbor()
1878 ni->ni_ies.vhtcap_ie, in ieee80211_init_neighbor()
1879 ni->ni_ies.vhtopmode_ie); in ieee80211_init_neighbor()
1887 ieee80211_ht_updateparams_final(ni, ni->ni_ies.htcap_ie, in ieee80211_init_neighbor()
1888 ni->ni_ies.htinfo_ie); in ieee80211_init_neighbor()
1890 ni->ni_ies.htcap_ie, in ieee80211_init_neighbor()
1893 ni->ni_ies.htinfo_ie); in ieee80211_init_neighbor()
1900 * XXX TODO: this is the wrong thing to do - in ieee80211_init_neighbor()
1910 if (ni->ni_ic->ic_newassoc) in ieee80211_init_neighbor()
1911 ni->ni_ic->ic_newassoc(ni, 1); in ieee80211_init_neighbor()
1916 * Do node discovery in adhoc mode on receipt of a beacon
1929 "%s: mac<%s>\n", __func__, ether_sprintf(wh->i_addr2)); in ieee80211_add_neighbor()
1930 ni = ieee80211_dup_bss(vap, wh->i_addr2);/* XXX alloc_node? */ in ieee80211_add_neighbor()
1932 struct ieee80211com *ic = vap->iv_ic; in ieee80211_add_neighbor()
1935 if (ieee80211_iserp_rateset(&ni->ni_rates)) in ieee80211_add_neighbor()
1936 ni->ni_flags |= IEEE80211_NODE_ERP; in ieee80211_add_neighbor()
1939 if (ic->ic_newassoc != NULL) in ieee80211_add_neighbor()
1940 ic->ic_newassoc(ni, 1); in ieee80211_add_neighbor()
1941 /* XXX not right for 802.1x/WPA */ in ieee80211_add_neighbor()
1948 ((wh->i_fc[0] & (IEEE80211_FC0_TYPE_MASK|IEEE80211_FC0_SUBTYPE_MASK)) \
1952 ((const struct ieee80211_frame *)(wh))->i_addr3))
1961 return _ieee80211_find_node_locked(nt, wh->i_addr2, func, line); in _find_rxnode()
1977 nt = &ic->ic_sta; in _ieee80211_find_rxnode()
2001 nt = &ic->ic_sta; in _ieee80211_find_rxnode_withkey()
2003 if (nt->nt_keyixmap != NULL && keyix < nt->nt_keyixmax) in _ieee80211_find_rxnode_withkey()
2004 ni = nt->nt_keyixmap[keyix]; in _ieee80211_find_rxnode_withkey()
2009 if (ni != NULL && nt->nt_keyixmap != NULL) { in _ieee80211_find_rxnode_withkey()
2012 * assigned update the key->node mapping table. in _ieee80211_find_rxnode_withkey()
2014 keyix = ni->ni_ucastkey.wk_rxkeyix; in _ieee80211_find_rxnode_withkey()
2015 /* XXX can keyixmap[keyix] != NULL? */ in _ieee80211_find_rxnode_withkey()
2016 if (keyix < nt->nt_keyixmax && in _ieee80211_find_rxnode_withkey()
2017 nt->nt_keyixmap[keyix] == NULL) { in _ieee80211_find_rxnode_withkey()
2018 IEEE80211_DPRINTF(ni->ni_vap, in _ieee80211_find_rxnode_withkey()
2021 __func__, ni, ether_sprintf(ni->ni_macaddr), in _ieee80211_find_rxnode_withkey()
2023 nt->nt_keyixmap[keyix] = ieee80211_ref_node(ni); in _ieee80211_find_rxnode_withkey()
2048 struct ieee80211_node_table *nt = &vap->iv_ic->ic_sta; in _ieee80211_find_txnode()
2054 * also optimize station mode operation, all frames go in _ieee80211_find_txnode()
2057 /* XXX can't hold lock across dup_bss 'cuz of recursive locking */ in _ieee80211_find_txnode()
2059 if (vap->iv_opmode == IEEE80211_M_STA || in _ieee80211_find_txnode()
2060 vap->iv_opmode == IEEE80211_M_WDS || in _ieee80211_find_txnode()
2062 ni = ieee80211_ref_node(vap->iv_bss); in _ieee80211_find_txnode()
2068 if (vap->iv_opmode == IEEE80211_M_IBSS || in _ieee80211_find_txnode()
2069 vap->iv_opmode == IEEE80211_M_AHDEMO) { in _ieee80211_find_txnode()
2071 * In adhoc mode cons up a node for the destination. in _ieee80211_find_txnode()
2077 * XXX TODO: this doesn't fake up 11n state; we need in _ieee80211_find_txnode()
2086 vap->iv_stats.is_tx_nonode++; in _ieee80211_find_txnode()
2098 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, in _ieee80211_ref_node()
2100 ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)+1); in _ieee80211_ref_node()
2109 struct ieee80211_node_table *nt = ni->ni_table; in __ieee80211_free_node()
2120 ether_sprintf(ni->ni_macaddr), in __ieee80211_free_node()
2121 nt != NULL ? nt->nt_name : "<gone>"); in __ieee80211_free_node()
2123 if (ni->ni_associd != 0) { in __ieee80211_free_node()
2124 struct ieee80211vap *vap = ni->ni_vap; in __ieee80211_free_node()
2125 if (vap->iv_aid_bitmap != NULL) in __ieee80211_free_node()
2126 IEEE80211_AID_CLR(vap, ni->ni_associd); in __ieee80211_free_node()
2130 ni->ni_ic->ic_node_free(ni); in __ieee80211_free_node()
2141 keyix = ni->ni_ucastkey.wk_rxkeyix; in node_clear_keyixmap()
2142 if (nt->nt_keyixmap != NULL && keyix < nt->nt_keyixmax && in node_clear_keyixmap()
2143 nt->nt_keyixmap[keyix] == ni) { in node_clear_keyixmap()
2144 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, in node_clear_keyixmap()
2146 __func__, ni, ether_sprintf(ni->ni_macaddr), keyix); in node_clear_keyixmap()
2147 nt->nt_keyixmap[keyix] = NULL; in node_clear_keyixmap()
2159 struct ieee80211_node_table *nt = ni->ni_table; in _ieee80211_free_node()
2162 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, in _ieee80211_free_node()
2164 ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)-1); in _ieee80211_free_node()
2189 struct ieee80211com *ic = ni->ni_ic; in ieee80211_node_delucastkey()
2190 struct ieee80211_node_table *nt = &ic->ic_sta; in ieee80211_node_delucastkey()
2212 if (ni->ni_ucastkey.wk_keyix != IEEE80211_KEYIX_NONE) { in ieee80211_node_delucastkey()
2213 keyix = ni->ni_ucastkey.wk_rxkeyix; in ieee80211_node_delucastkey()
2214 status = ieee80211_crypto_delkey(ni->ni_vap, &ni->ni_ucastkey); in ieee80211_node_delucastkey()
2215 if (nt->nt_keyixmap != NULL && keyix < nt->nt_keyixmax) { in ieee80211_node_delucastkey()
2216 nikey = nt->nt_keyixmap[keyix]; in ieee80211_node_delucastkey()
2217 nt->nt_keyixmap[keyix] = NULL; in ieee80211_node_delucastkey()
2226 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, in ieee80211_node_delucastkey()
2228 __func__, ni, ether_sprintf(ni->ni_macaddr), in ieee80211_node_delucastkey()
2229 ieee80211_node_refcnt(ni)-1); in ieee80211_node_delucastkey()
2238 * table and mark it gone by clearing the back-reference.
2246 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, in node_reclaim()
2248 __func__, ni, ether_sprintf(ni->ni_macaddr), in node_reclaim()
2249 nt->nt_name, ieee80211_node_refcnt(ni)-1); in node_reclaim()
2280 nt->nt_ic = ic; in ieee80211_node_table_init()
2281 IEEE80211_NODE_LOCK_INIT(nt, ic->ic_name); in ieee80211_node_table_init()
2282 TAILQ_INIT(&nt->nt_node); in ieee80211_node_table_init()
2283 nt->nt_count = 0; in ieee80211_node_table_init()
2284 nt->nt_name = name; in ieee80211_node_table_init()
2285 nt->nt_inact_init = inact; in ieee80211_node_table_init()
2286 nt->nt_keyixmax = keyixmax; in ieee80211_node_table_init()
2287 if (nt->nt_keyixmax > 0) { in ieee80211_node_table_init()
2288 nt->nt_keyixmap = (struct ieee80211_node **) IEEE80211_MALLOC( in ieee80211_node_table_init()
2292 if (nt->nt_keyixmap == NULL) in ieee80211_node_table_init()
2297 nt->nt_keyixmap = NULL; in ieee80211_node_table_init()
2307 TAILQ_FOREACH_SAFE(ni, &nt->nt_node, ni_list, next) { in ieee80211_node_table_reset()
2308 if (match != NULL && ni->ni_vap != match) in ieee80211_node_table_reset()
2310 /* XXX can this happen? if so need's work */ in ieee80211_node_table_reset()
2311 if (ni->ni_associd != 0) { in ieee80211_node_table_reset()
2312 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_table_reset()
2314 if (vap->iv_auth->ia_node_leave != NULL) in ieee80211_node_table_reset()
2315 vap->iv_auth->ia_node_leave(ni); in ieee80211_node_table_reset()
2316 if (vap->iv_aid_bitmap != NULL) in ieee80211_node_table_reset()
2317 IEEE80211_AID_CLR(vap, ni->ni_associd); in ieee80211_node_table_reset()
2319 ni->ni_wdsvap = NULL; /* clear reference */ in ieee80211_node_table_reset()
2322 if (match != NULL && match->iv_opmode == IEEE80211_M_WDS) { in ieee80211_node_table_reset()
2330 TAILQ_FOREACH_SAFE(ni, &nt->nt_node, ni_list, next) in ieee80211_node_table_reset()
2331 if (ni->ni_wdsvap == match) in ieee80211_node_table_reset()
2332 ni->ni_wdsvap = NULL; in ieee80211_node_table_reset()
2341 if (nt->nt_keyixmap != NULL) { in ieee80211_node_table_cleanup()
2343 /* XXX verify all entries are NULL */ in ieee80211_node_table_cleanup()
2345 for (i = 0; i < nt->nt_keyixmax; i++) in ieee80211_node_table_cleanup()
2346 if (nt->nt_keyixmap[i] != NULL) in ieee80211_node_table_cleanup()
2348 nt->nt_name, i); in ieee80211_node_table_cleanup()
2350 IEEE80211_FREE(nt->nt_keyixmap, M_80211_NODE); in ieee80211_node_table_cleanup()
2351 nt->nt_keyixmap = NULL; in ieee80211_node_table_cleanup()
2359 struct ieee80211com *ic = ni->ni_ic; in timeout_stations()
2360 struct ieee80211vap *vap = ni->ni_vap; in timeout_stations()
2369 if (vap->iv_state != IEEE80211_S_RUN) in timeout_stations()
2377 if ((vap->iv_opmode == IEEE80211_M_HOSTAP || in timeout_stations()
2378 vap->iv_opmode == IEEE80211_M_STA) && in timeout_stations()
2379 (ni->ni_flags & IEEE80211_NODE_AREF) == 0) in timeout_stations()
2384 * XXX doesn't belong here, move to node_age in timeout_stations()
2386 if (ni->ni_rxfrag[0] != NULL && in timeout_stations()
2387 ticks > ni->ni_rxfragstamp + hz) { in timeout_stations()
2388 m_freem(ni->ni_rxfrag[0]); in timeout_stations()
2389 ni->ni_rxfrag[0] = NULL; in timeout_stations()
2391 if (ni->ni_inact > 0) { in timeout_stations()
2392 ni->ni_inact--; in timeout_stations()
2395 __func__, ni->ni_inact, ni->ni_inact_reload, in timeout_stations()
2396 ni->ni_rates.rs_nrates); in timeout_stations()
2401 * XXX run ic_node_age in timeout_stations()
2403 /* XXX before inact decrement? */ in timeout_stations()
2404 if (ni == vap->iv_bss) in timeout_stations()
2406 if (ni->ni_associd != 0 || in timeout_stations()
2407 (vap->iv_opmode == IEEE80211_M_IBSS || in timeout_stations()
2408 vap->iv_opmode == IEEE80211_M_AHDEMO)) { in timeout_stations()
2412 ic->ic_node_age(ni); in timeout_stations()
2417 * for ps-poll support so it should be...). in timeout_stations()
2419 * XXX don't probe the station unless we've in timeout_stations()
2425 if ((vap->iv_flags_ext & IEEE80211_FEXT_INACT) && in timeout_stations()
2426 (0 < ni->ni_inact && in timeout_stations()
2427 ni->ni_inact <= vap->iv_inact_probe) && in timeout_stations()
2428 ni->ni_rates.rs_nrates != 0) { in timeout_stations()
2440 /* XXX fix this (not required anymore). */ in timeout_stations()
2442 /* XXX useless */ in timeout_stations()
2444 /* XXX stat? */ in timeout_stations()
2448 if ((vap->iv_flags_ext & IEEE80211_FEXT_INACT) && in timeout_stations()
2449 ni->ni_inact <= 0) { in timeout_stations()
2465 if (ni->ni_associd != 0) { in timeout_stations()
2471 vap->iv_stats.is_node_timeout++; in timeout_stations()
2481 struct ieee80211_node_table *nt = &ic->ic_sta; in ieee80211_timeout_stations()
2493 struct ieee80211_node_table *nt = &ic->ic_sta; in ieee80211_drain()
2498 TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { in ieee80211_drain()
2505 vap = ni->ni_vap; in ieee80211_drain()
2513 if (vap->iv_state != IEEE80211_S_RUN) in ieee80211_drain()
2515 /* XXX can vap be NULL? */ in ieee80211_drain()
2516 if ((vap->iv_opmode == IEEE80211_M_HOSTAP || in ieee80211_drain()
2517 vap->iv_opmode == IEEE80211_M_STA) && in ieee80211_drain()
2518 (ni->ni_flags & IEEE80211_NODE_AREF) == 0) in ieee80211_drain()
2522 * XXX doesn't belong here, move to node_drain in ieee80211_drain()
2524 if (ni->ni_rxfrag[0] != NULL) { in ieee80211_drain()
2525 m_freem(ni->ni_rxfrag[0]); in ieee80211_drain()
2526 ni->ni_rxfrag[0] = NULL; in ieee80211_drain()
2531 ic->ic_node_drain(ni); in ieee80211_drain()
2537 * Per-ieee80211vap inactivity timer callback.
2543 IEEE80211_LOCK_ASSERT(vap->iv_ic); in ieee80211_vap_timeout()
2551 * Per-ieee80211com inactivity timer callback.
2568 if ((ic->ic_flags & IEEE80211_F_CSAPENDING) == 0) { in ieee80211_node_timeout()
2571 ieee80211_ageq_age(&ic->ic_stageq, IEEE80211_INACT_WAIT); in ieee80211_node_timeout()
2574 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) in ieee80211_node_timeout()
2578 callout_reset(&ic->ic_inact, IEEE80211_INACT_WAIT*hz, in ieee80211_node_timeout()
2601 count = nt->nt_count; in ieee80211_iterate_nodes_vap()
2611 TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { in ieee80211_iterate_nodes_vap()
2612 if (vap != NULL && ni->ni_vap != vap) in ieee80211_iterate_nodes_vap()
2643 /* XXX no way to pass error to the caller. */ in ieee80211_iterate_nodes()
2652 ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)); in ieee80211_dump_node()
2654 ni->ni_authmode, ni->ni_flags); in ieee80211_dump_node()
2656 ni->ni_associd, ni->ni_txpower, ni->ni_vlan); in ieee80211_dump_node()
2658 ni->ni_txseqs[IEEE80211_NONQOS_TID], in ieee80211_dump_node()
2659 ni->ni_rxseqs[IEEE80211_NONQOS_TID] >> IEEE80211_SEQ_SEQ_SHIFT, in ieee80211_dump_node()
2660 ni->ni_rxseqs[IEEE80211_NONQOS_TID] & IEEE80211_SEQ_FRAG_MASK, in ieee80211_dump_node()
2661 ni->ni_rxfragstamp); in ieee80211_dump_node()
2663 node_getrssi(ni), ni->ni_noise, in ieee80211_dump_node()
2664 ni->ni_intval, ni->ni_capinfo); in ieee80211_dump_node()
2666 ether_sprintf(ni->ni_bssid), in ieee80211_dump_node()
2667 ni->ni_esslen, ni->ni_essid, in ieee80211_dump_node()
2668 (ni->ni_chan != IEEE80211_CHAN_ANYC) ? ni->ni_chan->ic_freq : 0, in ieee80211_dump_node()
2669 (ni->ni_chan != IEEE80211_CHAN_ANYC) ? ni->ni_chan->ic_flags : 0); in ieee80211_dump_node()
2671 ni->ni_inact, ni->ni_inact_reload, ni->ni_txrate); in ieee80211_dump_node()
2673 ni->ni_htcap, ni->ni_htparam, in ieee80211_dump_node()
2674 ni->ni_htctlchan, ni->ni_ht2ndchan); in ieee80211_dump_node()
2676 ni->ni_htopmode, ni->ni_htstbc, in ieee80211_dump_node()
2677 ni->ni_chw, IEEE80211_NI_CHW_BITS); in ieee80211_dump_node()
2679 ni->ni_vhtcap, (int) ni->ni_vht_chan1, (int) ni->ni_vht_chan2, in ieee80211_dump_node()
2680 (int) ni->ni_vht_basicmcs); in ieee80211_dump_node()
2681 /* XXX VHT state */ in ieee80211_dump_node()
2703 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) in ieee80211_notify_erp_locked()
2704 if (vap->iv_opmode == IEEE80211_M_HOSTAP) in ieee80211_notify_erp_locked()
2714 struct ieee80211com *ic = ni->ni_ic; in ieee80211_node_join_11g()
2715 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_join_11g()
2726 if ((ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME) == 0) { in ieee80211_node_join_11g()
2727 vap->iv_longslotsta++; in ieee80211_node_join_11g()
2728 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, in ieee80211_node_join_11g()
2730 vap->iv_longslotsta); in ieee80211_node_join_11g()
2732 * XXX TODO: this may need all VAPs checked! in ieee80211_node_join_11g()
2734 if (!IEEE80211_IS_CHAN_108G(ic->ic_bsschan)) { in ieee80211_node_join_11g()
2737 * mode as non-ERP stations won't be present; this in ieee80211_node_join_11g()
2748 if (!ieee80211_iserp_rateset(&ni->ni_rates)) { in ieee80211_node_join_11g()
2749 vap->iv_nonerpsta++; in ieee80211_node_join_11g()
2750 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, in ieee80211_node_join_11g()
2751 "station is !ERP, %d non-ERP stations associated", in ieee80211_node_join_11g()
2752 vap->iv_nonerpsta); in ieee80211_node_join_11g()
2757 if ((ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE) == 0) { in ieee80211_node_join_11g()
2758 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, in ieee80211_node_join_11g()
2760 vap->iv_flags |= IEEE80211_F_USEBARKER; in ieee80211_node_join_11g()
2761 vap->iv_flags &= ~IEEE80211_F_SHPREAMBLE; in ieee80211_node_join_11g()
2768 if (vap->iv_protmode != IEEE80211_PROT_NONE && in ieee80211_node_join_11g()
2769 vap->iv_nonerpsta == 1 && in ieee80211_node_join_11g()
2770 (vap->iv_flags_ext & IEEE80211_FEXT_NONERP_PR) == 0) { in ieee80211_node_join_11g()
2771 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_ASSOC, in ieee80211_node_join_11g()
2773 vap->iv_flags |= IEEE80211_F_USEPROT; in ieee80211_node_join_11g()
2777 ni->ni_flags |= IEEE80211_NODE_ERP; in ieee80211_node_join_11g()
2783 struct ieee80211com *ic = ni->ni_ic; in ieee80211_node_join()
2784 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_join()
2787 if (ni->ni_associd == 0) { in ieee80211_node_join()
2790 KASSERT(vap->iv_aid_bitmap != NULL, ("no aid bitmap")); in ieee80211_node_join()
2795 for (aid = 1; aid < vap->iv_max_aid; aid++) { in ieee80211_node_join()
2799 if (aid >= vap->iv_max_aid) { in ieee80211_node_join()
2804 ni->ni_associd = aid | 0xc000; in ieee80211_node_join()
2805 ni->ni_jointime = time_uptime; in ieee80211_node_join()
2807 IEEE80211_AID_SET(vap, ni->ni_associd); in ieee80211_node_join()
2808 vap->iv_sta_assoc++; in ieee80211_node_join()
2810 if (IEEE80211_IS_CHAN_HT(ic->ic_bsschan)) in ieee80211_node_join()
2812 if (IEEE80211_IS_CHAN_VHT(ic->ic_bsschan)) in ieee80211_node_join()
2814 if (IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan) && in ieee80211_node_join()
2815 IEEE80211_IS_CHAN_FULL(ic->ic_bsschan)) in ieee80211_node_join()
2824 * XXX VHT - should log VHT channel width, etc in ieee80211_node_join()
2829 vap->iv_flags & IEEE80211_F_SHPREAMBLE ? "short" : "long", in ieee80211_node_join()
2830 vap->iv_flags & IEEE80211_F_SHSLOT ? "short" : "long", in ieee80211_node_join()
2831 vap->iv_flags & IEEE80211_F_USEPROT ? ", protection" : "", in ieee80211_node_join()
2832 ni->ni_flags & IEEE80211_NODE_QOS ? ", QoS" : "", in ieee80211_node_join()
2833 /* XXX update for VHT string */ in ieee80211_node_join()
2834 ni->ni_flags & IEEE80211_NODE_HT ? in ieee80211_node_join()
2835 (ni->ni_chw == IEEE80211_STA_RX_BW_40 ? ", HT40" : ", HT20") : "", in ieee80211_node_join()
2836 ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "", in ieee80211_node_join()
2837 ni->ni_flags & IEEE80211_NODE_AMSDU ? " (+AMSDU)" : "", in ieee80211_node_join()
2838 ni->ni_flags & IEEE80211_NODE_MIMO_RTS ? " (+SMPS-DYN)" : in ieee80211_node_join()
2839 ni->ni_flags & IEEE80211_NODE_MIMO_PS ? " (+SMPS)" : "", in ieee80211_node_join()
2840 ni->ni_flags & IEEE80211_NODE_RIFS ? " (+RIFS)" : "", in ieee80211_node_join()
2842 ", fast-frames" : "", in ieee80211_node_join()
2850 if (ic->ic_newassoc != NULL) in ieee80211_node_join()
2851 ic->ic_newassoc(ni, newassoc); in ieee80211_node_join()
2854 if (vap->iv_auth->ia_node_join != NULL) in ieee80211_node_join()
2855 vap->iv_auth->ia_node_join(ni); in ieee80211_node_join()
2863 struct ieee80211com *ic = vap->iv_ic; in disable_protection()
2865 KASSERT(vap->iv_nonerpsta == 0 && in disable_protection()
2866 (vap->iv_flags_ext & IEEE80211_FEXT_NONERP_PR) == 0, in disable_protection()
2867 ("%d non ERP stations, flags 0x%x", vap->iv_nonerpsta, in disable_protection()
2868 vap->iv_flags_ext)); in disable_protection()
2870 vap->iv_flags &= ~IEEE80211_F_USEPROT; in disable_protection()
2871 /* XXX verify mode? */ in disable_protection()
2872 if (ic->ic_caps & IEEE80211_C_SHPREAMBLE) { in disable_protection()
2873 vap->iv_flags |= IEEE80211_F_SHPREAMBLE; in disable_protection()
2874 vap->iv_flags &= ~IEEE80211_F_USEBARKER; in disable_protection()
2886 struct ieee80211com *ic = ni->ni_ic; in ieee80211_node_leave_11g()
2887 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_leave_11g()
2891 KASSERT(IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan), in ieee80211_node_leave_11g()
2892 ("not in 11g, bss %u:0x%x", ic->ic_bsschan->ic_freq, in ieee80211_node_leave_11g()
2893 ic->ic_bsschan->ic_flags)); in ieee80211_node_leave_11g()
2898 if ((ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME) == 0) { in ieee80211_node_leave_11g()
2899 KASSERT(vap->iv_longslotsta > 0, in ieee80211_node_leave_11g()
2900 ("bogus long slot station count %d", vap->iv_longslotsta)); in ieee80211_node_leave_11g()
2901 vap->iv_longslotsta--; in ieee80211_node_leave_11g()
2902 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, in ieee80211_node_leave_11g()
2904 vap->iv_longslotsta); in ieee80211_node_leave_11g()
2906 * XXX TODO: this may need all VAPs checked! in ieee80211_node_leave_11g()
2908 if (vap->iv_longslotsta == 0) { in ieee80211_node_leave_11g()
2910 * Re-enable use of short slot time if supported in ieee80211_node_leave_11g()
2911 * and not operating in IBSS mode (per spec). in ieee80211_node_leave_11g()
2913 if ((ic->ic_caps & IEEE80211_C_SHSLOT) && in ieee80211_node_leave_11g()
2914 ic->ic_opmode != IEEE80211_M_IBSS) { in ieee80211_node_leave_11g()
2915 IEEE80211_DPRINTF(ni->ni_vap, in ieee80211_node_leave_11g()
2917 "%s: re-enable use of short slot time\n", in ieee80211_node_leave_11g()
2924 * If a non-ERP station do the protection-related bookkeeping. in ieee80211_node_leave_11g()
2926 if ((ni->ni_flags & IEEE80211_NODE_ERP) == 0) { in ieee80211_node_leave_11g()
2927 KASSERT(vap->iv_nonerpsta > 0, in ieee80211_node_leave_11g()
2928 ("bogus non-ERP station count %d", vap->iv_nonerpsta)); in ieee80211_node_leave_11g()
2929 vap->iv_nonerpsta--; in ieee80211_node_leave_11g()
2930 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, in ieee80211_node_leave_11g()
2931 "non-ERP station leaves, count now %d%s", vap->iv_nonerpsta, in ieee80211_node_leave_11g()
2932 (vap->iv_flags_ext & IEEE80211_FEXT_NONERP_PR) ? in ieee80211_node_leave_11g()
2933 " (non-ERP sta present)" : ""); in ieee80211_node_leave_11g()
2934 if (vap->iv_nonerpsta == 0 && in ieee80211_node_leave_11g()
2935 (vap->iv_flags_ext & IEEE80211_FEXT_NONERP_PR) == 0) { in ieee80211_node_leave_11g()
2936 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_ASSOC, in ieee80211_node_leave_11g()
2944 * Time out presence of an overlapping bss with non-ERP
2945 * stations. When operating in hostap mode we listen for
2946 * beacons from other stations and if we identify a non-ERP
2948 * when all non-ERP stations are gone we time out this
2955 IEEE80211_LOCK_ASSERT(vap->iv_ic); in ieee80211_vap_erp_timeout()
2957 if ((vap->iv_flags_ext & IEEE80211_FEXT_NONERP_PR) && in ieee80211_vap_erp_timeout()
2958 ieee80211_time_after(ticks, vap->iv_lastnonerp + IEEE80211_NONERP_PRESENT_AGE)) { in ieee80211_vap_erp_timeout()
2960 "%s", "age out non-ERP sta present on channel"); in ieee80211_vap_erp_timeout()
2961 vap->iv_flags_ext &= ~IEEE80211_FEXT_NONERP_PR; in ieee80211_vap_erp_timeout()
2962 if (vap->iv_nonerpsta == 0) in ieee80211_vap_erp_timeout()
2974 struct ieee80211com *ic = ni->ni_ic; in ieee80211_node_leave()
2975 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_leave()
2976 struct ieee80211_node_table *nt = ni->ni_table; in ieee80211_node_leave()
2981 KASSERT(vap->iv_opmode != IEEE80211_M_STA, in ieee80211_node_leave()
2982 ("unexpected operating mode %u", vap->iv_opmode)); in ieee80211_node_leave()
2987 /* XXX ibss mode bypasses 11g and notification */ in ieee80211_node_leave()
2988 if (ni->ni_associd == 0) in ieee80211_node_leave()
2996 if (vap->iv_auth->ia_node_leave != NULL) in ieee80211_node_leave()
2997 vap->iv_auth->ia_node_leave(ni); in ieee80211_node_leave()
3000 IEEE80211_AID_CLR(vap, ni->ni_associd); in ieee80211_node_leave()
3001 vap->iv_sta_assoc--; in ieee80211_node_leave()
3003 if (IEEE80211_IS_CHAN_VHT(ic->ic_bsschan)) in ieee80211_node_leave()
3005 if (IEEE80211_IS_CHAN_HT(ic->ic_bsschan)) in ieee80211_node_leave()
3007 if (IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan) && in ieee80211_node_leave()
3008 IEEE80211_IS_CHAN_FULL(ic->ic_bsschan)) in ieee80211_node_leave()
3042 struct ieee80211vap *vap = ni->ni_vap; in get_hostap_rssi()
3046 if (ni->ni_associd == 0) in get_hostap_rssi()
3048 rssi = vap->iv_ic->ic_node_getrssi(ni); in get_hostap_rssi()
3050 info->rssi_samples++; in get_hostap_rssi()
3051 info->rssi_total += rssi; in get_hostap_rssi()
3059 struct ieee80211vap *vap = ni->ni_vap; in get_adhoc_rssi()
3063 /* XXX check bssid */ in get_adhoc_rssi()
3064 if ((ni->ni_capinfo & IEEE80211_CAPINFO_IBSS) == 0) in get_adhoc_rssi()
3066 rssi = vap->iv_ic->ic_node_getrssi(ni); in get_adhoc_rssi()
3068 info->rssi_samples++; in get_adhoc_rssi()
3069 info->rssi_total += rssi; in get_adhoc_rssi()
3078 struct ieee80211vap *vap = ni->ni_vap; in get_mesh_rssi()
3082 if (ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) in get_mesh_rssi()
3084 rssi = vap->iv_ic->ic_node_getrssi(ni); in get_mesh_rssi()
3086 info->rssi_samples++; in get_mesh_rssi()
3087 info->rssi_total += rssi; in get_mesh_rssi()
3096 struct ieee80211com *ic = vap->iv_ic; in ieee80211_getrssi()
3101 switch (vap->iv_opmode) { in ieee80211_getrssi()
3104 ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, get_adhoc_rssi, in ieee80211_getrssi()
3108 ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, get_hostap_rssi, in ieee80211_getrssi()
3113 ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, get_mesh_rssi, in ieee80211_getrssi()
3117 case IEEE80211_M_MONITOR: /* XXX */ in ieee80211_getrssi()
3120 if (vap->iv_bss != NULL) in ieee80211_getrssi()
3121 info.rssi_total = ic->ic_node_getrssi(vap->iv_bss); in ieee80211_getrssi()
3133 if (vap->iv_bss == NULL) /* NB: shouldn't happen */ in ieee80211_getsignal()
3135 vap->iv_ic->ic_node_getsignal(vap->iv_bss, rssi, noise); in ieee80211_getsignal()
3136 /* for non-station mode return avg'd rssi accounting */ in ieee80211_getsignal()
3137 if (vap->iv_opmode != IEEE80211_M_STA) in ieee80211_getsignal()