xref: /freebsd/contrib/wpa/src/ap/hostapd.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
1e28a4053SRui Paulo /*
2e28a4053SRui Paulo  * hostapd / Initialization and configuration
35b9c547cSRui Paulo  * Copyright (c) 2002-2014, 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 HOSTAPD_H
10e28a4053SRui Paulo #define HOSTAPD_H
11e28a4053SRui Paulo 
12206b73d0SCy Schubert #ifdef CONFIG_SQLITE
13206b73d0SCy Schubert #include <sqlite3.h>
14206b73d0SCy Schubert #endif /* CONFIG_SQLITE */
15206b73d0SCy Schubert 
16e28a4053SRui Paulo #include "common/defs.h"
17*a90b9d01SCy Schubert #include "common/dpp.h"
185b9c547cSRui Paulo #include "utils/list.h"
19f05cddf9SRui Paulo #include "ap_config.h"
205b9c547cSRui Paulo #include "drivers/driver.h"
21e28a4053SRui Paulo 
2285732ac8SCy Schubert #define OCE_STA_CFON_ENABLED(hapd) \
2385732ac8SCy Schubert 	((hapd->conf->oce & OCE_STA_CFON) && \
2485732ac8SCy Schubert 	 (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_OCE_STA_CFON))
2585732ac8SCy Schubert #define OCE_AP_ENABLED(hapd) \
2685732ac8SCy Schubert 	((hapd->conf->oce & OCE_AP) && \
2785732ac8SCy Schubert 	 (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_OCE_AP))
2885732ac8SCy Schubert 
29e28a4053SRui Paulo struct wpa_ctrl_dst;
30e28a4053SRui Paulo struct radius_server_data;
31e28a4053SRui Paulo struct upnp_wps_device_sm;
32e28a4053SRui Paulo struct hostapd_data;
33e28a4053SRui Paulo struct sta_info;
34e28a4053SRui Paulo struct ieee80211_ht_capabilities;
35e28a4053SRui Paulo struct full_dynamic_vlan;
36f05cddf9SRui Paulo enum wps_event;
37f05cddf9SRui Paulo union wps_event_data;
385b9c547cSRui Paulo #ifdef CONFIG_MESH
395b9c547cSRui Paulo struct mesh_conf;
405b9c547cSRui Paulo #endif /* CONFIG_MESH */
41f05cddf9SRui Paulo 
42c1d255d3SCy Schubert #ifdef CONFIG_CTRL_IFACE_UDP
43c1d255d3SCy Schubert #define CTRL_IFACE_COOKIE_LEN 8
44c1d255d3SCy Schubert #endif /* CONFIG_CTRL_IFACE_UDP */
45c1d255d3SCy Schubert 
46f05cddf9SRui Paulo struct hostapd_iface;
47*a90b9d01SCy Schubert struct hostapd_mld;
48f05cddf9SRui Paulo 
49f05cddf9SRui Paulo struct hapd_interfaces {
50f05cddf9SRui Paulo 	int (*reload_config)(struct hostapd_iface *iface);
51f05cddf9SRui Paulo 	struct hostapd_config * (*config_read_cb)(const char *config_fname);
52f05cddf9SRui Paulo 	int (*ctrl_iface_init)(struct hostapd_data *hapd);
53f05cddf9SRui Paulo 	void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
54f05cddf9SRui Paulo 	int (*for_each_interface)(struct hapd_interfaces *interfaces,
55f05cddf9SRui Paulo 				  int (*cb)(struct hostapd_iface *iface,
56f05cddf9SRui Paulo 					    void *ctx), void *ctx);
57f05cddf9SRui Paulo 	int (*driver_init)(struct hostapd_iface *iface);
58f05cddf9SRui Paulo 
59f05cddf9SRui Paulo 	size_t count;
60f05cddf9SRui Paulo 	int global_ctrl_sock;
61780fb4a2SCy Schubert 	struct dl_list global_ctrl_dst;
62f05cddf9SRui Paulo 	char *global_iface_path;
63f05cddf9SRui Paulo 	char *global_iface_name;
645b9c547cSRui Paulo #ifndef CONFIG_NATIVE_WINDOWS
655b9c547cSRui Paulo 	gid_t ctrl_iface_group;
665b9c547cSRui Paulo #endif /* CONFIG_NATIVE_WINDOWS */
67f05cddf9SRui Paulo 	struct hostapd_iface **iface;
685b9c547cSRui Paulo 
695b9c547cSRui Paulo 	size_t terminate_on_error;
70325151a3SRui Paulo #ifndef CONFIG_NO_VLAN
71325151a3SRui Paulo 	struct dynamic_iface *vlan_priv;
72325151a3SRui Paulo #endif /* CONFIG_NO_VLAN */
7385732ac8SCy Schubert #ifdef CONFIG_ETH_P_OUI
7485732ac8SCy Schubert 	struct dl_list eth_p_oui; /* OUI Extended EtherType handlers */
7585732ac8SCy Schubert #endif /* CONFIG_ETH_P_OUI */
76780fb4a2SCy Schubert 	int eloop_initialized;
7785732ac8SCy Schubert 
7885732ac8SCy Schubert #ifdef CONFIG_DPP
794bc52338SCy Schubert 	struct dpp_global *dpp;
80*a90b9d01SCy Schubert #ifdef CONFIG_DPP3
81*a90b9d01SCy Schubert 	struct os_reltime dpp_pb_time;
82*a90b9d01SCy Schubert 	struct os_reltime dpp_pb_announce_time;
83*a90b9d01SCy Schubert 	struct dpp_pb_info dpp_pb[DPP_PB_INFO_COUNT];
84*a90b9d01SCy Schubert 	struct dpp_bootstrap_info *dpp_pb_bi;
85*a90b9d01SCy Schubert 	u8 dpp_pb_c_nonce[DPP_MAX_NONCE_LEN];
86*a90b9d01SCy Schubert 	u8 dpp_pb_resp_hash[SHA256_MAC_LEN];
87*a90b9d01SCy Schubert 	struct os_reltime dpp_pb_last_resp;
88*a90b9d01SCy Schubert 	bool dpp_pb_result_indicated;
89*a90b9d01SCy Schubert 	char *dpp_pb_cmd;
90*a90b9d01SCy Schubert #endif /* CONFIG_DPP3 */
9185732ac8SCy Schubert #endif /* CONFIG_DPP */
92c1d255d3SCy Schubert 
93c1d255d3SCy Schubert #ifdef CONFIG_CTRL_IFACE_UDP
94c1d255d3SCy Schubert        unsigned char ctrl_iface_cookie[CTRL_IFACE_COOKIE_LEN];
95c1d255d3SCy Schubert #endif /* CONFIG_CTRL_IFACE_UDP */
96c1d255d3SCy Schubert 
97*a90b9d01SCy Schubert #ifdef CONFIG_IEEE80211BE
98*a90b9d01SCy Schubert 	struct hostapd_mld **mld;
99*a90b9d01SCy Schubert 	size_t mld_count;
100*a90b9d01SCy Schubert #endif /* CONFIG_IEEE80211BE */
101f05cddf9SRui Paulo };
102f05cddf9SRui Paulo 
1035b9c547cSRui Paulo enum hostapd_chan_status {
1045b9c547cSRui Paulo 	HOSTAPD_CHAN_VALID = 0, /* channel is ready */
1055b9c547cSRui Paulo 	HOSTAPD_CHAN_INVALID = 1, /* no usable channel found */
1065b9c547cSRui Paulo 	HOSTAPD_CHAN_ACS = 2, /* ACS work being performed */
107*a90b9d01SCy Schubert 	HOSTAPD_CHAN_INVALID_NO_IR = 3, /* channel invalid due to AFC NO IR */
1085b9c547cSRui Paulo };
109e28a4053SRui Paulo 
110e28a4053SRui Paulo struct hostapd_probereq_cb {
111f05cddf9SRui Paulo 	int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
112f05cddf9SRui Paulo 		  const u8 *ie, size_t ie_len, int ssi_signal);
113e28a4053SRui Paulo 	void *ctx;
114e28a4053SRui Paulo };
115e28a4053SRui Paulo 
116e28a4053SRui Paulo #define HOSTAPD_RATE_BASIC 0x00000001
117e28a4053SRui Paulo 
118e28a4053SRui Paulo struct hostapd_rate_data {
119e28a4053SRui Paulo 	int rate; /* rate in 100 kbps */
120e28a4053SRui Paulo 	int flags; /* HOSTAPD_RATE_ flags */
121e28a4053SRui Paulo };
122e28a4053SRui Paulo 
123e28a4053SRui Paulo struct hostapd_frame_info {
12485732ac8SCy Schubert 	unsigned int freq;
125e28a4053SRui Paulo 	u32 channel;
126e28a4053SRui Paulo 	u32 datarate;
127f05cddf9SRui Paulo 	int ssi_signal; /* dBm */
128e28a4053SRui Paulo };
129e28a4053SRui Paulo 
1305b9c547cSRui Paulo enum wps_status {
1315b9c547cSRui Paulo 	WPS_STATUS_SUCCESS = 1,
1325b9c547cSRui Paulo 	WPS_STATUS_FAILURE
1335b9c547cSRui Paulo };
1345b9c547cSRui Paulo 
1355b9c547cSRui Paulo enum pbc_status {
1365b9c547cSRui Paulo 	WPS_PBC_STATUS_DISABLE,
1375b9c547cSRui Paulo 	WPS_PBC_STATUS_ACTIVE,
1385b9c547cSRui Paulo 	WPS_PBC_STATUS_TIMEOUT,
1395b9c547cSRui Paulo 	WPS_PBC_STATUS_OVERLAP
1405b9c547cSRui Paulo };
1415b9c547cSRui Paulo 
1425b9c547cSRui Paulo struct wps_stat {
1435b9c547cSRui Paulo 	enum wps_status status;
1445b9c547cSRui Paulo 	enum wps_error_indication failure_reason;
1455b9c547cSRui Paulo 	enum pbc_status pbc_status;
1465b9c547cSRui Paulo 	u8 peer_addr[ETH_ALEN];
1475b9c547cSRui Paulo };
1485b9c547cSRui Paulo 
149780fb4a2SCy Schubert struct hostapd_neighbor_entry {
150780fb4a2SCy Schubert 	struct dl_list list;
151780fb4a2SCy Schubert 	u8 bssid[ETH_ALEN];
152780fb4a2SCy Schubert 	struct wpa_ssid_value ssid;
153780fb4a2SCy Schubert 	struct wpabuf *nr;
154780fb4a2SCy Schubert 	struct wpabuf *lci;
155780fb4a2SCy Schubert 	struct wpabuf *civic;
156780fb4a2SCy Schubert 	/* LCI update time */
157780fb4a2SCy Schubert 	struct os_time lci_date;
15885732ac8SCy Schubert 	int stationary;
1594b72b91aSCy Schubert 	u32 short_ssid;
1604b72b91aSCy Schubert 	u8 bss_parameters;
161780fb4a2SCy Schubert };
162e28a4053SRui Paulo 
1634bc52338SCy Schubert struct hostapd_sae_commit_queue {
1644bc52338SCy Schubert 	struct dl_list list;
1654bc52338SCy Schubert 	int rssi;
1664bc52338SCy Schubert 	size_t len;
1674bc52338SCy Schubert 	u8 msg[];
1684bc52338SCy Schubert };
1694bc52338SCy Schubert 
170e28a4053SRui Paulo /**
171e28a4053SRui Paulo  * struct hostapd_data - hostapd per-BSS data structure
172e28a4053SRui Paulo  */
173e28a4053SRui Paulo struct hostapd_data {
174e28a4053SRui Paulo 	struct hostapd_iface *iface;
175e28a4053SRui Paulo 	struct hostapd_config *iconf;
176e28a4053SRui Paulo 	struct hostapd_bss_config *conf;
177e28a4053SRui Paulo 	int interface_added; /* virtual interface added for this BSS */
1785b9c547cSRui Paulo 	unsigned int started:1;
1795b9c547cSRui Paulo 	unsigned int disabled:1;
1805b9c547cSRui Paulo 	unsigned int reenable_beacon:1;
181e28a4053SRui Paulo 
182e28a4053SRui Paulo 	u8 own_addr[ETH_ALEN];
183e28a4053SRui Paulo 
184e28a4053SRui Paulo 	int num_sta; /* number of entries in sta_list */
185e28a4053SRui Paulo 	struct sta_info *sta_list; /* STA info list head */
186e28a4053SRui Paulo #define STA_HASH_SIZE 256
187e28a4053SRui Paulo #define STA_HASH(sta) (sta[5])
188e28a4053SRui Paulo 	struct sta_info *sta_hash[STA_HASH_SIZE];
189e28a4053SRui Paulo 
190e28a4053SRui Paulo 	/*
191e28a4053SRui Paulo 	 * Bitfield for indicating which AIDs are allocated. Only AID values
192e28a4053SRui Paulo 	 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
193e28a4053SRui Paulo 	 * 1.
194e28a4053SRui Paulo 	 */
195e28a4053SRui Paulo #define AID_WORDS ((2008 + 31) / 32)
196e28a4053SRui Paulo 	u32 sta_aid[AID_WORDS];
197e28a4053SRui Paulo 
198e28a4053SRui Paulo 	const struct wpa_driver_ops *driver;
199e28a4053SRui Paulo 	void *drv_priv;
200e28a4053SRui Paulo 
201e28a4053SRui Paulo 	void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
202e28a4053SRui Paulo 				 struct sta_info *sta, int reassoc);
203e28a4053SRui Paulo 
204e28a4053SRui Paulo 	void *msg_ctx; /* ctx for wpa_msg() calls */
205f05cddf9SRui Paulo 	void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
206e28a4053SRui Paulo 
207e28a4053SRui Paulo 	struct radius_client_data *radius;
208780fb4a2SCy Schubert 	u64 acct_session_id;
209f05cddf9SRui Paulo 	struct radius_das_data *radius_das;
210e28a4053SRui Paulo 
211e28a4053SRui Paulo 	struct hostapd_cached_radius_acl *acl_cache;
212e28a4053SRui Paulo 	struct hostapd_acl_query_data *acl_queries;
213e28a4053SRui Paulo 
214e28a4053SRui Paulo 	struct wpa_authenticator *wpa_auth;
215e28a4053SRui Paulo 	struct eapol_authenticator *eapol_auth;
216c1d255d3SCy Schubert 	struct eap_config *eap_cfg;
217e28a4053SRui Paulo 
218e28a4053SRui Paulo 	struct rsn_preauth_interface *preauth_iface;
2195b9c547cSRui Paulo 	struct os_reltime michael_mic_failure;
220e28a4053SRui Paulo 	int michael_mic_failures;
221e28a4053SRui Paulo 	int tkip_countermeasures;
222e28a4053SRui Paulo 
223e28a4053SRui Paulo 	int ctrl_sock;
224780fb4a2SCy Schubert 	struct dl_list ctrl_dst;
225e28a4053SRui Paulo 
226e28a4053SRui Paulo 	void *ssl_ctx;
227e28a4053SRui Paulo 	void *eap_sim_db_priv;
228*a90b9d01SCy Schubert 	struct crypto_rsa_key *imsi_privacy_key;
229e28a4053SRui Paulo 	struct radius_server_data *radius_srv;
2305b9c547cSRui Paulo 	struct dl_list erp_keys; /* struct eap_server_erp_key */
231e28a4053SRui Paulo 
232e28a4053SRui Paulo 	int parameter_set_count;
233e28a4053SRui Paulo 
234f05cddf9SRui Paulo 	/* Time Advertisement */
235f05cddf9SRui Paulo 	u8 time_update_counter;
236f05cddf9SRui Paulo 	struct wpabuf *time_adv;
237f05cddf9SRui Paulo 
238e28a4053SRui Paulo #ifdef CONFIG_FULL_DYNAMIC_VLAN
239e28a4053SRui Paulo 	struct full_dynamic_vlan *full_dynamic_vlan;
240e28a4053SRui Paulo #endif /* CONFIG_FULL_DYNAMIC_VLAN */
241e28a4053SRui Paulo 
242e28a4053SRui Paulo 	struct l2_packet_data *l2;
24385732ac8SCy Schubert 
24485732ac8SCy Schubert #ifdef CONFIG_IEEE80211R_AP
24585732ac8SCy Schubert 	struct dl_list l2_queue;
24685732ac8SCy Schubert 	struct dl_list l2_oui_queue;
24785732ac8SCy Schubert 	struct eth_p_oui_ctx *oui_pull;
24885732ac8SCy Schubert 	struct eth_p_oui_ctx *oui_resp;
24985732ac8SCy Schubert 	struct eth_p_oui_ctx *oui_push;
25085732ac8SCy Schubert 	struct eth_p_oui_ctx *oui_sreq;
25185732ac8SCy Schubert 	struct eth_p_oui_ctx *oui_sresp;
25285732ac8SCy Schubert #endif /* CONFIG_IEEE80211R_AP */
25385732ac8SCy Schubert 
254e28a4053SRui Paulo 	struct wps_context *wps;
255e28a4053SRui Paulo 
256f05cddf9SRui Paulo 	int beacon_set_done;
257e28a4053SRui Paulo 	struct wpabuf *wps_beacon_ie;
258e28a4053SRui Paulo 	struct wpabuf *wps_probe_resp_ie;
259e28a4053SRui Paulo #ifdef CONFIG_WPS
260e28a4053SRui Paulo 	unsigned int ap_pin_failures;
261f05cddf9SRui Paulo 	unsigned int ap_pin_failures_consecutive;
262e28a4053SRui Paulo 	struct upnp_wps_device_sm *wps_upnp;
263e28a4053SRui Paulo 	unsigned int ap_pin_lockout_time;
2645b9c547cSRui Paulo 
2655b9c547cSRui Paulo 	struct wps_stat wps_stats;
266e28a4053SRui Paulo #endif /* CONFIG_WPS */
267e28a4053SRui Paulo 
268206b73d0SCy Schubert #ifdef CONFIG_MACSEC
269206b73d0SCy Schubert 	struct ieee802_1x_kay *kay;
270206b73d0SCy Schubert #endif /* CONFIG_MACSEC */
271206b73d0SCy Schubert 
272e28a4053SRui Paulo 	struct hostapd_probereq_cb *probereq_cb;
273e28a4053SRui Paulo 	size_t num_probereq_cb;
274e28a4053SRui Paulo 
275e28a4053SRui Paulo 	void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
276e28a4053SRui Paulo 				 int freq);
277e28a4053SRui Paulo 	void *public_action_cb_ctx;
2785b9c547cSRui Paulo 	void (*public_action_cb2)(void *ctx, const u8 *buf, size_t len,
2795b9c547cSRui Paulo 				  int freq);
2805b9c547cSRui Paulo 	void *public_action_cb2_ctx;
281e28a4053SRui Paulo 
282f05cddf9SRui Paulo 	int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
283f05cddf9SRui Paulo 				int freq);
284f05cddf9SRui Paulo 	void *vendor_action_cb_ctx;
285f05cddf9SRui Paulo 
286e28a4053SRui Paulo 	void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
287e28a4053SRui Paulo 				   const u8 *uuid_e);
288e28a4053SRui Paulo 	void *wps_reg_success_cb_ctx;
289f05cddf9SRui Paulo 
290f05cddf9SRui Paulo 	void (*wps_event_cb)(void *ctx, enum wps_event event,
291f05cddf9SRui Paulo 			     union wps_event_data *data);
292f05cddf9SRui Paulo 	void *wps_event_cb_ctx;
293f05cddf9SRui Paulo 
294f05cddf9SRui Paulo 	void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
295*a90b9d01SCy Schubert 				  int authorized, const u8 *p2p_dev_addr,
296*a90b9d01SCy Schubert 				  const u8 *ip);
297f05cddf9SRui Paulo 	void *sta_authorized_cb_ctx;
298f05cddf9SRui Paulo 
299f05cddf9SRui Paulo 	void (*setup_complete_cb)(void *ctx);
300f05cddf9SRui Paulo 	void *setup_complete_cb_ctx;
301f05cddf9SRui Paulo 
3025b9c547cSRui Paulo 	void (*new_psk_cb)(void *ctx, const u8 *mac_addr,
3035b9c547cSRui Paulo 			   const u8 *p2p_dev_addr, const u8 *psk,
3045b9c547cSRui Paulo 			   size_t psk_len);
3055b9c547cSRui Paulo 	void *new_psk_cb_ctx;
3065b9c547cSRui Paulo 
3075b9c547cSRui Paulo 	/* channel switch parameters */
3085b9c547cSRui Paulo 	struct hostapd_freq_params cs_freq_params;
3095b9c547cSRui Paulo 	u8 cs_count;
3105b9c547cSRui Paulo 	int cs_block_tx;
3115b9c547cSRui Paulo 	unsigned int cs_c_off_beacon;
3125b9c547cSRui Paulo 	unsigned int cs_c_off_proberesp;
3135b9c547cSRui Paulo 	int csa_in_progress;
314780fb4a2SCy Schubert 	unsigned int cs_c_off_ecsa_beacon;
315780fb4a2SCy Schubert 	unsigned int cs_c_off_ecsa_proberesp;
3165b9c547cSRui Paulo 
317*a90b9d01SCy Schubert #ifdef CONFIG_IEEE80211AX
318*a90b9d01SCy Schubert 	bool cca_in_progress;
319*a90b9d01SCy Schubert 	u8 cca_count;
320*a90b9d01SCy Schubert 	u8 cca_color;
321*a90b9d01SCy Schubert 	unsigned int cca_c_off_beacon;
322*a90b9d01SCy Schubert 	unsigned int cca_c_off_proberesp;
323*a90b9d01SCy Schubert 	struct os_reltime first_color_collision;
324*a90b9d01SCy Schubert 	struct os_reltime last_color_collision;
325*a90b9d01SCy Schubert 	u64 color_collision_bitmap;
326*a90b9d01SCy Schubert #endif /* CONFIG_IEEE80211AX */
327*a90b9d01SCy Schubert 
328f05cddf9SRui Paulo #ifdef CONFIG_P2P
329f05cddf9SRui Paulo 	struct p2p_data *p2p;
330f05cddf9SRui Paulo 	struct p2p_group *p2p_group;
331f05cddf9SRui Paulo 	struct wpabuf *p2p_beacon_ie;
332f05cddf9SRui Paulo 	struct wpabuf *p2p_probe_resp_ie;
333f05cddf9SRui Paulo 
334f05cddf9SRui Paulo 	/* Number of non-P2P association stations */
335f05cddf9SRui Paulo 	int num_sta_no_p2p;
336f05cddf9SRui Paulo 
337f05cddf9SRui Paulo 	/* Periodic NoA (used only when no non-P2P clients in the group) */
338f05cddf9SRui Paulo 	int noa_enabled;
339f05cddf9SRui Paulo 	int noa_start;
340f05cddf9SRui Paulo 	int noa_duration;
341f05cddf9SRui Paulo #endif /* CONFIG_P2P */
3425b9c547cSRui Paulo #ifdef CONFIG_PROXYARP
3435b9c547cSRui Paulo 	struct l2_packet_data *sock_dhcp;
3445b9c547cSRui Paulo 	struct l2_packet_data *sock_ndisc;
345*a90b9d01SCy Schubert 	bool x_snoop_initialized;
3465b9c547cSRui Paulo #endif /* CONFIG_PROXYARP */
3475b9c547cSRui Paulo #ifdef CONFIG_MESH
3485b9c547cSRui Paulo 	int num_plinks;
3495b9c547cSRui Paulo 	int max_plinks;
350780fb4a2SCy Schubert 	void (*mesh_sta_free_cb)(struct hostapd_data *hapd,
351780fb4a2SCy Schubert 				 struct sta_info *sta);
3525b9c547cSRui Paulo 	struct wpabuf *mesh_pending_auth;
3535b9c547cSRui Paulo 	struct os_reltime mesh_pending_auth_time;
354780fb4a2SCy Schubert 	u8 mesh_required_peer[ETH_ALEN];
3555b9c547cSRui Paulo #endif /* CONFIG_MESH */
356f05cddf9SRui Paulo 
357f05cddf9SRui Paulo #ifdef CONFIG_SQLITE
358f05cddf9SRui Paulo 	struct hostapd_eap_user tmp_eap_user;
359f05cddf9SRui Paulo #endif /* CONFIG_SQLITE */
3605b9c547cSRui Paulo 
3615b9c547cSRui Paulo #ifdef CONFIG_SAE
362*a90b9d01SCy Schubert 
363*a90b9d01SCy Schubert #define COMEBACK_KEY_SIZE 8
364*a90b9d01SCy Schubert #define COMEBACK_PENDING_IDX_SIZE 256
365*a90b9d01SCy Schubert 
3665b9c547cSRui Paulo 	/** Key used for generating SAE anti-clogging tokens */
367*a90b9d01SCy Schubert 	u8 comeback_key[COMEBACK_KEY_SIZE];
368c1d255d3SCy Schubert 	struct os_reltime last_comeback_key_update;
369c1d255d3SCy Schubert 	u16 comeback_idx;
370*a90b9d01SCy Schubert 	u16 comeback_pending_idx[COMEBACK_PENDING_IDX_SIZE];
371325151a3SRui Paulo 	int dot11RSNASAERetransPeriod; /* msec */
3724bc52338SCy Schubert 	struct dl_list sae_commit_queue; /* struct hostapd_sae_commit_queue */
3735b9c547cSRui Paulo #endif /* CONFIG_SAE */
3745b9c547cSRui Paulo 
3755b9c547cSRui Paulo #ifdef CONFIG_TESTING_OPTIONS
3765b9c547cSRui Paulo 	unsigned int ext_mgmt_frame_handling:1;
3775b9c547cSRui Paulo 	unsigned int ext_eapol_frame_io:1;
3785b9c547cSRui Paulo 
3795b9c547cSRui Paulo 	struct l2_packet_data *l2_test;
38085732ac8SCy Schubert 
38185732ac8SCy Schubert 	enum wpa_alg last_gtk_alg;
38285732ac8SCy Schubert 	int last_gtk_key_idx;
38385732ac8SCy Schubert 	u8 last_gtk[WPA_GTK_MAX_LEN];
38485732ac8SCy Schubert 	size_t last_gtk_len;
38585732ac8SCy Schubert 
38685732ac8SCy Schubert 	enum wpa_alg last_igtk_alg;
38785732ac8SCy Schubert 	int last_igtk_key_idx;
38885732ac8SCy Schubert 	u8 last_igtk[WPA_IGTK_MAX_LEN];
38985732ac8SCy Schubert 	size_t last_igtk_len;
390c1d255d3SCy Schubert 
391c1d255d3SCy Schubert 	enum wpa_alg last_bigtk_alg;
392c1d255d3SCy Schubert 	int last_bigtk_key_idx;
393c1d255d3SCy Schubert 	u8 last_bigtk[WPA_BIGTK_MAX_LEN];
394c1d255d3SCy Schubert 	size_t last_bigtk_len;
395c1d255d3SCy Schubert 
396c1d255d3SCy Schubert 	bool force_backlog_bytes;
3975b9c547cSRui Paulo #endif /* CONFIG_TESTING_OPTIONS */
398780fb4a2SCy Schubert 
399780fb4a2SCy Schubert #ifdef CONFIG_MBO
400780fb4a2SCy Schubert 	unsigned int mbo_assoc_disallow;
401780fb4a2SCy Schubert #endif /* CONFIG_MBO */
402780fb4a2SCy Schubert 
403780fb4a2SCy Schubert 	struct dl_list nr_db;
404780fb4a2SCy Schubert 
40585732ac8SCy Schubert 	u8 beacon_req_token;
406780fb4a2SCy Schubert 	u8 lci_req_token;
407780fb4a2SCy Schubert 	u8 range_req_token;
408*a90b9d01SCy Schubert 	u8 link_measurement_req_token;
409780fb4a2SCy Schubert 	unsigned int lci_req_active:1;
410780fb4a2SCy Schubert 	unsigned int range_req_active:1;
411*a90b9d01SCy Schubert 	unsigned int link_mesr_req_active:1;
41285732ac8SCy Schubert 
41385732ac8SCy Schubert 	int dhcp_sock; /* UDP socket used with the DHCP server */
41485732ac8SCy Schubert 
415c1d255d3SCy Schubert 	struct ptksa_cache *ptksa;
416c1d255d3SCy Schubert 
41785732ac8SCy Schubert #ifdef CONFIG_DPP
41885732ac8SCy Schubert 	int dpp_init_done;
41985732ac8SCy Schubert 	struct dpp_authentication *dpp_auth;
42085732ac8SCy Schubert 	u8 dpp_allowed_roles;
42185732ac8SCy Schubert 	int dpp_qr_mutual;
42285732ac8SCy Schubert 	int dpp_auth_ok_on_ack;
42385732ac8SCy Schubert 	int dpp_in_response_listen;
42485732ac8SCy Schubert 	struct gas_query_ap *gas;
42585732ac8SCy Schubert 	struct dpp_pkex *dpp_pkex;
42685732ac8SCy Schubert 	struct dpp_bootstrap_info *dpp_pkex_bi;
42785732ac8SCy Schubert 	char *dpp_pkex_code;
428*a90b9d01SCy Schubert 	size_t dpp_pkex_code_len;
42985732ac8SCy Schubert 	char *dpp_pkex_identifier;
430*a90b9d01SCy Schubert 	enum dpp_pkex_ver dpp_pkex_ver;
43185732ac8SCy Schubert 	char *dpp_pkex_auth_cmd;
43285732ac8SCy Schubert 	char *dpp_configurator_params;
43385732ac8SCy Schubert 	struct os_reltime dpp_last_init;
43485732ac8SCy Schubert 	struct os_reltime dpp_init_iter_start;
43585732ac8SCy Schubert 	unsigned int dpp_init_max_tries;
43685732ac8SCy Schubert 	unsigned int dpp_init_retry_time;
43785732ac8SCy Schubert 	unsigned int dpp_resp_wait_time;
43885732ac8SCy Schubert 	unsigned int dpp_resp_max_tries;
43985732ac8SCy Schubert 	unsigned int dpp_resp_retry_time;
440c1d255d3SCy Schubert #ifdef CONFIG_DPP2
441c1d255d3SCy Schubert 	struct wpabuf *dpp_presence_announcement;
442c1d255d3SCy Schubert 	struct dpp_bootstrap_info *dpp_chirp_bi;
443c1d255d3SCy Schubert 	int dpp_chirp_freq;
444c1d255d3SCy Schubert 	int *dpp_chirp_freqs;
445c1d255d3SCy Schubert 	int dpp_chirp_iter;
446c1d255d3SCy Schubert 	int dpp_chirp_round;
447c1d255d3SCy Schubert 	int dpp_chirp_scan_done;
448c1d255d3SCy Schubert 	int dpp_chirp_listen;
449*a90b9d01SCy Schubert 	struct os_reltime dpp_relay_last_needs_ctrl;
450c1d255d3SCy Schubert #endif /* CONFIG_DPP2 */
45185732ac8SCy Schubert #ifdef CONFIG_TESTING_OPTIONS
45285732ac8SCy Schubert 	char *dpp_config_obj_override;
45385732ac8SCy Schubert 	char *dpp_discovery_override;
45485732ac8SCy Schubert 	char *dpp_groups_override;
45585732ac8SCy Schubert 	unsigned int dpp_ignore_netaccesskey_mismatch:1;
45685732ac8SCy Schubert #endif /* CONFIG_TESTING_OPTIONS */
45785732ac8SCy Schubert #endif /* CONFIG_DPP */
458206b73d0SCy Schubert 
459206b73d0SCy Schubert #ifdef CONFIG_AIRTIME_POLICY
460206b73d0SCy Schubert 	unsigned int num_backlogged_sta;
461206b73d0SCy Schubert 	unsigned int airtime_weight;
462206b73d0SCy Schubert #endif /* CONFIG_AIRTIME_POLICY */
463206b73d0SCy Schubert 
464206b73d0SCy Schubert 	u8 last_1x_eapol_key_replay_counter[8];
465206b73d0SCy Schubert 
466206b73d0SCy Schubert #ifdef CONFIG_SQLITE
467206b73d0SCy Schubert 	sqlite3 *rad_attr_db;
468206b73d0SCy Schubert #endif /* CONFIG_SQLITE */
469c1d255d3SCy Schubert 
470c1d255d3SCy Schubert #ifdef CONFIG_CTRL_IFACE_UDP
471c1d255d3SCy Schubert        unsigned char ctrl_iface_cookie[CTRL_IFACE_COOKIE_LEN];
472c1d255d3SCy Schubert #endif /* CONFIG_CTRL_IFACE_UDP */
473*a90b9d01SCy Schubert 
474*a90b9d01SCy Schubert #ifdef CONFIG_IEEE80211BE
475*a90b9d01SCy Schubert 	u8 eht_mld_bss_param_change;
476*a90b9d01SCy Schubert 	struct hostapd_mld *mld;
477*a90b9d01SCy Schubert 	struct dl_list link;
478*a90b9d01SCy Schubert 	u8 mld_link_id;
479*a90b9d01SCy Schubert #ifdef CONFIG_TESTING_OPTIONS
480*a90b9d01SCy Schubert 	u8 eht_mld_link_removal_count;
481*a90b9d01SCy Schubert #endif /* CONFIG_TESTING_OPTIONS */
482*a90b9d01SCy Schubert #endif /* CONFIG_IEEE80211BE */
483*a90b9d01SCy Schubert 
484*a90b9d01SCy Schubert #ifdef CONFIG_NAN_USD
485*a90b9d01SCy Schubert 	struct nan_de *nan_de;
486*a90b9d01SCy Schubert #endif /* CONFIG_NAN_USD */
487*a90b9d01SCy Schubert 
488*a90b9d01SCy Schubert 	u64 scan_cookie; /* Scan instance identifier for the ongoing HT40 scan
489*a90b9d01SCy Schubert 			  */
490e28a4053SRui Paulo };
491e28a4053SRui Paulo 
492e28a4053SRui Paulo 
493325151a3SRui Paulo struct hostapd_sta_info {
494325151a3SRui Paulo 	struct dl_list list;
495325151a3SRui Paulo 	u8 addr[ETH_ALEN];
496325151a3SRui Paulo 	struct os_reltime last_seen;
49785732ac8SCy Schubert 	int ssi_signal;
498780fb4a2SCy Schubert #ifdef CONFIG_TAXONOMY
499780fb4a2SCy Schubert 	struct wpabuf *probe_ie_taxonomy;
500780fb4a2SCy Schubert #endif /* CONFIG_TAXONOMY */
501325151a3SRui Paulo };
502325151a3SRui Paulo 
503*a90b9d01SCy Schubert #ifdef CONFIG_IEEE80211BE
504*a90b9d01SCy Schubert /**
505*a90b9d01SCy Schubert  * struct hostapd_mld - hostapd per-mld data structure
506*a90b9d01SCy Schubert  */
507*a90b9d01SCy Schubert struct hostapd_mld {
508*a90b9d01SCy Schubert 	char name[IFNAMSIZ + 1];
509*a90b9d01SCy Schubert 	u8 mld_addr[ETH_ALEN];
510*a90b9d01SCy Schubert 	u8 next_link_id;
511*a90b9d01SCy Schubert 	u8 num_links;
512*a90b9d01SCy Schubert 	/* Number of hostapd_data (hapd) referencing this. num_links cannot be
513*a90b9d01SCy Schubert 	 * used since num_links can go to 0 even when a BSS is disabled and
514*a90b9d01SCy Schubert 	 * when it is re-enabled, the MLD should exist and hence it cannot be
515*a90b9d01SCy Schubert 	 * freed when num_links is 0.
516*a90b9d01SCy Schubert 	 */
517*a90b9d01SCy Schubert 	u8 refcount;
518*a90b9d01SCy Schubert 
519*a90b9d01SCy Schubert 	struct hostapd_data *fbss;
520*a90b9d01SCy Schubert 	struct dl_list links; /* List head of all affiliated links */
521*a90b9d01SCy Schubert };
522*a90b9d01SCy Schubert 
523*a90b9d01SCy Schubert #define HOSTAPD_MLD_MAX_REF_COUNT      0xFF
524*a90b9d01SCy Schubert #endif /* CONFIG_IEEE80211BE */
525*a90b9d01SCy Schubert 
526e28a4053SRui Paulo /**
527e28a4053SRui Paulo  * struct hostapd_iface - hostapd per-interface data structure
528e28a4053SRui Paulo  */
529e28a4053SRui Paulo struct hostapd_iface {
530e28a4053SRui Paulo 	struct hapd_interfaces *interfaces;
531e28a4053SRui Paulo 	void *owner;
532e28a4053SRui Paulo 	char *config_fname;
533e28a4053SRui Paulo 	struct hostapd_config *conf;
5345b9c547cSRui Paulo 	char phy[16]; /* Name of the PHY (radio) */
5355b9c547cSRui Paulo 
5365b9c547cSRui Paulo 	enum hostapd_iface_state {
5375b9c547cSRui Paulo 		HAPD_IFACE_UNINITIALIZED,
5385b9c547cSRui Paulo 		HAPD_IFACE_DISABLED,
5395b9c547cSRui Paulo 		HAPD_IFACE_COUNTRY_UPDATE,
5405b9c547cSRui Paulo 		HAPD_IFACE_ACS,
5415b9c547cSRui Paulo 		HAPD_IFACE_HT_SCAN,
5425b9c547cSRui Paulo 		HAPD_IFACE_DFS,
543*a90b9d01SCy Schubert 		HAPD_IFACE_NO_IR,
5445b9c547cSRui Paulo 		HAPD_IFACE_ENABLED
5455b9c547cSRui Paulo 	} state;
5465b9c547cSRui Paulo 
5475b9c547cSRui Paulo #ifdef CONFIG_MESH
5485b9c547cSRui Paulo 	struct mesh_conf *mconf;
5495b9c547cSRui Paulo #endif /* CONFIG_MESH */
550e28a4053SRui Paulo 
551e28a4053SRui Paulo 	size_t num_bss;
552e28a4053SRui Paulo 	struct hostapd_data **bss;
553e28a4053SRui Paulo 
5545b9c547cSRui Paulo 	unsigned int wait_channel_update:1;
5555b9c547cSRui Paulo 	unsigned int cac_started:1;
556325151a3SRui Paulo #ifdef CONFIG_FST
557325151a3SRui Paulo 	struct fst_iface *fst;
558325151a3SRui Paulo 	const struct wpabuf *fst_ies;
559325151a3SRui Paulo #endif /* CONFIG_FST */
5605b9c547cSRui Paulo 
5615b9c547cSRui Paulo 	/*
5625b9c547cSRui Paulo 	 * When set, indicates that the driver will handle the AP
5635b9c547cSRui Paulo 	 * teardown: delete global keys, station keys, and stations.
5645b9c547cSRui Paulo 	 */
5655b9c547cSRui Paulo 	unsigned int driver_ap_teardown:1;
5665b9c547cSRui Paulo 
567780fb4a2SCy Schubert 	/*
568780fb4a2SCy Schubert 	 * When set, indicates that this interface is part of list of
569780fb4a2SCy Schubert 	 * interfaces that need to be started together (synchronously).
570780fb4a2SCy Schubert 	 */
571780fb4a2SCy Schubert 	unsigned int need_to_start_in_sync:1;
572780fb4a2SCy Schubert 
573780fb4a2SCy Schubert 	/* Ready to start but waiting for other interfaces to become ready. */
574780fb4a2SCy Schubert 	unsigned int ready_to_start_in_sync:1;
575780fb4a2SCy Schubert 
576e28a4053SRui Paulo 	int num_ap; /* number of entries in ap_list */
577e28a4053SRui Paulo 	struct ap_info *ap_list; /* AP info list head */
578e28a4053SRui Paulo 	struct ap_info *ap_hash[STA_HASH_SIZE];
579e28a4053SRui Paulo 
5805b9c547cSRui Paulo 	u64 drv_flags;
581c1d255d3SCy Schubert 	u64 drv_flags2;
582*a90b9d01SCy Schubert 	unsigned int drv_rrm_flags;
583f05cddf9SRui Paulo 
584f05cddf9SRui Paulo 	/*
585f05cddf9SRui Paulo 	 * A bitmap of supported protocols for probe response offload. See
586f05cddf9SRui Paulo 	 * struct wpa_driver_capa in driver.h
587f05cddf9SRui Paulo 	 */
588f05cddf9SRui Paulo 	unsigned int probe_resp_offloads;
589f05cddf9SRui Paulo 
5905b9c547cSRui Paulo 	/* extended capabilities supported by the driver */
5915b9c547cSRui Paulo 	const u8 *extended_capa, *extended_capa_mask;
5925b9c547cSRui Paulo 	unsigned int extended_capa_len;
5935b9c547cSRui Paulo 
594*a90b9d01SCy Schubert 	u16 mld_eml_capa, mld_mld_capa;
595*a90b9d01SCy Schubert 
5965b9c547cSRui Paulo 	unsigned int drv_max_acl_mac_addrs;
5975b9c547cSRui Paulo 
598e28a4053SRui Paulo 	struct hostapd_hw_modes *hw_features;
599e28a4053SRui Paulo 	int num_hw_features;
600e28a4053SRui Paulo 	struct hostapd_hw_modes *current_mode;
601e28a4053SRui Paulo 	/* Rates that are currently used (i.e., filtered copy of
602e28a4053SRui Paulo 	 * current_mode->channels */
603e28a4053SRui Paulo 	int num_rates;
604e28a4053SRui Paulo 	struct hostapd_rate_data *current_rates;
605f05cddf9SRui Paulo 	int *basic_rates;
606e28a4053SRui Paulo 	int freq;
607e28a4053SRui Paulo 
608*a90b9d01SCy Schubert 	bool radar_detected;
609*a90b9d01SCy Schubert 
610*a90b9d01SCy Schubert 	/* Background radar configuration */
611*a90b9d01SCy Schubert 	struct {
612*a90b9d01SCy Schubert 		int channel;
613*a90b9d01SCy Schubert 		int secondary_channel;
614*a90b9d01SCy Schubert 		int freq;
615*a90b9d01SCy Schubert 		int centr_freq_seg0_idx;
616*a90b9d01SCy Schubert 		int centr_freq_seg1_idx;
617*a90b9d01SCy Schubert 		/* Main chain is on temporary channel during
618*a90b9d01SCy Schubert 		 * CAC detection on radar offchain.
619*a90b9d01SCy Schubert 		 */
620*a90b9d01SCy Schubert 		unsigned int temp_ch:1;
621*a90b9d01SCy Schubert 		/* CAC started on radar offchain */
622*a90b9d01SCy Schubert 		unsigned int cac_started:1;
623*a90b9d01SCy Schubert 	} radar_background;
624*a90b9d01SCy Schubert 
625e28a4053SRui Paulo 	u16 hw_flags;
626e28a4053SRui Paulo 
627e28a4053SRui Paulo 	/* Number of associated Non-ERP stations (i.e., stations using 802.11b
628e28a4053SRui Paulo 	 * in 802.11g BSS) */
629e28a4053SRui Paulo 	int num_sta_non_erp;
630e28a4053SRui Paulo 
631e28a4053SRui Paulo 	/* Number of associated stations that do not support Short Slot Time */
632e28a4053SRui Paulo 	int num_sta_no_short_slot_time;
633e28a4053SRui Paulo 
634e28a4053SRui Paulo 	/* Number of associated stations that do not support Short Preamble */
635e28a4053SRui Paulo 	int num_sta_no_short_preamble;
636e28a4053SRui Paulo 
637e28a4053SRui Paulo 	int olbc; /* Overlapping Legacy BSS Condition */
638e28a4053SRui Paulo 
639e28a4053SRui Paulo 	/* Number of HT associated stations that do not support greenfield */
640e28a4053SRui Paulo 	int num_sta_ht_no_gf;
641e28a4053SRui Paulo 
642e28a4053SRui Paulo 	/* Number of associated non-HT stations */
643e28a4053SRui Paulo 	int num_sta_no_ht;
644e28a4053SRui Paulo 
645e28a4053SRui Paulo 	/* Number of HT associated stations 20 MHz */
646e28a4053SRui Paulo 	int num_sta_ht_20mhz;
647e28a4053SRui Paulo 
6485b9c547cSRui Paulo 	/* Number of HT40 intolerant stations */
6495b9c547cSRui Paulo 	int num_sta_ht40_intolerant;
6505b9c547cSRui Paulo 
651e28a4053SRui Paulo 	/* Overlapping BSS information */
652e28a4053SRui Paulo 	int olbc_ht;
653e28a4053SRui Paulo 
654e28a4053SRui Paulo 	u16 ht_op_mode;
6555b9c547cSRui Paulo 
6565b9c547cSRui Paulo 	/* surveying helpers */
6575b9c547cSRui Paulo 
6585b9c547cSRui Paulo 	/* number of channels surveyed */
6595b9c547cSRui Paulo 	unsigned int chans_surveyed;
6605b9c547cSRui Paulo 
6615b9c547cSRui Paulo 	/* lowest observed noise floor in dBm */
6625b9c547cSRui Paulo 	s8 lowest_nf;
6635b9c547cSRui Paulo 
6645b9c547cSRui Paulo 	/* channel utilization calculation */
6655b9c547cSRui Paulo 	u64 last_channel_time;
6665b9c547cSRui Paulo 	u64 last_channel_time_busy;
6675b9c547cSRui Paulo 	u8 channel_utilization;
6685b9c547cSRui Paulo 
66985732ac8SCy Schubert 	unsigned int chan_util_samples_sum;
67085732ac8SCy Schubert 	unsigned int chan_util_num_sample_periods;
67185732ac8SCy Schubert 	unsigned int chan_util_average;
67285732ac8SCy Schubert 
673780fb4a2SCy Schubert 	/* eCSA IE will be added only if operating class is specified */
674780fb4a2SCy Schubert 	u8 cs_oper_class;
675780fb4a2SCy Schubert 
6765b9c547cSRui Paulo 	unsigned int dfs_cac_ms;
6775b9c547cSRui Paulo 	struct os_reltime dfs_cac_start;
6785b9c547cSRui Paulo 
6795b9c547cSRui Paulo 	/* Latched with the actual secondary channel information and will be
6805b9c547cSRui Paulo 	 * used while juggling between HT20 and HT40 modes. */
6815b9c547cSRui Paulo 	int secondary_ch;
6825b9c547cSRui Paulo 
6835b9c547cSRui Paulo #ifdef CONFIG_ACS
6845b9c547cSRui Paulo 	unsigned int acs_num_completed_scans;
685*a90b9d01SCy Schubert 	unsigned int acs_num_retries;
6865b9c547cSRui Paulo #endif /* CONFIG_ACS */
6875b9c547cSRui Paulo 
688e28a4053SRui Paulo 	void (*scan_cb)(struct hostapd_iface *iface);
6895b9c547cSRui Paulo 	int num_ht40_scan_tries;
690325151a3SRui Paulo 
691325151a3SRui Paulo 	struct dl_list sta_seen; /* struct hostapd_sta_info */
692325151a3SRui Paulo 	unsigned int num_sta_seen;
69385732ac8SCy Schubert 
69485732ac8SCy Schubert 	u8 dfs_domain;
695206b73d0SCy Schubert #ifdef CONFIG_AIRTIME_POLICY
696206b73d0SCy Schubert 	unsigned int airtime_quantum;
697206b73d0SCy Schubert #endif /* CONFIG_AIRTIME_POLICY */
698206b73d0SCy Schubert 
699206b73d0SCy Schubert 	/* Previous WMM element information */
700206b73d0SCy Schubert 	struct hostapd_wmm_ac_params prev_wmm[WMM_AC_NUM];
701c1d255d3SCy Schubert 
702*a90b9d01SCy Schubert 	/* Maximum number of interfaces supported for MBSSID advertisement */
703*a90b9d01SCy Schubert 	unsigned int mbssid_max_interfaces;
704*a90b9d01SCy Schubert 	/* Maximum profile periodicity for enhanced MBSSID advertisement */
705*a90b9d01SCy Schubert 	unsigned int ema_max_periodicity;
706*a90b9d01SCy Schubert 
707c1d255d3SCy Schubert 	int (*enable_iface_cb)(struct hostapd_iface *iface);
708c1d255d3SCy Schubert 	int (*disable_iface_cb)(struct hostapd_iface *iface);
709*a90b9d01SCy Schubert 
710*a90b9d01SCy Schubert 	/* Configured freq of interface is NO_IR */
711*a90b9d01SCy Schubert 	bool is_no_ir;
712*a90b9d01SCy Schubert 
713*a90b9d01SCy Schubert 	bool is_ch_switch_dfs; /* Channel switch from ACS to DFS */
714e28a4053SRui Paulo };
715e28a4053SRui Paulo 
716e28a4053SRui Paulo /* hostapd.c */
717f05cddf9SRui Paulo int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
718f05cddf9SRui Paulo 			       int (*cb)(struct hostapd_iface *iface,
719f05cddf9SRui Paulo 					 void *ctx), void *ctx);
720e28a4053SRui Paulo int hostapd_reload_config(struct hostapd_iface *iface);
72185732ac8SCy Schubert void hostapd_reconfig_encryption(struct hostapd_data *hapd);
722e28a4053SRui Paulo struct hostapd_data *
723e28a4053SRui Paulo hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
724e28a4053SRui Paulo 		       struct hostapd_config *conf,
725e28a4053SRui Paulo 		       struct hostapd_bss_config *bss);
726e28a4053SRui Paulo int hostapd_setup_interface(struct hostapd_iface *iface);
727e28a4053SRui Paulo int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
728e28a4053SRui Paulo void hostapd_interface_deinit(struct hostapd_iface *iface);
729e28a4053SRui Paulo void hostapd_interface_free(struct hostapd_iface *iface);
730780fb4a2SCy Schubert struct hostapd_iface * hostapd_alloc_iface(void);
7315b9c547cSRui Paulo struct hostapd_iface * hostapd_init(struct hapd_interfaces *interfaces,
7325b9c547cSRui Paulo 				    const char *config_file);
7335b9c547cSRui Paulo struct hostapd_iface *
7345b9c547cSRui Paulo hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
7355b9c547cSRui Paulo 			   const char *config_fname, int debug);
736e28a4053SRui Paulo void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
737e28a4053SRui Paulo 			   int reassoc);
738f05cddf9SRui Paulo void hostapd_interface_deinit_free(struct hostapd_iface *iface);
739f05cddf9SRui Paulo int hostapd_enable_iface(struct hostapd_iface *hapd_iface);
740f05cddf9SRui Paulo int hostapd_reload_iface(struct hostapd_iface *hapd_iface);
741*a90b9d01SCy Schubert int hostapd_reload_bss_only(struct hostapd_data *bss);
742f05cddf9SRui Paulo int hostapd_disable_iface(struct hostapd_iface *hapd_iface);
743c1d255d3SCy Schubert void hostapd_bss_deinit_no_free(struct hostapd_data *hapd);
744c1d255d3SCy Schubert void hostapd_free_hapd_data(struct hostapd_data *hapd);
745c1d255d3SCy Schubert void hostapd_cleanup_iface_partial(struct hostapd_iface *iface);
746f05cddf9SRui Paulo int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf);
747f05cddf9SRui Paulo int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf);
7485b9c547cSRui Paulo void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator);
7495b9c547cSRui Paulo void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s);
7505b9c547cSRui Paulo const char * hostapd_state_text(enum hostapd_iface_state s);
751780fb4a2SCy Schubert int hostapd_csa_in_progress(struct hostapd_iface *iface);
752c1d255d3SCy Schubert void hostapd_chan_switch_config(struct hostapd_data *hapd,
753c1d255d3SCy Schubert 				struct hostapd_freq_params *freq_params);
7545b9c547cSRui Paulo int hostapd_switch_channel(struct hostapd_data *hapd,
7555b9c547cSRui Paulo 			   struct csa_settings *settings);
7565b9c547cSRui Paulo void
7575b9c547cSRui Paulo hostapd_switch_channel_fallback(struct hostapd_iface *iface,
7585b9c547cSRui Paulo 				const struct hostapd_freq_params *freq_params);
7595b9c547cSRui Paulo void hostapd_cleanup_cs_params(struct hostapd_data *hapd);
760325151a3SRui Paulo void hostapd_periodic_iface(struct hostapd_iface *iface);
76185732ac8SCy Schubert int hostapd_owe_trans_get_info(struct hostapd_data *hapd);
762c1d255d3SCy Schubert void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx);
763e28a4053SRui Paulo 
764*a90b9d01SCy Schubert void hostapd_switch_color(struct hostapd_data *hapd, u64 bitmap);
765*a90b9d01SCy Schubert void hostapd_cleanup_cca_params(struct hostapd_data *hapd);
766*a90b9d01SCy Schubert 
767e28a4053SRui Paulo /* utils.c */
768e28a4053SRui Paulo int hostapd_register_probereq_cb(struct hostapd_data *hapd,
769e28a4053SRui Paulo 				 int (*cb)(void *ctx, const u8 *sa,
770f05cddf9SRui Paulo 					   const u8 *da, const u8 *bssid,
771f05cddf9SRui Paulo 					   const u8 *ie, size_t ie_len,
772f05cddf9SRui Paulo 					   int ssi_signal),
773e28a4053SRui Paulo 				 void *ctx);
774*a90b9d01SCy Schubert void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr,
775*a90b9d01SCy Schubert 				int mld_assoc_link_id);
776e28a4053SRui Paulo 
777e28a4053SRui Paulo /* drv_callbacks.c (TODO: move to somewhere else?) */
77885732ac8SCy Schubert void hostapd_notify_assoc_fils_finish(struct hostapd_data *hapd,
77985732ac8SCy Schubert 				      struct sta_info *sta);
780e28a4053SRui Paulo int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
781*a90b9d01SCy Schubert 			const u8 *req_ie, size_t req_ielen, const u8 *resp_ie,
782*a90b9d01SCy Schubert 			size_t resp_ielen, const u8 *link_addr, int reassoc);
783e28a4053SRui Paulo void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
784f05cddf9SRui Paulo void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
7855b9c547cSRui Paulo void hostapd_event_connect_failed_reason(struct hostapd_data *hapd,
7865b9c547cSRui Paulo 					 const u8 *addr, int reason_code);
787f05cddf9SRui Paulo int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
788f05cddf9SRui Paulo 			 const u8 *bssid, const u8 *ie, size_t ie_len,
789f05cddf9SRui Paulo 			 int ssi_signal);
790f05cddf9SRui Paulo void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
791206b73d0SCy Schubert 			     int offset, int width, int cf1, int cf2,
792*a90b9d01SCy Schubert 			     u16 punct_bitmap, int finished);
793780fb4a2SCy Schubert struct survey_results;
794780fb4a2SCy Schubert void hostapd_event_get_survey(struct hostapd_iface *iface,
795780fb4a2SCy Schubert 			      struct survey_results *survey_results);
796780fb4a2SCy Schubert void hostapd_acs_channel_selected(struct hostapd_data *hapd,
797780fb4a2SCy Schubert 				  struct acs_selected_channels *acs_res);
798f05cddf9SRui Paulo 
799f05cddf9SRui Paulo const struct hostapd_eap_user *
800f05cddf9SRui Paulo hostapd_get_eap_user(struct hostapd_data *hapd, const u8 *identity,
801f05cddf9SRui Paulo 		     size_t identity_len, int phase2);
802e28a4053SRui Paulo 
803325151a3SRui Paulo struct hostapd_data * hostapd_get_iface(struct hapd_interfaces *interfaces,
804325151a3SRui Paulo 					const char *ifname);
80585732ac8SCy Schubert void hostapd_event_sta_opmode_changed(struct hostapd_data *hapd, const u8 *addr,
80685732ac8SCy Schubert 				      enum smps_mode smps_mode,
80785732ac8SCy Schubert 				      enum chan_width chan_width, u8 rx_nss);
808325151a3SRui Paulo 
809325151a3SRui Paulo #ifdef CONFIG_FST
810325151a3SRui Paulo void fst_hostapd_fill_iface_obj(struct hostapd_data *hapd,
811325151a3SRui Paulo 				struct fst_wpa_obj *iface_obj);
812325151a3SRui Paulo #endif /* CONFIG_FST */
813325151a3SRui Paulo 
814*a90b9d01SCy Schubert int hostapd_set_acl(struct hostapd_data *hapd);
815*a90b9d01SCy Schubert struct hostapd_data * hostapd_mbssid_get_tx_bss(struct hostapd_data *hapd);
816*a90b9d01SCy Schubert int hostapd_mbssid_get_bss_index(struct hostapd_data *hapd);
817*a90b9d01SCy Schubert struct hostapd_data * hostapd_mld_get_link_bss(struct hostapd_data *hapd,
818*a90b9d01SCy Schubert 					       u8 link_id);
819*a90b9d01SCy Schubert int hostapd_link_remove(struct hostapd_data *hapd, u32 count);
820*a90b9d01SCy Schubert bool hostapd_is_ml_partner(struct hostapd_data *hapd1,
821*a90b9d01SCy Schubert 			   struct hostapd_data *hapd2);
822*a90b9d01SCy Schubert u8 hostapd_get_mld_id(struct hostapd_data *hapd);
823*a90b9d01SCy Schubert int hostapd_mld_add_link(struct hostapd_data *hapd);
824*a90b9d01SCy Schubert int hostapd_mld_remove_link(struct hostapd_data *hapd);
825*a90b9d01SCy Schubert struct hostapd_data * hostapd_mld_get_first_bss(struct hostapd_data *hapd);
826*a90b9d01SCy Schubert 
827*a90b9d01SCy Schubert void free_beacon_data(struct beacon_data *beacon);
828*a90b9d01SCy Schubert int hostapd_fill_cca_settings(struct hostapd_data *hapd,
829*a90b9d01SCy Schubert 			      struct cca_settings *settings);
830*a90b9d01SCy Schubert 
831*a90b9d01SCy Schubert #ifdef CONFIG_IEEE80211BE
832*a90b9d01SCy Schubert 
833*a90b9d01SCy Schubert bool hostapd_mld_is_first_bss(struct hostapd_data *hapd);
834*a90b9d01SCy Schubert 
835*a90b9d01SCy Schubert #define for_each_mld_link(partner, self) \
836*a90b9d01SCy Schubert 	dl_list_for_each(partner, &self->mld->links, struct hostapd_data, link)
837*a90b9d01SCy Schubert 
838*a90b9d01SCy Schubert #else /* CONFIG_IEEE80211BE */
839*a90b9d01SCy Schubert 
hostapd_mld_is_first_bss(struct hostapd_data * hapd)840*a90b9d01SCy Schubert static inline bool hostapd_mld_is_first_bss(struct hostapd_data *hapd)
841*a90b9d01SCy Schubert {
842*a90b9d01SCy Schubert 	return true;
843*a90b9d01SCy Schubert }
844*a90b9d01SCy Schubert 
845*a90b9d01SCy Schubert #define for_each_mld_link(partner, self) \
846*a90b9d01SCy Schubert 	if (false)
847*a90b9d01SCy Schubert 
848*a90b9d01SCy Schubert #endif /* CONFIG_IEEE80211BE */
849*a90b9d01SCy Schubert 
850*a90b9d01SCy Schubert u16 hostapd_get_punct_bitmap(struct hostapd_data *hapd);
851*a90b9d01SCy Schubert 
852e28a4053SRui Paulo #endif /* HOSTAPD_H */
853