Lines Matching refs:ni

74 static	int hostap_input(struct ieee80211_node *ni, struct mbuf *m,
112 sta_disassoc(void *arg, struct ieee80211_node *ni)
115 if (ni->ni_associd != 0) {
116 IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DISASSOC,
118 ieee80211_node_leave(ni);
123 sta_csa(void *arg, struct ieee80211_node *ni)
125 struct ieee80211vap *vap = ni->ni_vap;
127 if (ni->ni_associd != 0)
128 if (ni->ni_inact > vap->iv_inact_init) {
129 ni->ni_inact = vap->iv_inact_init;
130 IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni,
131 "%s: inact %u", __func__, ni->ni_inact);
136 sta_drop(void *arg, struct ieee80211_node *ni)
139 if (ni->ni_associd != 0)
140 ieee80211_node_leave(ni);
312 struct ieee80211_node *ni = vap->iv_bss;
315 ether_sprintf(ni->ni_bssid));
316 ieee80211_print_essid(ni->ni_essid,
317 ni->ni_esslen);
321 IEEE80211_RATE2MBS(ni->ni_txrate));
361 struct ieee80211_node *ni, struct mbuf *m)
376 IEEE80211_NODE_STAT(ni, rx_data);
377 IEEE80211_NODE_STAT_ADD(ni, rx_bytes, m->m_pkthdr.len);
380 IEEE80211_NODE_STAT(ni, rx_mcast);
382 IEEE80211_NODE_STAT(ni, rx_ucast);
437 if (ni->ni_vlan != 0) {
439 m->m_pkthdr.ether_vtag = ni->ni_vlan;
475 hostap_input(struct ieee80211_node *ni, struct mbuf *m,
478 struct ieee80211vap *vap = ni->ni_vap;
479 struct ieee80211com *ic = ni->ni_ic;
515 KASSERT(ni != NULL, ("null node"));
516 ni->ni_inact = ni->ni_inact_reload;
522 ni->ni_macaddr, NULL,
538 ni->ni_macaddr, NULL, "wrong version, fc %02x:%02x",
555 IEEE80211_MSG_ANY, ni->ni_macaddr,
577 IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi);
578 ni->ni_noise = nf;
584 if (! ieee80211_check_rxseq(ni, wh, bssid, rxs))
595 ni->ni_macaddr, NULL,
618 if (ni == vap->iv_bss) {
621 ieee80211_send_error(ni, wh->i_addr2,
627 if (ni->ni_associd == 0) {
630 IEEE80211_SEND_MGMT(ni,
642 (ni->ni_flags & IEEE80211_NODE_PWR_MGT)))
643 vap->iv_node_ps(ni,
650 if (dir == IEEE80211_FC1_DIR_DSTODS && ni->ni_wdsvap == NULL) {
651 if (!ieee80211_node_is_authorized(ni)) {
658 IEEE80211_NODE_STAT(ni, rx_unauth);
661 ieee80211_dwds_discover(ni, m);
672 ieee80211_ampdu_reorder(ni, m, rxs) != 0) {
694 IEEE80211_NODE_STAT(ni, rx_noprivacy);
697 if (ieee80211_crypto_decap(ni, m, hdrspace, &key) == 0) {
699 IEEE80211_NODE_STAT(ni, rx_wepfail);
722 m = ieee80211_defrag(ni, m, hdrspace);
735 ni->ni_macaddr, "data", "%s", "demic error");
737 IEEE80211_NODE_STAT(ni, rx_demicfail);
755 ni->ni_macaddr, "data", "%s", "decap error");
757 IEEE80211_NODE_STAT(ni, rx_decap);
761 if (!ieee80211_node_is_authorized(ni)) {
776 IEEE80211_NODE_STAT(ni, rx_unauth);
792 IEEE80211_NODE_STAT(ni, rx_unencrypted);
798 m = ieee80211_decap_amsdu(ni, m);
803 m = ieee80211_decap_fastframe(vap, ni, m);
808 if (dir == IEEE80211_FC1_DIR_DSTODS && ni->ni_wdsvap != NULL)
809 ieee80211_deliver_data(ni->ni_wdsvap, ni, m);
811 hostap_deliver_data(vap, ni, m);
816 IEEE80211_NODE_STAT(ni, rx_mgmt);
825 ni->ni_macaddr, "mgt", "too short: len %u",
868 if (ieee80211_crypto_decap(ni, m, hdrspace, &key) == 0) {
884 vap->iv_recv_mgmt(ni, m, subtype, rxs, rssi, nf);
889 IEEE80211_NODE_STAT(ni, rx_ctrl);
890 vap->iv_recv_ctl(ni, m, subtype);
910 hostap_auth_open(struct ieee80211_node *ni, struct ieee80211_frame *wh,
913 struct ieee80211vap *vap = ni->ni_vap;
917 if (ni->ni_authmode == IEEE80211_AUTH_SHARED) {
919 ni->ni_macaddr, "open auth",
920 "bad sta auth mode %u", ni->ni_authmode);
927 if (ni->ni_challenge != NULL) {
928 IEEE80211_FREE(ni->ni_challenge, M_80211_NODE);
929 ni->ni_challenge = NULL;
932 ieee80211_send_error(ni, wh->i_addr2,
942 if (ni == vap->iv_bss) {
943 ni = ieee80211_dup_bss(vap, wh->i_addr2);
944 if (ni == NULL)
946 } else if ((ni->ni_flags & IEEE80211_NODE_AREF) == 0)
947 (void) ieee80211_ref_node(ni);
953 ni->ni_flags |= IEEE80211_NODE_AREF;
958 ni->ni_flags |= IEEE80211_NODE_ASSOCID;
970 IEEE80211_MSG_AUTH | IEEE80211_MSG_ACL, ni->ni_macaddr,
972 ieee80211_notify_node_auth(ni);
974 IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_AUTH, seq + 1);
976 IEEE80211_MSG_DEBUG | IEEE80211_MSG_AUTH, ni->ni_macaddr,
982 if (ni->ni_authmode != IEEE80211_AUTH_8021X)
983 ieee80211_node_authorize(ni);
988 hostap_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh,
992 struct ieee80211vap *vap = ni->ni_vap;
1008 ni->ni_macaddr, "shared key auth",
1018 if (ni->ni_authmode != IEEE80211_AUTH_AUTO &&
1019 ni->ni_authmode != IEEE80211_AUTH_SHARED) {
1021 ni->ni_macaddr, "shared key auth",
1022 "bad sta auth mode %u", ni->ni_authmode);
1032 ni->ni_macaddr, "shared key auth",
1048 ni->ni_macaddr, "shared key auth",
1056 ni->ni_macaddr, "shared key auth",
1067 if (ni == vap->iv_bss) {
1068 ni = ieee80211_dup_bss(vap, wh->i_addr2);
1069 if (ni == NULL) {
1075 if ((ni->ni_flags & IEEE80211_NODE_AREF) == 0)
1076 (void) ieee80211_ref_node(ni);
1084 ni->ni_flags |= IEEE80211_NODE_AREF;
1089 ni->ni_flags |= IEEE80211_NODE_ASSOCID;
1090 IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi);
1091 ni->ni_noise = nf;
1092 if (!ieee80211_alloc_challenge(ni)) {
1096 get_random_bytes(ni->ni_challenge,
1099 ni, "shared key %sauth request", allocbs ? "" : "re");
1111 ni->ni_macaddr,
1113 ieee80211_notify_node_auth(ni);
1118 if (ni == vap->iv_bss) {
1120 ni->ni_macaddr, "shared key response",
1125 if (ni->ni_challenge == NULL) {
1127 ni->ni_macaddr, "shared key response",
1133 if (memcmp(ni->ni_challenge, &challenge[2],
1136 ni->ni_macaddr, "shared key response",
1143 ni, "%s", "station authenticated (shared key)");
1144 ieee80211_node_authorize(ni);
1148 ni->ni_macaddr, "shared key auth",
1154 IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_AUTH, seq + 1);
1161 ieee80211_send_error(ni, wh->i_addr2,
1537 wpa_assocreq(struct ieee80211_node *ni, struct ieee80211_rsnparms *rsnparms,
1541 struct ieee80211vap *vap = ni->ni_vap;
1545 ni->ni_flags &= ~(IEEE80211_NODE_WPS|IEEE80211_NODE_TSN);
1553 ni->ni_flags |= IEEE80211_NODE_WPS;
1562 ni->ni_flags |= IEEE80211_NODE_TSN;
1605 IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC | IEEE80211_MSG_WPA, ni,
1614 ieee80211_node_deauth(ni, reason);
1633 ieee80211_deliver_l2uf(struct ieee80211_node *ni)
1635 struct ieee80211vap *vap = ni->ni_vap;
1643 IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC, ni,
1653 IEEE80211_ADDR_COPY(eh->ether_shost, ni->ni_macaddr);
1664 hostap_deliver_data(vap, ni, m);
1668 ratesetmismatch(struct ieee80211_node *ni, const struct ieee80211_frame *wh,
1671 IEEE80211_NOTE_MAC(ni->ni_vap, IEEE80211_MSG_ANY, wh->i_addr2,
1674 IEEE80211_SEND_MGMT(ni, resp, IEEE80211_STATUS_BASIC_RATE);
1675 ieee80211_node_leave(ni);
1679 capinfomismatch(struct ieee80211_node *ni, const struct ieee80211_frame *wh,
1682 struct ieee80211vap *vap = ni->ni_vap;
1687 IEEE80211_SEND_MGMT(ni, resp, IEEE80211_STATUS_CAPINFO);
1688 ieee80211_node_leave(ni);
1693 htcapmismatch(struct ieee80211_node *ni, const struct ieee80211_frame *wh,
1696 IEEE80211_NOTE_MAC(ni->ni_vap, IEEE80211_MSG_ANY, wh->i_addr2,
1699 IEEE80211_SEND_MGMT(ni, resp, IEEE80211_STATUS_MISSING_HT_CAPS);
1700 ieee80211_node_leave(ni);
1704 authalgreject(struct ieee80211_node *ni, const struct ieee80211_frame *wh,
1707 struct ieee80211vap *vap = ni->ni_vap;
1712 ieee80211_send_error(ni, wh->i_addr2, IEEE80211_FC0_SUBTYPE_AUTH,
1743 hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
1746 struct ieee80211vap *vap = ni->ni_vap;
1747 struct ieee80211com *ic = ni->ni_ic;
1775 if (ieee80211_parse_beacon(ni, m0, ic->ic_curchan, &scan) &~ IEEE80211_BPARSE_OFFCHAN)
1782 IEEE80211_NODE_STAT(ni, rx_beacons);
1784 IEEE80211_NODE_STAT(ni, rx_proberesp);
1960 ieee80211_send_error(ni, wh->i_addr2,
1970 ieee80211_send_error(ni, wh->i_addr2,
1976 hostap_auth_shared(ni, wh, frm + 6, efrm, rssi, nf,
1979 hostap_auth_open(ni, wh, rssi, nf, seq, status);
1981 authalgreject(ni, wh, algo,
1994 authalgreject(ni, wh, algo,
2023 if (ni == vap->iv_bss) {
2027 ieee80211_send_error(ni, wh->i_addr2,
2122 !wpa_assocreq(ni, &rsnparms, wh, wpa, rsn, capinfo))
2125 if (ni->ni_challenge != NULL) {
2126 IEEE80211_FREE(ni->ni_challenge, M_80211_NODE);
2127 ni->ni_challenge = NULL;
2131 capinfomismatch(ni, wh, reassoc, resp,
2138 if (ni->ni_associd != 0 &&
2140 ((ni->ni_capinfo ^ capinfo) & IEEE80211_CAPINFO_SHORT_SLOTTIME)) {
2141 capinfomismatch(ni, wh, reassoc, resp,
2145 rate = ieee80211_setup_rates(ni, rates, xrates,
2149 ratesetmismatch(ni, wh, reassoc, resp, "legacy", rate);
2160 ratesetmismatch(ni, wh, reassoc, resp, "11g", rate);
2168 ni->ni_chan = vap->iv_bss->ni_chan;
2171 if (IEEE80211_IS_CHAN_VHT(ni->ni_chan) &&
2176 ieee80211_vht_node_init(ni);
2177 ieee80211_vht_update_cap(ni, vhtcap, vhtinfo);
2178 } else if (ni->ni_flags & IEEE80211_NODE_VHT)
2179 ieee80211_vht_node_cleanup(ni);
2182 if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && htcap != NULL) {
2183 rate = ieee80211_setup_htrates(ni, htcap,
2187 ratesetmismatch(ni, wh, reassoc, resp,
2192 ieee80211_ht_node_init(ni);
2193 ieee80211_ht_updatehtcap(ni, htcap);
2194 } else if (ni->ni_flags & IEEE80211_NODE_HT)
2195 ieee80211_ht_node_cleanup(ni);
2198 if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && htcap != NULL) {
2199 ieee80211_ht_updatehtcap_final(ni);
2204 ieee80211_ff_node_cleanup(ni);
2212 if ((ni->ni_flags & IEEE80211_NODE_HT) &&
2217 IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, ni,
2221 ieee80211_ht_node_cleanup(ni);
2224 ieee80211_ff_node_cleanup(ni);
2232 (ni->ni_flags & IEEE80211_NODE_HT) == 0) {
2233 htcapmismatch(ni, wh, reassoc, resp);
2237 IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi);
2238 ni->ni_noise = nf;
2239 ni->ni_intval = lintval;
2240 ni->ni_capinfo = capinfo;
2241 ni->ni_fhdwell = vap->iv_bss->ni_fhdwell;
2242 ni->ni_fhindex = vap->iv_bss->ni_fhindex;
2247 if (ieee80211_ies_init(&ni->ni_ies, sfrm, efrm - sfrm)) {
2248 #define setie(_ie, _off) ieee80211_ies_setie(ni->ni_ies, _ie, _off)
2260 ni->ni_flags |= IEEE80211_NODE_QOS;
2261 if (ieee80211_parse_wmeie(wme, wh, ni) > 0) {
2262 if (ni->ni_uapsd != 0)
2263 ni->ni_flags |=
2266 ni->ni_flags &=
2270 ni->ni_flags &=
2279 ieee80211_parse_ath(ni, ni->ni_ies.ath_ie);
2282 ni->ni_ath_flags = 0;
2285 ni->ni_flags &= ~IEEE80211_NODE_QOS;
2286 ni->ni_flags &= ~IEEE80211_NODE_UAPSD;
2287 ni->ni_ath_flags = 0;
2289 ieee80211_node_join(ni, resp);
2290 ieee80211_deliver_l2uf(ni);
2312 IEEE80211_NODE_STAT(ni, rx_deauth);
2315 IEEE80211_NODE_STAT(ni, rx_disassoc);
2317 IEEE80211_NOTE(vap, IEEE80211_MSG_AUTH, ni,
2321 if (ni != vap->iv_bss)
2322 ieee80211_node_leave(ni);
2328 if (ni == vap->iv_bss) {
2343 if (ieee80211_parse_action(ni, m0) == 0)
2344 (void)ic->ic_recv_action(ni, wh, frm, efrm);
2366 hostap_recv_ctl(struct ieee80211_node *ni, struct mbuf *m, int subtype)
2370 ni->ni_vap->iv_recv_pspoll(ni, m);
2373 ieee80211_recv_bar(ni, m);
2382 ieee80211_recv_pspoll(struct ieee80211_node *ni, struct mbuf *m0)
2384 struct ieee80211vap *vap = ni->ni_vap;
2392 if (ni->ni_associd == 0) {
2398 IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DEAUTH,
2404 if (aid != ni->ni_associd) {
2409 ni->ni_associd, aid);
2423 m = ieee80211_node_psq_dequeue(ni, &qlen);
2427 ieee80211_send_nulldata(ieee80211_ref_node(ni));
2430 vap->iv_set_tim(ni, 0); /* just in case */
2439 IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni,
2443 IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni,
2446 vap->iv_set_tim(ni, 0);