xref: /freebsd/contrib/wpa/src/ap/sta_info.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
1e28a4053SRui Paulo /*
2e28a4053SRui Paulo  * hostapd / Station table
385732ac8SCy Schubert  * Copyright (c) 2002-2017, Jouni Malinen <j@w1.fi>
4e28a4053SRui Paulo  *
5f05cddf9SRui Paulo  * This software may be distributed under the terms of the BSD license.
6f05cddf9SRui Paulo  * See README for more details.
7e28a4053SRui Paulo  */
8e28a4053SRui Paulo 
9e28a4053SRui Paulo #ifndef STA_INFO_H
10e28a4053SRui Paulo #define STA_INFO_H
11e28a4053SRui Paulo 
125b9c547cSRui Paulo #include "common/defs.h"
135b9c547cSRui Paulo #include "list.h"
14780fb4a2SCy Schubert #include "vlan.h"
1585732ac8SCy Schubert #include "common/wpa_common.h"
1685732ac8SCy Schubert #include "common/ieee802_11_defs.h"
17c1d255d3SCy Schubert #include "common/sae.h"
18c1d255d3SCy Schubert #include "crypto/sha384.h"
19*a90b9d01SCy Schubert #include "pasn/pasn_common.h"
20*a90b9d01SCy Schubert #include "hostapd.h"
215b9c547cSRui Paulo 
22e28a4053SRui Paulo /* STA flags */
23e28a4053SRui Paulo #define WLAN_STA_AUTH BIT(0)
24e28a4053SRui Paulo #define WLAN_STA_ASSOC BIT(1)
25e28a4053SRui Paulo #define WLAN_STA_AUTHORIZED BIT(5)
26e28a4053SRui Paulo #define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */
27e28a4053SRui Paulo #define WLAN_STA_SHORT_PREAMBLE BIT(7)
28e28a4053SRui Paulo #define WLAN_STA_PREAUTH BIT(8)
29e28a4053SRui Paulo #define WLAN_STA_WMM BIT(9)
30e28a4053SRui Paulo #define WLAN_STA_MFP BIT(10)
31e28a4053SRui Paulo #define WLAN_STA_HT BIT(11)
32e28a4053SRui Paulo #define WLAN_STA_WPS BIT(12)
33e28a4053SRui Paulo #define WLAN_STA_MAYBE_WPS BIT(13)
34e28a4053SRui Paulo #define WLAN_STA_WDS BIT(14)
35f05cddf9SRui Paulo #define WLAN_STA_ASSOC_REQ_OK BIT(15)
36f05cddf9SRui Paulo #define WLAN_STA_WPS2 BIT(16)
37f05cddf9SRui Paulo #define WLAN_STA_GAS BIT(17)
38f05cddf9SRui Paulo #define WLAN_STA_VHT BIT(18)
395b9c547cSRui Paulo #define WLAN_STA_WNM_SLEEP_MODE BIT(19)
405b9c547cSRui Paulo #define WLAN_STA_VHT_OPMODE_ENABLED BIT(20)
415b9c547cSRui Paulo #define WLAN_STA_VENDOR_VHT BIT(21)
4285732ac8SCy Schubert #define WLAN_STA_PENDING_FILS_ERP BIT(22)
434bc52338SCy Schubert #define WLAN_STA_MULTI_AP BIT(23)
44206b73d0SCy Schubert #define WLAN_STA_HE BIT(24)
45c1d255d3SCy Schubert #define WLAN_STA_6GHZ BIT(25)
46c1d255d3SCy Schubert #define WLAN_STA_PENDING_PASN_FILS_ERP BIT(26)
47*a90b9d01SCy Schubert #define WLAN_STA_EHT BIT(27)
48f05cddf9SRui Paulo #define WLAN_STA_PENDING_DISASSOC_CB BIT(29)
49f05cddf9SRui Paulo #define WLAN_STA_PENDING_DEAUTH_CB BIT(30)
50e28a4053SRui Paulo #define WLAN_STA_NONERP BIT(31)
51e28a4053SRui Paulo 
52e28a4053SRui Paulo /* Maximum number of supported rates (from both Supported Rates and Extended
53e28a4053SRui Paulo  * Supported Rates IEs). */
54e28a4053SRui Paulo #define WLAN_SUPP_RATES_MAX 32
55e28a4053SRui Paulo 
5685732ac8SCy Schubert struct hostapd_data;
57e28a4053SRui Paulo 
58780fb4a2SCy Schubert struct mbo_non_pref_chan_info {
59780fb4a2SCy Schubert 	struct mbo_non_pref_chan_info *next;
60780fb4a2SCy Schubert 	u8 op_class;
61780fb4a2SCy Schubert 	u8 pref;
62780fb4a2SCy Schubert 	u8 reason_code;
63780fb4a2SCy Schubert 	u8 num_channels;
64780fb4a2SCy Schubert 	u8 channels[];
65780fb4a2SCy Schubert };
66780fb4a2SCy Schubert 
67780fb4a2SCy Schubert struct pending_eapol_rx {
68780fb4a2SCy Schubert 	struct wpabuf *buf;
69780fb4a2SCy Schubert 	struct os_reltime rx_time;
70*a90b9d01SCy Schubert 	enum frame_encryption encrypted;
71780fb4a2SCy Schubert };
72780fb4a2SCy Schubert 
73*a90b9d01SCy Schubert #define EHT_ML_MAX_STA_PROF_LEN 1024
74*a90b9d01SCy Schubert struct mld_info {
75*a90b9d01SCy Schubert 	bool mld_sta;
76c1d255d3SCy Schubert 
77*a90b9d01SCy Schubert 	struct ml_common_info {
78*a90b9d01SCy Schubert 		u8 mld_addr[ETH_ALEN];
79*a90b9d01SCy Schubert 		u16 medium_sync_delay;
80*a90b9d01SCy Schubert 		u16 eml_capa;
81*a90b9d01SCy Schubert 		u16 mld_capa;
82*a90b9d01SCy Schubert 	} common_info;
83c1d255d3SCy Schubert 
84*a90b9d01SCy Schubert 	struct mld_link_info {
85*a90b9d01SCy Schubert 		u8 valid:1;
86*a90b9d01SCy Schubert 		u8 nstr_bitmap_len:2;
87*a90b9d01SCy Schubert 		u8 local_addr[ETH_ALEN];
88*a90b9d01SCy Schubert 		u8 peer_addr[ETH_ALEN];
89c1d255d3SCy Schubert 
90*a90b9d01SCy Schubert 		u8 nstr_bitmap[2];
91c1d255d3SCy Schubert 
92*a90b9d01SCy Schubert 		u16 capability;
93c1d255d3SCy Schubert 
94*a90b9d01SCy Schubert 		u16 status;
95*a90b9d01SCy Schubert 		u16 resp_sta_profile_len;
96*a90b9d01SCy Schubert 		u8 *resp_sta_profile;
97*a90b9d01SCy Schubert 	} links[MAX_NUM_MLD_LINKS];
98c1d255d3SCy Schubert };
99c1d255d3SCy Schubert 
100e28a4053SRui Paulo struct sta_info {
101e28a4053SRui Paulo 	struct sta_info *next; /* next entry in sta list */
102e28a4053SRui Paulo 	struct sta_info *hnext; /* next entry in hash table list */
103e28a4053SRui Paulo 	u8 addr[6];
1045b9c547cSRui Paulo 	be32 ipaddr;
1055b9c547cSRui Paulo 	struct dl_list ip6addr; /* list head for struct ip6addr */
106e28a4053SRui Paulo 	u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */
10785732ac8SCy Schubert 	u16 disconnect_reason_code; /* RADIUS server override */
108e28a4053SRui Paulo 	u32 flags; /* Bitfield of WLAN_STA_* */
109e28a4053SRui Paulo 	u16 capability;
110e28a4053SRui Paulo 	u16 listen_interval; /* or beacon_int for APs */
111e28a4053SRui Paulo 	u8 supported_rates[WLAN_SUPP_RATES_MAX];
112e28a4053SRui Paulo 	int supported_rates_len;
113f05cddf9SRui Paulo 	u8 qosinfo; /* Valid when WLAN_STA_WMM is set */
114e28a4053SRui Paulo 
1155b9c547cSRui Paulo #ifdef CONFIG_MESH
1165b9c547cSRui Paulo 	enum mesh_plink_state plink_state;
1175b9c547cSRui Paulo 	u16 peer_lid;
1185b9c547cSRui Paulo 	u16 my_lid;
119780fb4a2SCy Schubert 	u16 peer_aid;
1205b9c547cSRui Paulo 	u16 mpm_close_reason;
1215b9c547cSRui Paulo 	int mpm_retries;
122780fb4a2SCy Schubert 	u8 my_nonce[WPA_NONCE_LEN];
123780fb4a2SCy Schubert 	u8 peer_nonce[WPA_NONCE_LEN];
1245b9c547cSRui Paulo 	u8 aek[32];	/* SHA256 digest length */
125780fb4a2SCy Schubert 	u8 mtk[WPA_TK_MAX_LEN];
126780fb4a2SCy Schubert 	size_t mtk_len;
127780fb4a2SCy Schubert 	u8 mgtk_rsc[6];
128780fb4a2SCy Schubert 	u8 mgtk_key_id;
129780fb4a2SCy Schubert 	u8 mgtk[WPA_TK_MAX_LEN];
130780fb4a2SCy Schubert 	size_t mgtk_len;
131780fb4a2SCy Schubert 	u8 igtk_rsc[6];
132780fb4a2SCy Schubert 	u8 igtk[WPA_TK_MAX_LEN];
133780fb4a2SCy Schubert 	size_t igtk_len;
134780fb4a2SCy Schubert 	u16 igtk_key_id;
1355b9c547cSRui Paulo 	u8 sae_auth_retry;
1365b9c547cSRui Paulo #endif /* CONFIG_MESH */
1375b9c547cSRui Paulo 
138e28a4053SRui Paulo 	unsigned int nonerp_set:1;
139e28a4053SRui Paulo 	unsigned int no_short_slot_time_set:1;
140e28a4053SRui Paulo 	unsigned int no_short_preamble_set:1;
141e28a4053SRui Paulo 	unsigned int no_ht_gf_set:1;
142e28a4053SRui Paulo 	unsigned int no_ht_set:1;
1435b9c547cSRui Paulo 	unsigned int ht40_intolerant_set:1;
144e28a4053SRui Paulo 	unsigned int ht_20mhz_set:1;
145f05cddf9SRui Paulo 	unsigned int no_p2p_set:1;
1465b9c547cSRui Paulo 	unsigned int qos_map_enabled:1;
1475b9c547cSRui Paulo 	unsigned int remediation:1;
1485b9c547cSRui Paulo 	unsigned int hs20_deauth_requested:1;
149*a90b9d01SCy Schubert 	unsigned int hs20_deauth_on_ack:1;
1505b9c547cSRui Paulo 	unsigned int session_timeout_set:1;
1515b9c547cSRui Paulo 	unsigned int radius_das_match:1;
152780fb4a2SCy Schubert 	unsigned int ecsa_supported:1;
153780fb4a2SCy Schubert 	unsigned int added_unassoc:1;
15485732ac8SCy Schubert 	unsigned int pending_wds_enable:1;
15585732ac8SCy Schubert 	unsigned int power_capab:1;
15685732ac8SCy Schubert 	unsigned int agreed_to_steer:1;
15785732ac8SCy Schubert 	unsigned int hs20_t_c_filtering:1;
1584bc52338SCy Schubert 	unsigned int ft_over_ds:1;
159206b73d0SCy Schubert 	unsigned int external_dh_updated:1;
160c1d255d3SCy Schubert 	unsigned int post_csa_sa_query:1;
161e28a4053SRui Paulo 
162e28a4053SRui Paulo 	u16 auth_alg;
163e28a4053SRui Paulo 
164e28a4053SRui Paulo 	enum {
1655b9c547cSRui Paulo 		STA_NULLFUNC = 0, STA_DISASSOC, STA_DEAUTH, STA_REMOVE,
1665b9c547cSRui Paulo 		STA_DISASSOC_FROM_CLI
167e28a4053SRui Paulo 	} timeout_next;
168e28a4053SRui Paulo 
169f05cddf9SRui Paulo 	u16 deauth_reason;
170f05cddf9SRui Paulo 	u16 disassoc_reason;
171f05cddf9SRui Paulo 
172e28a4053SRui Paulo 	/* IEEE 802.1X related data */
173e28a4053SRui Paulo 	struct eapol_state_machine *eapol_sm;
174e28a4053SRui Paulo 
175780fb4a2SCy Schubert 	struct pending_eapol_rx *pending_eapol_rx;
176780fb4a2SCy Schubert 
177780fb4a2SCy Schubert 	u64 acct_session_id;
1785b9c547cSRui Paulo 	struct os_reltime acct_session_start;
179e28a4053SRui Paulo 	int acct_session_started;
180e28a4053SRui Paulo 	int acct_terminate_cause; /* Acct-Terminate-Cause */
181e28a4053SRui Paulo 	int acct_interim_interval; /* Acct-Interim-Interval */
182780fb4a2SCy Schubert 	unsigned int acct_interim_errors;
183e28a4053SRui Paulo 
184780fb4a2SCy Schubert 	/* For extending 32-bit driver counters to 64-bit counters */
185780fb4a2SCy Schubert 	u32 last_rx_bytes_hi;
186780fb4a2SCy Schubert 	u32 last_rx_bytes_lo;
187780fb4a2SCy Schubert 	u32 last_tx_bytes_hi;
188780fb4a2SCy Schubert 	u32 last_tx_bytes_lo;
189e28a4053SRui Paulo 
190e28a4053SRui Paulo 	u8 *challenge; /* IEEE 802.11 Shared Key Authentication Challenge */
191e28a4053SRui Paulo 
192e28a4053SRui Paulo 	struct wpa_state_machine *wpa_sm;
193e28a4053SRui Paulo 	struct rsn_preauth_interface *preauth_iface;
194e28a4053SRui Paulo 
195325151a3SRui Paulo 	int vlan_id; /* 0: none, >0: VID */
196780fb4a2SCy Schubert 	struct vlan_description *vlan_desc;
197325151a3SRui Paulo 	int vlan_id_bound; /* updated by ap_sta_bind_vlan() */
198f05cddf9SRui Paulo 	 /* PSKs from RADIUS authentication server */
199f05cddf9SRui Paulo 	struct hostapd_sta_wpa_psk_short *psk;
200f05cddf9SRui Paulo 
201f05cddf9SRui Paulo 	char *identity; /* User-Name from RADIUS */
202f05cddf9SRui Paulo 	char *radius_cui; /* Chargeable-User-Identity from RADIUS */
203e28a4053SRui Paulo 
204e28a4053SRui Paulo 	struct ieee80211_ht_capabilities *ht_capabilities;
205f05cddf9SRui Paulo 	struct ieee80211_vht_capabilities *vht_capabilities;
2064bc52338SCy Schubert 	struct ieee80211_vht_operation *vht_operation;
2075b9c547cSRui Paulo 	u8 vht_opmode;
208206b73d0SCy Schubert 	struct ieee80211_he_capabilities *he_capab;
209206b73d0SCy Schubert 	size_t he_capab_len;
210c1d255d3SCy Schubert 	struct ieee80211_he_6ghz_band_cap *he_6ghz_capab;
211*a90b9d01SCy Schubert 	struct ieee80211_eht_capabilities *eht_capab;
212*a90b9d01SCy Schubert 	size_t eht_capab_len;
213e28a4053SRui Paulo 
214e28a4053SRui Paulo 	int sa_query_count; /* number of pending SA Query requests;
215e28a4053SRui Paulo 			     * 0 = no SA Query in progress */
216e28a4053SRui Paulo 	int sa_query_timed_out;
217e28a4053SRui Paulo 	u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
218e28a4053SRui Paulo 				* sa_query_count octets of pending SA Query
219e28a4053SRui Paulo 				* transaction identifiers */
2205b9c547cSRui Paulo 	struct os_reltime sa_query_start;
221e28a4053SRui Paulo 
22285732ac8SCy Schubert #if defined(CONFIG_INTERWORKING) || defined(CONFIG_DPP)
223f05cddf9SRui Paulo #define GAS_DIALOG_MAX 8 /* Max concurrent dialog number */
224f05cddf9SRui Paulo 	struct gas_dialog_info *gas_dialog;
225f05cddf9SRui Paulo 	u8 gas_dialog_next;
22685732ac8SCy Schubert #endif /* CONFIG_INTERWORKING || CONFIG_DPP */
227f05cddf9SRui Paulo 
228e28a4053SRui Paulo 	struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
229f05cddf9SRui Paulo 	struct wpabuf *p2p_ie; /* P2P IE from (Re)Association Request */
230f05cddf9SRui Paulo 	struct wpabuf *hs20_ie; /* HS 2.0 IE from (Re)Association Request */
23185732ac8SCy Schubert 	/* Hotspot 2.0 Roaming Consortium from (Re)Association Request */
23285732ac8SCy Schubert 	struct wpabuf *roaming_consortium;
2335b9c547cSRui Paulo 	u8 remediation_method;
2345b9c547cSRui Paulo 	char *remediation_url; /* HS 2.0 Subscription Remediation Server URL */
23585732ac8SCy Schubert 	char *t_c_url; /* HS 2.0 Terms and Conditions Server URL */
2365b9c547cSRui Paulo 	struct wpabuf *hs20_deauth_req;
2375b9c547cSRui Paulo 	char *hs20_session_info_url;
2385b9c547cSRui Paulo 	int hs20_disassoc_timer;
239325151a3SRui Paulo #ifdef CONFIG_FST
240325151a3SRui Paulo 	struct wpabuf *mb_ies; /* MB IEs from (Re)Association Request */
241325151a3SRui Paulo #endif /* CONFIG_FST */
242f05cddf9SRui Paulo 
2435b9c547cSRui Paulo 	struct os_reltime connected_time;
244f05cddf9SRui Paulo 
245f05cddf9SRui Paulo #ifdef CONFIG_SAE
2465b9c547cSRui Paulo 	struct sae_data *sae;
247780fb4a2SCy Schubert 	unsigned int mesh_sae_pmksa_caching:1;
248f05cddf9SRui Paulo #endif /* CONFIG_SAE */
2495b9c547cSRui Paulo 
25085732ac8SCy Schubert 	/* valid only if session_timeout_set == 1 */
25185732ac8SCy Schubert 	struct os_reltime session_timeout;
2525b9c547cSRui Paulo 
2535b9c547cSRui Paulo 	/* Last Authentication/(Re)Association Request/Action frame sequence
2545b9c547cSRui Paulo 	 * control */
2555b9c547cSRui Paulo 	u16 last_seq_ctrl;
2565b9c547cSRui Paulo 	/* Last Authentication/(Re)Association Request/Action frame subtype */
2575b9c547cSRui Paulo 	u8 last_subtype;
258780fb4a2SCy Schubert 
259780fb4a2SCy Schubert #ifdef CONFIG_MBO
260780fb4a2SCy Schubert 	u8 cell_capa; /* 0 = unknown (not an MBO STA); otherwise,
261780fb4a2SCy Schubert 		       * enum mbo_cellular_capa values */
262780fb4a2SCy Schubert 	struct mbo_non_pref_chan_info *non_pref_chan;
2634bc52338SCy Schubert 	int auth_rssi; /* Last Authentication frame RSSI */
264780fb4a2SCy Schubert #endif /* CONFIG_MBO */
265780fb4a2SCy Schubert 
266780fb4a2SCy Schubert 	u8 *supp_op_classes; /* Supported Operating Classes element, if
267780fb4a2SCy Schubert 			      * received, starting from the Length field */
268780fb4a2SCy Schubert 
269780fb4a2SCy Schubert 	u8 rrm_enabled_capa[5];
270780fb4a2SCy Schubert 
27185732ac8SCy Schubert 	s8 min_tx_power;
27285732ac8SCy Schubert 	s8 max_tx_power;
27385732ac8SCy Schubert 
274780fb4a2SCy Schubert #ifdef CONFIG_TAXONOMY
275780fb4a2SCy Schubert 	struct wpabuf *probe_ie_taxonomy;
276780fb4a2SCy Schubert 	struct wpabuf *assoc_ie_taxonomy;
277780fb4a2SCy Schubert #endif /* CONFIG_TAXONOMY */
27885732ac8SCy Schubert 
27985732ac8SCy Schubert #ifdef CONFIG_FILS
28085732ac8SCy Schubert 	u8 fils_snonce[FILS_NONCE_LEN];
28185732ac8SCy Schubert 	u8 fils_session[FILS_SESSION_LEN];
28285732ac8SCy Schubert 	u8 fils_erp_pmkid[PMKID_LEN];
28385732ac8SCy Schubert 	u8 *fils_pending_assoc_req;
28485732ac8SCy Schubert 	size_t fils_pending_assoc_req_len;
28585732ac8SCy Schubert 	unsigned int fils_pending_assoc_is_reassoc:1;
28685732ac8SCy Schubert 	unsigned int fils_dhcp_rapid_commit_proxy:1;
28785732ac8SCy Schubert 	unsigned int fils_erp_pmkid_set:1;
28885732ac8SCy Schubert 	unsigned int fils_drv_assoc_finish:1;
28985732ac8SCy Schubert 	struct wpabuf *fils_hlp_resp;
29085732ac8SCy Schubert 	struct wpabuf *hlp_dhcp_discover;
29185732ac8SCy Schubert 	void (*fils_pending_cb)(struct hostapd_data *hapd, struct sta_info *sta,
29285732ac8SCy Schubert 				u16 resp, struct wpabuf *data, int pub);
29385732ac8SCy Schubert #ifdef CONFIG_FILS_SK_PFS
29485732ac8SCy Schubert 	struct crypto_ecdh *fils_ecdh;
29585732ac8SCy Schubert #endif /* CONFIG_FILS_SK_PFS */
29685732ac8SCy Schubert 	struct wpabuf *fils_dh_ss;
29785732ac8SCy Schubert 	struct wpabuf *fils_g_sta;
29885732ac8SCy Schubert #endif /* CONFIG_FILS */
29985732ac8SCy Schubert 
30085732ac8SCy Schubert #ifdef CONFIG_OWE
30185732ac8SCy Schubert 	u8 *owe_pmk;
30285732ac8SCy Schubert 	size_t owe_pmk_len;
30385732ac8SCy Schubert 	struct crypto_ecdh *owe_ecdh;
30485732ac8SCy Schubert 	u16 owe_group;
30585732ac8SCy Schubert #endif /* CONFIG_OWE */
30685732ac8SCy Schubert 
30785732ac8SCy Schubert 	u8 *ext_capability;
30885732ac8SCy Schubert 	char *ifname_wds; /* WDS ifname, if in use */
30985732ac8SCy Schubert 
3104bc52338SCy Schubert #ifdef CONFIG_DPP2
3114bc52338SCy Schubert 	struct dpp_pfs *dpp_pfs;
3124bc52338SCy Schubert #endif /* CONFIG_DPP2 */
3134bc52338SCy Schubert 
31485732ac8SCy Schubert #ifdef CONFIG_TESTING_OPTIONS
31585732ac8SCy Schubert 	enum wpa_alg last_tk_alg;
31685732ac8SCy Schubert 	int last_tk_key_idx;
31785732ac8SCy Schubert 	u8 last_tk[WPA_TK_MAX_LEN];
31885732ac8SCy Schubert 	size_t last_tk_len;
319c1d255d3SCy Schubert 	u8 *sae_postponed_commit;
320c1d255d3SCy Schubert 	size_t sae_postponed_commit_len;
32185732ac8SCy Schubert #endif /* CONFIG_TESTING_OPTIONS */
322206b73d0SCy Schubert #ifdef CONFIG_AIRTIME_POLICY
323206b73d0SCy Schubert 	unsigned int airtime_weight;
324206b73d0SCy Schubert 	struct os_reltime backlogged_until;
325206b73d0SCy Schubert #endif /* CONFIG_AIRTIME_POLICY */
326c1d255d3SCy Schubert 
327c1d255d3SCy Schubert #ifdef CONFIG_PASN
328c1d255d3SCy Schubert 	struct pasn_data *pasn;
329c1d255d3SCy Schubert #endif /* CONFIG_PASN */
330*a90b9d01SCy Schubert 
331*a90b9d01SCy Schubert #ifdef CONFIG_IEEE80211BE
332*a90b9d01SCy Schubert 	struct mld_info mld_info;
333*a90b9d01SCy Schubert 	u8 mld_assoc_link_id;
334*a90b9d01SCy Schubert #endif /* CONFIG_IEEE80211BE */
335*a90b9d01SCy Schubert 
336*a90b9d01SCy Schubert 	u16 max_idle_period; /* if nonzero, the granted BSS max idle period in
337*a90b9d01SCy Schubert 			      * units of 1000 TUs */
338e28a4053SRui Paulo };
339e28a4053SRui Paulo 
340e28a4053SRui Paulo 
341e28a4053SRui Paulo /* Default value for maximum station inactivity. After AP_MAX_INACTIVITY has
342e28a4053SRui Paulo  * passed since last received frame from the station, a nullfunc data frame is
343e28a4053SRui Paulo  * sent to the station. If this frame is not acknowledged and no other frames
344e28a4053SRui Paulo  * have been received, the station will be disassociated after
345f05cddf9SRui Paulo  * AP_DISASSOC_DELAY seconds. Similarly, the station will be deauthenticated
346e28a4053SRui Paulo  * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
347e28a4053SRui Paulo #define AP_MAX_INACTIVITY (5 * 60)
348780fb4a2SCy Schubert #define AP_DISASSOC_DELAY (3)
349e28a4053SRui Paulo #define AP_DEAUTH_DELAY (1)
350e28a4053SRui Paulo /* Number of seconds to keep STA entry with Authenticated flag after it has
351e28a4053SRui Paulo  * been disassociated. */
352e28a4053SRui Paulo #define AP_MAX_INACTIVITY_AFTER_DISASSOC (1 * 30)
353e28a4053SRui Paulo /* Number of seconds to keep STA entry after it has been deauthenticated. */
354e28a4053SRui Paulo #define AP_MAX_INACTIVITY_AFTER_DEAUTH (1 * 5)
355e28a4053SRui Paulo 
356e28a4053SRui Paulo 
357e28a4053SRui Paulo int ap_for_each_sta(struct hostapd_data *hapd,
358e28a4053SRui Paulo 		    int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
359e28a4053SRui Paulo 			      void *ctx),
360e28a4053SRui Paulo 		    void *ctx);
361e28a4053SRui Paulo struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta);
3625b9c547cSRui Paulo struct sta_info * ap_get_sta_p2p(struct hostapd_data *hapd, const u8 *addr);
363e28a4053SRui Paulo void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta);
364e28a4053SRui Paulo void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);
3655b9c547cSRui Paulo void ap_sta_ip6addr_del(struct hostapd_data *hapd, struct sta_info *sta);
366e28a4053SRui Paulo void hostapd_free_stas(struct hostapd_data *hapd);
367e28a4053SRui Paulo void ap_handle_timer(void *eloop_ctx, void *timeout_ctx);
3685b9c547cSRui Paulo void ap_sta_replenish_timeout(struct hostapd_data *hapd, struct sta_info *sta,
3695b9c547cSRui Paulo 			      u32 session_timeout);
370e28a4053SRui Paulo void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
371e28a4053SRui Paulo 			    u32 session_timeout);
372e28a4053SRui Paulo void ap_sta_no_session_timeout(struct hostapd_data *hapd,
373e28a4053SRui Paulo 			       struct sta_info *sta);
3745b9c547cSRui Paulo void ap_sta_session_warning_timeout(struct hostapd_data *hapd,
3755b9c547cSRui Paulo 				    struct sta_info *sta, int warning_time);
376e28a4053SRui Paulo struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr);
377e28a4053SRui Paulo void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
378e28a4053SRui Paulo 			 u16 reason);
379e28a4053SRui Paulo void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
380e28a4053SRui Paulo 			   u16 reason);
381f05cddf9SRui Paulo #ifdef CONFIG_WPS
382f05cddf9SRui Paulo int ap_sta_wps_cancel(struct hostapd_data *hapd,
383f05cddf9SRui Paulo 		      struct sta_info *sta, void *ctx);
384f05cddf9SRui Paulo #endif /* CONFIG_WPS */
385325151a3SRui Paulo int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta);
386780fb4a2SCy Schubert int ap_sta_set_vlan(struct hostapd_data *hapd, struct sta_info *sta,
387780fb4a2SCy Schubert 		    struct vlan_description *vlan_desc);
388e28a4053SRui Paulo void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
389e28a4053SRui Paulo void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
390e28a4053SRui Paulo int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta);
3914bc52338SCy Schubert const char * ap_sta_wpa_get_keyid(struct hostapd_data *hapd,
3924bc52338SCy Schubert 				  struct sta_info *sta);
393*a90b9d01SCy Schubert const u8 * ap_sta_wpa_get_dpp_pkhash(struct hostapd_data *hapd,
394*a90b9d01SCy Schubert 				     struct sta_info *sta);
395e28a4053SRui Paulo void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
396e28a4053SRui Paulo 		       const u8 *addr, u16 reason);
397e28a4053SRui Paulo 
398*a90b9d01SCy Schubert bool ap_sta_set_authorized_flag(struct hostapd_data *hapd, struct sta_info *sta,
399*a90b9d01SCy Schubert 				int authorized);
400*a90b9d01SCy Schubert void ap_sta_set_authorized_event(struct hostapd_data *hapd,
401*a90b9d01SCy Schubert 				 struct sta_info *sta, int authorized);
402f05cddf9SRui Paulo void ap_sta_set_authorized(struct hostapd_data *hapd,
403f05cddf9SRui Paulo 			   struct sta_info *sta, int authorized);
ap_sta_is_authorized(struct sta_info * sta)404f05cddf9SRui Paulo static inline int ap_sta_is_authorized(struct sta_info *sta)
405f05cddf9SRui Paulo {
406f05cddf9SRui Paulo 	return sta->flags & WLAN_STA_AUTHORIZED;
407f05cddf9SRui Paulo }
408f05cddf9SRui Paulo 
409f05cddf9SRui Paulo void ap_sta_deauth_cb(struct hostapd_data *hapd, struct sta_info *sta);
410f05cddf9SRui Paulo void ap_sta_disassoc_cb(struct hostapd_data *hapd, struct sta_info *sta);
411780fb4a2SCy Schubert void ap_sta_clear_disconnect_timeouts(struct hostapd_data *hapd,
412780fb4a2SCy Schubert 				      struct sta_info *sta);
413f05cddf9SRui Paulo 
4145b9c547cSRui Paulo int ap_sta_flags_txt(u32 flags, char *buf, size_t buflen);
41585732ac8SCy Schubert void ap_sta_delayed_1x_auth_fail_disconnect(struct hostapd_data *hapd,
416*a90b9d01SCy Schubert 					    struct sta_info *sta,
417*a90b9d01SCy Schubert 					    unsigned timeout);
41885732ac8SCy Schubert int ap_sta_pending_delayed_1x_auth_fail_disconnect(struct hostapd_data *hapd,
41985732ac8SCy Schubert 						   struct sta_info *sta);
420c1d255d3SCy Schubert int ap_sta_re_add(struct hostapd_data *hapd, struct sta_info *sta);
421c1d255d3SCy Schubert 
422c1d255d3SCy Schubert void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta);
4235b9c547cSRui Paulo 
ap_sta_is_mld(struct hostapd_data * hapd,struct sta_info * sta)424*a90b9d01SCy Schubert static inline bool ap_sta_is_mld(struct hostapd_data *hapd,
425*a90b9d01SCy Schubert 				 struct sta_info *sta)
426*a90b9d01SCy Schubert {
427*a90b9d01SCy Schubert #ifdef CONFIG_IEEE80211BE
428*a90b9d01SCy Schubert 	return hapd->conf->mld_ap && sta && sta->mld_info.mld_sta;
429*a90b9d01SCy Schubert #else /* CONFIG_IEEE80211BE */
430*a90b9d01SCy Schubert 	return false;
431*a90b9d01SCy Schubert #endif /* CONFIG_IEEE80211BE */
432*a90b9d01SCy Schubert }
433*a90b9d01SCy Schubert 
ap_sta_set_mld(struct sta_info * sta,bool mld)434*a90b9d01SCy Schubert static inline void ap_sta_set_mld(struct sta_info *sta, bool mld)
435*a90b9d01SCy Schubert {
436*a90b9d01SCy Schubert #ifdef CONFIG_IEEE80211BE
437*a90b9d01SCy Schubert 	if (sta)
438*a90b9d01SCy Schubert 		sta->mld_info.mld_sta = mld;
439*a90b9d01SCy Schubert #endif /* CONFIG_IEEE80211BE */
440*a90b9d01SCy Schubert }
441*a90b9d01SCy Schubert 
442*a90b9d01SCy Schubert void ap_sta_free_sta_profile(struct mld_info *info);
443*a90b9d01SCy Schubert 
444*a90b9d01SCy Schubert void hostapd_free_link_stas(struct hostapd_data *hapd);
445*a90b9d01SCy Schubert 
446e28a4053SRui Paulo #endif /* STA_INFO_H */
447