FreeBSD kernel WLAN code
ieee80211_sta.c File Reference
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_wlan.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/endian.h>
#include <sys/errno.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <net/if_media.h>
#include <net/if_llc.h>
#include <net/if_dl.h>
#include <net/if_var.h>
#include <net/ethernet.h>
#include <net/bpf.h>
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_sta.h>
#include <net80211/ieee80211_input.h>
#include <net80211/ieee80211_ratectl.h>
#include <net80211/ieee80211_vht.h>
Include dependency graph for ieee80211_sta.c:

Go to the source code of this file.

Macros

#define IEEE80211_RATE2MBS(r)   (((r) & IEEE80211_RATE_VAL) / 2)
 
#define QWH4(wh)   ((const struct ieee80211_qosframe_addr4 *)wh)
 
#define WH4(wh)   ((const struct ieee80211_frame_addr4 *)wh)
 
#define ISREASSOC(_st)   ((_st) == IEEE80211_FC0_SUBTYPE_REASSOC_RESP)
 

Functions

 __FBSDID ("$FreeBSD$")
 
static void sta_vattach (struct ieee80211vap *)
 
static void sta_beacon_miss (struct ieee80211vap *)
 
static int sta_newstate (struct ieee80211vap *, enum ieee80211_state, int)
 
static int sta_input (struct ieee80211_node *, struct mbuf *, const struct ieee80211_rx_stats *, int, int)
 
static void sta_recv_mgmt (struct ieee80211_node *, struct mbuf *, int subtype, const struct ieee80211_rx_stats *, int rssi, int nf)
 
static void sta_recv_ctl (struct ieee80211_node *, struct mbuf *, int subtype)
 
void ieee80211_sta_attach (struct ieee80211com *ic)
 
void ieee80211_sta_detach (struct ieee80211com *ic)
 
static void sta_vdetach (struct ieee80211vap *vap)
 
static void sta_authretry (struct ieee80211vap *vap, struct ieee80211_node *ni, int reason)
 
static void sta_swbmiss_start (struct ieee80211vap *vap)
 
static __inline int isdstods_mcastecho (struct ieee80211vap *vap, const struct ieee80211_frame *wh)
 
static __inline int isfromds_mcastecho (struct ieee80211vap *vap, const struct ieee80211_frame *wh)
 
static __inline int doprint (struct ieee80211vap *vap, int subtype)
 
static void sta_auth_open (struct ieee80211_node *ni, struct ieee80211_frame *wh, int rssi, int nf, uint16_t seq, uint16_t status)
 
static void sta_auth_shared (struct ieee80211_node *ni, struct ieee80211_frame *wh, uint8_t *frm, uint8_t *efrm, int rssi, int nf, uint16_t seq, uint16_t status)
 
int ieee80211_parse_wmeie (uint8_t *frm, const struct ieee80211_frame *wh, struct ieee80211_node *ni)
 
int ieee80211_parse_wmeparams (struct ieee80211vap *vap, uint8_t *frm, const struct ieee80211_frame *wh, uint8_t *qosinfo)
 
static void ieee80211_parse_csaparams (struct ieee80211vap *vap, uint8_t *frm, const struct ieee80211_frame *wh)
 
static __inline int contbgscan (struct ieee80211vap *vap)
 
static __inline int startbgscan (struct ieee80211vap *vap)
 

Macro Definition Documentation

◆ IEEE80211_RATE2MBS

#define IEEE80211_RATE2MBS (   r)    (((r) & IEEE80211_RATE_VAL) / 2)

Definition at line 71 of file ieee80211_sta.c.

◆ ISREASSOC

#define ISREASSOC (   _st)    ((_st) == IEEE80211_FC0_SUBTYPE_REASSOC_RESP)

◆ QWH4

#define QWH4 (   wh)    ((const struct ieee80211_qosframe_addr4 *)wh)

◆ WH4

#define WH4 (   wh)    ((const struct ieee80211_frame_addr4 *)wh)

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ contbgscan()

◆ doprint()

static __inline int doprint ( struct ieee80211vap vap,
int  subtype 
)
static

Definition at line 518 of file ieee80211_sta.c.

References ieee80211com::ic_flags, IEEE80211_F_SCAN, IEEE80211_FC0_SUBTYPE_BEACON, IEEE80211_FC0_SUBTYPE_PROBE_REQ, and ieee80211vap::iv_ic.

Referenced by sta_input().

Here is the caller graph for this function:

◆ ieee80211_parse_csaparams()

◆ ieee80211_parse_wmeie()

int ieee80211_parse_wmeie ( uint8_t *  frm,
const struct ieee80211_frame wh,
struct ieee80211_node ni 
)

◆ ieee80211_parse_wmeparams()

◆ ieee80211_sta_attach()

void ieee80211_sta_attach ( struct ieee80211com ic)

Definition at line 83 of file ieee80211_sta.c.

References ieee80211com::ic_vattach, IEEE80211_M_STA, and sta_vattach().

Referenced by ieee80211_proto_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ieee80211_sta_detach()

void ieee80211_sta_detach ( struct ieee80211com ic)

Definition at line 89 of file ieee80211_sta.c.

Referenced by ieee80211_proto_detach().

Here is the caller graph for this function:

◆ isdstods_mcastecho()

static __inline int isdstods_mcastecho ( struct ieee80211vap vap,
const struct ieee80211_frame wh 
)
static

Definition at line 481 of file ieee80211_sta.c.

References ieee80211_frame::i_addr3, IEEE80211_ADDR_EQ, IEEE80211_IS_MULTICAST, IEEE80211_M_STA, IEEE80211_QOS_HAS_SEQ, ieee80211vap::iv_myaddr, ieee80211vap::iv_opmode, QWH4, and WH4.

Referenced by sta_input().

Here is the caller graph for this function:

◆ isfromds_mcastecho()

static __inline int isfromds_mcastecho ( struct ieee80211vap vap,
const struct ieee80211_frame wh 
)
static

Definition at line 502 of file ieee80211_sta.c.

References ieee80211_frame::i_addr1, ieee80211_frame::i_addr3, IEEE80211_ADDR_EQ, IEEE80211_IS_MULTICAST, IEEE80211_M_STA, ieee80211vap::iv_myaddr, and ieee80211vap::iv_opmode.

Referenced by sta_input().

Here is the caller graph for this function:

◆ sta_auth_open()

◆ sta_auth_shared()

◆ sta_authretry()

◆ sta_beacon_miss()

◆ sta_input()

static int sta_input ( struct ieee80211_node ni,
struct mbuf *  m,
const struct ieee80211_rx_stats rxs,
int  rssi,
int  nf 
)
static

Definition at line 540 of file ieee80211_sta.c.

References ieee80211_rx_stats::c_pktflags, doprint(), ieee80211_frame::i_addr1, ieee80211_frame::i_addr2, ieee80211_frame::i_fc, ieee80211com::ic_flags, ieee80211com::ic_wme, IEEE80211_ADDR_EQ, ieee80211_ampdu_reorder(), ieee80211_anyhdrsize(), ieee80211_check_rxseq(), ieee80211_crypto_decap(), ieee80211_crypto_demic(), ieee80211_decap(), ieee80211_decap_amsdu(), ieee80211_decap_fastframe(), ieee80211_defrag(), ieee80211_deliver_data(), IEEE80211_DISCARD, IEEE80211_DISCARD_MAC, IEEE80211_F_DROPUNENC, IEEE80211_F_DWDS, IEEE80211_F_PRIVACY, IEEE80211_F_SCAN, IEEE80211_FC0_SUBTYPE_AUTH, IEEE80211_FC0_SUBTYPE_MASK, IEEE80211_FC0_SUBTYPE_NODATA, IEEE80211_FC0_SUBTYPE_QOS, IEEE80211_FC0_SUBTYPE_QOS_NULL, IEEE80211_FC0_TYPE_CTL, IEEE80211_FC0_TYPE_DATA, IEEE80211_FC0_TYPE_MASK, IEEE80211_FC0_TYPE_MGT, IEEE80211_FC0_VERSION_0, IEEE80211_FC0_VERSION_MASK, IEEE80211_FC1_DIR_DSTODS, IEEE80211_FC1_DIR_FROMDS, IEEE80211_FC1_DIR_MASK, IEEE80211_FC1_DIR_NODS, IEEE80211_FC1_PROTECTED, ieee80211_getqos(), ieee80211_gettid(), IEEE80211_HAS_SEQ, ieee80211_hdrspace(), IEEE80211_IS_MULTICAST, ieee80211_mgt_subtype_name(), IEEE80211_MSG_ANY, ieee80211_msg_dumppkts, IEEE80211_MSG_INPUT, ieee80211_node_is_authorized(), IEEE80211_NODE_STAT, IEEE80211_QOS_AMSDU, IEEE80211_QOS_HAS_SEQ, ieee80211_radiotap_active_vap(), ieee80211_radiotap_rx(), IEEE80211_RSSI_LPF, IEEE80211_RX_F_DECRYPTED, ieee80211_stats::is_rx_badversion, ieee80211_stats::is_rx_ctl, ieee80211_stats::is_rx_decap, ieee80211_stats::is_rx_demicfail, ieee80211_stats::is_rx_mcastecho, ieee80211_stats::is_rx_mgmt, ieee80211_stats::is_rx_mgtdiscard, ieee80211_stats::is_rx_noprivacy, ieee80211_stats::is_rx_tooshort, ieee80211_stats::is_rx_unauth, ieee80211_stats::is_rx_unencrypted, ieee80211_stats::is_rx_wrongbss, ieee80211_stats::is_rx_wrongdir, isdstods_mcastecho(), isfromds_mcastecho(), ieee80211vap::iv_flags, ieee80211vap::iv_ifp, ieee80211vap::iv_recv_ctl, ieee80211vap::iv_recv_mgmt, ieee80211vap::iv_stats, M_AMPDU, M_AMPDU_MPDU, M_WEP, ieee80211_node::ni_avgrssi, ieee80211_node::ni_bssid, ieee80211_node::ni_ic, ieee80211_node::ni_inact, ieee80211_node::ni_inact_reload, ieee80211_node::ni_macaddr, ieee80211_node::ni_noise, ieee80211_node::ni_vap, TID_TO_WME_AC, WME_AC_VI, and ieee80211_wme_state::wme_hipri_traffic.

Referenced by sta_vattach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sta_newstate()

static int sta_newstate ( struct ieee80211vap vap,
enum ieee80211_state  nstate,
int  arg 
)
static

Definition at line 234 of file ieee80211_sta.c.

References ieee80211_authenticator::ia_detach, ieee80211com::ic_curchan, ieee80211com::ic_newassoc, IEEE80211_AUTH_8021X, ieee80211_cancel_scan(), ieee80211_chan2ieee(), ieee80211_check_scan(), ieee80211_check_scan_current(), IEEE80211_DPRINTF, IEEE80211_F_WPA, IEEE80211_FC0_SUBTYPE_ASSOC_REQ, IEEE80211_FC0_SUBTYPE_ASSOC_RESP, IEEE80211_FC0_SUBTYPE_AUTH, IEEE80211_FC0_SUBTYPE_DEAUTH, IEEE80211_FC0_SUBTYPE_DISASSOC, IEEE80211_FC0_SUBTYPE_REASSOC_REQ, IEEE80211_FEXT_SCANREQ, IEEE80211_FEXT_SWBMISS, IEEE80211_LOCK_ASSERT, IEEE80211_M_STA, IEEE80211_MSG_STATE, ieee80211_node_authorize(), ieee80211_notify_node_join(), ieee80211_print_essid(), IEEE80211_RATE2MBS, IEEE80211_REASON_ASSOC_LEAVE, IEEE80211_REASON_AUTH_LEAVE, ieee80211_reset_bss(), IEEE80211_ROAMING_AUTO, IEEE80211_S_ASSOC, IEEE80211_S_AUTH, IEEE80211_S_CSA, IEEE80211_S_INIT, IEEE80211_S_RUN, IEEE80211_S_SCAN, IEEE80211_S_SLEEP, ieee80211_scan_assoc_fail(), ieee80211_scan_assoc_success(), IEEE80211_SEND_MGMT, ieee80211_sta_leave(), ieee80211_state_name, ieee80211_sync_curchan(), ieee80211vap::iv_auth, ieee80211vap::iv_bss, ieee80211vap::iv_flags, ieee80211vap::iv_flags_ext, ieee80211vap::iv_ic, ieee80211vap::iv_mgtsend, ieee80211vap::iv_opmode, ieee80211vap::iv_roaming, ieee80211vap::iv_scanreq_duration, ieee80211vap::iv_scanreq_flags, ieee80211vap::iv_scanreq_maxdwell, ieee80211vap::iv_scanreq_mindwell, ieee80211vap::iv_scanreq_nssid, ieee80211vap::iv_scanreq_ssid, ieee80211vap::iv_sta_ps, ieee80211vap::iv_state, ieee80211vap::iv_swbmiss, ieee80211_node::ni_authmode, ieee80211_node::ni_bssid, ieee80211_node::ni_essid, ieee80211_node::ni_esslen, ieee80211_node::ni_macaddr, ieee80211_node::ni_txrate, sta_authretry(), and sta_swbmiss_start().

Referenced by sta_vattach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sta_recv_ctl()

static void sta_recv_ctl ( struct ieee80211_node ni,
struct mbuf *  m,
int  subtype 
)
static

Definition at line 2063 of file ieee80211_sta.c.

References IEEE80211_FC0_SUBTYPE_BAR, and ieee80211_recv_bar().

Referenced by sta_vattach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sta_recv_mgmt()

static void sta_recv_mgmt ( struct ieee80211_node ni,
struct mbuf *  m0,
int  subtype,
const struct ieee80211_rx_stats rxs,
int  rssi,
int  nf 
)
static

Definition at line 1399 of file ieee80211_sta.c.

References ieee80211_scanparams::ath, ieee80211_scanparams::capinfo, contbgscan(), ieee80211_scanparams::csa, ieee80211_node::data, ieee80211_scanparams::erp, ieee80211_scanparams::htcap, ieee80211_scanparams::htinfo, ieee80211_frame::i_addr1, ieee80211_frame::i_addr2, ieee80211com::ic_bsschan, ieee80211com::ic_curchan, ieee80211com::ic_flags, ieee80211com::ic_flags_ext, ieee80211com::ic_lastdata, ieee80211com::ic_recv_action, ieee80211com::ic_set_quiet, ieee80211_add_scan(), IEEE80211_ADDR_EQ, IEEE80211_AID, IEEE80211_ATH_CAP, IEEE80211_AUTH_ALG_OPEN, IEEE80211_AUTH_ALG_SHARED, ieee80211_bg_scan(), IEEE80211_CAPINFO_SHORT_PREAMBLE, IEEE80211_CAPINFO_SHORT_SLOTTIME, ieee80211_csa_cancelswitch(), IEEE80211_DISCARD, IEEE80211_ELEMID_HTCAP, IEEE80211_ELEMID_HTINFO, IEEE80211_ELEMID_RATES, IEEE80211_ELEMID_VENDOR, IEEE80211_ELEMID_VHT_CAP, IEEE80211_ELEMID_VHT_OPMODE, IEEE80211_ELEMID_XRATES, IEEE80211_ERP_USE_PROTECTION, IEEE80211_F_COUNTERM, IEEE80211_F_CSAPENDING, IEEE80211_F_DOBRS, IEEE80211_F_DODEL, IEEE80211_F_DOFRATE, IEEE80211_F_DONEGO, IEEE80211_F_DOSORT, IEEE80211_F_DOTH, IEEE80211_F_JOIN, IEEE80211_F_SCAN, IEEE80211_F_SHPREAMBLE, IEEE80211_F_SHSLOT, IEEE80211_F_USEBARKER, IEEE80211_F_USEPROT, IEEE80211_FC0_SUBTYPE_ACTION, IEEE80211_FC0_SUBTYPE_ACTION_NOACK, IEEE80211_FC0_SUBTYPE_ASSOC_REQ, IEEE80211_FC0_SUBTYPE_ASSOC_RESP, IEEE80211_FC0_SUBTYPE_ATIM, IEEE80211_FC0_SUBTYPE_AUTH, IEEE80211_FC0_SUBTYPE_BEACON, IEEE80211_FC0_SUBTYPE_DEAUTH, IEEE80211_FC0_SUBTYPE_DISASSOC, IEEE80211_FC0_SUBTYPE_PROBE_REQ, IEEE80211_FC0_SUBTYPE_PROBE_RESP, IEEE80211_FC0_SUBTYPE_REASSOC_REQ, IEEE80211_FC0_SUBTYPE_REASSOC_RESP, IEEE80211_FC0_SUBTYPE_TIMING_ADV, IEEE80211_FEXT_PROBECHAN, ieee80211_ff_node_init(), IEEE80211_FHT_HT, IEEE80211_FHT_HTCOMPAT, IEEE80211_FVHT_VHT, ieee80211_ht_node_init(), ieee80211_ht_updateparams(), ieee80211_ht_updateparams_final(), IEEE80211_IS_CHAN_2GHZ, IEEE80211_IS_CHAN_A, IEEE80211_IS_CHAN_ANYG, IEEE80211_IS_MULTICAST, IEEE80211_LOCK, ieee80211_lookup_channel_rxstatus(), IEEE80211_M_HOSTAP, IEEE80211_MSG_ANY, IEEE80211_MSG_ASSOC, IEEE80211_MSG_AUTH, IEEE80211_MSG_CRYPTO, IEEE80211_MSG_DEBUG, IEEE80211_MSG_INPUT, ieee80211_new_state(), IEEE80211_NODE_AID, IEEE80211_NODE_AMPDU, IEEE80211_NODE_AMSDU, IEEE80211_NODE_FF, IEEE80211_NODE_HT, IEEE80211_NODE_MIMO_PS, IEEE80211_NODE_MIMO_RTS, IEEE80211_NODE_QOS, IEEE80211_NODE_RIFS, ieee80211_node_setuptxparms(), IEEE80211_NODE_STAT, IEEE80211_NODE_TURBOP, IEEE80211_NODE_UAPSD, IEEE80211_NOTE, IEEE80211_NOTE_MAC, ieee80211_parse_action(), ieee80211_parse_athparams(), ieee80211_parse_beacon(), ieee80211_parse_csaparams(), ieee80211_parse_wmeparams(), ieee80211_probe_curchan(), IEEE80211_RATE_BASIC, IEEE80211_RATE_MAXSIZE, ieee80211_ratectl_node_init(), IEEE80211_REASON_MIC_FAILURE, ieee80211_reason_to_string(), IEEE80211_S_ASSOC, IEEE80211_S_AUTH, IEEE80211_S_RUN, IEEE80211_S_SCAN, IEEE80211_SCAN_FAIL_STATUS, ieee80211_send_error(), ieee80211_setup_basic_htrates(), ieee80211_setup_htrates(), ieee80211_setup_rates(), ieee80211_setup_vht_rates(), ieee80211_sta_ps_timer_check(), ieee80211_sta_tim_notify(), ieee80211_state_name, IEEE80211_UNLOCK, ieee80211_update_chw(), ieee80211_vap_set_shortslottime(), ieee80211_vap_update_erp_protmode(), ieee80211_vap_update_preamble(), IEEE80211_VERIFY_ELEMENT, IEEE80211_VERIFY_LENGTH, ieee80211_vht_node_init(), ieee80211_vht_updateparams(), ieee80211_wme_updateparams(), ieee80211_stats::is_beacon_bad, ieee80211_stats::is_rx_assoc_norate, ieee80211_stats::is_rx_auth_countermeasures, ieee80211_stats::is_rx_auth_fail, ieee80211_stats::is_rx_auth_unsupported, ieee80211_stats::is_rx_badsubtype, ieee80211_stats::is_rx_beacon, ieee80211_stats::is_rx_deauth, ieee80211_stats::is_rx_deauth_code, ieee80211_stats::is_rx_disassoc, ieee80211_stats::is_rx_disassoc_code, ieee80211_stats::is_rx_mgtdiscard, ieee80211_stats::is_scan_bg, ishtcapoui(), ishtinfooui(), ISREASSOC, iswmeoui(), ieee80211vap::iv_bmiss_count, ieee80211vap::iv_bss, ieee80211vap::iv_flags, ieee80211vap::iv_flags_ht, ieee80211vap::iv_flags_vht, ieee80211vap::iv_myaddr, ieee80211vap::iv_opmode, ieee80211vap::iv_state, ieee80211vap::iv_stats, ieee80211vap::iv_swbmiss_count, ieee80211_node::ni_associd, ieee80211_node::ni_bssid, ieee80211_node::ni_capinfo, ieee80211_node::ni_chan, ieee80211_node::ni_chw, ieee80211_node::ni_dtim_count, ieee80211_node::ni_dtim_period, ieee80211_node::ni_erp, ieee80211_node::ni_flags, ieee80211_node::ni_ic, ieee80211_node::ni_jointime, ieee80211_node::ni_macaddr, ieee80211_node::ni_quiet_ie, ieee80211_node::ni_quiet_ie_set, ieee80211_node::ni_tstamp, ieee80211_node::ni_vap, ieee80211_scanparams::quiet, sta_auth_open(), sta_auth_shared(), startbgscan(), ieee80211_scanparams::tim, ieee80211_tim_ie::tim_bitctl, ieee80211_tim_ie::tim_bitmap, ieee80211_tim_ie::tim_count, ieee80211_tim_ie::tim_len, ieee80211_tim_ie::tim_period, ieee80211_scanparams::tstamp, ieee80211_scanparams::vhtcap, ieee80211_scanparams::vhtopmode, ieee80211_scanparams::wme, and WME_CAPINFO_UAPSD_EN.

Referenced by sta_vattach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sta_swbmiss_start()

static void sta_swbmiss_start ( struct ieee80211vap vap)
static

◆ sta_vattach()

static void sta_vattach ( struct ieee80211vap vap)
static

◆ sta_vdetach()

static void sta_vdetach ( struct ieee80211vap vap)
static

Definition at line 94 of file ieee80211_sta.c.

Referenced by sta_vattach().

Here is the caller graph for this function:

◆ startbgscan()