Lines Matching +full:tlv +full:- +full:layout

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
5 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
98 return (vap->iv_opmode == IEEE80211_M_IBSS); in doprint()
111 * A-MPDU state stuff, fast-frames state stuff, encapsulation
124 struct ieee80211com *ic = vap->iv_ic; in ieee80211_vap_pkt_send_dest()
125 struct ifnet *ifp = vap->iv_ifp; in ieee80211_vap_pkt_send_dest()
135 if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) && in ieee80211_vap_pkt_send_dest()
136 (m->m_flags & M_PWR_SAV) == 0) { in ieee80211_vap_pkt_send_dest()
156 ni->ni_macaddr, NULL, in ieee80211_vap_pkt_send_dest()
158 vap->iv_stats.is_tx_classify++; in ieee80211_vap_pkt_send_dest()
172 MPASS((m->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0); in ieee80211_vap_pkt_send_dest()
173 m->m_pkthdr.rcvif = (void *)ni; in ieee80211_vap_pkt_send_dest()
174 mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1: 0; in ieee80211_vap_pkt_send_dest()
179 * Figure out if we can do A-MPDU, A-MSDU or FF. in ieee80211_vap_pkt_send_dest()
181 * A-MPDU depends upon vap/node config. in ieee80211_vap_pkt_send_dest()
182 * A-MSDU depends upon vap/node config. in ieee80211_vap_pkt_send_dest()
189 do_ampdu = ((ni->ni_flags & IEEE80211_NODE_AMPDU_TX) && in ieee80211_vap_pkt_send_dest()
190 (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_TX)); in ieee80211_vap_pkt_send_dest()
192 do_amsdu = ((ni->ni_flags & IEEE80211_NODE_AMSDU_TX) && in ieee80211_vap_pkt_send_dest()
193 (vap->iv_flags_ht & IEEE80211_FHT_AMSDU_TX)); in ieee80211_vap_pkt_send_dest()
195 ((ni->ni_flags & IEEE80211_NODE_HT) == 0) && in ieee80211_vap_pkt_send_dest()
196 ((ni->ni_flags & IEEE80211_NODE_VHT) == 0) && in ieee80211_vap_pkt_send_dest()
201 * Check if A-MPDU tx aggregation is setup or if we in ieee80211_vap_pkt_send_dest()
203 * with HT and A-MPDU enabled for use. When the policy in ieee80211_vap_pkt_send_dest()
204 * routine decides we should enable A-MPDU we issue an in ieee80211_vap_pkt_send_dest()
206 * encapsulated will go out w/o using A-MPDU, or possibly in ieee80211_vap_pkt_send_dest()
212 * Don't treat group-addressed frames as candidates for aggregation; in ieee80211_vap_pkt_send_dest()
213 * net80211 doesn't support 802.11aa-2012 and so group addressed in ieee80211_vap_pkt_send_dest()
218 if ((m->m_flags & M_EAPOL) == 0 && (! mcast)) { in ieee80211_vap_pkt_send_dest()
220 struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[tid]; in ieee80211_vap_pkt_send_dest()
229 m->m_flags |= M_AMPDU_MPDU; in ieee80211_vap_pkt_send_dest()
231 ic->ic_ampdu_enable(ni, tap)) { in ieee80211_vap_pkt_send_dest()
239 * Now update the no-ampdu flag. A-MPDU may have been in ieee80211_vap_pkt_send_dest()
243 * This will let us know whether we should be doing A-MSDU in ieee80211_vap_pkt_send_dest()
244 * at this point. We only do A-MSDU if we're either not in ieee80211_vap_pkt_send_dest()
245 * doing A-MPDU, or A-MPDU is NACKed, or A-MPDU + A-MSDU in ieee80211_vap_pkt_send_dest()
248 * Whilst here, update the amsdu-ampdu flag. The above may in ieee80211_vap_pkt_send_dest()
249 * have also set or cleared the amsdu-in-ampdu txa_flags in ieee80211_vap_pkt_send_dest()
250 * combination so we can correctly do A-MPDU + A-MSDU. in ieee80211_vap_pkt_send_dest()
265 * A-MSDU encapsulation for 802.3 drivers. Now, we in ieee80211_vap_pkt_send_dest()
268 * to really need to. For A-MSDU we'd have to set the in ieee80211_vap_pkt_send_dest()
269 * A-MSDU QoS bit in the wifi header, so we just plain in ieee80211_vap_pkt_send_dest()
272 if (__predict_true((vap->iv_caps & IEEE80211_C_8023ENCAP) == 0)) { in ieee80211_vap_pkt_send_dest()
298 * Grab the TX lock - serialise the TX process from this in ieee80211_vap_pkt_send_dest()
306 * so things like the FF (and later A-MSDU) path can just call in ieee80211_vap_pkt_send_dest()
309 if (__predict_true((vap->iv_caps & IEEE80211_C_8023ENCAP) == 0)) { in ieee80211_vap_pkt_send_dest()
325 * Unlock at this point - no need to hold it across in ieee80211_vap_pkt_send_dest()
329 ic->ic_lastdata = ticks; in ieee80211_vap_pkt_send_dest()
341 * does (eg CAC timeout, interface wakeup) - the caller must
348 (vap->iv_opmode == IEEE80211_M_WDS && \ in ieee80211_start_pkt()
349 (vap->iv_flags_ext & IEEE80211_FEXT_WDSLEGACY) == 0) in ieee80211_start_pkt()
350 struct ieee80211com *ic = vap->iv_ic; in ieee80211_start_pkt()
351 struct ifnet *ifp = vap->iv_ifp; in ieee80211_start_pkt()
358 if (ic->ic_flags & IEEE80211_F_SCAN) in ieee80211_start_pkt()
368 if (m->m_len < sizeof(struct ether_header) && in ieee80211_start_pkt()
372 vap->iv_stats.is_tx_nobuf++; /* XXX */ in ieee80211_start_pkt()
377 if (ETHER_IS_MULTICAST(eh->ether_dhost)) { in ieee80211_start_pkt()
386 eh->ether_dhost, "mcast", "%s", "on DWDS"); in ieee80211_start_pkt()
387 vap->iv_stats.is_dwds_mcast++; in ieee80211_start_pkt()
393 if (vap->iv_opmode == IEEE80211_M_HOSTAP) { in ieee80211_start_pkt()
402 if (vap->iv_opmode != IEEE80211_M_MBSS) { in ieee80211_start_pkt()
404 ni = ieee80211_find_txnode(vap, eh->ether_dhost); in ieee80211_start_pkt()
412 if (ni->ni_associd == 0 && in ieee80211_start_pkt()
413 (ni->ni_flags & IEEE80211_NODE_ASSOCID)) { in ieee80211_start_pkt()
415 eh->ether_dhost, NULL, in ieee80211_start_pkt()
417 htons(eh->ether_type)); in ieee80211_start_pkt()
418 vap->iv_stats.is_tx_notassoc++; in ieee80211_start_pkt()
427 if (!IEEE80211_ADDR_EQ(eh->ether_shost, vap->iv_myaddr)) { in ieee80211_start_pkt()
435 eh->ether_dhost, NULL, in ieee80211_start_pkt()
437 vap->iv_stats.is_mesh_notproxy++; in ieee80211_start_pkt()
445 eh->ether_shost, ":", in ieee80211_start_pkt()
446 eh->ether_dhost, ":"); in ieee80211_start_pkt()
447 ieee80211_mesh_proxy_check(vap, eh->ether_shost); in ieee80211_start_pkt()
449 ni = ieee80211_mesh_discover(vap, eh->ether_dhost, m); in ieee80211_start_pkt()
466 if (vap->iv_state == IEEE80211_S_SLEEP) { in ieee80211_start_pkt()
471 ic->ic_lastdata = ticks; in ieee80211_start_pkt()
496 struct ieee80211vap *vap = ifp->if_softc; in ieee80211_vap_transmit()
497 struct ieee80211com *ic = vap->iv_ic; in ieee80211_vap_transmit()
505 if (vap->iv_state != IEEE80211_S_RUN && in ieee80211_vap_transmit()
506 vap->iv_state != IEEE80211_S_SLEEP) { in ieee80211_vap_transmit()
508 /* re-check under the com lock to avoid races */ in ieee80211_vap_transmit()
509 if (vap->iv_state != IEEE80211_S_RUN && in ieee80211_vap_transmit()
510 vap->iv_state != IEEE80211_S_SLEEP) { in ieee80211_vap_transmit()
513 __func__, ieee80211_state_name[vap->iv_state]); in ieee80211_vap_transmit()
514 vap->iv_stats.is_tx_badstate++; in ieee80211_vap_transmit()
516 ifp->if_drv_flags |= IFF_DRV_OACTIVE; in ieee80211_vap_transmit()
527 * be set for frames that are re-submitted from the in ieee80211_vap_transmit()
533 m->m_flags &= ~(M_80211_TX - M_PWR_SAV - M_MORE_DATA); in ieee80211_vap_transmit()
563 struct ieee80211com *ic = vap->iv_ic; in ieee80211_raw_output()
567 * Set node - the caller has taken a reference, so ensure in ieee80211_raw_output()
571 MPASS((m->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0); in ieee80211_raw_output()
572 m->m_pkthdr.rcvif = (void *)ni; in ieee80211_raw_output()
581 * they'll have to be added - so fail the transmit if in ieee80211_raw_output()
587 error = ic->ic_raw_xmit(ni, m, params); in ieee80211_raw_output()
589 if_inc_counter(vap->iv_ifp, IFCOUNTER_OERRORS, 1); in ieee80211_raw_output()
602 if (m->m_pkthdr.len < sizeof(struct ieee80211_frame_ack)) in ieee80211_validate_frame()
609 type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; in ieee80211_validate_frame()
611 if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) != in ieee80211_validate_frame()
616 (wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG) != 0) in ieee80211_validate_frame()
622 if ((params && (params->ibp_flags & IEEE80211_BPF_CRYPTO) != 0) || in ieee80211_validate_frame()
626 subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; in ieee80211_validate_frame()
629 * See IEEE Std 802.11-2012, in ieee80211_validate_frame()
638 wh->i_fc[1] |= IEEE80211_FC1_PROTECTED; in ieee80211_validate_frame()
641 if (m->m_pkthdr.len < ieee80211_anyhdrsize(wh)) in ieee80211_validate_frame()
650 struct ieee80211com *ic = ni->ni_ic; in ieee80211_validate_rate()
653 if ((ic->ic_htcaps & IEEE80211_HTC_HT) == 0) in ieee80211_validate_rate()
658 if (rate > ic->ic_txstream * 8 - 1) in ieee80211_validate_rate()
665 if ((ic->ic_htcaps & IEEE80211_HTC_TXMCS32) == 0) in ieee80211_validate_rate()
671 if ((ic->ic_htcaps & IEEE80211_HTC_TXUNEQUAL) == 0) in ieee80211_validate_rate()
674 switch (ic->ic_txstream) { in ieee80211_validate_rate()
697 if (!ieee80211_isratevalid(ic->ic_rt, rate)) in ieee80211_validate_rate()
713 if (params->ibp_rate0 != 0) { in ieee80211_sanitize_rates()
714 error = ieee80211_validate_rate(ni, params->ibp_rate0); in ieee80211_sanitize_rates()
718 /* XXX pre-setup some default (e.g., mgmt / mcast) rate */ in ieee80211_sanitize_rates()
723 if (params->ibp_rate1 != 0 && in ieee80211_sanitize_rates()
724 (error = ieee80211_validate_rate(ni, params->ibp_rate1)) != 0) in ieee80211_sanitize_rates()
727 if (params->ibp_rate2 != 0 && in ieee80211_sanitize_rates()
728 (error = ieee80211_validate_rate(ni, params->ibp_rate2)) != 0) in ieee80211_sanitize_rates()
731 if (params->ibp_rate3 != 0 && in ieee80211_sanitize_rates()
732 (error = ieee80211_validate_rate(ni, params->ibp_rate3)) != 0) in ieee80211_sanitize_rates()
756 if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { in ieee80211_output()
758 * Short-circuit requests if the vap is marked OACTIVE in ieee80211_output()
767 vap = ifp->if_softc; in ieee80211_output()
768 ic = vap->iv_ic; in ieee80211_output()
773 if (dst->sa_family != AF_IEEE80211) in ieee80211_output()
774 return vap->iv_output(ifp, m, dst, ro); in ieee80211_output()
780 if (ifp->if_flags & IFF_MONITOR) in ieee80211_output()
784 if (vap->iv_state == IEEE80211_S_CAC) { in ieee80211_output()
788 vap->iv_stats.is_tx_badstate++; in ieee80211_output()
790 } else if (vap->iv_state == IEEE80211_S_SCAN) in ieee80211_output()
800 if (dst->sa_len != 0) in ieee80211_output()
801 params = (const struct ieee80211_bpf_params *)dst->sa_data; in ieee80211_output()
810 switch (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) { in ieee80211_output()
813 ni = ieee80211_find_txnode(vap, wh->i_addr1); in ieee80211_output()
817 ni = ieee80211_find_txnode(vap, wh->i_addr3); in ieee80211_output()
827 if (dst->sa_len == 0) in ieee80211_output()
829 ni = ieee80211_ref_node(vap->iv_bss); in ieee80211_output()
838 m->m_flags &= ~M_80211_TX; in ieee80211_output()
839 m->m_flags |= M_ENCAP; /* mark encapsulated */ in ieee80211_output()
848 m->m_pkthdr.len - ieee80211_hdrsize(wh)); in ieee80211_output()
857 if (IEEE80211_IS_MULTICAST(wh->i_addr1)) { in ieee80211_output()
859 m->m_flags |= M_MCAST; in ieee80211_output()
892 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_send_setup()
897 IEEE80211_TX_LOCK_ASSERT(ni->ni_ic); in ieee80211_send_setup()
899 wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | type; in ieee80211_send_setup()
901 switch (vap->iv_opmode) { in ieee80211_send_setup()
903 wh->i_fc[1] = IEEE80211_FC1_DIR_TODS; in ieee80211_send_setup()
904 IEEE80211_ADDR_COPY(wh->i_addr1, bssid); in ieee80211_send_setup()
905 IEEE80211_ADDR_COPY(wh->i_addr2, sa); in ieee80211_send_setup()
906 IEEE80211_ADDR_COPY(wh->i_addr3, da); in ieee80211_send_setup()
910 wh->i_fc[1] = IEEE80211_FC1_DIR_NODS; in ieee80211_send_setup()
911 IEEE80211_ADDR_COPY(wh->i_addr1, da); in ieee80211_send_setup()
912 IEEE80211_ADDR_COPY(wh->i_addr2, sa); in ieee80211_send_setup()
913 IEEE80211_ADDR_COPY(wh->i_addr3, bssid); in ieee80211_send_setup()
916 wh->i_fc[1] = IEEE80211_FC1_DIR_FROMDS; in ieee80211_send_setup()
917 IEEE80211_ADDR_COPY(wh->i_addr1, da); in ieee80211_send_setup()
918 IEEE80211_ADDR_COPY(wh->i_addr2, bssid); in ieee80211_send_setup()
919 IEEE80211_ADDR_COPY(wh->i_addr3, sa); in ieee80211_send_setup()
922 wh->i_fc[1] = IEEE80211_FC1_DIR_DSTODS; in ieee80211_send_setup()
923 IEEE80211_ADDR_COPY(wh->i_addr1, da); in ieee80211_send_setup()
924 IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr); in ieee80211_send_setup()
925 IEEE80211_ADDR_COPY(wh->i_addr3, da); in ieee80211_send_setup()
926 IEEE80211_ADDR_COPY(WH4(wh)->i_addr4, sa); in ieee80211_send_setup()
931 wh->i_fc[1] = IEEE80211_FC1_DIR_FROMDS; in ieee80211_send_setup()
933 IEEE80211_ADDR_COPY(wh->i_addr1, da); in ieee80211_send_setup()
934 IEEE80211_ADDR_COPY(wh->i_addr2, in ieee80211_send_setup()
935 vap->iv_myaddr); in ieee80211_send_setup()
937 wh->i_fc[1] = IEEE80211_FC1_DIR_DSTODS; in ieee80211_send_setup()
938 IEEE80211_ADDR_COPY(wh->i_addr1, da); in ieee80211_send_setup()
939 IEEE80211_ADDR_COPY(wh->i_addr2, in ieee80211_send_setup()
940 vap->iv_myaddr); in ieee80211_send_setup()
941 IEEE80211_ADDR_COPY(wh->i_addr3, da); in ieee80211_send_setup()
942 IEEE80211_ADDR_COPY(WH4(wh)->i_addr4, sa); in ieee80211_send_setup()
950 wh->i_fc[1] = IEEE80211_FC1_DIR_NODS; in ieee80211_send_setup()
951 IEEE80211_ADDR_COPY(wh->i_addr1, da); in ieee80211_send_setup()
952 IEEE80211_ADDR_COPY(wh->i_addr2, sa); in ieee80211_send_setup()
954 if (vap->iv_opmode == IEEE80211_M_MBSS) in ieee80211_send_setup()
955 IEEE80211_ADDR_COPY(wh->i_addr3, sa); in ieee80211_send_setup()
958 IEEE80211_ADDR_COPY(wh->i_addr3, bssid); in ieee80211_send_setup()
960 *(uint16_t *)&wh->i_dur[0] = 0; in ieee80211_send_setup()
965 * need to be in lock-step with what the driver is doing in ieee80211_send_setup()
972 tap = &ni->ni_tx_ampdu[tid]; in ieee80211_send_setup()
974 m->m_flags |= M_AMPDU_MPDU; in ieee80211_send_setup()
977 *(uint16_t *)&wh->i_seq[0] = 0; in ieee80211_send_setup()
982 * 802.11-2012 9.3.2.10 - QoS multicast frames in ieee80211_send_setup()
985 if (IEEE80211_IS_MULTICAST(wh->i_addr1)) { in ieee80211_send_setup()
986 seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++; in ieee80211_send_setup()
988 seqno = ni->ni_txseqs[tid]++; in ieee80211_send_setup()
993 *(uint16_t *)&wh->i_seq[0] = in ieee80211_send_setup()
998 if (IEEE80211_IS_MULTICAST(wh->i_addr1)) in ieee80211_send_setup()
999 m->m_flags |= M_MCAST; in ieee80211_send_setup()
1015 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_mgmt_output()
1016 struct ieee80211com *ic = ni->ni_ic; in ieee80211_mgmt_output()
1022 if (vap->iv_state == IEEE80211_S_CAC) { in ieee80211_mgmt_output()
1026 vap->iv_stats.is_tx_badstate++; in ieee80211_mgmt_output()
1043 vap->iv_myaddr, ni->ni_macaddr, ni->ni_bssid); in ieee80211_mgmt_output()
1044 if (params->ibp_flags & IEEE80211_BPF_CRYPTO) { in ieee80211_mgmt_output()
1045 IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_AUTH, wh->i_addr1, in ieee80211_mgmt_output()
1047 wh->i_fc[1] |= IEEE80211_FC1_PROTECTED; in ieee80211_mgmt_output()
1049 m->m_flags |= M_ENCAP; /* mark encapsulated */ in ieee80211_mgmt_output()
1052 M_WME_SETAC(m, params->ibp_pri); in ieee80211_mgmt_output()
1059 ether_sprintf(wh->i_addr1), in ieee80211_mgmt_output()
1061 ieee80211_chan2ieee(ic, ic->ic_curchan)); in ieee80211_mgmt_output()
1075 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_nulldata_transmitted()
1083 * If this is a WDS station then a 4-address frame is constructed.
1095 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_send_nulldata()
1096 struct ieee80211com *ic = ni->ni_ic; in ieee80211_send_nulldata()
1103 if (vap->iv_state == IEEE80211_S_CAC) { in ieee80211_send_nulldata()
1107 vap->iv_stats.is_tx_badstate++; in ieee80211_send_nulldata()
1111 if (ni->ni_flags & (IEEE80211_NODE_QOS|IEEE80211_NODE_HT)) in ieee80211_send_nulldata()
1115 /* NB: only WDS vap's get 4-address frames */ in ieee80211_send_nulldata()
1116 if (vap->iv_opmode == IEEE80211_M_WDS) in ieee80211_send_nulldata()
1118 if (ic->ic_flags & IEEE80211_F_DATAPAD) in ieee80211_send_nulldata()
1121 m = ieee80211_getmgtframe(&frm, ic->ic_headroom + hdrlen, 0); in ieee80211_send_nulldata()
1125 vap->iv_stats.is_tx_nobuf++; in ieee80211_send_nulldata()
1140 if (ni->ni_flags & IEEE80211_NODE_QOS) { in ieee80211_send_nulldata()
1146 tid, vap->iv_myaddr, ni->ni_macaddr, ni->ni_bssid); in ieee80211_send_nulldata()
1148 if (vap->iv_opmode == IEEE80211_M_WDS) in ieee80211_send_nulldata()
1149 qos = ((struct ieee80211_qosframe_addr4 *) wh)->i_qos; in ieee80211_send_nulldata()
1151 qos = ((struct ieee80211_qosframe *) wh)->i_qos; in ieee80211_send_nulldata()
1153 if (ic->ic_wme.wme_wmeChanParams.cap_wmeParams[WME_AC_BE].wmep_noackPolicy) in ieee80211_send_nulldata()
1160 vap->iv_myaddr, ni->ni_macaddr, ni->ni_bssid); in ieee80211_send_nulldata()
1162 if (vap->iv_opmode != IEEE80211_M_WDS) { in ieee80211_send_nulldata()
1164 if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) && in ieee80211_send_nulldata()
1165 vap->iv_opmode != IEEE80211_M_HOSTAP) in ieee80211_send_nulldata()
1166 wh->i_fc[1] |= IEEE80211_FC1_PWR_MGT; in ieee80211_send_nulldata()
1168 if ((ic->ic_flags & IEEE80211_F_SCAN) && in ieee80211_send_nulldata()
1169 (ni->ni_flags & IEEE80211_NODE_PWR_MGT)) { in ieee80211_send_nulldata()
1173 m->m_len = m->m_pkthdr.len = hdrlen; in ieee80211_send_nulldata()
1174 m->m_flags |= M_ENCAP; /* mark encapsulated */ in ieee80211_send_nulldata()
1182 ni->ni_flags & IEEE80211_NODE_QOS ? "QoS " : "", in ieee80211_send_nulldata()
1183 ieee80211_chan2ieee(ic, ic->ic_curchan), in ieee80211_send_nulldata()
1184 wh->i_fc[1] & IEEE80211_FC1_PWR_MGT ? "ena" : "dis"); in ieee80211_send_nulldata()
1204 if (__predict_false(m->m_flags & M_ENCAP)) { in ieee80211_classify()
1209 subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; in ieee80211_classify()
1216 if (m->m_pkthdr.len < hdrlen + sizeof(*llc)) in ieee80211_classify()
1220 if (llc->llc_dsap != LLC_SNAP_LSAP || in ieee80211_classify()
1221 llc->llc_ssap != LLC_SNAP_LSAP || in ieee80211_classify()
1222 llc->llc_control != LLC_UI || in ieee80211_classify()
1223 llc->llc_snap.org_code[0] != 0 || in ieee80211_classify()
1224 llc->llc_snap.org_code[1] != 0 || in ieee80211_classify()
1225 llc->llc_snap.org_code[2] != 0) in ieee80211_classify()
1228 ether_type = llc->llc_snap.ether_type; in ieee80211_classify()
1231 ether_type = eh->ether_type; in ieee80211_classify()
1239 m->m_flags |= M_EAPOL; in ieee80211_classify()
1244 * Non-qos traffic goes to BE. in ieee80211_classify()
1246 if ((ni->ni_flags & IEEE80211_NODE_QOS) == 0) { in ieee80211_classify()
1256 if (ni->ni_vlan != 0) { in ieee80211_classify()
1257 if ((m->m_flags & M_VLANTAG) == 0) { in ieee80211_classify()
1261 if (EVL_VLANOFTAG(m->m_pkthdr.ether_vtag) != in ieee80211_classify()
1262 EVL_VLANOFTAG(ni->ni_vlan)) { in ieee80211_classify()
1267 v_wme_ac = TID_TO_WME_AC(EVL_PRIOFTAG(ni->ni_vlan)); in ieee80211_classify()
1274 switch (ntohs(eh->ether_type)) { in ieee80211_classify()
1324 if (ni->ni_vap->iv_opmode == IEEE80211_M_STA) { in ieee80211_classify()
1331 struct ieee80211com *ic = ni->ni_ic; in ieee80211_classify()
1334 ic->ic_wme.wme_wmeBssChanParams.cap_wmeParams[ac].wmep_acm) in ieee80211_classify()
1352 #define TO_BE_RECLAIMED (sizeof(struct ether_header) - sizeof(struct llc)) in ieee80211_mbuf_adjust()
1353 int needed_space = vap->iv_ic->ic_headroom + hdrsize; in ieee80211_mbuf_adjust()
1357 needed_space += key->wk_cipher->ic_header; in ieee80211_mbuf_adjust()
1365 if (key->wk_flags & (IEEE80211_KEY_SWENCRYPT|IEEE80211_KEY_SWENMIC)) { in ieee80211_mbuf_adjust()
1370 vap->iv_stats.is_tx_nobuf++; /* XXX new stat */ in ieee80211_mbuf_adjust()
1379 * sizeof(struct ether_header) - sizeof(struct llc) in ieee80211_mbuf_adjust()
1384 if (M_LEADINGSPACE(m) < needed_space - TO_BE_RECLAIMED) { in ieee80211_mbuf_adjust()
1385 struct mbuf *n = m_gethdr(IEEE80211_M_NOWAIT, m->m_type); in ieee80211_mbuf_adjust()
1389 vap->iv_stats.is_tx_nobuf++; in ieee80211_mbuf_adjust()
1403 n->m_len = 0; /* NB: m_gethdr does not set */ in ieee80211_mbuf_adjust()
1404 n->m_data += needed_space; in ieee80211_mbuf_adjust()
1406 * Pull up Ethernet header to create the expected layout. in ieee80211_mbuf_adjust()
1412 n->m_len += sizeof(struct ether_header); in ieee80211_mbuf_adjust()
1413 m->m_len -= sizeof(struct ether_header); in ieee80211_mbuf_adjust()
1414 m->m_data += sizeof(struct ether_header); in ieee80211_mbuf_adjust()
1418 n->m_next = m; in ieee80211_mbuf_adjust()
1434 if (IEEE80211_KEY_UNDEFINED(&ni->ni_ucastkey)) { in ieee80211_crypto_getucastkey()
1435 if (vap->iv_def_txkey == IEEE80211_KEYIX_NONE || in ieee80211_crypto_getucastkey()
1436 IEEE80211_KEY_UNDEFINED(&vap->iv_nw_keys[vap->iv_def_txkey])) in ieee80211_crypto_getucastkey()
1438 return &vap->iv_nw_keys[vap->iv_def_txkey]; in ieee80211_crypto_getucastkey()
1440 return &ni->ni_ucastkey; in ieee80211_crypto_getucastkey()
1453 if (vap->iv_def_txkey == IEEE80211_KEYIX_NONE || in ieee80211_crypto_getmcastkey()
1454 IEEE80211_KEY_UNDEFINED(&vap->iv_nw_keys[vap->iv_def_txkey])) in ieee80211_crypto_getmcastkey()
1456 return &vap->iv_nw_keys[vap->iv_def_txkey]; in ieee80211_crypto_getmcastkey()
1474 struct ieee80211com *ic = ni->ni_ic; in ieee80211_encap()
1476 struct ieee80211_mesh_state *ms = vap->iv_mesh; in ieee80211_encap()
1479 int dir = -1; in ieee80211_encap()
1493 is_mcast = !! (m->m_flags & (M_MCAST | M_BCAST)); in ieee80211_encap()
1500 KASSERT(m->m_len >= sizeof(eh), ("no ethernet header!")); in ieee80211_encap()
1515 if (vap->iv_flags & IEEE80211_F_PRIVACY) { in ieee80211_encap()
1516 if (vap->iv_opmode == IEEE80211_M_STA || in ieee80211_encap()
1518 (vap->iv_opmode == IEEE80211_M_WDS && in ieee80211_encap()
1519 (vap->iv_flags_ext & IEEE80211_FEXT_WDSLEGACY))) { in ieee80211_encap()
1521 } else if ((vap->iv_opmode == IEEE80211_M_WDS) && in ieee80211_encap()
1522 (! (vap->iv_flags_ext & IEEE80211_FEXT_WDSLEGACY))) { in ieee80211_encap()
1533 * AP VAP, the dynamically created per-STA WDS node) in ieee80211_encap()
1540 if (key == NULL && (m->m_flags & M_EAPOL) == 0) { in ieee80211_encap()
1544 __func__, vap->iv_def_txkey); in ieee80211_encap()
1545 vap->iv_stats.is_tx_nodefkey++; in ieee80211_encap()
1551 * XXX Some ap's don't handle QoS-encapsulated EAPOL in ieee80211_encap()
1553 * ap's require all data frames to be QoS-encapsulated in ieee80211_encap()
1564 (((is_mcast == 0) && (ni->ni_flags & in ieee80211_encap()
1566 (vap->iv_opmode == IEEE80211_M_MBSS)) && in ieee80211_encap()
1567 (m->m_flags & M_EAPOL) == 0; in ieee80211_encap()
1574 if (vap->iv_opmode == IEEE80211_M_MBSS) { in ieee80211_encap()
1579 * at the local sta are sent w/ 3-address format and in ieee80211_encap()
1582 * at the local sta are sent w/ 4-address format and in ieee80211_encap()
1584 * o Group Addressed data forwarded from a non-mesh sta are in ieee80211_encap()
1585 * sent w/ 3-address format and address extension mode 01 in ieee80211_encap()
1587 * w/ 4-address format and address extension mode 10 in ieee80211_encap()
1595 if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) { in ieee80211_encap()
1596 if (IEEE80211_ADDR_EQ(rt->rt_mesh_gate, in ieee80211_encap()
1597 vap->iv_myaddr)) { in ieee80211_encap()
1614 if (!IEEE80211_ADDR_EQ(eh.ether_shost, vap->iv_myaddr)) { in ieee80211_encap()
1628 * 4-address frames need to be generated for: in ieee80211_encap()
1633 is4addr = vap->iv_opmode == IEEE80211_M_WDS || in ieee80211_encap()
1634 ((vap->iv_flags_ext & IEEE80211_FEXT_4ADDR) && in ieee80211_encap()
1635 !IEEE80211_ADDR_EQ(eh.ether_shost, vap->iv_myaddr)); in ieee80211_encap()
1645 if (ic->ic_flags & IEEE80211_F_DATAPAD) in ieee80211_encap()
1650 if (__predict_true((m->m_flags & M_FF) == 0)) { in ieee80211_encap()
1660 m_adj(m, sizeof(struct ether_header) - sizeof(struct llc)); in ieee80211_encap()
1662 llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; in ieee80211_encap()
1663 llc->llc_control = LLC_UI; in ieee80211_encap()
1664 llc->llc_snap.org_code[0] = 0; in ieee80211_encap()
1665 llc->llc_snap.org_code[1] = 0; in ieee80211_encap()
1666 llc->llc_snap.org_code[2] = 0; in ieee80211_encap()
1667 llc->llc_snap.ether_type = eh.ether_type; in ieee80211_encap()
1688 datalen = m->m_pkthdr.len; /* NB: w/o 802.11 header */ in ieee80211_encap()
1692 vap->iv_stats.is_tx_nobuf++; in ieee80211_encap()
1696 wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_DATA; in ieee80211_encap()
1697 *(uint16_t *)wh->i_dur = 0; in ieee80211_encap()
1700 wh->i_fc[1] = IEEE80211_FC1_DIR_DSTODS; in ieee80211_encap()
1701 IEEE80211_ADDR_COPY(wh->i_addr1, ni->ni_macaddr); in ieee80211_encap()
1702 IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr); in ieee80211_encap()
1703 IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_dhost); in ieee80211_encap()
1704 IEEE80211_ADDR_COPY(WH4(wh)->i_addr4, eh.ether_shost); in ieee80211_encap()
1705 } else switch (vap->iv_opmode) { in ieee80211_encap()
1707 wh->i_fc[1] = IEEE80211_FC1_DIR_TODS; in ieee80211_encap()
1708 IEEE80211_ADDR_COPY(wh->i_addr1, ni->ni_bssid); in ieee80211_encap()
1709 IEEE80211_ADDR_COPY(wh->i_addr2, eh.ether_shost); in ieee80211_encap()
1710 IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_dhost); in ieee80211_encap()
1714 wh->i_fc[1] = IEEE80211_FC1_DIR_NODS; in ieee80211_encap()
1715 IEEE80211_ADDR_COPY(wh->i_addr1, eh.ether_dhost); in ieee80211_encap()
1716 IEEE80211_ADDR_COPY(wh->i_addr2, eh.ether_shost); in ieee80211_encap()
1721 IEEE80211_ADDR_COPY(wh->i_addr3, vap->iv_bss->ni_bssid); in ieee80211_encap()
1724 wh->i_fc[1] = IEEE80211_FC1_DIR_FROMDS; in ieee80211_encap()
1725 IEEE80211_ADDR_COPY(wh->i_addr1, eh.ether_dhost); in ieee80211_encap()
1726 IEEE80211_ADDR_COPY(wh->i_addr2, ni->ni_bssid); in ieee80211_encap()
1727 IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_shost); in ieee80211_encap()
1734 wh->i_fc[1] = dir; in ieee80211_encap()
1737 mc->mc_flags = 0; in ieee80211_encap()
1739 IEEE80211_ADDR_COPY(wh->i_addr1, in ieee80211_encap()
1740 ni->ni_macaddr); in ieee80211_encap()
1741 IEEE80211_ADDR_COPY(wh->i_addr2, in ieee80211_encap()
1742 vap->iv_myaddr); in ieee80211_encap()
1743 IEEE80211_ADDR_COPY(wh->i_addr3, in ieee80211_encap()
1745 IEEE80211_ADDR_COPY(WH4(wh)->i_addr4, in ieee80211_encap()
1748 wh)->i_qos; in ieee80211_encap()
1751 IEEE80211_ADDR_COPY(wh->i_addr1, in ieee80211_encap()
1753 IEEE80211_ADDR_COPY(wh->i_addr2, in ieee80211_encap()
1754 vap->iv_myaddr); in ieee80211_encap()
1755 IEEE80211_ADDR_COPY(wh->i_addr3, in ieee80211_encap()
1758 wh)->i_qos; in ieee80211_encap()
1762 wh->i_fc[1] = IEEE80211_FC1_DIR_FROMDS; in ieee80211_encap()
1763 IEEE80211_ADDR_COPY(wh->i_addr1, eh.ether_dhost); in ieee80211_encap()
1764 IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr); in ieee80211_encap()
1765 IEEE80211_ADDR_COPY(wh->i_addr3, vap->iv_myaddr); in ieee80211_encap()
1766 mc->mc_flags = 1; in ieee80211_encap()
1767 IEEE80211_ADDR_COPY(MC01(mc)->mc_addr4, in ieee80211_encap()
1769 qos = ((struct ieee80211_qosframe *) wh)->i_qos; in ieee80211_encap()
1773 IEEE80211_ADDR_COPY(wh->i_addr1, rt->rt_nexthop); in ieee80211_encap()
1774 IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr); in ieee80211_encap()
1775 IEEE80211_ADDR_COPY(wh->i_addr3, rt->rt_mesh_gate); in ieee80211_encap()
1776 IEEE80211_ADDR_COPY(WH4(wh)->i_addr4, vap->iv_myaddr); in ieee80211_encap()
1777 mc->mc_flags = IEEE80211_MESH_AE_10; in ieee80211_encap()
1778 IEEE80211_ADDR_COPY(mc->mc_addr5, eh.ether_dhost); in ieee80211_encap()
1779 IEEE80211_ADDR_COPY(mc->mc_addr6, eh.ether_shost); in ieee80211_encap()
1780 qos = ((struct ieee80211_qosframe_addr4 *) wh)->i_qos; in ieee80211_encap()
1786 mc->mc_ttl = ms->ms_ttl; in ieee80211_encap()
1787 ms->ms_seq++; in ieee80211_encap()
1788 le32enc(mc->mc_seq, ms->ms_seq); in ieee80211_encap()
1795 if (m->m_flags & M_MORE_DATA) in ieee80211_encap()
1796 wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA; in ieee80211_encap()
1801 qos = ((struct ieee80211_qosframe_addr4 *) wh)->i_qos; in ieee80211_encap()
1803 } else if (vap->iv_opmode != IEEE80211_M_MBSS) in ieee80211_encap()
1804 qos = ((struct ieee80211_qosframe *) wh)->i_qos; in ieee80211_encap()
1809 if (ic->ic_wme.wme_wmeChanParams.cap_wmeParams[ac].wmep_noackPolicy) in ieee80211_encap()
1812 if (vap->iv_opmode == IEEE80211_M_MBSS) in ieee80211_encap()
1817 wh->i_fc[0] |= IEEE80211_FC0_SUBTYPE_QOS_DATA; in ieee80211_encap()
1820 * If this is an A-MSDU then ensure we set the in ieee80211_encap()
1831 if ((m->m_flags & M_AMPDU_MPDU) == 0) { in ieee80211_encap()
1833 * 802.11-2012 9.3.2.10 - in ieee80211_encap()
1843 if (IEEE80211_IS_MULTICAST(wh->i_addr1)) in ieee80211_encap()
1844 seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++; in ieee80211_encap()
1846 seqno = ni->ni_txseqs[tid]++; in ieee80211_encap()
1860 *(uint16_t *)wh->i_seq = in ieee80211_encap()
1865 *(uint16_t *)wh->i_seq = 0; in ieee80211_encap()
1873 seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++; in ieee80211_encap()
1874 *(uint16_t *)wh->i_seq = in ieee80211_encap()
1880 * be forced to be non-QoS traffic to be A-MSDU encapsulated. in ieee80211_encap()
1896 txfrag = (m->m_pkthdr.len > vap->iv_fragthreshold && in ieee80211_encap()
1897 !IEEE80211_IS_MULTICAST(wh->i_addr1) && in ieee80211_encap()
1898 (vap->iv_caps & IEEE80211_C_TXFRAG) && in ieee80211_encap()
1899 (m->m_flags & (M_FF | M_AMPDU_MPDU)) == 0); in ieee80211_encap()
1906 if ((m->m_flags & M_EAPOL) == 0 || in ieee80211_encap()
1907 ((vap->iv_flags & IEEE80211_F_WPA) && in ieee80211_encap()
1908 (vap->iv_opmode == IEEE80211_M_STA ? in ieee80211_encap()
1910 !IEEE80211_KEY_UNDEFINED(&ni->ni_ucastkey)))) { in ieee80211_encap()
1911 wh->i_fc[1] |= IEEE80211_FC1_PROTECTED; in ieee80211_encap()
1916 vap->iv_stats.is_crypto_enmicfail++; in ieee80211_encap()
1922 key != NULL ? key->wk_cipher->ic_header : 0, vap->iv_fragthreshold)) in ieee80211_encap()
1925 m->m_flags |= M_ENCAP; /* mark encapsulated */ in ieee80211_encap()
1928 if (IEEE80211_IS_MULTICAST(wh->i_addr1)) { in ieee80211_encap()
1930 m->m_flags |= M_MCAST; in ieee80211_encap()
1953 next = m->m_nextpkt; in ieee80211_free_mbuf()
1954 m->m_nextpkt = NULL; in ieee80211_free_mbuf()
1971 struct ieee80211com *ic = vap->iv_ic; in ieee80211_fragment()
1977 KASSERT(m0->m_nextpkt == NULL, ("mbuf already chained?")); in ieee80211_fragment()
1978 KASSERT(m0->m_pkthdr.len > mtu, in ieee80211_fragment()
1979 ("pktlen %u mtu %u", m0->m_pkthdr.len, mtu)); in ieee80211_fragment()
1984 if (ic->ic_flags & IEEE80211_F_DATAPAD) in ieee80211_fragment()
1991 wh->i_fc[1] |= IEEE80211_FC1_MORE_FRAG; in ieee80211_fragment()
1994 off = mtu - ciphdrsize; in ieee80211_fragment()
1995 remainder = m0->m_pkthdr.len - off; in ieee80211_fragment()
2003 m_align(m, fragsize - ciphdrsize); in ieee80211_fragment()
2015 if (vap->iv_opmode == IEEE80211_M_MBSS) in ieee80211_fragment()
2018 *(uint16_t *)&whf->i_seq[0] |= htole16( in ieee80211_fragment()
2023 payload = fragsize - totalhdrsize; in ieee80211_fragment()
2027 m->m_len = hdrspace + payload; in ieee80211_fragment()
2028 m->m_pkthdr.len = hdrspace + payload; in ieee80211_fragment()
2029 m->m_flags |= M_FRAG; in ieee80211_fragment()
2032 prev->m_nextpkt = m; in ieee80211_fragment()
2036 remainder -= payload; in ieee80211_fragment()
2041 m->m_flags |= M_LASTFRAG; in ieee80211_fragment()
2042 whf->i_fc[1] &= ~IEEE80211_FC1_MORE_FRAG; in ieee80211_fragment()
2045 m_adj(m0, -(m0->m_pkthdr.len - (mtu - ciphdrsize))); in ieee80211_fragment()
2046 m0->m_flags |= M_FIRSTFRAG | M_FRAG; in ieee80211_fragment()
2048 vap->iv_stats.is_tx_fragframes++; in ieee80211_fragment()
2049 vap->iv_stats.is_tx_frags += fragno-1; in ieee80211_fragment()
2054 ieee80211_free_mbuf(m0->m_nextpkt); in ieee80211_fragment()
2055 m0->m_nextpkt = NULL; in ieee80211_fragment()
2068 nrates = rs->rs_nrates; in ieee80211_add_rates()
2072 memcpy(frm, rs->rs_rates, nrates); in ieee80211_add_rates()
2085 if (rs->rs_nrates > IEEE80211_RATE_SIZE) { in ieee80211_add_xrates()
2086 int nrates = rs->rs_nrates - IEEE80211_RATE_SIZE; in ieee80211_add_xrates()
2089 memcpy(frm, rs->rs_rates + IEEE80211_RATE_SIZE, nrates); in ieee80211_add_xrates()
2113 struct ieee80211com *ic = vap->iv_ic; in ieee80211_add_erp()
2122 * the per-VAP flags are fine for per-VAP, but don't in ieee80211_add_erp()
2131 if (ic->ic_flags_ext & IEEE80211_FEXT_NONERP_PR) in ieee80211_add_erp()
2137 * of per-VAP and channels. in ieee80211_add_erp()
2139 if (ic->ic_flags & IEEE80211_F_USEPROT) in ieee80211_add_erp()
2141 if (ic->ic_flags & IEEE80211_F_USEBARKER) in ieee80211_add_erp()
2170 memcpy(frm, ie->ie_data, ie->ie_len); in add_appie()
2171 return frm + ie->ie_len; in add_appie()
2190 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_add_wme_info()
2193 *frm++ = sizeof(struct ieee80211_wme_info) - 2; in ieee80211_add_wme_info()
2200 switch (vap->iv_opmode) { in ieee80211_add_wme_info()
2202 *frm = wme->wme_bssChanParams.cap_info; in ieee80211_add_wme_info()
2203 if (vap->iv_flags_ext & IEEE80211_FEXT_UAPSD) in ieee80211_add_wme_info()
2212 *frm++ = vap->iv_uapsdinfo; in ieee80211_add_wme_info()
2236 .wme_len = sizeof(struct ieee80211_wme_param) - 2, in ieee80211_add_wme_param()
2246 *frm = wme->wme_bssChanParams.cap_info; /* AC info */ in ieee80211_add_wme_param()
2251 /* XXX TODO - U-APSD bits - SP, flags below */ in ieee80211_add_wme_param()
2254 &wme->wme_bssChanParams.cap_wmeParams[i]; in ieee80211_add_wme_param()
2256 | _IEEE80211_SHIFTMASK(ac->wmep_acm, WME_PARAM_ACM) in ieee80211_add_wme_param()
2257 | _IEEE80211_SHIFTMASK(ac->wmep_aifsn, WME_PARAM_AIFSN) in ieee80211_add_wme_param()
2259 *frm++ = _IEEE80211_SHIFTMASK(ac->wmep_logcwmax, in ieee80211_add_wme_param()
2261 | _IEEE80211_SHIFTMASK(ac->wmep_logcwmin, in ieee80211_add_wme_param()
2264 ADDSHORT(frm, ac->wmep_txopLimit); in ieee80211_add_wme_param()
2277 const struct ieee80211_channel *c = vap->iv_bss->ni_chan; in ieee80211_add_powerconstraint()
2278 /* XXX per-vap tx power limit? */ in ieee80211_add_powerconstraint()
2279 int8_t limit = vap->iv_ic->ic_txpowlimit / 2; in ieee80211_add_powerconstraint()
2283 frm[2] = c->ic_maxregpower > limit ? c->ic_maxregpower - limit : 0; in ieee80211_add_powerconstraint()
2295 frm[2] = c->ic_minpower; in ieee80211_add_powercapability()
2296 frm[3] = c->ic_maxpower; in ieee80211_add_powercapability()
2311 memcpy(frm+2, ic->ic_chan_avail, ielen); in ieee80211_add_supportedchannels()
2323 quiet->quiet_ie = IEEE80211_ELEMID_QUIET; in ieee80211_add_quiet()
2324 quiet->len = 6; in ieee80211_add_quiet()
2327 * Only update every beacon interval - otherwise probe responses in ieee80211_add_quiet()
2331 if (vap->iv_quiet_count_value == 1) in ieee80211_add_quiet()
2332 vap->iv_quiet_count_value = vap->iv_quiet_count; in ieee80211_add_quiet()
2333 else if (vap->iv_quiet_count_value > 1) in ieee80211_add_quiet()
2334 vap->iv_quiet_count_value--; in ieee80211_add_quiet()
2337 if (vap->iv_quiet_count_value == 0) { in ieee80211_add_quiet()
2339 vap->iv_quiet_count_value = 1; in ieee80211_add_quiet()
2342 quiet->tbttcount = vap->iv_quiet_count_value; in ieee80211_add_quiet()
2343 quiet->period = vap->iv_quiet_period; in ieee80211_add_quiet()
2344 quiet->duration = htole16(vap->iv_quiet_duration); in ieee80211_add_quiet()
2345 quiet->offset = htole16(vap->iv_quiet_offset); in ieee80211_add_quiet()
2351 * Note that we use the per-vap CSA count to adjust the global
2358 struct ieee80211com *ic = vap->iv_ic; in ieee80211_add_csa()
2361 csa->csa_ie = IEEE80211_ELEMID_CSA; in ieee80211_add_csa()
2362 csa->csa_len = 3; in ieee80211_add_csa()
2363 csa->csa_mode = 1; /* XXX force quiet on channel */ in ieee80211_add_csa()
2364 csa->csa_newchan = ieee80211_chan2ieee(ic, ic->ic_csa_newchan); in ieee80211_add_csa()
2365 csa->csa_count = ic->ic_csa_count - vap->iv_csa_count; in ieee80211_add_csa()
2376 if (ic->ic_countryie == NULL || in ieee80211_add_countryie()
2377 ic->ic_countryie_chan != ic->ic_bsschan) { in ieee80211_add_countryie()
2381 * re-calculation. in ieee80211_add_countryie()
2383 if (ic->ic_countryie != NULL) in ieee80211_add_countryie()
2384 IEEE80211_FREE(ic->ic_countryie, M_80211_NODE_IE); in ieee80211_add_countryie()
2385 ic->ic_countryie = ieee80211_alloc_countryie(ic); in ieee80211_add_countryie()
2386 if (ic->ic_countryie == NULL) in ieee80211_add_countryie()
2388 ic->ic_countryie_chan = ic->ic_bsschan; in ieee80211_add_countryie()
2390 return add_appie(frm, ic->ic_countryie); in ieee80211_add_countryie()
2396 if (vap->iv_flags & IEEE80211_F_WPA1 && vap->iv_wpa_ie != NULL) in ieee80211_add_wpa()
2397 return (add_ie(frm, vap->iv_wpa_ie)); in ieee80211_add_wpa()
2407 if (vap->iv_flags & IEEE80211_F_WPA2 && vap->iv_rsn_ie != NULL) in ieee80211_add_rsn()
2408 return (add_ie(frm, vap->iv_rsn_ie)); in ieee80211_add_rsn()
2418 if (ni->ni_flags & IEEE80211_NODE_QOS) { in ieee80211_add_qos()
2437 rs = ieee80211_get_suprates(ic, ic->ic_curchan); in ieee80211_probereq_ie_len()
2441 * [tlv] ssid in ieee80211_probereq_ie_len()
2442 * [tlv] supported rates in ieee80211_probereq_ie_len()
2443 * [tlv] extended supported rates (if needed) in ieee80211_probereq_ie_len()
2444 * [tlv] HT cap (optional) in ieee80211_probereq_ie_len()
2445 * [tlv] VHT cap (optional) in ieee80211_probereq_ie_len()
2446 * [tlv] WPA (optional) in ieee80211_probereq_ie_len()
2447 * [tlv] user-specified ie's in ieee80211_probereq_ie_len()
2451 + ((rs->rs_nrates > IEEE80211_RATE_SIZE) ? in ieee80211_probereq_ie_len()
2452 2 + (rs->rs_nrates - IEEE80211_RATE_SIZE) : 0) in ieee80211_probereq_ie_len()
2453 + (((vap->iv_opmode == IEEE80211_M_IBSS) && in ieee80211_probereq_ie_len()
2454 (vap->iv_flags_ht & IEEE80211_FHT_HT)) ? in ieee80211_probereq_ie_len()
2460 + ((vap->iv_flags & IEEE80211_F_WPA1 && vap->iv_wpa_ie != NULL) ? in ieee80211_probereq_ie_len()
2461 vap->iv_wpa_ie[1] : 0) in ieee80211_probereq_ie_len()
2462 + (vap->iv_appie_probereq != NULL ? in ieee80211_probereq_ie_len()
2463 vap->iv_appie_probereq->ie_len : 0) in ieee80211_probereq_ie_len()
2484 if (ssidlen == -1) in ieee80211_probereq_ie()
2485 len -= (2 + IEEE80211_NWID_LEN); in ieee80211_probereq_ie()
2495 if (ssidlen != -1) in ieee80211_probereq_ie()
2497 rs = ieee80211_get_suprates(ic, ic->ic_curchan); in ieee80211_probereq_ie()
2508 if ((vap->iv_opmode == IEEE80211_M_IBSS) && in ieee80211_probereq_ie()
2509 (vap->iv_flags_ht & IEEE80211_FHT_HT)) { in ieee80211_probereq_ie()
2516 c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, in ieee80211_probereq_ie()
2517 vap->iv_flags_ht); in ieee80211_probereq_ie()
2526 if (vap->iv_vht_flags & IEEE80211_FVHT_VHT) { in ieee80211_probereq_ie()
2529 c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, in ieee80211_probereq_ie()
2530 vap->iv_flags_ht); in ieee80211_probereq_ie()
2531 c = ieee80211_vht_adjust_channel(ic, c, vap->iv_vht_flags); in ieee80211_probereq_ie()
2537 if (vap->iv_appie_probereq != NULL) in ieee80211_probereq_ie()
2538 frm = add_appie(frm, vap->iv_appie_probereq); in ieee80211_probereq_ie()
2555 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_send_probereq()
2556 struct ieee80211com *ic = ni->ni_ic; in ieee80211_send_probereq()
2565 bss = ieee80211_ref_node(vap->iv_bss); in ieee80211_send_probereq()
2567 if (vap->iv_state == IEEE80211_S_CAC) { in ieee80211_send_probereq()
2570 vap->iv_stats.is_tx_badstate++; in ieee80211_send_probereq()
2583 ni, ether_sprintf(ni->ni_macaddr), in ieee80211_send_probereq()
2590 ic->ic_headroom + sizeof(struct ieee80211_frame), frmlen); in ieee80211_send_probereq()
2592 vap->iv_stats.is_tx_nobuf++; in ieee80211_send_probereq()
2603 m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); in ieee80211_send_probereq()
2619 m->m_flags |= M_ENCAP; /* mark encapsulated */ in ieee80211_send_probereq()
2628 ieee80211_chan2ieee(ic, ic->ic_curchan), in ieee80211_send_probereq()
2636 tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; in ieee80211_send_probereq()
2637 params.ibp_rate0 = tp->mgmtrate; in ieee80211_send_probereq()
2642 params.ibp_try0 = tp->maxretry; in ieee80211_send_probereq()
2643 params.ibp_power = ni->ni_txpower; in ieee80211_send_probereq()
2658 KASSERT(vap->iv_opmode != IEEE80211_M_STA, ("station mode")); in ieee80211_getcapinfo()
2660 if (vap->iv_opmode == IEEE80211_M_HOSTAP) in ieee80211_getcapinfo()
2662 else if (vap->iv_opmode == IEEE80211_M_IBSS) in ieee80211_getcapinfo()
2666 if (vap->iv_flags & IEEE80211_F_PRIVACY) in ieee80211_getcapinfo()
2668 if ((vap->iv_flags & IEEE80211_F_SHPREAMBLE) && in ieee80211_getcapinfo()
2671 if (vap->iv_flags & IEEE80211_F_SHSLOT) in ieee80211_getcapinfo()
2673 if (IEEE80211_IS_CHAN_5GHZ(chan) && (vap->iv_flags & IEEE80211_F_DOTH)) in ieee80211_getcapinfo()
2687 #define senderr(_x, _v) do { vap->iv_stats._v++; ret = _x; goto bad; } while (0) in ieee80211_send_mgmt()
2688 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_send_mgmt()
2689 struct ieee80211com *ic = ni->ni_ic; in ieee80211_send_mgmt()
2690 struct ieee80211_node *bss = vap->iv_bss; in ieee80211_send_mgmt()
2707 ni, ether_sprintf(ni->ni_macaddr), in ieee80211_send_mgmt()
2718 ni->ni_challenge != NULL); in ieee80211_send_mgmt()
2730 bss->ni_authmode == IEEE80211_AUTH_SHARED); in ieee80211_send_mgmt()
2733 ic->ic_headroom + sizeof(struct ieee80211_frame), in ieee80211_send_mgmt()
2750 memcpy(&((uint16_t *)frm)[4], ni->ni_challenge, in ieee80211_send_mgmt()
2752 m->m_pkthdr.len = m->m_len = in ieee80211_send_mgmt()
2761 m->m_pkthdr.len = m->m_len = 3 * sizeof(uint16_t); in ieee80211_send_mgmt()
2769 if (vap->iv_opmode == IEEE80211_M_STA) in ieee80211_send_mgmt()
2771 (void *) vap->iv_state); in ieee80211_send_mgmt()
2779 ic->ic_headroom + sizeof(struct ieee80211_frame), in ieee80211_send_mgmt()
2784 m->m_pkthdr.len = m->m_len = sizeof(uint16_t); in ieee80211_send_mgmt()
2799 * [tlv] ssid in ieee80211_send_mgmt()
2800 * [tlv] supported rates in ieee80211_send_mgmt()
2801 * [tlv] extended supported rates in ieee80211_send_mgmt()
2804 * [tlv] HT capabilities in ieee80211_send_mgmt()
2805 * [tlv] VHT capabilities in ieee80211_send_mgmt()
2806 * [tlv] WME (optional) in ieee80211_send_mgmt()
2807 * [tlv] Vendor OUI HT capabilities (optional) in ieee80211_send_mgmt()
2808 * [tlv] Atheros capabilities (if negotiated) in ieee80211_send_mgmt()
2809 * [tlv] AppIE's (optional) in ieee80211_send_mgmt()
2812 ic->ic_headroom + sizeof(struct ieee80211_frame), in ieee80211_send_mgmt()
2818 + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) in ieee80211_send_mgmt()
2828 + (vap->iv_appie_wpa != NULL ? in ieee80211_send_mgmt()
2829 vap->iv_appie_wpa->ie_len : 0) in ieee80211_send_mgmt()
2830 + (vap->iv_appie_assocreq != NULL ? in ieee80211_send_mgmt()
2831 vap->iv_appie_assocreq->ie_len : 0) in ieee80211_send_mgmt()
2836 KASSERT(vap->iv_opmode == IEEE80211_M_STA, in ieee80211_send_mgmt()
2837 ("wrong mode %u", vap->iv_opmode)); in ieee80211_send_mgmt()
2839 if (vap->iv_flags & IEEE80211_F_PRIVACY) in ieee80211_send_mgmt()
2845 if ((vap->iv_flags & IEEE80211_F_SHPREAMBLE) && in ieee80211_send_mgmt()
2846 IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) in ieee80211_send_mgmt()
2848 if (IEEE80211_IS_CHAN_ANYG(ic->ic_curchan) && in ieee80211_send_mgmt()
2849 (ic->ic_caps & IEEE80211_C_SHSLOT)) in ieee80211_send_mgmt()
2851 if ((ni->ni_capinfo & IEEE80211_CAPINFO_SPECTRUM_MGMT) && in ieee80211_send_mgmt()
2852 (vap->iv_flags & IEEE80211_F_DOTH)) in ieee80211_send_mgmt()
2857 KASSERT(bss->ni_intval != 0, ("beacon interval is zero!")); in ieee80211_send_mgmt()
2858 *(uint16_t *)frm = htole16(howmany(ic->ic_lintval, in ieee80211_send_mgmt()
2859 bss->ni_intval)); in ieee80211_send_mgmt()
2863 IEEE80211_ADDR_COPY(frm, bss->ni_bssid); in ieee80211_send_mgmt()
2867 frm = ieee80211_add_ssid(frm, ni->ni_essid, ni->ni_esslen); in ieee80211_send_mgmt()
2868 frm = ieee80211_add_rates(frm, &ni->ni_rates); in ieee80211_send_mgmt()
2870 frm = ieee80211_add_xrates(frm, &ni->ni_rates); in ieee80211_send_mgmt()
2873 ic->ic_curchan); in ieee80211_send_mgmt()
2878 * Check the channel - we may be using an 11n NIC with an in ieee80211_send_mgmt()
2882 if ((vap->iv_flags_ht & IEEE80211_FHT_HT) && in ieee80211_send_mgmt()
2883 IEEE80211_IS_CHAN_HT(ni->ni_chan) && in ieee80211_send_mgmt()
2884 ni->ni_ies.htcap_ie != NULL && in ieee80211_send_mgmt()
2885 ni->ni_ies.htcap_ie[0] == IEEE80211_ELEMID_HTCAP) { in ieee80211_send_mgmt()
2889 if ((vap->iv_vht_flags & IEEE80211_FVHT_VHT) && in ieee80211_send_mgmt()
2890 IEEE80211_IS_CHAN_VHT(ni->ni_chan) && in ieee80211_send_mgmt()
2891 ni->ni_ies.vhtcap_ie != NULL && in ieee80211_send_mgmt()
2892 ni->ni_ies.vhtcap_ie[0] == IEEE80211_ELEMID_VHT_CAP) { in ieee80211_send_mgmt()
2897 if ((vap->iv_flags & IEEE80211_F_WME) && in ieee80211_send_mgmt()
2898 ni->ni_ies.wme_ie != NULL) in ieee80211_send_mgmt()
2899 frm = ieee80211_add_wme_info(frm, &ic->ic_wme, ni); in ieee80211_send_mgmt()
2902 * Same deal - only send HT info if we're on an 11n in ieee80211_send_mgmt()
2905 if ((vap->iv_flags_ht & IEEE80211_FHT_HT) && in ieee80211_send_mgmt()
2906 IEEE80211_IS_CHAN_HT(ni->ni_chan) && in ieee80211_send_mgmt()
2907 ni->ni_ies.htcap_ie != NULL && in ieee80211_send_mgmt()
2908 ni->ni_ies.htcap_ie[0] == IEEE80211_ELEMID_VENDOR) { in ieee80211_send_mgmt()
2915 ((vap->iv_flags & IEEE80211_F_WPA) == 0 && in ieee80211_send_mgmt()
2916 ni->ni_authmode != IEEE80211_AUTH_8021X) ? in ieee80211_send_mgmt()
2917 vap->iv_def_txkey : IEEE80211_KEYIX_NONE); in ieee80211_send_mgmt()
2920 if (vap->iv_appie_assocreq != NULL) in ieee80211_send_mgmt()
2921 frm = add_appie(frm, vap->iv_appie_assocreq); in ieee80211_send_mgmt()
2922 m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); in ieee80211_send_mgmt()
2925 (void *) vap->iv_state); in ieee80211_send_mgmt()
2935 * [tlv] supported rates in ieee80211_send_mgmt()
2936 * [tlv] extended supported rates in ieee80211_send_mgmt()
2937 * [tlv] HT capabilities (standard, if STA enabled) in ieee80211_send_mgmt()
2938 * [tlv] HT information (standard, if STA enabled) in ieee80211_send_mgmt()
2939 * [tlv] VHT capabilities (standard, if STA enabled) in ieee80211_send_mgmt()
2940 * [tlv] VHT information (standard, if STA enabled) in ieee80211_send_mgmt()
2941 * [tlv] WME (if configured and STA enabled) in ieee80211_send_mgmt()
2942 * [tlv] HT capabilities (vendor OUI, if STA enabled) in ieee80211_send_mgmt()
2943 * [tlv] HT information (vendor OUI, if STA enabled) in ieee80211_send_mgmt()
2944 * [tlv] Atheros capabilities (if STA enabled) in ieee80211_send_mgmt()
2945 * [tlv] AppIE's (optional) in ieee80211_send_mgmt()
2948 ic->ic_headroom + sizeof(struct ieee80211_frame), in ieee80211_send_mgmt()
2953 + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) in ieee80211_send_mgmt()
2962 + (vap->iv_appie_assocresp != NULL ? in ieee80211_send_mgmt()
2963 vap->iv_appie_assocresp->ie_len : 0) in ieee80211_send_mgmt()
2968 capinfo = ieee80211_getcapinfo(vap, bss->ni_chan); in ieee80211_send_mgmt()
2976 *(uint16_t *)frm = htole16(ni->ni_associd); in ieee80211_send_mgmt()
2982 frm = ieee80211_add_rates(frm, &ni->ni_rates); in ieee80211_send_mgmt()
2983 frm = ieee80211_add_xrates(frm, &ni->ni_rates); in ieee80211_send_mgmt()
2985 if ((ni->ni_flags & HTFLAGS) == IEEE80211_NODE_HT) { in ieee80211_send_mgmt()
2989 if ((vap->iv_flags & IEEE80211_F_WME) && in ieee80211_send_mgmt()
2990 ni->ni_ies.wme_ie != NULL) in ieee80211_send_mgmt()
2991 frm = ieee80211_add_wme_param(frm, &ic->ic_wme, in ieee80211_send_mgmt()
2992 !! (vap->iv_flags_ext & IEEE80211_FEXT_UAPSD)); in ieee80211_send_mgmt()
2993 if ((ni->ni_flags & HTFLAGS) == HTFLAGS) { in ieee80211_send_mgmt()
2997 if (ni->ni_flags & IEEE80211_NODE_VHT) { in ieee80211_send_mgmt()
3005 ((vap->iv_flags & IEEE80211_F_WPA) == 0 && in ieee80211_send_mgmt()
3006 ni->ni_authmode != IEEE80211_AUTH_8021X) ? in ieee80211_send_mgmt()
3007 vap->iv_def_txkey : IEEE80211_KEYIX_NONE); in ieee80211_send_mgmt()
3009 if (vap->iv_appie_assocresp != NULL) in ieee80211_send_mgmt()
3010 frm = add_appie(frm, vap->iv_appie_assocresp); in ieee80211_send_mgmt()
3011 m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); in ieee80211_send_mgmt()
3019 ic->ic_headroom + sizeof(struct ieee80211_frame), in ieee80211_send_mgmt()
3024 m->m_pkthdr.len = m->m_len = sizeof(uint16_t); in ieee80211_send_mgmt()
3037 /* NB: force non-ProbeResp frames to the highest queue */ in ieee80211_send_mgmt()
3039 params.ibp_rate0 = bss->ni_txparms->mgmtrate; in ieee80211_send_mgmt()
3041 params.ibp_try0 = bss->ni_txparms->maxretry; in ieee80211_send_mgmt()
3042 params.ibp_power = bss->ni_txpower; in ieee80211_send_mgmt()
3059 struct ieee80211vap *vap = bss->ni_vap; in ieee80211_alloc_proberesp()
3060 struct ieee80211com *ic = bss->ni_ic; in ieee80211_alloc_proberesp()
3071 * [tlv] ssid in ieee80211_alloc_proberesp()
3072 * [tlv] supported rates in ieee80211_alloc_proberesp()
3073 * [tlv] parameter set (FH/DS) in ieee80211_alloc_proberesp()
3074 * [tlv] parameter set (IBSS) in ieee80211_alloc_proberesp()
3075 * [tlv] country (optional) in ieee80211_alloc_proberesp()
3078 * [tlv] extended rate phy (ERP) in ieee80211_alloc_proberesp()
3079 * [tlv] extended supported rates in ieee80211_alloc_proberesp()
3080 * [tlv] RSN (optional) in ieee80211_alloc_proberesp()
3081 * [tlv] HT capabilities in ieee80211_alloc_proberesp()
3082 * [tlv] HT information in ieee80211_alloc_proberesp()
3083 * [tlv] VHT capabilities in ieee80211_alloc_proberesp()
3084 * [tlv] VHT information in ieee80211_alloc_proberesp()
3085 * [tlv] WPA (optional) in ieee80211_alloc_proberesp()
3086 * [tlv] WME (optional) in ieee80211_alloc_proberesp()
3087 * [tlv] Vendor OUI HT capabilities (optional) in ieee80211_alloc_proberesp()
3088 * [tlv] Vendor OUI HT information (optional) in ieee80211_alloc_proberesp()
3089 * [tlv] Atheros capabilities in ieee80211_alloc_proberesp()
3090 * [tlv] AppIE's (optional) in ieee80211_alloc_proberesp()
3091 * [tlv] Mesh ID (MBSS) in ieee80211_alloc_proberesp()
3092 * [tlv] Mesh Conf (MBSS) in ieee80211_alloc_proberesp()
3095 ic->ic_headroom + sizeof(struct ieee80211_frame), in ieee80211_alloc_proberesp()
3107 + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) in ieee80211_alloc_proberesp()
3124 + (vap->iv_appie_proberesp != NULL ? in ieee80211_alloc_proberesp()
3125 vap->iv_appie_proberesp->ie_len : 0) in ieee80211_alloc_proberesp()
3128 vap->iv_stats.is_tx_nobuf++; in ieee80211_alloc_proberesp()
3134 *(uint16_t *)frm = htole16(bss->ni_intval); in ieee80211_alloc_proberesp()
3136 capinfo = ieee80211_getcapinfo(vap, bss->ni_chan); in ieee80211_alloc_proberesp()
3140 frm = ieee80211_add_ssid(frm, bss->ni_essid, bss->ni_esslen); in ieee80211_alloc_proberesp()
3141 rs = ieee80211_get_suprates(ic, bss->ni_chan); in ieee80211_alloc_proberesp()
3144 if (IEEE80211_IS_CHAN_FHSS(bss->ni_chan)) { in ieee80211_alloc_proberesp()
3147 *frm++ = bss->ni_fhdwell & 0x00ff; in ieee80211_alloc_proberesp()
3148 *frm++ = (bss->ni_fhdwell >> 8) & 0x00ff; in ieee80211_alloc_proberesp()
3150 ieee80211_chan2ieee(ic, bss->ni_chan)); in ieee80211_alloc_proberesp()
3152 ieee80211_chan2ieee(ic, bss->ni_chan)); in ieee80211_alloc_proberesp()
3153 *frm++ = bss->ni_fhindex; in ieee80211_alloc_proberesp()
3157 *frm++ = ieee80211_chan2ieee(ic, bss->ni_chan); in ieee80211_alloc_proberesp()
3160 if (vap->iv_opmode == IEEE80211_M_IBSS) { in ieee80211_alloc_proberesp()
3165 if ((vap->iv_flags & IEEE80211_F_DOTH) || in ieee80211_alloc_proberesp()
3166 (vap->iv_flags_ext & IEEE80211_FEXT_DOTD)) in ieee80211_alloc_proberesp()
3168 if (vap->iv_flags & IEEE80211_F_DOTH) { in ieee80211_alloc_proberesp()
3169 if (IEEE80211_IS_CHAN_5GHZ(bss->ni_chan)) in ieee80211_alloc_proberesp()
3171 if (ic->ic_flags & IEEE80211_F_CSAPENDING) in ieee80211_alloc_proberesp()
3174 if (vap->iv_flags & IEEE80211_F_DOTH) { in ieee80211_alloc_proberesp()
3175 if (IEEE80211_IS_CHAN_DFS(ic->ic_bsschan) && in ieee80211_alloc_proberesp()
3176 (vap->iv_flags_ext & IEEE80211_FEXT_DFS)) { in ieee80211_alloc_proberesp()
3177 if (vap->iv_quiet) in ieee80211_alloc_proberesp()
3181 if (IEEE80211_IS_CHAN_ANYG(bss->ni_chan)) in ieee80211_alloc_proberesp()
3191 if (IEEE80211_IS_CHAN_HT(bss->ni_chan) && in ieee80211_alloc_proberesp()
3196 if (IEEE80211_IS_CHAN_VHT(bss->ni_chan) && in ieee80211_alloc_proberesp()
3202 if (vap->iv_flags & IEEE80211_F_WME) in ieee80211_alloc_proberesp()
3203 frm = ieee80211_add_wme_param(frm, &ic->ic_wme, in ieee80211_alloc_proberesp()
3204 !! (vap->iv_flags_ext & IEEE80211_FEXT_UAPSD)); in ieee80211_alloc_proberesp()
3205 if (IEEE80211_IS_CHAN_HT(bss->ni_chan) && in ieee80211_alloc_proberesp()
3206 (vap->iv_flags_ht & IEEE80211_FHT_HTCOMPAT) && in ieee80211_alloc_proberesp()
3212 if ((vap->iv_flags & IEEE80211_F_ATHEROS) && in ieee80211_alloc_proberesp()
3216 if (vap->iv_appie_proberesp != NULL) in ieee80211_alloc_proberesp()
3217 frm = add_appie(frm, vap->iv_appie_proberesp); in ieee80211_alloc_proberesp()
3219 if (vap->iv_opmode == IEEE80211_M_MBSS) { in ieee80211_alloc_proberesp()
3224 m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); in ieee80211_alloc_proberesp()
3232 * can specify the destination address and re-use the bss node
3239 struct ieee80211_node *bss = vap->iv_bss; in ieee80211_send_proberesp()
3240 struct ieee80211com *ic = vap->iv_ic; in ieee80211_send_proberesp()
3244 if (vap->iv_state == IEEE80211_S_CAC) { in ieee80211_send_proberesp()
3247 vap->iv_stats.is_tx_badstate++; in ieee80211_send_proberesp()
3258 __func__, __LINE__, bss, ether_sprintf(bss->ni_macaddr), in ieee80211_send_proberesp()
3274 IEEE80211_NONQOS_TID, vap->iv_myaddr, da, bss->ni_bssid); in ieee80211_send_proberesp()
3276 m->m_flags |= M_ENCAP; /* mark encapsulated */ in ieee80211_send_proberesp()
3282 ieee80211_chan2ieee(ic, ic->ic_curchan), ether_sprintf(da), in ieee80211_send_proberesp()
3307 rts->i_fc[0] = IEEE80211_FC0_VERSION_0 | in ieee80211_alloc_rts()
3309 rts->i_fc[1] = IEEE80211_FC1_DIR_NODS; in ieee80211_alloc_rts()
3310 *(u_int16_t *)rts->i_dur = htole16(dur); in ieee80211_alloc_rts()
3311 IEEE80211_ADDR_COPY(rts->i_ra, ra); in ieee80211_alloc_rts()
3312 IEEE80211_ADDR_COPY(rts->i_ta, ta); in ieee80211_alloc_rts()
3314 m->m_pkthdr.len = m->m_len = sizeof(struct ieee80211_frame_rts); in ieee80211_alloc_rts()
3333 cts->i_fc[0] = IEEE80211_FC0_VERSION_0 | in ieee80211_alloc_cts()
3335 cts->i_fc[1] = IEEE80211_FC1_DIR_NODS; in ieee80211_alloc_cts()
3336 *(u_int16_t *)cts->i_dur = htole16(dur); in ieee80211_alloc_cts()
3337 IEEE80211_ADDR_COPY(cts->i_ra, ra); in ieee80211_alloc_cts()
3339 m->m_pkthdr.len = m->m_len = sizeof(struct ieee80211_frame_cts); in ieee80211_alloc_cts()
3351 struct ieee80211com *ic = ni->ni_ic; in ieee80211_alloc_prot()
3352 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_alloc_prot()
3363 pktlen = m->m_pkthdr.len + IEEE80211_CRC_LEN; in ieee80211_alloc_prot()
3364 isshort = (vap->iv_flags & IEEE80211_F_SHPREAMBLE) != 0; in ieee80211_alloc_prot()
3365 dur = ieee80211_compute_duration(ic->ic_rt, pktlen, rate, isshort) in ieee80211_alloc_prot()
3366 + ieee80211_ack_duration(ic->ic_rt, rate, isshort); in ieee80211_alloc_prot()
3370 dur += ieee80211_ack_duration(ic->ic_rt, rate, isshort); in ieee80211_alloc_prot()
3371 mprot = ieee80211_alloc_rts(ic, wh->i_addr1, wh->i_addr2, dur); in ieee80211_alloc_prot()
3373 mprot = ieee80211_alloc_cts(ic, vap->iv_myaddr, dur); in ieee80211_alloc_prot()
3385 ieee80211_opmode_name[vap->iv_opmode], in ieee80211_tx_mgt_timeout()
3386 ieee80211_state_name[vap->iv_state], in ieee80211_tx_mgt_timeout()
3387 vap->iv_ic->ic_flags, IEEE80211_F_SCAN); in ieee80211_tx_mgt_timeout()
3389 IEEE80211_LOCK(vap->iv_ic); in ieee80211_tx_mgt_timeout()
3390 if (vap->iv_state != IEEE80211_S_INIT && in ieee80211_tx_mgt_timeout()
3391 (vap->iv_ic->ic_flags & IEEE80211_F_SCAN) == 0) { in ieee80211_tx_mgt_timeout()
3399 IEEE80211_UNLOCK(vap->iv_ic); in ieee80211_tx_mgt_timeout()
3403 * This is the callback set on net80211-sourced transmitted
3419 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_tx_mgt_cb()
3428 * not be too time-critical and not happen too often so the in ieee80211_tx_mgt_cb()
3433 if (vap->iv_state == ostate) { in ieee80211_tx_mgt_cb()
3436 ieee80211_opmode_name[vap->iv_opmode], in ieee80211_tx_mgt_cb()
3437 ieee80211_state_name[vap->iv_state], arg, status); in ieee80211_tx_mgt_cb()
3439 callout_reset(&vap->iv_mgtsend, in ieee80211_tx_mgt_cb()
3449 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_beacon_construct()
3450 struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; in ieee80211_beacon_construct()
3451 struct ieee80211com *ic = ni->ni_ic; in ieee80211_beacon_construct()
3452 struct ieee80211_rateset *rs = &ni->ni_rates; in ieee80211_beacon_construct()
3458 * TODO: update to 802.11-2012; a lot of stuff has changed; in ieee80211_beacon_construct()
3464 * [tlv] ssid in ieee80211_beacon_construct()
3465 * [tlv] supported rates in ieee80211_beacon_construct()
3468 * [tlv] parameter set (IBSS/TIM) in ieee80211_beacon_construct()
3469 * [tlv] country (optional) in ieee80211_beacon_construct()
3475 * [tlv] extended rate phy (ERP) in ieee80211_beacon_construct()
3476 * [tlv] extended supported rates in ieee80211_beacon_construct()
3477 * [tlv] RSN parameters in ieee80211_beacon_construct()
3482 * [tlv] HT capabilities in ieee80211_beacon_construct()
3483 * [tlv] HT information in ieee80211_beacon_construct()
3500 * XXX Vendor-specific OIDs (e.g. Atheros) in ieee80211_beacon_construct()
3501 * [tlv] WPA parameters in ieee80211_beacon_construct()
3502 * [tlv] WME parameters in ieee80211_beacon_construct()
3503 * [tlv] Vendor OUI HT capabilities (optional) in ieee80211_beacon_construct()
3504 * [tlv] Vendor OUI HT information (optional) in ieee80211_beacon_construct()
3505 * [tlv] Atheros capabilities (optional) in ieee80211_beacon_construct()
3506 * [tlv] TDMA parameters (optional) in ieee80211_beacon_construct()
3507 * [tlv] Mesh ID (MBSS) in ieee80211_beacon_construct()
3508 * [tlv] Mesh Conf (MBSS) in ieee80211_beacon_construct()
3509 * [tlv] application data (optional) in ieee80211_beacon_construct()
3516 *(uint16_t *)frm = htole16(ni->ni_intval); in ieee80211_beacon_construct()
3518 capinfo = ieee80211_getcapinfo(vap, ni->ni_chan); in ieee80211_beacon_construct()
3519 bo->bo_caps = (uint16_t *)frm; in ieee80211_beacon_construct()
3523 if ((vap->iv_flags & IEEE80211_F_HIDESSID) == 0) { in ieee80211_beacon_construct()
3524 *frm++ = ni->ni_esslen; in ieee80211_beacon_construct()
3525 memcpy(frm, ni->ni_essid, ni->ni_esslen); in ieee80211_beacon_construct()
3526 frm += ni->ni_esslen; in ieee80211_beacon_construct()
3530 if (!IEEE80211_IS_CHAN_FHSS(ni->ni_chan)) { in ieee80211_beacon_construct()
3533 *frm++ = ieee80211_chan2ieee(ic, ni->ni_chan); in ieee80211_beacon_construct()
3535 if (ic->ic_flags & IEEE80211_F_PCF) { in ieee80211_beacon_construct()
3536 bo->bo_cfp = frm; in ieee80211_beacon_construct()
3539 bo->bo_tim = frm; in ieee80211_beacon_construct()
3540 if (vap->iv_opmode == IEEE80211_M_IBSS) { in ieee80211_beacon_construct()
3544 bo->bo_tim_len = 0; in ieee80211_beacon_construct()
3545 } else if (vap->iv_opmode == IEEE80211_M_HOSTAP || in ieee80211_beacon_construct()
3546 vap->iv_opmode == IEEE80211_M_MBSS) { in ieee80211_beacon_construct()
3550 tie->tim_ie = IEEE80211_ELEMID_TIM; in ieee80211_beacon_construct()
3551 tie->tim_len = 4; /* length */ in ieee80211_beacon_construct()
3552 tie->tim_count = 0; /* DTIM count */ in ieee80211_beacon_construct()
3553 tie->tim_period = vap->iv_dtim_period; /* DTIM period */ in ieee80211_beacon_construct()
3554 tie->tim_bitctl = 0; /* bitmap control */ in ieee80211_beacon_construct()
3555 tie->tim_bitmap[0] = 0; /* Partial Virtual Bitmap */ in ieee80211_beacon_construct()
3557 bo->bo_tim_len = 1; in ieee80211_beacon_construct()
3559 bo->bo_tim_trailer = frm; in ieee80211_beacon_construct()
3560 if ((vap->iv_flags & IEEE80211_F_DOTH) || in ieee80211_beacon_construct()
3561 (vap->iv_flags_ext & IEEE80211_FEXT_DOTD)) in ieee80211_beacon_construct()
3563 if (vap->iv_flags & IEEE80211_F_DOTH) { in ieee80211_beacon_construct()
3564 if (IEEE80211_IS_CHAN_5GHZ(ni->ni_chan)) in ieee80211_beacon_construct()
3566 bo->bo_csa = frm; in ieee80211_beacon_construct()
3567 if (ic->ic_flags & IEEE80211_F_CSAPENDING) in ieee80211_beacon_construct()
3570 bo->bo_csa = frm; in ieee80211_beacon_construct()
3572 bo->bo_quiet = NULL; in ieee80211_beacon_construct()
3573 if (vap->iv_flags & IEEE80211_F_DOTH) { in ieee80211_beacon_construct()
3574 if (IEEE80211_IS_CHAN_DFS(ic->ic_bsschan) && in ieee80211_beacon_construct()
3575 (vap->iv_flags_ext & IEEE80211_FEXT_DFS) && in ieee80211_beacon_construct()
3576 (vap->iv_quiet == 1)) { in ieee80211_beacon_construct()
3583 if (vap->iv_quiet) { in ieee80211_beacon_construct()
3584 bo->bo_quiet = frm; in ieee80211_beacon_construct()
3590 if (IEEE80211_IS_CHAN_ANYG(ni->ni_chan)) { in ieee80211_beacon_construct()
3591 bo->bo_erp = frm; in ieee80211_beacon_construct()
3596 if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { in ieee80211_beacon_construct()
3598 bo->bo_htinfo = frm; in ieee80211_beacon_construct()
3602 if (IEEE80211_IS_CHAN_VHT(ni->ni_chan)) { in ieee80211_beacon_construct()
3604 bo->bo_vhtinfo = frm; in ieee80211_beacon_construct()
3612 if (vap->iv_flags & IEEE80211_F_WME) { in ieee80211_beacon_construct()
3613 bo->bo_wme = frm; in ieee80211_beacon_construct()
3614 frm = ieee80211_add_wme_param(frm, &ic->ic_wme, in ieee80211_beacon_construct()
3615 !! (vap->iv_flags_ext & IEEE80211_FEXT_UAPSD)); in ieee80211_beacon_construct()
3617 if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && in ieee80211_beacon_construct()
3618 (vap->iv_flags_ht & IEEE80211_FHT_HTCOMPAT)) { in ieee80211_beacon_construct()
3624 if (vap->iv_flags & IEEE80211_F_ATHEROS) { in ieee80211_beacon_construct()
3625 bo->bo_ath = frm; in ieee80211_beacon_construct()
3630 if (vap->iv_caps & IEEE80211_C_TDMA) { in ieee80211_beacon_construct()
3631 bo->bo_tdma = frm; in ieee80211_beacon_construct()
3635 if (vap->iv_appie_beacon != NULL) { in ieee80211_beacon_construct()
3636 bo->bo_appie = frm; in ieee80211_beacon_construct()
3637 bo->bo_appie_len = vap->iv_appie_beacon->ie_len; in ieee80211_beacon_construct()
3638 frm = add_appie(frm, vap->iv_appie_beacon); in ieee80211_beacon_construct()
3643 if (vap->iv_opmode == IEEE80211_M_MBSS) { in ieee80211_beacon_construct()
3645 bo->bo_meshconf = frm; in ieee80211_beacon_construct()
3649 bo->bo_tim_trailer_len = frm - bo->bo_tim_trailer; in ieee80211_beacon_construct()
3650 bo->bo_csa_trailer_len = frm - bo->bo_csa; in ieee80211_beacon_construct()
3651 m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); in ieee80211_beacon_construct()
3660 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_beacon_alloc()
3661 struct ieee80211com *ic = ni->ni_ic; in ieee80211_beacon_alloc()
3662 struct ifnet *ifp = vap->iv_ifp; in ieee80211_beacon_alloc()
3671 if (vap->iv_quiet == 1) in ieee80211_beacon_alloc()
3672 vap->iv_flags_ext |= IEEE80211_FEXT_QUIET_IE; in ieee80211_beacon_alloc()
3673 else if (vap->iv_quiet == 0) in ieee80211_beacon_alloc()
3674 vap->iv_flags_ext &= ~IEEE80211_FEXT_QUIET_IE; in ieee80211_beacon_alloc()
3679 * Note: This needs updating for 802.11-2012. in ieee80211_beacon_alloc()
3684 * [tlv] ssid in ieee80211_beacon_alloc()
3685 * [tlv] supported rates in ieee80211_beacon_alloc()
3688 * [tlv] parameter set (IBSS/TIM) in ieee80211_beacon_alloc()
3689 * [tlv] country (optional) in ieee80211_beacon_alloc()
3692 * [tlv] extended rate phy (ERP) in ieee80211_beacon_alloc()
3693 * [tlv] extended supported rates in ieee80211_beacon_alloc()
3694 * [tlv] RSN parameters in ieee80211_beacon_alloc()
3695 * [tlv] HT capabilities in ieee80211_beacon_alloc()
3696 * [tlv] HT information in ieee80211_beacon_alloc()
3697 * [tlv] VHT capabilities in ieee80211_beacon_alloc()
3698 * [tlv] VHT operation in ieee80211_beacon_alloc()
3699 * [tlv] Vendor OUI HT capabilities (optional) in ieee80211_beacon_alloc()
3700 * [tlv] Vendor OUI HT information (optional) in ieee80211_beacon_alloc()
3701 * XXX Vendor-specific OIDs (e.g. Atheros) in ieee80211_beacon_alloc()
3702 * [tlv] WPA parameters in ieee80211_beacon_alloc()
3703 * [tlv] WME parameters in ieee80211_beacon_alloc()
3704 * [tlv] TDMA parameters (optional) in ieee80211_beacon_alloc()
3705 * [tlv] Mesh ID (MBSS) in ieee80211_beacon_alloc()
3706 * [tlv] Mesh Conf (MBSS) in ieee80211_beacon_alloc()
3707 * [tlv] application data (optional) in ieee80211_beacon_alloc()
3714 + 2 + ni->ni_esslen /* ssid */ in ieee80211_beacon_alloc()
3718 + 2 + 4 + vap->iv_tim_len /* DTIM/IBSSPARMS */ in ieee80211_beacon_alloc()
3724 + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) in ieee80211_beacon_alloc()
3725 + (vap->iv_caps & IEEE80211_C_WPA ? /* WPA 1+2 */ in ieee80211_beacon_alloc()
3732 + (vap->iv_caps & IEEE80211_C_WME ? /* WME */ in ieee80211_beacon_alloc()
3738 + (vap->iv_caps & IEEE80211_C_TDMA ? /* TDMA */ in ieee80211_beacon_alloc()
3742 + 2 + ni->ni_meshidlen in ieee80211_beacon_alloc()
3748 ic->ic_headroom + sizeof(struct ieee80211_frame), pktlen); in ieee80211_beacon_alloc()
3752 vap->iv_stats.is_tx_nobuf++; in ieee80211_beacon_alloc()
3760 wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_MGT | in ieee80211_beacon_alloc()
3762 wh->i_fc[1] = IEEE80211_FC1_DIR_NODS; in ieee80211_beacon_alloc()
3763 *(uint16_t *)wh->i_dur = 0; in ieee80211_beacon_alloc()
3764 IEEE80211_ADDR_COPY(wh->i_addr1, ifp->if_broadcastaddr); in ieee80211_beacon_alloc()
3765 IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr); in ieee80211_beacon_alloc()
3766 IEEE80211_ADDR_COPY(wh->i_addr3, ni->ni_bssid); in ieee80211_beacon_alloc()
3767 *(uint16_t *)wh->i_seq = 0; in ieee80211_beacon_alloc()
3778 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_beacon_update()
3779 struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; in ieee80211_beacon_update()
3780 struct ieee80211com *ic = ni->ni_ic; in ieee80211_beacon_update()
3794 if (isset(bo->bo_flags, IEEE80211_BEACON_CSA) && in ieee80211_beacon_update()
3795 vap->iv_csa_count == ic->ic_csa_count) { in ieee80211_beacon_update()
3796 vap->iv_csa_count = 0; in ieee80211_beacon_update()
3801 if (ic->ic_csa_newchan != NULL) in ieee80211_beacon_update()
3819 * beacon - that way the gap is provided as appropriate. in ieee80211_beacon_update()
3824 if ((vap->iv_flags_ext & IEEE80211_FEXT_QUIET_IE) && in ieee80211_beacon_update()
3825 (vap->iv_quiet == 0)) { in ieee80211_beacon_update()
3830 vap->iv_flags_ext &= ~IEEE80211_FEXT_QUIET_IE; in ieee80211_beacon_update()
3838 if (((vap->iv_flags_ext & IEEE80211_FEXT_QUIET_IE) == 0) && in ieee80211_beacon_update()
3839 (vap->iv_quiet == 1)) { in ieee80211_beacon_update()
3844 vap->iv_flags_ext |= IEEE80211_FEXT_QUIET_IE; in ieee80211_beacon_update()
3856 * lock held so as to serialise access to the non-qos TID sequence in ieee80211_beacon_update()
3862 seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++; in ieee80211_beacon_update()
3863 *(uint16_t *)&wh->i_seq[0] = in ieee80211_beacon_update()
3868 capinfo = ieee80211_getcapinfo(vap, ni->ni_chan); in ieee80211_beacon_update()
3869 *bo->bo_caps = htole16(capinfo); in ieee80211_beacon_update()
3871 if (vap->iv_flags & IEEE80211_F_WME) { in ieee80211_beacon_update()
3872 struct ieee80211_wme_state *wme = &ic->ic_wme; in ieee80211_beacon_update()
3879 * to optimize performance of legacy/non-QoS traffic. in ieee80211_beacon_update()
3881 if (wme->wme_flags & WME_F_AGGRMODE) { in ieee80211_beacon_update()
3882 if (wme->wme_hipri_traffic > in ieee80211_beacon_update()
3883 wme->wme_hipri_switch_thresh) { in ieee80211_beacon_update()
3886 __func__, wme->wme_hipri_traffic); in ieee80211_beacon_update()
3887 wme->wme_flags &= ~WME_F_AGGRMODE; in ieee80211_beacon_update()
3889 wme->wme_hipri_traffic = in ieee80211_beacon_update()
3890 wme->wme_hipri_switch_hysteresis; in ieee80211_beacon_update()
3892 wme->wme_hipri_traffic = 0; in ieee80211_beacon_update()
3894 if (wme->wme_hipri_traffic <= in ieee80211_beacon_update()
3895 wme->wme_hipri_switch_thresh) { in ieee80211_beacon_update()
3898 __func__, wme->wme_hipri_traffic); in ieee80211_beacon_update()
3899 wme->wme_flags |= WME_F_AGGRMODE; in ieee80211_beacon_update()
3901 wme->wme_hipri_traffic = 0; in ieee80211_beacon_update()
3903 wme->wme_hipri_traffic = in ieee80211_beacon_update()
3904 wme->wme_hipri_switch_hysteresis; in ieee80211_beacon_update()
3906 if (isset(bo->bo_flags, IEEE80211_BEACON_WME)) { in ieee80211_beacon_update()
3907 (void) ieee80211_add_wme_param(bo->bo_wme, wme, in ieee80211_beacon_update()
3908 vap->iv_flags_ext & IEEE80211_FEXT_UAPSD); in ieee80211_beacon_update()
3909 clrbit(bo->bo_flags, IEEE80211_BEACON_WME); in ieee80211_beacon_update()
3913 if (isset(bo->bo_flags, IEEE80211_BEACON_HTINFO)) { in ieee80211_beacon_update()
3915 clrbit(bo->bo_flags, IEEE80211_BEACON_HTINFO); in ieee80211_beacon_update()
3918 if (vap->iv_caps & IEEE80211_C_TDMA) { in ieee80211_beacon_update()
3926 if (vap->iv_opmode == IEEE80211_M_MBSS) in ieee80211_beacon_update()
3930 if (vap->iv_opmode == IEEE80211_M_HOSTAP || in ieee80211_beacon_update()
3931 vap->iv_opmode == IEEE80211_M_MBSS) { /* NB: no IBSS support*/ in ieee80211_beacon_update()
3933 (struct ieee80211_tim_ie *) bo->bo_tim; in ieee80211_beacon_update()
3934 if (isset(bo->bo_flags, IEEE80211_BEACON_TIM)) { in ieee80211_beacon_update()
3943 * maximal-size virtual bitmap (based on iv_max_aid). in ieee80211_beacon_update()
3952 if (vap->iv_ps_pending != 0) { in ieee80211_beacon_update()
3954 for (i = 0; i < vap->iv_tim_len; i++) in ieee80211_beacon_update()
3955 if (vap->iv_tim_bitmap[i]) { in ieee80211_beacon_update()
3960 for (i = vap->iv_tim_len-1; i >= timoff; i--) in ieee80211_beacon_update()
3961 if (vap->iv_tim_bitmap[i]) in ieee80211_beacon_update()
3963 timlen = 1 + (i - timoff); in ieee80211_beacon_update()
3972 if (timlen != bo->bo_tim_len) { in ieee80211_beacon_update()
3974 int adjust = tie->tim_bitmap+timlen in ieee80211_beacon_update()
3975 - bo->bo_tim_trailer; in ieee80211_beacon_update()
3976 ovbcopy(bo->bo_tim_trailer, in ieee80211_beacon_update()
3977 bo->bo_tim_trailer+adjust, in ieee80211_beacon_update()
3978 bo->bo_tim_trailer_len); in ieee80211_beacon_update()
3979 bo->bo_tim_trailer += adjust; in ieee80211_beacon_update()
3980 bo->bo_erp += adjust; in ieee80211_beacon_update()
3981 bo->bo_htinfo += adjust; in ieee80211_beacon_update()
3982 bo->bo_vhtinfo += adjust; in ieee80211_beacon_update()
3984 bo->bo_ath += adjust; in ieee80211_beacon_update()
3987 bo->bo_tdma += adjust; in ieee80211_beacon_update()
3990 bo->bo_meshconf += adjust; in ieee80211_beacon_update()
3992 bo->bo_appie += adjust; in ieee80211_beacon_update()
3993 bo->bo_wme += adjust; in ieee80211_beacon_update()
3994 bo->bo_csa += adjust; in ieee80211_beacon_update()
3995 bo->bo_quiet += adjust; in ieee80211_beacon_update()
3996 bo->bo_tim_len = timlen; in ieee80211_beacon_update()
3999 tie->tim_len = 3 + timlen; in ieee80211_beacon_update()
4000 tie->tim_bitctl = timoff; in ieee80211_beacon_update()
4003 memcpy(tie->tim_bitmap, vap->iv_tim_bitmap + timoff, in ieee80211_beacon_update()
4004 bo->bo_tim_len); in ieee80211_beacon_update()
4006 clrbit(bo->bo_flags, IEEE80211_BEACON_TIM); in ieee80211_beacon_update()
4010 __func__, vap->iv_ps_pending, timoff, timlen); in ieee80211_beacon_update()
4013 if (tie->tim_count == 0) in ieee80211_beacon_update()
4014 tie->tim_count = tie->tim_period - 1; in ieee80211_beacon_update()
4016 tie->tim_count--; in ieee80211_beacon_update()
4018 if (mcast && tie->tim_count == 0) in ieee80211_beacon_update()
4019 tie->tim_bitctl |= 1; in ieee80211_beacon_update()
4021 tie->tim_bitctl &= ~1; in ieee80211_beacon_update()
4022 if (isset(bo->bo_flags, IEEE80211_BEACON_CSA)) { in ieee80211_beacon_update()
4024 (struct ieee80211_csa_ie *) bo->bo_csa; in ieee80211_beacon_update()
4033 if (vap->iv_csa_count == 0) { in ieee80211_beacon_update()
4034 memmove(&csa[1], csa, bo->bo_csa_trailer_len); in ieee80211_beacon_update()
4035 bo->bo_erp += sizeof(*csa); in ieee80211_beacon_update()
4036 bo->bo_htinfo += sizeof(*csa); in ieee80211_beacon_update()
4037 bo->bo_vhtinfo += sizeof(*csa); in ieee80211_beacon_update()
4038 bo->bo_wme += sizeof(*csa); in ieee80211_beacon_update()
4040 bo->bo_ath += sizeof(*csa); in ieee80211_beacon_update()
4043 bo->bo_tdma += sizeof(*csa); in ieee80211_beacon_update()
4046 bo->bo_meshconf += sizeof(*csa); in ieee80211_beacon_update()
4048 bo->bo_appie += sizeof(*csa); in ieee80211_beacon_update()
4049 bo->bo_csa_trailer_len += sizeof(*csa); in ieee80211_beacon_update()
4050 bo->bo_quiet += sizeof(*csa); in ieee80211_beacon_update()
4051 bo->bo_tim_trailer_len += sizeof(*csa); in ieee80211_beacon_update()
4052 m->m_len += sizeof(*csa); in ieee80211_beacon_update()
4053 m->m_pkthdr.len += sizeof(*csa); in ieee80211_beacon_update()
4055 ieee80211_add_csa(bo->bo_csa, vap); in ieee80211_beacon_update()
4057 csa->csa_count--; in ieee80211_beacon_update()
4058 vap->iv_csa_count++; in ieee80211_beacon_update()
4066 if (IEEE80211_IS_CHAN_DFS(ic->ic_bsschan) && in ieee80211_beacon_update()
4067 (vap->iv_flags_ext & IEEE80211_FEXT_DFS)) { in ieee80211_beacon_update()
4068 if (vap->iv_quiet && in ieee80211_beacon_update()
4069 (vap->iv_flags_ext & IEEE80211_FEXT_QUIET_IE)) { in ieee80211_beacon_update()
4070 ieee80211_add_quiet(bo->bo_quiet, vap, 1); in ieee80211_beacon_update()
4073 if (isset(bo->bo_flags, IEEE80211_BEACON_ERP)) { in ieee80211_beacon_update()
4077 (void) ieee80211_add_erp(bo->bo_erp, vap); in ieee80211_beacon_update()
4078 clrbit(bo->bo_flags, IEEE80211_BEACON_ERP); in ieee80211_beacon_update()
4081 if (isset(bo->bo_flags, IEEE80211_BEACON_ATH)) { in ieee80211_beacon_update()
4082 ieee80211_add_athcaps(bo->bo_ath, ni); in ieee80211_beacon_update()
4083 clrbit(bo->bo_flags, IEEE80211_BEACON_ATH); in ieee80211_beacon_update()
4087 if (isset(bo->bo_flags, IEEE80211_BEACON_APPIE)) { in ieee80211_beacon_update()
4088 const struct ieee80211_appie *aie = vap->iv_appie_beacon; in ieee80211_beacon_update()
4094 aielen += aie->ie_len; in ieee80211_beacon_update()
4095 if (aielen != bo->bo_appie_len) { in ieee80211_beacon_update()
4097 int adjust = aielen - bo->bo_appie_len; in ieee80211_beacon_update()
4098 ovbcopy(bo->bo_tim_trailer, bo->bo_tim_trailer+adjust, in ieee80211_beacon_update()
4099 bo->bo_tim_trailer_len); in ieee80211_beacon_update()
4100 bo->bo_tim_trailer += adjust; in ieee80211_beacon_update()
4101 bo->bo_appie += adjust; in ieee80211_beacon_update()
4102 bo->bo_appie_len = aielen; in ieee80211_beacon_update()
4106 frm = bo->bo_appie; in ieee80211_beacon_update()
4109 clrbit(bo->bo_flags, IEEE80211_BEACON_APPIE); in ieee80211_beacon_update()
4117 * Do Ethernet-LLC encapsulation for each payload in a fast frame
4131 m_adj(m, sizeof(struct ether_header) - sizeof(struct llc)); in ieee80211_ff_encap1()
4133 llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; in ieee80211_ff_encap1()
4134 llc->llc_control = LLC_UI; in ieee80211_ff_encap1()
4135 llc->llc_snap.org_code[0] = 0; in ieee80211_ff_encap1()
4136 llc->llc_snap.org_code[1] = 0; in ieee80211_ff_encap1()
4137 llc->llc_snap.org_code[2] = 0; in ieee80211_ff_encap1()
4138 llc->llc_snap.ether_type = eh->ether_type; in ieee80211_ff_encap1()
4139 payload = m->m_pkthdr.len; /* NB: w/o Ethernet header */ in ieee80211_ff_encap1()
4145 vap->iv_stats.is_tx_nobuf++; in ieee80211_ff_encap1()
4149 mtod(m, struct ether_header *)->ether_type = htons(payload); in ieee80211_ff_encap1()
4162 * and already transmitted, it may end up doing A-MPDU retransmission,
4177 struct ifnet *ifp = ni->ni_vap->iv_ifp; in ieee80211_tx_complete()
4180 if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len); in ieee80211_tx_complete()
4182 if (m->m_flags & M_MCAST) in ieee80211_tx_complete()
4186 if (m->m_flags & M_TXCB) { in ieee80211_tx_complete()
4187 IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, in ieee80211_tx_complete()
4188 "ni %p vap %p mode %s state %s m %p status %d\n", ni, ni->ni_vap, in ieee80211_tx_complete()
4189 ieee80211_opmode_name[ni->ni_vap->iv_opmode], in ieee80211_tx_complete()
4190 ieee80211_state_name[ni->ni_vap->iv_state], m, status); in ieee80211_tx_complete()