Lines Matching defs:ni

69 static	int hostap_input(struct ieee80211_node *ni, struct mbuf *m,
106 sta_disassoc(void *arg, struct ieee80211_node *ni)
110 if (ni->ni_vap == vap && ni->ni_associd != 0) {
111 IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DISASSOC,
113 ieee80211_node_leave(ni);
118 sta_csa(void *arg, struct ieee80211_node *ni)
122 if (ni->ni_vap == vap && ni->ni_associd != 0)
123 if (ni->ni_inact > vap->iv_inact_init) {
124 ni->ni_inact = vap->iv_inact_init;
125 IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni,
126 "%s: inact %u", __func__, ni->ni_inact);
131 sta_drop(void *arg, struct ieee80211_node *ni)
135 if (ni->ni_vap == vap && ni->ni_associd != 0)
136 ieee80211_node_leave(ni);
304 struct ieee80211_node *ni = vap->iv_bss;
307 ether_sprintf(ni->ni_bssid));
308 ieee80211_print_essid(ni->ni_essid,
309 ni->ni_esslen);
313 IEEE80211_RATE2MBS(ni->ni_txrate));
352 struct ieee80211_node *ni, struct mbuf *m)
371 IEEE80211_NODE_STAT(ni, rx_data);
372 IEEE80211_NODE_STAT_ADD(ni, rx_bytes, m->m_pkthdr.len);
375 IEEE80211_NODE_STAT(ni, rx_mcast);
377 IEEE80211_NODE_STAT(ni, rx_ucast);
440 if (ni->ni_vlan != 0) {
442 m->m_pkthdr.ether_vtag = ni->ni_vlan;
478 hostap_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
481 struct ieee80211vap *vap = ni->ni_vap;
482 struct ieee80211com *ic = ni->ni_ic;
509 KASSERT(ni != NULL, ("null node"));
510 ni->ni_inact = ni->ni_inact_reload;
516 ni->ni_macaddr, NULL,
532 ni->ni_macaddr, NULL, "wrong version, fc %02x:%02x",
549 IEEE80211_MSG_ANY, ni->ni_macaddr,
571 IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi);
572 ni->ni_noise = nf;
579 if (! ieee80211_check_rxseq(ni, wh)) {
585 ni->ni_rxseqs[tid] >>
588 ni->ni_rxseqs[tid] &
592 IEEE80211_NODE_STAT(ni, rx_dup);
595 ni->ni_rxseqs[tid] = rxseq;
605 ni->ni_macaddr, NULL,
628 if (ni == vap->iv_bss) {
631 ieee80211_send_error(ni, wh->i_addr2,
637 if (ni->ni_associd == 0) {
640 IEEE80211_SEND_MGMT(ni,
652 (ni->ni_flags & IEEE80211_NODE_PWR_MGT)))
653 vap->iv_node_ps(ni,
660 if (dir == IEEE80211_FC1_DIR_DSTODS && ni->ni_wdsvap == NULL) {
661 if (!ieee80211_node_is_authorized(ni)) {
668 IEEE80211_NODE_STAT(ni, rx_unauth);
671 ieee80211_dwds_discover(ni, m);
682 ieee80211_ampdu_reorder(ni, m) != 0) {
704 IEEE80211_NODE_STAT(ni, rx_noprivacy);
707 key = ieee80211_crypto_decap(ni, m, hdrspace);
710 IEEE80211_NODE_STAT(ni, rx_wepfail);
734 m = ieee80211_defrag(ni, m, hdrspace);
747 ni->ni_macaddr, "data", "%s", "demic error");
749 IEEE80211_NODE_STAT(ni, rx_demicfail);
767 ni->ni_macaddr, "data", "%s", "decap error");
769 IEEE80211_NODE_STAT(ni, rx_decap);
773 if (!ieee80211_node_is_authorized(ni)) {
788 IEEE80211_NODE_STAT(ni, rx_unauth);
803 IEEE80211_NODE_STAT(ni, rx_unencrypted);
809 m = ieee80211_decap_amsdu(ni, m);
814 m = ieee80211_decap_fastframe(vap, ni, m);
819 if (dir == IEEE80211_FC1_DIR_DSTODS && ni->ni_wdsvap != NULL)
820 ieee80211_deliver_data(ni->ni_wdsvap, ni, m);
822 hostap_deliver_data(vap, ni, m);
827 IEEE80211_NODE_STAT(ni, rx_mgmt);
836 ni->ni_macaddr, "mgt", "too short: len %u",
880 key = ieee80211_crypto_decap(ni, m, hdrspace);
896 vap->iv_recv_mgmt(ni, m, subtype, rssi, nf);
901 IEEE80211_NODE_STAT(ni, rx_ctrl);
902 vap->iv_recv_ctl(ni, m, subtype);
922 hostap_auth_open(struct ieee80211_node *ni, struct ieee80211_frame *wh,
925 struct ieee80211vap *vap = ni->ni_vap;
929 if (ni->ni_authmode == IEEE80211_AUTH_SHARED) {
931 ni->ni_macaddr, "open auth",
932 "bad sta auth mode %u", ni->ni_authmode);
939 if (ni->ni_challenge != NULL) {
940 free(ni->ni_challenge, M_80211_NODE);
941 ni->ni_challenge = NULL;
944 ieee80211_send_error(ni, wh->i_addr2,
954 if (ni == vap->iv_bss) {
955 ni = ieee80211_dup_bss(vap, wh->i_addr2);
956 if (ni == NULL)
958 } else if ((ni->ni_flags & IEEE80211_NODE_AREF) == 0)
959 (void) ieee80211_ref_node(ni);
965 ni->ni_flags |= IEEE80211_NODE_AREF;
970 ni->ni_flags |= IEEE80211_NODE_ASSOCID;
982 IEEE80211_MSG_AUTH | IEEE80211_MSG_ACL, ni->ni_macaddr,
984 ieee80211_notify_node_auth(ni);
986 IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_AUTH, seq + 1);
988 IEEE80211_MSG_DEBUG | IEEE80211_MSG_AUTH, ni->ni_macaddr,
994 if (ni->ni_authmode != IEEE80211_AUTH_8021X)
995 ieee80211_node_authorize(ni);
1000 hostap_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh,
1004 struct ieee80211vap *vap = ni->ni_vap;
1020 ni->ni_macaddr, "shared key auth",
1030 if (ni->ni_authmode != IEEE80211_AUTH_AUTO &&
1031 ni->ni_authmode != IEEE80211_AUTH_SHARED) {
1033 ni->ni_macaddr, "shared key auth",
1034 "bad sta auth mode %u", ni->ni_authmode);
1044 ni->ni_macaddr, "shared key auth",
1060 ni->ni_macaddr, "shared key auth",
1068 ni->ni_macaddr, "shared key auth",
1079 if (ni == vap->iv_bss) {
1080 ni = ieee80211_dup_bss(vap, wh->i_addr2);
1081 if (ni == NULL) {
1087 if ((ni->ni_flags & IEEE80211_NODE_AREF) == 0)
1088 (void) ieee80211_ref_node(ni);
1096 ni->ni_flags |= IEEE80211_NODE_AREF;
1101 ni->ni_flags |= IEEE80211_NODE_ASSOCID;
1102 IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi);
1103 ni->ni_noise = nf;
1104 if (!ieee80211_alloc_challenge(ni)) {
1108 get_random_bytes(ni->ni_challenge,
1111 ni, "shared key %sauth request", allocbs ? "" : "re");
1123 ni->ni_macaddr,
1125 ieee80211_notify_node_auth(ni);
1130 if (ni == vap->iv_bss) {
1132 ni->ni_macaddr, "shared key response",
1137 if (ni->ni_challenge == NULL) {
1139 ni->ni_macaddr, "shared key response",
1145 if (memcmp(ni->ni_challenge, &challenge[2],
1148 ni->ni_macaddr, "shared key response",
1155 ni, "%s", "station authenticated (shared key)");
1156 ieee80211_node_authorize(ni);
1160 ni->ni_macaddr, "shared key auth",
1166 IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_AUTH, seq + 1);
1173 ieee80211_send_error(ni, wh->i_addr2,
1478 wpa_assocreq(struct ieee80211_node *ni, struct ieee80211_rsnparms *rsnparms,
1482 struct ieee80211vap *vap = ni->ni_vap;
1486 ni->ni_flags &= ~(IEEE80211_NODE_WPS|IEEE80211_NODE_TSN);
1494 ni->ni_flags |= IEEE80211_NODE_WPS;
1503 ni->ni_flags |= IEEE80211_NODE_TSN;
1545 IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC | IEEE80211_MSG_WPA, ni,
1554 ieee80211_node_deauth(ni, reason);
1573 ieee80211_deliver_l2uf(struct ieee80211_node *ni)
1575 struct ieee80211vap *vap = ni->ni_vap;
1583 IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC, ni,
1593 IEEE80211_ADDR_COPY(eh->ether_shost, ni->ni_macaddr);
1604 hostap_deliver_data(vap, ni, m);
1608 ratesetmismatch(struct ieee80211_node *ni, const struct ieee80211_frame *wh,
1611 IEEE80211_NOTE_MAC(ni->ni_vap, IEEE80211_MSG_ANY, wh->i_addr2,
1614 IEEE80211_SEND_MGMT(ni, resp, IEEE80211_STATUS_BASIC_RATE);
1615 ieee80211_node_leave(ni);
1619 capinfomismatch(struct ieee80211_node *ni, const struct ieee80211_frame *wh,
1622 struct ieee80211vap *vap = ni->ni_vap;
1627 IEEE80211_SEND_MGMT(ni, resp, IEEE80211_STATUS_CAPINFO);
1628 ieee80211_node_leave(ni);
1633 htcapmismatch(struct ieee80211_node *ni, const struct ieee80211_frame *wh,
1636 IEEE80211_NOTE_MAC(ni->ni_vap, IEEE80211_MSG_ANY, wh->i_addr2,
1639 IEEE80211_SEND_MGMT(ni, resp, IEEE80211_STATUS_MISSING_HT_CAPS);
1640 ieee80211_node_leave(ni);
1644 authalgreject(struct ieee80211_node *ni, const struct ieee80211_frame *wh,
1647 struct ieee80211vap *vap = ni->ni_vap;
1652 ieee80211_send_error(ni, wh->i_addr2, IEEE80211_FC0_SUBTYPE_AUTH,
1683 hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
1686 struct ieee80211vap *vap = ni->ni_vap;
1687 struct ieee80211com *ic = ni->ni_ic;
1712 if (ieee80211_parse_beacon(ni, m0, &scan) &~ IEEE80211_BPARSE_OFFCHAN)
1719 IEEE80211_NODE_STAT(ni, rx_beacons);
1721 IEEE80211_NODE_STAT(ni, rx_proberesp);
1894 ieee80211_send_error(ni, wh->i_addr2,
1904 ieee80211_send_error(ni, wh->i_addr2,
1910 hostap_auth_shared(ni, wh, frm + 6, efrm, rssi, nf,
1913 hostap_auth_open(ni, wh, rssi, nf, seq, status);
1915 authalgreject(ni, wh, algo,
1928 authalgreject(ni, wh, algo,
1957 if (ni == vap->iv_bss) {
1961 ieee80211_send_error(ni, wh->i_addr2,
2037 !wpa_assocreq(ni, &rsnparms, wh, wpa, rsn, capinfo))
2040 if (ni->ni_challenge != NULL) {
2041 free(ni->ni_challenge, M_80211_NODE);
2042 ni->ni_challenge = NULL;
2046 capinfomismatch(ni, wh, reassoc, resp,
2053 if (ni->ni_associd != 0 &&
2055 ((ni->ni_capinfo ^ capinfo) & IEEE80211_CAPINFO_SHORT_SLOTTIME)) {
2056 capinfomismatch(ni, wh, reassoc, resp,
2060 rate = ieee80211_setup_rates(ni, rates, xrates,
2064 ratesetmismatch(ni, wh, reassoc, resp, "legacy", rate);
2075 ratesetmismatch(ni, wh, reassoc, resp, "11g", rate);
2082 ni->ni_chan = vap->iv_bss->ni_chan;
2083 if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && htcap != NULL) {
2084 rate = ieee80211_setup_htrates(ni, htcap,
2088 ratesetmismatch(ni, wh, reassoc, resp,
2093 ieee80211_ht_node_init(ni);
2094 ieee80211_ht_updatehtcap(ni, htcap);
2095 } else if (ni->ni_flags & IEEE80211_NODE_HT)
2096 ieee80211_ht_node_cleanup(ni);
2098 else if (ni->ni_ath_flags & IEEE80211_NODE_ATH)
2099 ieee80211_ff_node_cleanup(ni);
2107 if ((ni->ni_flags & IEEE80211_NODE_HT) &&
2112 IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, ni,
2116 ieee80211_ht_node_cleanup(ni);
2123 (ni->ni_flags & IEEE80211_NODE_HT) == 0) {
2124 htcapmismatch(ni, wh, reassoc, resp);
2128 IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi);
2129 ni->ni_noise = nf;
2130 ni->ni_intval = lintval;
2131 ni->ni_capinfo = capinfo;
2132 ni->ni_fhdwell = vap->iv_bss->ni_fhdwell;
2133 ni->ni_fhindex = vap->iv_bss->ni_fhindex;
2138 if (ieee80211_ies_init(&ni->ni_ies, sfrm, efrm - sfrm)) {
2139 #define setie(_ie, _off) ieee80211_ies_setie(ni->ni_ies, _ie, _off)
2151 ni->ni_flags |= IEEE80211_NODE_QOS;
2153 ni->ni_flags &= ~IEEE80211_NODE_QOS;
2160 ieee80211_parse_ath(ni, ni->ni_ies.ath_ie);
2163 ni->ni_ath_flags = 0;
2166 ni->ni_flags &= ~IEEE80211_NODE_QOS;
2167 ni->ni_ath_flags = 0;
2169 ieee80211_node_join(ni, resp);
2170 ieee80211_deliver_l2uf(ni);
2192 IEEE80211_NODE_STAT(ni, rx_deauth);
2195 IEEE80211_NODE_STAT(ni, rx_disassoc);
2197 IEEE80211_NOTE(vap, IEEE80211_MSG_AUTH, ni,
2200 if (ni != vap->iv_bss)
2201 ieee80211_node_leave(ni);
2207 if (ni == vap->iv_bss) {
2222 if (ieee80211_parse_action(ni, m0) == 0)
2223 (void)ic->ic_recv_action(ni, wh, frm, efrm);
2244 hostap_recv_ctl(struct ieee80211_node *ni, struct mbuf *m, int subtype)
2248 ni->ni_vap->iv_recv_pspoll(ni, m);
2251 ieee80211_recv_bar(ni, m);
2260 ieee80211_recv_pspoll(struct ieee80211_node *ni, struct mbuf *m0)
2262 struct ieee80211vap *vap = ni->ni_vap;
2270 if (ni->ni_associd == 0) {
2276 IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DEAUTH,
2282 if (aid != ni->ni_associd) {
2287 ni->ni_associd, aid);
2301 m = ieee80211_node_psq_dequeue(ni, &qlen);
2305 ieee80211_send_nulldata(ieee80211_ref_node(ni));
2308 vap->iv_set_tim(ni, 0); /* just in case */
2317 IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni,
2321 IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni,
2324 vap->iv_set_tim(ni, 0);
2335 ieee80211_free_node(ni);