xref: /freebsd/contrib/wpa/src/ap/sta_info.h (revision c1d255d3)
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"
17*c1d255d3SCy Schubert #include "common/sae.h"
18*c1d255d3SCy Schubert #include "crypto/sha384.h"
195b9c547cSRui Paulo 
20e28a4053SRui Paulo /* STA flags */
21e28a4053SRui Paulo #define WLAN_STA_AUTH BIT(0)
22e28a4053SRui Paulo #define WLAN_STA_ASSOC BIT(1)
23e28a4053SRui Paulo #define WLAN_STA_AUTHORIZED BIT(5)
24e28a4053SRui Paulo #define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */
25e28a4053SRui Paulo #define WLAN_STA_SHORT_PREAMBLE BIT(7)
26e28a4053SRui Paulo #define WLAN_STA_PREAUTH BIT(8)
27e28a4053SRui Paulo #define WLAN_STA_WMM BIT(9)
28e28a4053SRui Paulo #define WLAN_STA_MFP BIT(10)
29e28a4053SRui Paulo #define WLAN_STA_HT BIT(11)
30e28a4053SRui Paulo #define WLAN_STA_WPS BIT(12)
31e28a4053SRui Paulo #define WLAN_STA_MAYBE_WPS BIT(13)
32e28a4053SRui Paulo #define WLAN_STA_WDS BIT(14)
33f05cddf9SRui Paulo #define WLAN_STA_ASSOC_REQ_OK BIT(15)
34f05cddf9SRui Paulo #define WLAN_STA_WPS2 BIT(16)
35f05cddf9SRui Paulo #define WLAN_STA_GAS BIT(17)
36f05cddf9SRui Paulo #define WLAN_STA_VHT BIT(18)
375b9c547cSRui Paulo #define WLAN_STA_WNM_SLEEP_MODE BIT(19)
385b9c547cSRui Paulo #define WLAN_STA_VHT_OPMODE_ENABLED BIT(20)
395b9c547cSRui Paulo #define WLAN_STA_VENDOR_VHT BIT(21)
4085732ac8SCy Schubert #define WLAN_STA_PENDING_FILS_ERP BIT(22)
414bc52338SCy Schubert #define WLAN_STA_MULTI_AP BIT(23)
42206b73d0SCy Schubert #define WLAN_STA_HE BIT(24)
43*c1d255d3SCy Schubert #define WLAN_STA_6GHZ BIT(25)
44*c1d255d3SCy Schubert #define WLAN_STA_PENDING_PASN_FILS_ERP BIT(26)
45f05cddf9SRui Paulo #define WLAN_STA_PENDING_DISASSOC_CB BIT(29)
46f05cddf9SRui Paulo #define WLAN_STA_PENDING_DEAUTH_CB BIT(30)
47e28a4053SRui Paulo #define WLAN_STA_NONERP BIT(31)
48e28a4053SRui Paulo 
49e28a4053SRui Paulo /* Maximum number of supported rates (from both Supported Rates and Extended
50e28a4053SRui Paulo  * Supported Rates IEs). */
51e28a4053SRui Paulo #define WLAN_SUPP_RATES_MAX 32
52e28a4053SRui Paulo 
5385732ac8SCy Schubert struct hostapd_data;
54e28a4053SRui Paulo 
55780fb4a2SCy Schubert struct mbo_non_pref_chan_info {
56780fb4a2SCy Schubert 	struct mbo_non_pref_chan_info *next;
57780fb4a2SCy Schubert 	u8 op_class;
58780fb4a2SCy Schubert 	u8 pref;
59780fb4a2SCy Schubert 	u8 reason_code;
60780fb4a2SCy Schubert 	u8 num_channels;
61780fb4a2SCy Schubert 	u8 channels[];
62780fb4a2SCy Schubert };
63780fb4a2SCy Schubert 
64780fb4a2SCy Schubert struct pending_eapol_rx {
65780fb4a2SCy Schubert 	struct wpabuf *buf;
66780fb4a2SCy Schubert 	struct os_reltime rx_time;
67780fb4a2SCy Schubert };
68780fb4a2SCy Schubert 
69*c1d255d3SCy Schubert enum pasn_fils_state {
70*c1d255d3SCy Schubert 	PASN_FILS_STATE_NONE = 0,
71*c1d255d3SCy Schubert 	PASN_FILS_STATE_PENDING_AS,
72*c1d255d3SCy Schubert 	PASN_FILS_STATE_COMPLETE
73*c1d255d3SCy Schubert };
74*c1d255d3SCy Schubert 
75*c1d255d3SCy Schubert struct pasn_fils_data {
76*c1d255d3SCy Schubert 	u8 state;
77*c1d255d3SCy Schubert 	u8 nonce[FILS_NONCE_LEN];
78*c1d255d3SCy Schubert 	u8 anonce[FILS_NONCE_LEN];
79*c1d255d3SCy Schubert 	u8 session[FILS_SESSION_LEN];
80*c1d255d3SCy Schubert 	u8 erp_pmkid[PMKID_LEN];
81*c1d255d3SCy Schubert 
82*c1d255d3SCy Schubert 	struct wpabuf *erp_resp;
83*c1d255d3SCy Schubert };
84*c1d255d3SCy Schubert 
85*c1d255d3SCy Schubert struct pasn_data {
86*c1d255d3SCy Schubert 	int akmp;
87*c1d255d3SCy Schubert 	int cipher;
88*c1d255d3SCy Schubert 	u16 group;
89*c1d255d3SCy Schubert 	u8 trans_seq;
90*c1d255d3SCy Schubert 	u8 wrapped_data_format;
91*c1d255d3SCy Schubert 	size_t kdk_len;
92*c1d255d3SCy Schubert 
93*c1d255d3SCy Schubert 	u8 hash[SHA384_MAC_LEN];
94*c1d255d3SCy Schubert 	struct wpa_ptk ptk;
95*c1d255d3SCy Schubert 	struct crypto_ecdh *ecdh;
96*c1d255d3SCy Schubert 
97*c1d255d3SCy Schubert 	struct wpabuf *secret;
98*c1d255d3SCy Schubert #ifdef CONFIG_SAE
99*c1d255d3SCy Schubert 	struct sae_data sae;
100*c1d255d3SCy Schubert #endif /* CONFIG_SAE */
101*c1d255d3SCy Schubert #ifdef CONFIG_FILS
102*c1d255d3SCy Schubert 	struct pasn_fils_data fils;
103*c1d255d3SCy Schubert #endif /* CONFIG_FILS */
104*c1d255d3SCy Schubert };
105*c1d255d3SCy Schubert 
106e28a4053SRui Paulo struct sta_info {
107e28a4053SRui Paulo 	struct sta_info *next; /* next entry in sta list */
108e28a4053SRui Paulo 	struct sta_info *hnext; /* next entry in hash table list */
109e28a4053SRui Paulo 	u8 addr[6];
1105b9c547cSRui Paulo 	be32 ipaddr;
1115b9c547cSRui Paulo 	struct dl_list ip6addr; /* list head for struct ip6addr */
112e28a4053SRui Paulo 	u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */
11385732ac8SCy Schubert 	u16 disconnect_reason_code; /* RADIUS server override */
114e28a4053SRui Paulo 	u32 flags; /* Bitfield of WLAN_STA_* */
115e28a4053SRui Paulo 	u16 capability;
116e28a4053SRui Paulo 	u16 listen_interval; /* or beacon_int for APs */
117e28a4053SRui Paulo 	u8 supported_rates[WLAN_SUPP_RATES_MAX];
118e28a4053SRui Paulo 	int supported_rates_len;
119f05cddf9SRui Paulo 	u8 qosinfo; /* Valid when WLAN_STA_WMM is set */
120e28a4053SRui Paulo 
1215b9c547cSRui Paulo #ifdef CONFIG_MESH
1225b9c547cSRui Paulo 	enum mesh_plink_state plink_state;
1235b9c547cSRui Paulo 	u16 peer_lid;
1245b9c547cSRui Paulo 	u16 my_lid;
125780fb4a2SCy Schubert 	u16 peer_aid;
1265b9c547cSRui Paulo 	u16 mpm_close_reason;
1275b9c547cSRui Paulo 	int mpm_retries;
128780fb4a2SCy Schubert 	u8 my_nonce[WPA_NONCE_LEN];
129780fb4a2SCy Schubert 	u8 peer_nonce[WPA_NONCE_LEN];
1305b9c547cSRui Paulo 	u8 aek[32];	/* SHA256 digest length */
131780fb4a2SCy Schubert 	u8 mtk[WPA_TK_MAX_LEN];
132780fb4a2SCy Schubert 	size_t mtk_len;
133780fb4a2SCy Schubert 	u8 mgtk_rsc[6];
134780fb4a2SCy Schubert 	u8 mgtk_key_id;
135780fb4a2SCy Schubert 	u8 mgtk[WPA_TK_MAX_LEN];
136780fb4a2SCy Schubert 	size_t mgtk_len;
137780fb4a2SCy Schubert 	u8 igtk_rsc[6];
138780fb4a2SCy Schubert 	u8 igtk[WPA_TK_MAX_LEN];
139780fb4a2SCy Schubert 	size_t igtk_len;
140780fb4a2SCy Schubert 	u16 igtk_key_id;
1415b9c547cSRui Paulo 	u8 sae_auth_retry;
1425b9c547cSRui Paulo #endif /* CONFIG_MESH */
1435b9c547cSRui Paulo 
144e28a4053SRui Paulo 	unsigned int nonerp_set:1;
145e28a4053SRui Paulo 	unsigned int no_short_slot_time_set:1;
146e28a4053SRui Paulo 	unsigned int no_short_preamble_set:1;
147e28a4053SRui Paulo 	unsigned int no_ht_gf_set:1;
148e28a4053SRui Paulo 	unsigned int no_ht_set:1;
1495b9c547cSRui Paulo 	unsigned int ht40_intolerant_set:1;
150e28a4053SRui Paulo 	unsigned int ht_20mhz_set:1;
151f05cddf9SRui Paulo 	unsigned int no_p2p_set:1;
1525b9c547cSRui Paulo 	unsigned int qos_map_enabled:1;
1535b9c547cSRui Paulo 	unsigned int remediation:1;
1545b9c547cSRui Paulo 	unsigned int hs20_deauth_requested:1;
1555b9c547cSRui Paulo 	unsigned int session_timeout_set:1;
1565b9c547cSRui Paulo 	unsigned int radius_das_match:1;
157780fb4a2SCy Schubert 	unsigned int ecsa_supported:1;
158780fb4a2SCy Schubert 	unsigned int added_unassoc:1;
15985732ac8SCy Schubert 	unsigned int pending_wds_enable:1;
16085732ac8SCy Schubert 	unsigned int power_capab:1;
16185732ac8SCy Schubert 	unsigned int agreed_to_steer:1;
16285732ac8SCy Schubert 	unsigned int hs20_t_c_filtering:1;
1634bc52338SCy Schubert 	unsigned int ft_over_ds:1;
164206b73d0SCy Schubert 	unsigned int external_dh_updated:1;
165*c1d255d3SCy Schubert 	unsigned int post_csa_sa_query:1;
166e28a4053SRui Paulo 
167e28a4053SRui Paulo 	u16 auth_alg;
168e28a4053SRui Paulo 
169e28a4053SRui Paulo 	enum {
1705b9c547cSRui Paulo 		STA_NULLFUNC = 0, STA_DISASSOC, STA_DEAUTH, STA_REMOVE,
1715b9c547cSRui Paulo 		STA_DISASSOC_FROM_CLI
172e28a4053SRui Paulo 	} timeout_next;
173e28a4053SRui Paulo 
174f05cddf9SRui Paulo 	u16 deauth_reason;
175f05cddf9SRui Paulo 	u16 disassoc_reason;
176f05cddf9SRui Paulo 
177e28a4053SRui Paulo 	/* IEEE 802.1X related data */
178e28a4053SRui Paulo 	struct eapol_state_machine *eapol_sm;
179e28a4053SRui Paulo 
180780fb4a2SCy Schubert 	struct pending_eapol_rx *pending_eapol_rx;
181780fb4a2SCy Schubert 
182780fb4a2SCy Schubert 	u64 acct_session_id;
1835b9c547cSRui Paulo 	struct os_reltime acct_session_start;
184e28a4053SRui Paulo 	int acct_session_started;
185e28a4053SRui Paulo 	int acct_terminate_cause; /* Acct-Terminate-Cause */
186e28a4053SRui Paulo 	int acct_interim_interval; /* Acct-Interim-Interval */
187780fb4a2SCy Schubert 	unsigned int acct_interim_errors;
188e28a4053SRui Paulo 
189780fb4a2SCy Schubert 	/* For extending 32-bit driver counters to 64-bit counters */
190780fb4a2SCy Schubert 	u32 last_rx_bytes_hi;
191780fb4a2SCy Schubert 	u32 last_rx_bytes_lo;
192780fb4a2SCy Schubert 	u32 last_tx_bytes_hi;
193780fb4a2SCy Schubert 	u32 last_tx_bytes_lo;
194e28a4053SRui Paulo 
195e28a4053SRui Paulo 	u8 *challenge; /* IEEE 802.11 Shared Key Authentication Challenge */
196e28a4053SRui Paulo 
197e28a4053SRui Paulo 	struct wpa_state_machine *wpa_sm;
198e28a4053SRui Paulo 	struct rsn_preauth_interface *preauth_iface;
199e28a4053SRui Paulo 
200325151a3SRui Paulo 	int vlan_id; /* 0: none, >0: VID */
201780fb4a2SCy Schubert 	struct vlan_description *vlan_desc;
202325151a3SRui Paulo 	int vlan_id_bound; /* updated by ap_sta_bind_vlan() */
203f05cddf9SRui Paulo 	 /* PSKs from RADIUS authentication server */
204f05cddf9SRui Paulo 	struct hostapd_sta_wpa_psk_short *psk;
205f05cddf9SRui Paulo 
206f05cddf9SRui Paulo 	char *identity; /* User-Name from RADIUS */
207f05cddf9SRui Paulo 	char *radius_cui; /* Chargeable-User-Identity from RADIUS */
208e28a4053SRui Paulo 
209e28a4053SRui Paulo 	struct ieee80211_ht_capabilities *ht_capabilities;
210f05cddf9SRui Paulo 	struct ieee80211_vht_capabilities *vht_capabilities;
2114bc52338SCy Schubert 	struct ieee80211_vht_operation *vht_operation;
2125b9c547cSRui Paulo 	u8 vht_opmode;
213206b73d0SCy Schubert 	struct ieee80211_he_capabilities *he_capab;
214206b73d0SCy Schubert 	size_t he_capab_len;
215*c1d255d3SCy Schubert 	struct ieee80211_he_6ghz_band_cap *he_6ghz_capab;
216e28a4053SRui Paulo 
217e28a4053SRui Paulo 	int sa_query_count; /* number of pending SA Query requests;
218e28a4053SRui Paulo 			     * 0 = no SA Query in progress */
219e28a4053SRui Paulo 	int sa_query_timed_out;
220e28a4053SRui Paulo 	u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
221e28a4053SRui Paulo 				* sa_query_count octets of pending SA Query
222e28a4053SRui Paulo 				* transaction identifiers */
2235b9c547cSRui Paulo 	struct os_reltime sa_query_start;
224e28a4053SRui Paulo 
22585732ac8SCy Schubert #if defined(CONFIG_INTERWORKING) || defined(CONFIG_DPP)
226f05cddf9SRui Paulo #define GAS_DIALOG_MAX 8 /* Max concurrent dialog number */
227f05cddf9SRui Paulo 	struct gas_dialog_info *gas_dialog;
228f05cddf9SRui Paulo 	u8 gas_dialog_next;
22985732ac8SCy Schubert #endif /* CONFIG_INTERWORKING || CONFIG_DPP */
230f05cddf9SRui Paulo 
231e28a4053SRui Paulo 	struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
232f05cddf9SRui Paulo 	struct wpabuf *p2p_ie; /* P2P IE from (Re)Association Request */
233f05cddf9SRui Paulo 	struct wpabuf *hs20_ie; /* HS 2.0 IE from (Re)Association Request */
23485732ac8SCy Schubert 	/* Hotspot 2.0 Roaming Consortium from (Re)Association Request */
23585732ac8SCy Schubert 	struct wpabuf *roaming_consortium;
2365b9c547cSRui Paulo 	u8 remediation_method;
2375b9c547cSRui Paulo 	char *remediation_url; /* HS 2.0 Subscription Remediation Server URL */
23885732ac8SCy Schubert 	char *t_c_url; /* HS 2.0 Terms and Conditions Server URL */
2395b9c547cSRui Paulo 	struct wpabuf *hs20_deauth_req;
2405b9c547cSRui Paulo 	char *hs20_session_info_url;
2415b9c547cSRui Paulo 	int hs20_disassoc_timer;
242325151a3SRui Paulo #ifdef CONFIG_FST
243325151a3SRui Paulo 	struct wpabuf *mb_ies; /* MB IEs from (Re)Association Request */
244325151a3SRui Paulo #endif /* CONFIG_FST */
245f05cddf9SRui Paulo 
2465b9c547cSRui Paulo 	struct os_reltime connected_time;
247f05cddf9SRui Paulo 
248f05cddf9SRui Paulo #ifdef CONFIG_SAE
2495b9c547cSRui Paulo 	struct sae_data *sae;
250780fb4a2SCy Schubert 	unsigned int mesh_sae_pmksa_caching:1;
251f05cddf9SRui Paulo #endif /* CONFIG_SAE */
2525b9c547cSRui Paulo 
25385732ac8SCy Schubert 	/* valid only if session_timeout_set == 1 */
25485732ac8SCy Schubert 	struct os_reltime session_timeout;
2555b9c547cSRui Paulo 
2565b9c547cSRui Paulo 	/* Last Authentication/(Re)Association Request/Action frame sequence
2575b9c547cSRui Paulo 	 * control */
2585b9c547cSRui Paulo 	u16 last_seq_ctrl;
2595b9c547cSRui Paulo 	/* Last Authentication/(Re)Association Request/Action frame subtype */
2605b9c547cSRui Paulo 	u8 last_subtype;
261780fb4a2SCy Schubert 
262780fb4a2SCy Schubert #ifdef CONFIG_MBO
263780fb4a2SCy Schubert 	u8 cell_capa; /* 0 = unknown (not an MBO STA); otherwise,
264780fb4a2SCy Schubert 		       * enum mbo_cellular_capa values */
265780fb4a2SCy Schubert 	struct mbo_non_pref_chan_info *non_pref_chan;
2664bc52338SCy Schubert 	int auth_rssi; /* Last Authentication frame RSSI */
267780fb4a2SCy Schubert #endif /* CONFIG_MBO */
268780fb4a2SCy Schubert 
269780fb4a2SCy Schubert 	u8 *supp_op_classes; /* Supported Operating Classes element, if
270780fb4a2SCy Schubert 			      * received, starting from the Length field */
271780fb4a2SCy Schubert 
272780fb4a2SCy Schubert 	u8 rrm_enabled_capa[5];
273780fb4a2SCy Schubert 
27485732ac8SCy Schubert 	s8 min_tx_power;
27585732ac8SCy Schubert 	s8 max_tx_power;
27685732ac8SCy Schubert 
277780fb4a2SCy Schubert #ifdef CONFIG_TAXONOMY
278780fb4a2SCy Schubert 	struct wpabuf *probe_ie_taxonomy;
279780fb4a2SCy Schubert 	struct wpabuf *assoc_ie_taxonomy;
280780fb4a2SCy Schubert #endif /* CONFIG_TAXONOMY */
28185732ac8SCy Schubert 
28285732ac8SCy Schubert #ifdef CONFIG_FILS
28385732ac8SCy Schubert 	u8 fils_snonce[FILS_NONCE_LEN];
28485732ac8SCy Schubert 	u8 fils_session[FILS_SESSION_LEN];
28585732ac8SCy Schubert 	u8 fils_erp_pmkid[PMKID_LEN];
28685732ac8SCy Schubert 	u8 *fils_pending_assoc_req;
28785732ac8SCy Schubert 	size_t fils_pending_assoc_req_len;
28885732ac8SCy Schubert 	unsigned int fils_pending_assoc_is_reassoc:1;
28985732ac8SCy Schubert 	unsigned int fils_dhcp_rapid_commit_proxy:1;
29085732ac8SCy Schubert 	unsigned int fils_erp_pmkid_set:1;
29185732ac8SCy Schubert 	unsigned int fils_drv_assoc_finish:1;
29285732ac8SCy Schubert 	struct wpabuf *fils_hlp_resp;
29385732ac8SCy Schubert 	struct wpabuf *hlp_dhcp_discover;
29485732ac8SCy Schubert 	void (*fils_pending_cb)(struct hostapd_data *hapd, struct sta_info *sta,
29585732ac8SCy Schubert 				u16 resp, struct wpabuf *data, int pub);
29685732ac8SCy Schubert #ifdef CONFIG_FILS_SK_PFS
29785732ac8SCy Schubert 	struct crypto_ecdh *fils_ecdh;
29885732ac8SCy Schubert #endif /* CONFIG_FILS_SK_PFS */
29985732ac8SCy Schubert 	struct wpabuf *fils_dh_ss;
30085732ac8SCy Schubert 	struct wpabuf *fils_g_sta;
30185732ac8SCy Schubert #endif /* CONFIG_FILS */
30285732ac8SCy Schubert 
30385732ac8SCy Schubert #ifdef CONFIG_OWE
30485732ac8SCy Schubert 	u8 *owe_pmk;
30585732ac8SCy Schubert 	size_t owe_pmk_len;
30685732ac8SCy Schubert 	struct crypto_ecdh *owe_ecdh;
30785732ac8SCy Schubert 	u16 owe_group;
30885732ac8SCy Schubert #endif /* CONFIG_OWE */
30985732ac8SCy Schubert 
31085732ac8SCy Schubert 	u8 *ext_capability;
31185732ac8SCy Schubert 	char *ifname_wds; /* WDS ifname, if in use */
31285732ac8SCy Schubert 
3134bc52338SCy Schubert #ifdef CONFIG_DPP2
3144bc52338SCy Schubert 	struct dpp_pfs *dpp_pfs;
3154bc52338SCy Schubert #endif /* CONFIG_DPP2 */
3164bc52338SCy Schubert 
31785732ac8SCy Schubert #ifdef CONFIG_TESTING_OPTIONS
31885732ac8SCy Schubert 	enum wpa_alg last_tk_alg;
31985732ac8SCy Schubert 	int last_tk_key_idx;
32085732ac8SCy Schubert 	u8 last_tk[WPA_TK_MAX_LEN];
32185732ac8SCy Schubert 	size_t last_tk_len;
322*c1d255d3SCy Schubert 	u8 *sae_postponed_commit;
323*c1d255d3SCy Schubert 	size_t sae_postponed_commit_len;
32485732ac8SCy Schubert #endif /* CONFIG_TESTING_OPTIONS */
325206b73d0SCy Schubert #ifdef CONFIG_AIRTIME_POLICY
326206b73d0SCy Schubert 	unsigned int airtime_weight;
327206b73d0SCy Schubert 	struct os_reltime backlogged_until;
328206b73d0SCy Schubert #endif /* CONFIG_AIRTIME_POLICY */
329*c1d255d3SCy Schubert 
330*c1d255d3SCy Schubert #ifdef CONFIG_PASN
331*c1d255d3SCy Schubert 	struct pasn_data *pasn;
332*c1d255d3SCy Schubert #endif /* CONFIG_PASN */
333e28a4053SRui Paulo };
334e28a4053SRui Paulo 
335e28a4053SRui Paulo 
336e28a4053SRui Paulo /* Default value for maximum station inactivity. After AP_MAX_INACTIVITY has
337e28a4053SRui Paulo  * passed since last received frame from the station, a nullfunc data frame is
338e28a4053SRui Paulo  * sent to the station. If this frame is not acknowledged and no other frames
339e28a4053SRui Paulo  * have been received, the station will be disassociated after
340f05cddf9SRui Paulo  * AP_DISASSOC_DELAY seconds. Similarly, the station will be deauthenticated
341e28a4053SRui Paulo  * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
342e28a4053SRui Paulo #define AP_MAX_INACTIVITY (5 * 60)
343780fb4a2SCy Schubert #define AP_DISASSOC_DELAY (3)
344e28a4053SRui Paulo #define AP_DEAUTH_DELAY (1)
345e28a4053SRui Paulo /* Number of seconds to keep STA entry with Authenticated flag after it has
346e28a4053SRui Paulo  * been disassociated. */
347e28a4053SRui Paulo #define AP_MAX_INACTIVITY_AFTER_DISASSOC (1 * 30)
348e28a4053SRui Paulo /* Number of seconds to keep STA entry after it has been deauthenticated. */
349e28a4053SRui Paulo #define AP_MAX_INACTIVITY_AFTER_DEAUTH (1 * 5)
350e28a4053SRui Paulo 
351e28a4053SRui Paulo 
352e28a4053SRui Paulo int ap_for_each_sta(struct hostapd_data *hapd,
353e28a4053SRui Paulo 		    int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
354e28a4053SRui Paulo 			      void *ctx),
355e28a4053SRui Paulo 		    void *ctx);
356e28a4053SRui Paulo struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta);
3575b9c547cSRui Paulo struct sta_info * ap_get_sta_p2p(struct hostapd_data *hapd, const u8 *addr);
358e28a4053SRui Paulo void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta);
359e28a4053SRui Paulo void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);
3605b9c547cSRui Paulo void ap_sta_ip6addr_del(struct hostapd_data *hapd, struct sta_info *sta);
361e28a4053SRui Paulo void hostapd_free_stas(struct hostapd_data *hapd);
362e28a4053SRui Paulo void ap_handle_timer(void *eloop_ctx, void *timeout_ctx);
3635b9c547cSRui Paulo void ap_sta_replenish_timeout(struct hostapd_data *hapd, struct sta_info *sta,
3645b9c547cSRui Paulo 			      u32 session_timeout);
365e28a4053SRui Paulo void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
366e28a4053SRui Paulo 			    u32 session_timeout);
367e28a4053SRui Paulo void ap_sta_no_session_timeout(struct hostapd_data *hapd,
368e28a4053SRui Paulo 			       struct sta_info *sta);
3695b9c547cSRui Paulo void ap_sta_session_warning_timeout(struct hostapd_data *hapd,
3705b9c547cSRui Paulo 				    struct sta_info *sta, int warning_time);
371e28a4053SRui Paulo struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr);
372e28a4053SRui Paulo void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
373e28a4053SRui Paulo 			 u16 reason);
374e28a4053SRui Paulo void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
375e28a4053SRui Paulo 			   u16 reason);
376f05cddf9SRui Paulo #ifdef CONFIG_WPS
377f05cddf9SRui Paulo int ap_sta_wps_cancel(struct hostapd_data *hapd,
378f05cddf9SRui Paulo 		      struct sta_info *sta, void *ctx);
379f05cddf9SRui Paulo #endif /* CONFIG_WPS */
380325151a3SRui Paulo int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta);
381780fb4a2SCy Schubert int ap_sta_set_vlan(struct hostapd_data *hapd, struct sta_info *sta,
382780fb4a2SCy Schubert 		    struct vlan_description *vlan_desc);
383e28a4053SRui Paulo void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
384e28a4053SRui Paulo void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta);
385e28a4053SRui Paulo int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta);
3864bc52338SCy Schubert const char * ap_sta_wpa_get_keyid(struct hostapd_data *hapd,
3874bc52338SCy Schubert 				  struct sta_info *sta);
388e28a4053SRui Paulo void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
389e28a4053SRui Paulo 		       const u8 *addr, u16 reason);
390e28a4053SRui Paulo 
391f05cddf9SRui Paulo void ap_sta_set_authorized(struct hostapd_data *hapd,
392f05cddf9SRui Paulo 			   struct sta_info *sta, int authorized);
ap_sta_is_authorized(struct sta_info * sta)393f05cddf9SRui Paulo static inline int ap_sta_is_authorized(struct sta_info *sta)
394f05cddf9SRui Paulo {
395f05cddf9SRui Paulo 	return sta->flags & WLAN_STA_AUTHORIZED;
396f05cddf9SRui Paulo }
397f05cddf9SRui Paulo 
398f05cddf9SRui Paulo void ap_sta_deauth_cb(struct hostapd_data *hapd, struct sta_info *sta);
399f05cddf9SRui Paulo void ap_sta_disassoc_cb(struct hostapd_data *hapd, struct sta_info *sta);
400780fb4a2SCy Schubert void ap_sta_clear_disconnect_timeouts(struct hostapd_data *hapd,
401780fb4a2SCy Schubert 				      struct sta_info *sta);
402f05cddf9SRui Paulo 
4035b9c547cSRui Paulo int ap_sta_flags_txt(u32 flags, char *buf, size_t buflen);
40485732ac8SCy Schubert void ap_sta_delayed_1x_auth_fail_disconnect(struct hostapd_data *hapd,
40585732ac8SCy Schubert 					    struct sta_info *sta);
40685732ac8SCy Schubert int ap_sta_pending_delayed_1x_auth_fail_disconnect(struct hostapd_data *hapd,
40785732ac8SCy Schubert 						   struct sta_info *sta);
408*c1d255d3SCy Schubert int ap_sta_re_add(struct hostapd_data *hapd, struct sta_info *sta);
409*c1d255d3SCy Schubert 
410*c1d255d3SCy Schubert void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta);
4115b9c547cSRui Paulo 
412e28a4053SRui Paulo #endif /* STA_INFO_H */
413