Lines Matching full:ni
102 struct ieee80211_node *ni);
231 ieee80211_node_authorize(struct ieee80211_node *ni) in ieee80211_node_authorize() argument
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()
239 IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni, in ieee80211_node_authorize()
240 "%s: inact_reload %u", __func__, ni->ni_inact_reload); in ieee80211_node_authorize()
244 ieee80211_node_unauthorize(struct ieee80211_node *ni) in ieee80211_node_unauthorize() argument
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()
253 IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni, in ieee80211_node_unauthorize()
255 ni->ni_inact_reload, ni->ni_inact); in ieee80211_node_unauthorize()
262 ieee80211_node_setuptxparms(struct ieee80211_node *ni) in ieee80211_node_setuptxparms() argument
264 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_setuptxparms()
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()
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()
278 if (IEEE80211_IS_CHAN_ST(ni->ni_chan)) in ieee80211_node_setuptxparms()
280 else if (IEEE80211_IS_CHAN_HALF(ni->ni_chan)) in ieee80211_node_setuptxparms()
282 else if (IEEE80211_IS_CHAN_QUARTER(ni->ni_chan)) in ieee80211_node_setuptxparms()
285 else if (IEEE80211_IS_CHAN_A(ni->ni_chan)) 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()
293 ni->ni_txparms = &vap->iv_txparms[mode]; in ieee80211_node_setuptxparms()
302 ieee80211_node_set_chan(struct ieee80211_node *ni, in ieee80211_node_set_chan() argument
305 struct ieee80211com *ic = ni->ni_ic; in ieee80211_node_set_chan()
306 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_set_chan()
311 ni->ni_chan = chan; in ieee80211_node_set_chan()
318 ni->ni_htrates = *ieee80211_get_suphtrates(ic, chan); 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()
353 struct ieee80211_node *ni; in ieee80211_create_ibss() local
362 ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr, in ieee80211_create_ibss()
364 if (ni == NULL) { 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()
372 copy_bss(ni, vap->iv_bss); in ieee80211_create_ibss()
373 ni->ni_intval = ic->ic_bintval; in ieee80211_create_ibss()
375 ni->ni_capinfo |= IEEE80211_CAPINFO_PRIVACY; in ieee80211_create_ibss()
377 ni->ni_fhdwell = 200; /* XXX */ in ieee80211_create_ibss()
378 ni->ni_fhindex = 1; in ieee80211_create_ibss()
381 ni->ni_capinfo |= IEEE80211_CAPINFO_IBSS; /* XXX */ 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()
392 IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_des_bssid); in ieee80211_create_ibss()
397 memset(ni->ni_bssid, 0, IEEE80211_ADDR_LEN); 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()
413 ieee80211_node_set_chan(ni, chan); in ieee80211_create_ibss()
423 ieee80211_setbasicrates(&ni->ni_rates, in ieee80211_create_ibss()
430 ieee80211_addbasicrates(&ni->ni_rates, in ieee80211_create_ibss()
437 ieee80211_setbasicrates(&ni->ni_rates, in ieee80211_create_ibss()
445 if (IEEE80211_IS_CHAN_VHT(ni->ni_chan)) { in ieee80211_create_ibss()
447 ieee80211_ht_node_init(ni); in ieee80211_create_ibss()
448 ieee80211_vht_node_init(ni); in ieee80211_create_ibss()
449 } else if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { in ieee80211_create_ibss()
451 ieee80211_ht_node_init(ni); in ieee80211_create_ibss()
454 (void) ieee80211_sta_join1(ieee80211_ref_node(ni)); in ieee80211_create_ibss()
467 struct ieee80211_node *ni, *obss; in ieee80211_reset_bss() local
475 ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr, in ieee80211_reset_bss()
477 KASSERT(ni != NULL, ("unable to setup initial BSS node")); in ieee80211_reset_bss()
478 obss = vap->iv_update_bss(vap, ieee80211_ref_node(ni)); in ieee80211_reset_bss()
480 copy_bss(ni, obss); 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()
488 match_ssid(const struct ieee80211_node *ni, in match_ssid() argument
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()
505 check_bss(struct ieee80211vap *vap, struct ieee80211_node *ni) in check_bss() argument
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()
513 if ((ni->ni_capinfo & IEEE80211_CAPINFO_IBSS) == 0) in check_bss()
516 if ((ni->ni_capinfo & IEEE80211_CAPINFO_ESS) == 0) in check_bss()
520 if ((ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY) == 0) 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()
532 !match_ssid(ni, vap->iv_des_nssid, vap->iv_des_ssid)) in check_bss()
535 !IEEE80211_ADDR_EQ(vap->iv_des_bssid, ni->ni_bssid)) in check_bss()
545 check_bss_debug(struct ieee80211vap *vap, struct ieee80211_node *ni) in check_bss_debug() argument
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()
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()
562 if ((ni->ni_capinfo & IEEE80211_CAPINFO_PRIVACY) == 0) 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()
574 !match_ssid(ni, vap->iv_des_nssid, vap->iv_des_ssid)) 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()
600 ieee80211_ibss_merge_check(struct ieee80211_node *ni) in ieee80211_ibss_merge_check() argument
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()
610 if (!check_bss(vap, ni)) { in ieee80211_ibss_merge_check()
616 check_bss_debug(vap, ni); in ieee80211_ibss_merge_check()
636 ieee80211_ibss_node_check_new(struct ieee80211_node *ni, in ieee80211_ibss_node_check_new() argument
639 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_ibss_node_check_new()
693 ieee80211_ibss_merge(struct ieee80211_node *ni) in ieee80211_ibss_merge() argument
696 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_ibss_merge()
699 if (! ieee80211_ibss_merge_check(ni)) in ieee80211_ibss_merge()
704 ether_sprintf(ni->ni_bssid), in ieee80211_ibss_merge()
709 return ieee80211_sta_join1(ieee80211_ref_node(ni)); in ieee80211_ibss_merge()
941 struct ieee80211_node *ni; in ieee80211_sta_join() local
944 ni = ieee80211_alloc_node(&ic->ic_sta, vap, se->se_macaddr, in ieee80211_sta_join()
946 if (ni == NULL) { 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()
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()
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()
1018 if (ni->ni_ies.htinfo_ie != NULL && in ieee80211_sta_join()
1019 ni->ni_ies.htcap_ie != NULL && in ieee80211_sta_join()
1021 ieee80211_ht_node_init(ni); in ieee80211_sta_join()
1022 ieee80211_ht_updateparams(ni, 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()
1037 if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) { in ieee80211_sta_join()
1040 ni->ni_macaddr, in ieee80211_sta_join()
1043 ieee80211_vht_node_init(ni); in ieee80211_sta_join()
1044 ieee80211_vht_updateparams(ni, 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()
1065 ieee80211_node_setuptxparms(ni); in ieee80211_sta_join()
1066 ieee80211_ratectl_node_init(ni); in ieee80211_sta_join()
1068 return ieee80211_sta_join1(ieee80211_ref_node(ni)); in ieee80211_sta_join()
1076 ieee80211_sta_leave(struct ieee80211_node *ni) in ieee80211_sta_leave() argument
1078 struct ieee80211com *ic = ni->ni_ic; in ieee80211_sta_leave()
1080 ic->ic_node_cleanup(ni); in ieee80211_sta_leave()
1081 ieee80211_notify_node_leave(ni); in ieee80211_sta_leave()
1088 ieee80211_node_deauth(struct ieee80211_node *ni, int reason) in ieee80211_node_deauth() argument
1091 ieee80211_ref_node(ni); in ieee80211_node_deauth()
1092 if (ni->ni_associd != 0) in ieee80211_node_deauth()
1093 IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DEAUTH, reason); in ieee80211_node_deauth()
1094 ieee80211_node_leave(ni); in ieee80211_node_deauth()
1095 ieee80211_free_node(ni); in ieee80211_node_deauth()
1101 struct ieee80211_node *ni; in node_alloc() local
1103 ni = (struct ieee80211_node *) IEEE80211_MALLOC(sizeof(struct ieee80211_node), in node_alloc()
1105 return ni; in node_alloc()
1109 node_init(struct ieee80211_node *ni) in node_init() argument
1233 node_cleanup(struct ieee80211_node *ni) in node_cleanup() argument
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()
1243 ni->ni_flags &= ~IEEE80211_NODE_PWR_MGT; in node_cleanup()
1244 IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni, in node_cleanup()
1250 if (ni->ni_flags & IEEE80211_NODE_VHT) in node_cleanup()
1251 ieee80211_vht_node_cleanup(ni); in node_cleanup()
1252 if (ni->ni_flags & IEEE80211_NODE_HT) in node_cleanup()
1253 ieee80211_ht_node_cleanup(ni); in node_cleanup()
1256 ieee80211_ff_node_cleanup(ni); in node_cleanup()
1263 ieee80211_mesh_node_cleanup(ni); 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()
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()
1311 ieee80211_node_delucastkey(ni); in node_cleanup()
1315 node_free(struct ieee80211_node *ni) in node_free() argument
1317 struct ieee80211com *ic = ni->ni_ic; in node_free()
1319 ieee80211_ratectl_node_deinit(ni); 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()
1323 IEEE80211_FREE(ni, M_80211_NODE); in node_free()
1327 node_age(struct ieee80211_node *ni) in node_age() argument
1329 struct ieee80211vap *vap = ni->ni_vap; in node_age()
1334 if (ieee80211_node_psq_age(ni) != 0 && 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()
1341 if (ni->ni_associd != 0 && (ni->ni_flags & IEEE80211_NODE_HT)) in node_age()
1342 ieee80211_ht_node_age(ni); in node_age()
1346 node_getrssi(const struct ieee80211_node *ni) in node_getrssi() argument
1348 uint32_t avgrssi = ni->ni_avgrssi; in node_getrssi()
1358 node_getsignal(const struct ieee80211_node *ni, int8_t *rssi, int8_t *noise) in node_getsignal() argument
1360 *rssi = node_getrssi(ni); in node_getsignal()
1361 *noise = ni->ni_noise; in node_getsignal()
1365 node_getmimoinfo(const struct ieee80211_node *ni, in node_getmimoinfo() argument
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()
1383 info->ch[i].noise[0] = ni->ni_mimo_noise_ctl[i]; in node_getmimoinfo()
1393 struct ieee80211_node *ni) in ieee80211_add_node_nt() argument
1400 hash = IEEE80211_NODE_HASH(ic, ni->ni_macaddr); 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()
1405 ni->ni_table = nt; in ieee80211_add_node_nt()
1410 struct ieee80211_node *ni) in ieee80211_del_node_nt() argument
1415 TAILQ_REMOVE(&nt->nt_node, ni, ni_list); in ieee80211_del_node_nt()
1416 LIST_REMOVE(ni, ni_hash); in ieee80211_del_node_nt()
1420 ni->ni_table = NULL; in ieee80211_del_node_nt()
1429 struct ieee80211_node *ni; in ieee80211_alloc_node() local
1431 ni = ic->ic_node_alloc(vap, macaddr); in ieee80211_alloc_node()
1432 if (ni == NULL) { in ieee80211_alloc_node()
1438 "%s %p<%s> in %s table\n", __func__, ni, in ieee80211_alloc_node()
1441 IEEE80211_ADDR_COPY(ni->ni_macaddr, macaddr); in ieee80211_alloc_node()
1442 ieee80211_node_initref(ni); /* mark referenced */ in ieee80211_alloc_node()
1445 "%s (%s:%u) %p<%s> refcnt %d\n", __func__, func, line, ni, 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()
1460 ieee80211_mesh_node_init(vap, ni); in ieee80211_alloc_node()
1463 ieee80211_add_node_nt(nt, ni); 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()
1471 ieee80211_psq_cleanup(&ni->ni_psq); in ieee80211_alloc_node()
1472 ieee80211_ratectl_node_deinit(ni); in ieee80211_alloc_node()
1473 __ieee80211_free_node(ni); in ieee80211_alloc_node()
1477 IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni, in ieee80211_alloc_node()
1478 "%s: inact_reload %u", __func__, ni->ni_inact_reload); in ieee80211_alloc_node()
1480 return ni; in ieee80211_alloc_node()
1494 struct ieee80211_node *ni; in ieee80211_tmp_node() local
1496 ni = ic->ic_node_alloc(vap, macaddr); in ieee80211_tmp_node()
1497 if (ni != NULL) { in ieee80211_tmp_node()
1501 "%s %p<%s>\n", __func__, ni, ether_sprintf(macaddr)); 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()
1509 ieee80211_node_initref(ni); /* mark referenced */ 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()
1522 ieee80211_psq_init(&ni->ni_psq, "unknown"); in ieee80211_tmp_node()
1524 ieee80211_ratectl_node_init(ni); in ieee80211_tmp_node()
1527 if (ic->ic_node_init(ni) != 0) { in ieee80211_tmp_node()
1529 ieee80211_psq_cleanup(&ni->ni_psq); in ieee80211_tmp_node()
1530 ieee80211_ratectl_node_deinit(ni); in ieee80211_tmp_node()
1531 __ieee80211_free_node(ni); in ieee80211_tmp_node()
1539 return ni; in ieee80211_tmp_node()
1547 struct ieee80211_node *ni; in ieee80211_dup_bss() local
1549 ni = ieee80211_alloc_node(&ic->ic_sta, vap, macaddr, __func__, __LINE__); in ieee80211_dup_bss()
1550 if (ni != NULL) { in ieee80211_dup_bss()
1555 copy_bss(ni, 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()
1559 return ni; in ieee80211_dup_bss()
1574 struct ieee80211_node *ni; in ieee80211_node_create_wds() local
1577 ni = ieee80211_alloc_node(&ic->ic_sta, vap, bssid, __func__, __LINE__); in ieee80211_node_create_wds()
1578 if (ni != NULL) { 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()
1585 ieee80211_node_set_chan(ni, chan); 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()
1596 ni->ni_flags |= IEEE80211_NODE_QOS; in ieee80211_node_create_wds()
1599 ni->ni_flags |= IEEE80211_NODE_FF; in ieee80211_node_create_wds()
1609 ieee80211_ht_wds_init(ni); in ieee80211_node_create_wds()
1614 struct ieee80211_channel *c = ni->ni_chan; 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()
1625 return ni; in ieee80211_node_create_wds()
1633 struct ieee80211_node *ni; in _ieee80211_find_node_locked() local
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()
1641 ieee80211_ref_node(ni); /* mark referenced */ 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()
1647 ieee80211_node_refcnt(ni)); in _ieee80211_find_node_locked()
1649 return ni; in _ieee80211_find_node_locked()
1660 struct ieee80211_node *ni; in _ieee80211_find_node() local
1663 ni = _ieee80211_find_node_locked(nt, macaddr, func, line); in _ieee80211_find_node()
1665 return ni; in _ieee80211_find_node()
1673 struct ieee80211_node *ni; in _ieee80211_find_vap_node_locked() local
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()
1682 ieee80211_ref_node(ni); /* mark referenced */ 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()
1688 ieee80211_node_refcnt(ni)); in _ieee80211_find_vap_node_locked()
1690 return ni; in _ieee80211_find_vap_node_locked()
1701 struct ieee80211_node *ni; in _ieee80211_find_vap_node() local
1704 ni = _ieee80211_find_vap_node_locked(nt, vap, macaddr, func, line); in _ieee80211_find_vap_node()
1706 return ni; in _ieee80211_find_vap_node()
1719 struct ieee80211_node *ni; in ieee80211_fakeup_adhoc_node() local
1723 ni = ieee80211_dup_bss(vap, macaddr); in ieee80211_fakeup_adhoc_node()
1724 if (ni != NULL) { 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()
1743 ni->ni_flags |= IEEE80211_NODE_QOS; in ieee80211_fakeup_adhoc_node()
1746 ni->ni_flags |= IEEE80211_NODE_FF; in ieee80211_fakeup_adhoc_node()
1749 ieee80211_node_setuptxparms(ni); in ieee80211_fakeup_adhoc_node()
1750 ieee80211_ratectl_node_init(ni); in ieee80211_fakeup_adhoc_node()
1763 ic->ic_newassoc(ni, 1); in ieee80211_fakeup_adhoc_node()
1781 ieee80211_send_probereq(ni, /* node */ in ieee80211_fakeup_adhoc_node()
1783 ni->ni_macaddr, /* DA */ in ieee80211_fakeup_adhoc_node()
1790 ieee80211_node_authorize(ni); in ieee80211_fakeup_adhoc_node()
1792 return ni; in ieee80211_fakeup_adhoc_node()
1796 ieee80211_init_neighbor(struct ieee80211_node *ni, in ieee80211_init_neighbor() argument
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()
1815 ieee80211_mesh_init_neighbor(ni, wh, sp); 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()
1861 ieee80211_ht_node_init(ni); in ieee80211_init_neighbor()
1862 ieee80211_ht_updateparams(ni, 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()
1873 ieee80211_vht_node_init(ni); in ieee80211_init_neighbor()
1874 ieee80211_vht_updateparams(ni, in ieee80211_init_neighbor()
1875 ni->ni_ies.vhtcap_ie, in ieee80211_init_neighbor()
1876 ni->ni_ies.vhtopmode_ie); in ieee80211_init_neighbor()
1877 ieee80211_setup_vht_rates(ni, 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()
1889 ieee80211_setup_htrates(ni, in ieee80211_init_neighbor()
1890 ni->ni_ies.htcap_ie, in ieee80211_init_neighbor()
1892 ieee80211_setup_basic_htrates(ni, in ieee80211_init_neighbor()
1893 ni->ni_ies.htinfo_ie); in ieee80211_init_neighbor()
1895 ieee80211_node_setuptxparms(ni); in ieee80211_init_neighbor()
1896 ieee80211_ratectl_node_init(ni); 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()
1926 struct ieee80211_node *ni; in ieee80211_add_neighbor() local
1930 ni = ieee80211_dup_bss(vap, wh->i_addr2);/* XXX alloc_node? */ in ieee80211_add_neighbor()
1931 if (ni != NULL) { in ieee80211_add_neighbor()
1934 ieee80211_init_neighbor(ni, wh, sp); 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()
1937 ieee80211_node_setuptxparms(ni); in ieee80211_add_neighbor()
1938 ieee80211_ratectl_node_init(ni); in ieee80211_add_neighbor()
1940 ic->ic_newassoc(ni, 1); in ieee80211_add_neighbor()
1942 ieee80211_node_authorize(ni); in ieee80211_add_neighbor()
1944 return ni; in ieee80211_add_neighbor()
1975 struct ieee80211_node *ni; in _ieee80211_find_rxnode() local
1979 ni = _find_rxnode(nt, wh, func, line); in _ieee80211_find_rxnode()
1982 return ni; in _ieee80211_find_rxnode()
1999 struct ieee80211_node *ni; in _ieee80211_find_rxnode_withkey() local
2004 ni = nt->nt_keyixmap[keyix]; in _ieee80211_find_rxnode_withkey()
2006 ni = NULL; in _ieee80211_find_rxnode_withkey()
2007 if (ni == NULL) { in _ieee80211_find_rxnode_withkey()
2008 ni = _find_rxnode(nt, wh, func, line); in _ieee80211_find_rxnode_withkey()
2009 if (ni != NULL && nt->nt_keyixmap != NULL) { in _ieee80211_find_rxnode_withkey()
2014 keyix = ni->ni_ucastkey.wk_rxkeyix; 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()
2022 ieee80211_node_refcnt(ni)+1); in _ieee80211_find_rxnode_withkey()
2023 nt->nt_keyixmap[keyix] = ieee80211_ref_node(ni); in _ieee80211_find_rxnode_withkey()
2028 ni = NULL; /* spam bcast probe req to all vap's */ in _ieee80211_find_rxnode_withkey()
2030 ieee80211_ref_node(ni); in _ieee80211_find_rxnode_withkey()
2034 return ni; in _ieee80211_find_rxnode_withkey()
2049 struct ieee80211_node *ni; in _ieee80211_find_txnode() local
2062 ni = ieee80211_ref_node(vap->iv_bss); in _ieee80211_find_txnode()
2064 ni = _ieee80211_find_node_locked(nt, macaddr, func, line); in _ieee80211_find_txnode()
2067 if (ni == NULL) { in _ieee80211_find_txnode()
2080 ni = ieee80211_fakeup_adhoc_node(vap, macaddr); in _ieee80211_find_txnode()
2081 if (ni != NULL) in _ieee80211_find_txnode()
2082 (void) ieee80211_ref_node(ni); in _ieee80211_find_txnode()
2089 return ni; in _ieee80211_find_txnode()
2093 _ieee80211_ref_node(struct ieee80211_node *ni, in _ieee80211_ref_node() argument
2098 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, in _ieee80211_ref_node()
2099 "%s (%s:%u) %p<%s> refcnt %d\n", __func__, func, line, ni, in _ieee80211_ref_node()
2100 ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)+1); in _ieee80211_ref_node()
2102 ieee80211_node_incref(ni); in _ieee80211_ref_node()
2103 return (ni); in _ieee80211_ref_node()
2107 __ieee80211_free_node(struct ieee80211_node *ni) in __ieee80211_free_node() argument
2109 struct ieee80211_node_table *nt = ni->ni_table; in __ieee80211_free_node()
2119 "%s %p<%s> in %s table\n", __func__, ni, in __ieee80211_free_node()
2120 ether_sprintf(ni->ni_macaddr), 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()
2126 IEEE80211_AID_CLR(vap, ni->ni_associd); in __ieee80211_free_node()
2129 ieee80211_del_node_nt(nt, ni); in __ieee80211_free_node()
2130 ni->ni_ic->ic_node_free(ni); in __ieee80211_free_node()
2137 node_clear_keyixmap(struct ieee80211_node_table *nt, struct ieee80211_node *ni) in node_clear_keyixmap() argument
2141 keyix = ni->ni_ucastkey.wk_rxkeyix; 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()
2148 ieee80211_node_decref(ni); in node_clear_keyixmap()
2156 _ieee80211_free_node(struct ieee80211_node *ni, in _ieee80211_free_node() argument
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()
2163 "%s (%s:%u) %p<%s> refcnt %d\n", __func__, func, line, ni, in _ieee80211_free_node()
2164 ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)-1); in _ieee80211_free_node()
2168 if (ieee80211_node_dectestref(ni)) { in _ieee80211_free_node()
2172 __ieee80211_free_node(ni); in _ieee80211_free_node()
2173 } else if (ieee80211_node_refcnt(ni) == 1) in _ieee80211_free_node()
2174 if (node_clear_keyixmap(nt, ni)) in _ieee80211_free_node()
2175 __ieee80211_free_node(ni); in _ieee80211_free_node()
2178 if (ieee80211_node_dectestref(ni)) in _ieee80211_free_node()
2179 __ieee80211_free_node(ni); in _ieee80211_free_node()
2187 ieee80211_node_delucastkey(struct ieee80211_node *ni) in ieee80211_node_delucastkey() argument
2189 struct ieee80211com *ic = ni->ni_ic; 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()
2224 KASSERT(nikey == ni, in ieee80211_node_delucastkey()
2225 ("key map out of sync, ni %p nikey %p", ni, nikey)); 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()
2230 ieee80211_free_node(ni); in ieee80211_node_delucastkey()
2241 node_reclaim(struct ieee80211_node_table *nt, struct ieee80211_node *ni) in node_reclaim() argument
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()
2257 (void)node_clear_keyixmap(nt, ni); in node_reclaim()
2258 if (!ieee80211_node_dectestref(ni)) { in node_reclaim()
2265 ieee80211_del_node_nt(nt, ni); in node_reclaim()
2267 __ieee80211_free_node(ni); in node_reclaim()
2304 struct ieee80211_node *ni, *next; in ieee80211_node_table_reset() local
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()
2311 if (ni->ni_associd != 0) { in ieee80211_node_table_reset()
2312 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_table_reset()
2315 vap->iv_auth->ia_node_leave(ni); 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()
2320 node_reclaim(nt, ni); 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()
2357 timeout_stations(void *arg __unused, struct ieee80211_node *ni) in timeout_stations() argument
2359 struct ieee80211com *ic = ni->ni_ic; in timeout_stations()
2360 struct ieee80211vap *vap = ni->ni_vap; in timeout_stations()
2379 (ni->ni_flags & IEEE80211_NODE_AREF) == 0) 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()
2393 IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni, in timeout_stations()
2395 __func__, ni->ni_inact, ni->ni_inact_reload, in timeout_stations()
2396 ni->ni_rates.rs_nrates); in timeout_stations()
2404 if (ni == vap->iv_bss) in timeout_stations()
2406 if (ni->ni_associd != 0 || in timeout_stations()
2412 ic->ic_node_age(ni); 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()
2431 ni, "%s", in timeout_stations()
2441 ieee80211_ref_node(ni); in timeout_stations()
2443 ieee80211_send_nulldata(ni); in timeout_stations()
2449 ni->ni_inact <= 0) { in timeout_stations()
2451 IEEE80211_MSG_INACT | IEEE80211_MSG_NODE, ni, in timeout_stations()
2453 "(refcnt %u)", ieee80211_node_refcnt(ni)); in timeout_stations()
2465 if (ni->ni_associd != 0) { in timeout_stations()
2466 IEEE80211_SEND_MGMT(ni, in timeout_stations()
2470 ieee80211_node_leave(ni); in timeout_stations()
2495 struct ieee80211_node *ni; in ieee80211_drain() local
2498 TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { in ieee80211_drain()
2505 vap = ni->ni_vap; in ieee80211_drain()
2518 (ni->ni_flags & IEEE80211_NODE_AREF) == 0) 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()
2590 struct ieee80211_node *ni; in ieee80211_iterate_nodes_vap() local
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()
2617 ni_arr[i] = ieee80211_ref_node(ni); in ieee80211_iterate_nodes_vap()
2649 struct ieee80211_node *ni) in ieee80211_dump_node() argument
2651 printf("%p: mac %s refcnt %d\n", ni, in ieee80211_dump_node()
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, ni->ni_chw); in ieee80211_dump_node()
2678 ni->ni_vhtcap, (int) ni->ni_vht_chan1, (int) ni->ni_vht_chan2, in ieee80211_dump_node()
2679 (int) ni->ni_vht_basicmcs); in ieee80211_dump_node()
2711 ieee80211_node_join_11g(struct ieee80211_node *ni) in ieee80211_node_join_11g() argument
2713 struct ieee80211com *ic = ni->ni_ic; in ieee80211_node_join_11g()
2714 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_join_11g()
2725 if ((ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME) == 0) { in ieee80211_node_join_11g()
2727 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, in ieee80211_node_join_11g()
2747 if (!ieee80211_iserp_rateset(&ni->ni_rates)) { in ieee80211_node_join_11g()
2749 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, in ieee80211_node_join_11g()
2756 if ((ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE) == 0) { in ieee80211_node_join_11g()
2757 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, in ieee80211_node_join_11g()
2770 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_ASSOC, in ieee80211_node_join_11g()
2776 ni->ni_flags |= IEEE80211_NODE_ERP; in ieee80211_node_join_11g()
2780 ieee80211_node_join(struct ieee80211_node *ni, int resp) in ieee80211_node_join() argument
2782 struct ieee80211com *ic = ni->ni_ic; in ieee80211_node_join()
2783 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_join()
2786 if (ni->ni_associd == 0) { in ieee80211_node_join()
2799 IEEE80211_SEND_MGMT(ni, resp, IEEE80211_STATUS_TOOMANY); in ieee80211_node_join()
2800 ieee80211_node_leave(ni); in ieee80211_node_join()
2803 ni->ni_associd = aid | 0xc000; in ieee80211_node_join()
2804 ni->ni_jointime = time_uptime; in ieee80211_node_join()
2806 IEEE80211_AID_SET(vap, ni->ni_associd); in ieee80211_node_join()
2810 ieee80211_ht_node_join(ni); in ieee80211_node_join()
2812 ieee80211_vht_node_join(ni); in ieee80211_node_join()
2815 ieee80211_node_join_11g(ni); in ieee80211_node_join()
2825 IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC | IEEE80211_MSG_DEBUG, ni, in ieee80211_node_join()
2827 IEEE80211_NODE_AID(ni), in ieee80211_node_join()
2831 ni->ni_flags & IEEE80211_NODE_QOS ? ", QoS" : "", in ieee80211_node_join()
2833 ni->ni_flags & IEEE80211_NODE_HT ? in ieee80211_node_join()
2834 (ni->ni_chw == 40 ? ", HT40" : ", HT20") : "", in ieee80211_node_join()
2835 ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "", in ieee80211_node_join()
2836 ni->ni_flags & IEEE80211_NODE_AMSDU ? " (+AMSDU)" : "", in ieee80211_node_join()
2837 ni->ni_flags & IEEE80211_NODE_MIMO_RTS ? " (+SMPS-DYN)" : in ieee80211_node_join()
2838 ni->ni_flags & IEEE80211_NODE_MIMO_PS ? " (+SMPS)" : "", in ieee80211_node_join()
2839 ni->ni_flags & IEEE80211_NODE_RIFS ? " (+RIFS)" : "", in ieee80211_node_join()
2840 IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF) ? in ieee80211_node_join()
2842 IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_TURBOP) ? in ieee80211_node_join()
2846 ieee80211_node_setuptxparms(ni); in ieee80211_node_join()
2847 ieee80211_ratectl_node_init(ni); in ieee80211_node_join()
2850 ic->ic_newassoc(ni, newassoc); in ieee80211_node_join()
2851 IEEE80211_SEND_MGMT(ni, resp, IEEE80211_STATUS_SUCCESS); in ieee80211_node_join()
2854 vap->iv_auth->ia_node_join(ni); in ieee80211_node_join()
2855 ieee80211_notify_node_join(ni, in ieee80211_node_join()
2883 ieee80211_node_leave_11g(struct ieee80211_node *ni) in ieee80211_node_leave_11g() argument
2885 struct ieee80211com *ic = ni->ni_ic; in ieee80211_node_leave_11g()
2886 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_leave_11g()
2897 if ((ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME) == 0) { in ieee80211_node_leave_11g()
2901 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, in ieee80211_node_leave_11g()
2914 IEEE80211_DPRINTF(ni->ni_vap, in ieee80211_node_leave_11g()
2925 if ((ni->ni_flags & IEEE80211_NODE_ERP) == 0) { in ieee80211_node_leave_11g()
2929 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, in ieee80211_node_leave_11g()
2935 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_ASSOC, in ieee80211_node_leave_11g()
2971 ieee80211_node_leave(struct ieee80211_node *ni) in ieee80211_node_leave() argument
2973 struct ieee80211com *ic = ni->ni_ic; in ieee80211_node_leave()
2974 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_node_leave()
2975 struct ieee80211_node_table *nt = ni->ni_table; in ieee80211_node_leave()
2977 IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC | IEEE80211_MSG_DEBUG, ni, in ieee80211_node_leave()
2978 "station with aid %d leaves", IEEE80211_NODE_AID(ni)); in ieee80211_node_leave()
2987 if (ni->ni_associd == 0) in ieee80211_node_leave()
2996 vap->iv_auth->ia_node_leave(ni); in ieee80211_node_leave()
2999 IEEE80211_AID_CLR(vap, ni->ni_associd); in ieee80211_node_leave()
3003 ieee80211_vht_node_leave(ni); in ieee80211_node_leave()
3005 ieee80211_ht_node_leave(ni); in ieee80211_node_leave()
3008 ieee80211_node_leave_11g(ni); in ieee80211_node_leave()
3016 ieee80211_sta_leave(ni); in ieee80211_node_leave()
3026 node_reclaim(nt, ni); in ieee80211_node_leave()
3029 ieee80211_free_node(ni); in ieee80211_node_leave()
3038 get_hostap_rssi(void *arg, struct ieee80211_node *ni) in get_hostap_rssi() argument
3041 struct ieee80211vap *vap = ni->ni_vap; in get_hostap_rssi()
3045 if (ni->ni_associd == 0) in get_hostap_rssi()
3047 rssi = vap->iv_ic->ic_node_getrssi(ni); in get_hostap_rssi()
3055 get_adhoc_rssi(void *arg, struct ieee80211_node *ni) in get_adhoc_rssi() argument
3058 struct ieee80211vap *vap = ni->ni_vap; in get_adhoc_rssi()
3063 if ((ni->ni_capinfo & IEEE80211_CAPINFO_IBSS) == 0) in get_adhoc_rssi()
3065 rssi = vap->iv_ic->ic_node_getrssi(ni); in get_adhoc_rssi()
3074 get_mesh_rssi(void *arg, struct ieee80211_node *ni) in get_mesh_rssi() argument
3077 struct ieee80211vap *vap = ni->ni_vap; in get_mesh_rssi()
3081 if (ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) in get_mesh_rssi()
3083 rssi = vap->iv_ic->ic_node_getrssi(ni); in get_mesh_rssi()