blob: 44ef7532fd86ff18622379c2c76d5d1fd9bfc7de [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * hostapd / Initialization and configuration
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08003 * Copyright (c) 2002-2014, Jouni Malinen <j@w1.fi>
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#ifndef HOSTAPD_H
10#define HOSTAPD_H
11
12#include "common/defs.h"
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080013#include "utils/list.h"
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080014#include "ap_config.h"
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -080015#include "drivers/driver.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070016
Hai Shalom74f70d42019-02-11 14:42:39 -080017#define OCE_STA_CFON_ENABLED(hapd) \
18 ((hapd->conf->oce & OCE_STA_CFON) && \
19 (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_OCE_STA_CFON))
20#define OCE_AP_ENABLED(hapd) \
21 ((hapd->conf->oce & OCE_AP) && \
22 (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_OCE_AP))
23
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070024struct wpa_ctrl_dst;
25struct radius_server_data;
26struct upnp_wps_device_sm;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070027struct hostapd_data;
28struct sta_info;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070029struct ieee80211_ht_capabilities;
30struct full_dynamic_vlan;
31enum wps_event;
32union wps_event_data;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080033#ifdef CONFIG_MESH
34struct mesh_conf;
35#endif /* CONFIG_MESH */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070036
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070037struct hostapd_iface;
38
Dmitry Shmidt04949592012-07-19 12:16:46 -070039struct hapd_interfaces {
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070040 int (*reload_config)(struct hostapd_iface *iface);
41 struct hostapd_config * (*config_read_cb)(const char *config_fname);
42 int (*ctrl_iface_init)(struct hostapd_data *hapd);
43 void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
44 int (*for_each_interface)(struct hapd_interfaces *interfaces,
45 int (*cb)(struct hostapd_iface *iface,
46 void *ctx), void *ctx);
47 int (*driver_init)(struct hostapd_iface *iface);
48
Dmitry Shmidt04949592012-07-19 12:16:46 -070049 size_t count;
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070050 int global_ctrl_sock;
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -080051 struct dl_list global_ctrl_dst;
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070052 char *global_iface_path;
53 char *global_iface_name;
Dmitry Shmidtfa3fc4a2013-11-21 13:34:38 -080054#ifndef CONFIG_NATIVE_WINDOWS
Dmitry Shmidt0ccb66e2013-03-29 16:41:28 -070055 gid_t ctrl_iface_group;
Dmitry Shmidtfa3fc4a2013-11-21 13:34:38 -080056#endif /* CONFIG_NATIVE_WINDOWS */
Dmitry Shmidt04949592012-07-19 12:16:46 -070057 struct hostapd_iface **iface;
Dmitry Shmidtb96dad42013-11-05 10:07:29 -080058
59 size_t terminate_on_error;
Dmitry Shmidta3dc3092015-06-23 11:21:28 -070060#ifndef CONFIG_NO_VLAN
61 struct dynamic_iface *vlan_priv;
62#endif /* CONFIG_NO_VLAN */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070063#ifdef CONFIG_ETH_P_OUI
64 struct dl_list eth_p_oui; /* OUI Extended EtherType handlers */
65#endif /* CONFIG_ETH_P_OUI */
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -070066 int eloop_initialized;
Roshan Pius3a1667e2018-07-03 15:17:14 -070067
68#ifdef CONFIG_DPP
Hai Shalom021b0b52019-04-10 11:17:58 -070069 struct dpp_global *dpp;
Roshan Pius3a1667e2018-07-03 15:17:14 -070070#endif /* CONFIG_DPP */
Dmitry Shmidt04949592012-07-19 12:16:46 -070071};
72
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -070073enum hostapd_chan_status {
74 HOSTAPD_CHAN_VALID = 0, /* channel is ready */
75 HOSTAPD_CHAN_INVALID = 1, /* no usable channel found */
76 HOSTAPD_CHAN_ACS = 2, /* ACS work being performed */
77};
Dmitry Shmidt04949592012-07-19 12:16:46 -070078
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070079struct hostapd_probereq_cb {
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080080 int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
Dmitry Shmidt04949592012-07-19 12:16:46 -070081 const u8 *ie, size_t ie_len, int ssi_signal);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070082 void *ctx;
83};
84
85#define HOSTAPD_RATE_BASIC 0x00000001
86
87struct hostapd_rate_data {
88 int rate; /* rate in 100 kbps */
89 int flags; /* HOSTAPD_RATE_ flags */
90};
91
92struct hostapd_frame_info {
Roshan Pius3a1667e2018-07-03 15:17:14 -070093 unsigned int freq;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070094 u32 channel;
95 u32 datarate;
Dmitry Shmidt04949592012-07-19 12:16:46 -070096 int ssi_signal; /* dBm */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070097};
98
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -070099enum wps_status {
100 WPS_STATUS_SUCCESS = 1,
101 WPS_STATUS_FAILURE
102};
103
104enum pbc_status {
105 WPS_PBC_STATUS_DISABLE,
106 WPS_PBC_STATUS_ACTIVE,
107 WPS_PBC_STATUS_TIMEOUT,
108 WPS_PBC_STATUS_OVERLAP
109};
110
111struct wps_stat {
112 enum wps_status status;
113 enum wps_error_indication failure_reason;
114 enum pbc_status pbc_status;
115 u8 peer_addr[ETH_ALEN];
116};
117
Dmitry Shmidt849734c2016-05-27 09:59:01 -0700118struct hostapd_neighbor_entry {
119 struct dl_list list;
120 u8 bssid[ETH_ALEN];
121 struct wpa_ssid_value ssid;
122 struct wpabuf *nr;
123 struct wpabuf *lci;
124 struct wpabuf *civic;
125 /* LCI update time */
126 struct os_time lci_date;
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800127 int stationary;
Dmitry Shmidt849734c2016-05-27 09:59:01 -0700128};
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700129
Hai Shalom021b0b52019-04-10 11:17:58 -0700130struct hostapd_sae_commit_queue {
131 struct dl_list list;
132 int rssi;
133 size_t len;
134 u8 msg[];
135};
136
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700137/**
138 * struct hostapd_data - hostapd per-BSS data structure
139 */
140struct hostapd_data {
141 struct hostapd_iface *iface;
142 struct hostapd_config *iconf;
143 struct hostapd_bss_config *conf;
Dmitry Shmidt54605472013-11-08 11:10:19 -0800144 int interface_added; /* virtual interface added for this BSS */
145 unsigned int started:1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800146 unsigned int disabled:1;
147 unsigned int reenable_beacon:1;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700148
149 u8 own_addr[ETH_ALEN];
150
151 int num_sta; /* number of entries in sta_list */
152 struct sta_info *sta_list; /* STA info list head */
153#define STA_HASH_SIZE 256
154#define STA_HASH(sta) (sta[5])
155 struct sta_info *sta_hash[STA_HASH_SIZE];
156
157 /*
158 * Bitfield for indicating which AIDs are allocated. Only AID values
159 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
160 * 1.
161 */
162#define AID_WORDS ((2008 + 31) / 32)
163 u32 sta_aid[AID_WORDS];
164
165 const struct wpa_driver_ops *driver;
166 void *drv_priv;
167
168 void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
169 struct sta_info *sta, int reassoc);
170
171 void *msg_ctx; /* ctx for wpa_msg() calls */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800172 void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700173
174 struct radius_client_data *radius;
Dmitry Shmidtb97e4282016-02-08 10:16:07 -0800175 u64 acct_session_id;
Dmitry Shmidt04949592012-07-19 12:16:46 -0700176 struct radius_das_data *radius_das;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700177
178 struct iapp_data *iapp;
179
180 struct hostapd_cached_radius_acl *acl_cache;
181 struct hostapd_acl_query_data *acl_queries;
182
183 struct wpa_authenticator *wpa_auth;
184 struct eapol_authenticator *eapol_auth;
185
186 struct rsn_preauth_interface *preauth_iface;
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800187 struct os_reltime michael_mic_failure;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700188 int michael_mic_failures;
189 int tkip_countermeasures;
190
191 int ctrl_sock;
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800192 struct dl_list ctrl_dst;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700193
194 void *ssl_ctx;
195 void *eap_sim_db_priv;
196 struct radius_server_data *radius_srv;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800197 struct dl_list erp_keys; /* struct eap_server_erp_key */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700198
199 int parameter_set_count;
200
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800201 /* Time Advertisement */
202 u8 time_update_counter;
203 struct wpabuf *time_adv;
204
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700205#ifdef CONFIG_FULL_DYNAMIC_VLAN
206 struct full_dynamic_vlan *full_dynamic_vlan;
207#endif /* CONFIG_FULL_DYNAMIC_VLAN */
208
209 struct l2_packet_data *l2;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700210
211#ifdef CONFIG_IEEE80211R_AP
212 struct dl_list l2_queue;
213 struct dl_list l2_oui_queue;
214 struct eth_p_oui_ctx *oui_pull;
215 struct eth_p_oui_ctx *oui_resp;
216 struct eth_p_oui_ctx *oui_push;
217 struct eth_p_oui_ctx *oui_sreq;
218 struct eth_p_oui_ctx *oui_sresp;
219#endif /* CONFIG_IEEE80211R_AP */
220
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700221 struct wps_context *wps;
222
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800223 int beacon_set_done;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700224 struct wpabuf *wps_beacon_ie;
225 struct wpabuf *wps_probe_resp_ie;
226#ifdef CONFIG_WPS
227 unsigned int ap_pin_failures;
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -0800228 unsigned int ap_pin_failures_consecutive;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700229 struct upnp_wps_device_sm *wps_upnp;
230 unsigned int ap_pin_lockout_time;
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -0700231
232 struct wps_stat wps_stats;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700233#endif /* CONFIG_WPS */
234
Hai Shalom81f62d82019-07-22 12:10:00 -0700235#ifdef CONFIG_MACSEC
236 struct ieee802_1x_kay *kay;
237#endif /* CONFIG_MACSEC */
238
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700239 struct hostapd_probereq_cb *probereq_cb;
240 size_t num_probereq_cb;
241
242 void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
243 int freq);
244 void *public_action_cb_ctx;
Dmitry Shmidt4b9d52f2013-02-05 17:44:43 -0800245 void (*public_action_cb2)(void *ctx, const u8 *buf, size_t len,
246 int freq);
247 void *public_action_cb2_ctx;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700248
249 int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
250 int freq);
251 void *vendor_action_cb_ctx;
252
253 void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
254 const u8 *uuid_e);
255 void *wps_reg_success_cb_ctx;
256
257 void (*wps_event_cb)(void *ctx, enum wps_event event,
258 union wps_event_data *data);
259 void *wps_event_cb_ctx;
260
261 void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800262 int authorized, const u8 *p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700263 void *sta_authorized_cb_ctx;
264
265 void (*setup_complete_cb)(void *ctx);
266 void *setup_complete_cb_ctx;
267
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700268 void (*new_psk_cb)(void *ctx, const u8 *mac_addr,
269 const u8 *p2p_dev_addr, const u8 *psk,
270 size_t psk_len);
271 void *new_psk_cb_ctx;
272
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700273 /* channel switch parameters */
274 struct hostapd_freq_params cs_freq_params;
275 u8 cs_count;
276 int cs_block_tx;
277 unsigned int cs_c_off_beacon;
278 unsigned int cs_c_off_proberesp;
279 int csa_in_progress;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800280 unsigned int cs_c_off_ecsa_beacon;
281 unsigned int cs_c_off_ecsa_proberesp;
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700282
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700283#ifdef CONFIG_P2P
284 struct p2p_data *p2p;
285 struct p2p_group *p2p_group;
286 struct wpabuf *p2p_beacon_ie;
287 struct wpabuf *p2p_probe_resp_ie;
288
289 /* Number of non-P2P association stations */
290 int num_sta_no_p2p;
291
292 /* Periodic NoA (used only when no non-P2P clients in the group) */
293 int noa_enabled;
294 int noa_start;
295 int noa_duration;
296#endif /* CONFIG_P2P */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800297#ifdef CONFIG_PROXYARP
298 struct l2_packet_data *sock_dhcp;
299 struct l2_packet_data *sock_ndisc;
300#endif /* CONFIG_PROXYARP */
301#ifdef CONFIG_MESH
302 int num_plinks;
303 int max_plinks;
Dmitry Shmidtb97e4282016-02-08 10:16:07 -0800304 void (*mesh_sta_free_cb)(struct hostapd_data *hapd,
305 struct sta_info *sta);
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800306 struct wpabuf *mesh_pending_auth;
307 struct os_reltime mesh_pending_auth_time;
Dmitry Shmidte4663042016-04-04 10:07:49 -0700308 u8 mesh_required_peer[ETH_ALEN];
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800309#endif /* CONFIG_MESH */
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800310
311#ifdef CONFIG_SQLITE
312 struct hostapd_eap_user tmp_eap_user;
313#endif /* CONFIG_SQLITE */
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -0800314
315#ifdef CONFIG_SAE
316 /** Key used for generating SAE anti-clogging tokens */
317 u8 sae_token_key[8];
Dmitry Shmidt04f534e2013-12-09 15:50:16 -0800318 struct os_reltime last_sae_token_key_update;
Hai Shalom021b0b52019-04-10 11:17:58 -0700319 u16 sae_token_idx;
320 u16 sae_pending_token_idx[256];
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800321 int dot11RSNASAERetransPeriod; /* msec */
Hai Shalom021b0b52019-04-10 11:17:58 -0700322 struct dl_list sae_commit_queue; /* struct hostapd_sae_commit_queue */
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -0800323#endif /* CONFIG_SAE */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800324
325#ifdef CONFIG_TESTING_OPTIONS
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800326 unsigned int ext_mgmt_frame_handling:1;
327 unsigned int ext_eapol_frame_io:1;
328
329 struct l2_packet_data *l2_test;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700330
331 enum wpa_alg last_gtk_alg;
332 int last_gtk_key_idx;
333 u8 last_gtk[WPA_GTK_MAX_LEN];
334 size_t last_gtk_len;
335
336#ifdef CONFIG_IEEE80211W
337 enum wpa_alg last_igtk_alg;
338 int last_igtk_key_idx;
339 u8 last_igtk[WPA_IGTK_MAX_LEN];
340 size_t last_igtk_len;
341#endif /* CONFIG_IEEE80211W */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800342#endif /* CONFIG_TESTING_OPTIONS */
Dmitry Shmidt57c2d392016-02-23 13:40:19 -0800343
344#ifdef CONFIG_MBO
345 unsigned int mbo_assoc_disallow;
346#endif /* CONFIG_MBO */
Dmitry Shmidt849734c2016-05-27 09:59:01 -0700347
348 struct dl_list nr_db;
349
Dmitry Shmidt29333592017-01-09 12:27:11 -0800350 u8 beacon_req_token;
Dmitry Shmidt849734c2016-05-27 09:59:01 -0700351 u8 lci_req_token;
352 u8 range_req_token;
353 unsigned int lci_req_active:1;
354 unsigned int range_req_active:1;
Dmitry Shmidtebd93af2017-02-21 13:40:44 -0800355
356 int dhcp_sock; /* UDP socket used with the DHCP server */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700357
358#ifdef CONFIG_DPP
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700359 int dpp_init_done;
360 struct dpp_authentication *dpp_auth;
361 u8 dpp_allowed_roles;
362 int dpp_qr_mutual;
363 int dpp_auth_ok_on_ack;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700364 int dpp_in_response_listen;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700365 struct gas_query_ap *gas;
366 struct dpp_pkex *dpp_pkex;
367 struct dpp_bootstrap_info *dpp_pkex_bi;
368 char *dpp_pkex_code;
369 char *dpp_pkex_identifier;
370 char *dpp_pkex_auth_cmd;
371 char *dpp_configurator_params;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700372 struct os_reltime dpp_last_init;
373 struct os_reltime dpp_init_iter_start;
374 unsigned int dpp_init_max_tries;
375 unsigned int dpp_init_retry_time;
376 unsigned int dpp_resp_wait_time;
377 unsigned int dpp_resp_max_tries;
378 unsigned int dpp_resp_retry_time;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700379#ifdef CONFIG_TESTING_OPTIONS
380 char *dpp_config_obj_override;
381 char *dpp_discovery_override;
382 char *dpp_groups_override;
383 unsigned int dpp_ignore_netaccesskey_mismatch:1;
384#endif /* CONFIG_TESTING_OPTIONS */
385#endif /* CONFIG_DPP */
Hai Shalom81f62d82019-07-22 12:10:00 -0700386
387#ifdef CONFIG_AIRTIME_POLICY
388 unsigned int num_backlogged_sta;
389 unsigned int airtime_weight;
390#endif /* CONFIG_AIRTIME_POLICY */
391
392 u8 last_1x_eapol_key_replay_counter[8];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700393};
394
395
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800396struct hostapd_sta_info {
397 struct dl_list list;
398 u8 addr[ETH_ALEN];
399 struct os_reltime last_seen;
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800400 int ssi_signal;
Dmitry Shmidtaca489e2016-09-28 15:44:14 -0700401#ifdef CONFIG_TAXONOMY
402 struct wpabuf *probe_ie_taxonomy;
403#endif /* CONFIG_TAXONOMY */
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800404};
405
Roshan Piuscc817562017-12-22 14:45:05 -0800406enum hostapd_iface_state {
407 HAPD_IFACE_UNINITIALIZED,
408 HAPD_IFACE_DISABLED,
409 HAPD_IFACE_COUNTRY_UPDATE,
410 HAPD_IFACE_ACS,
411 HAPD_IFACE_HT_SCAN,
412 HAPD_IFACE_DFS,
413 HAPD_IFACE_ENABLED
414};
415
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700416/**
417 * struct hostapd_iface - hostapd per-interface data structure
418 */
419struct hostapd_iface {
420 struct hapd_interfaces *interfaces;
421 void *owner;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700422 char *config_fname;
423 struct hostapd_config *conf;
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800424 char phy[16]; /* Name of the PHY (radio) */
425
Roshan Piuscc817562017-12-22 14:45:05 -0800426 enum hostapd_iface_state state;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800427#ifdef CONFIG_MESH
428 struct mesh_conf *mconf;
429#endif /* CONFIG_MESH */
430
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700431 size_t num_bss;
432 struct hostapd_data **bss;
433
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800434 unsigned int wait_channel_update:1;
435 unsigned int cac_started:1;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800436#ifdef CONFIG_FST
437 struct fst_iface *fst;
438 const struct wpabuf *fst_ies;
439#endif /* CONFIG_FST */
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800440
Dmitry Shmidta38abf92014-03-06 13:38:44 -0800441 /*
442 * When set, indicates that the driver will handle the AP
443 * teardown: delete global keys, station keys, and stations.
444 */
445 unsigned int driver_ap_teardown:1;
446
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800447 /*
448 * When set, indicates that this interface is part of list of
449 * interfaces that need to be started together (synchronously).
450 */
451 unsigned int need_to_start_in_sync:1;
452
453 /* Ready to start but waiting for other interfaces to become ready. */
454 unsigned int ready_to_start_in_sync:1;
455
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700456 int num_ap; /* number of entries in ap_list */
457 struct ap_info *ap_list; /* AP info list head */
458 struct ap_info *ap_hash[STA_HASH_SIZE];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700459
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800460 u64 drv_flags;
461
462 /* SMPS modes supported by the driver (WPA_DRIVER_SMPS_MODE_*) */
463 unsigned int smps_modes;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800464
465 /*
466 * A bitmap of supported protocols for probe response offload. See
467 * struct wpa_driver_capa in driver.h
468 */
469 unsigned int probe_resp_offloads;
470
Dmitry Shmidt444d5672013-04-01 13:08:44 -0700471 /* extended capabilities supported by the driver */
472 const u8 *extended_capa, *extended_capa_mask;
473 unsigned int extended_capa_len;
474
Dmitry Shmidt8bae4132013-06-06 11:25:10 -0700475 unsigned int drv_max_acl_mac_addrs;
476
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700477 struct hostapd_hw_modes *hw_features;
478 int num_hw_features;
479 struct hostapd_hw_modes *current_mode;
480 /* Rates that are currently used (i.e., filtered copy of
481 * current_mode->channels */
482 int num_rates;
483 struct hostapd_rate_data *current_rates;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800484 int *basic_rates;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700485 int freq;
486
487 u16 hw_flags;
488
489 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
490 * in 802.11g BSS) */
491 int num_sta_non_erp;
492
493 /* Number of associated stations that do not support Short Slot Time */
494 int num_sta_no_short_slot_time;
495
496 /* Number of associated stations that do not support Short Preamble */
497 int num_sta_no_short_preamble;
498
499 int olbc; /* Overlapping Legacy BSS Condition */
500
501 /* Number of HT associated stations that do not support greenfield */
502 int num_sta_ht_no_gf;
503
504 /* Number of associated non-HT stations */
505 int num_sta_no_ht;
506
507 /* Number of HT associated stations 20 MHz */
508 int num_sta_ht_20mhz;
509
Dmitry Shmidt7832adb2014-04-29 10:53:02 -0700510 /* Number of HT40 intolerant stations */
511 int num_sta_ht40_intolerant;
512
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700513 /* Overlapping BSS information */
514 int olbc_ht;
515
516 u16 ht_op_mode;
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -0700517
518 /* surveying helpers */
519
520 /* number of channels surveyed */
521 unsigned int chans_surveyed;
522
523 /* lowest observed noise floor in dBm */
524 s8 lowest_nf;
525
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800526 /* channel utilization calculation */
527 u64 last_channel_time;
528 u64 last_channel_time_busy;
529 u8 channel_utilization;
530
Roshan Pius3a1667e2018-07-03 15:17:14 -0700531 unsigned int chan_util_samples_sum;
532 unsigned int chan_util_num_sample_periods;
533 unsigned int chan_util_average;
534
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800535 /* eCSA IE will be added only if operating class is specified */
536 u8 cs_oper_class;
537
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -0700538 unsigned int dfs_cac_ms;
539 struct os_reltime dfs_cac_start;
540
Dmitry Shmidt7832adb2014-04-29 10:53:02 -0700541 /* Latched with the actual secondary channel information and will be
542 * used while juggling between HT20 and HT40 modes. */
543 int secondary_ch;
544
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700545#ifdef CONFIG_ACS
546 unsigned int acs_num_completed_scans;
547#endif /* CONFIG_ACS */
548
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700549 void (*scan_cb)(struct hostapd_iface *iface);
Dmitry Shmidt7832adb2014-04-29 10:53:02 -0700550 int num_ht40_scan_tries;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800551
552 struct dl_list sta_seen; /* struct hostapd_sta_info */
553 unsigned int num_sta_seen;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700554
555 u8 dfs_domain;
Hai Shalom81f62d82019-07-22 12:10:00 -0700556#ifdef CONFIG_AIRTIME_POLICY
557 unsigned int airtime_quantum;
558#endif /* CONFIG_AIRTIME_POLICY */
559
560 /* Previous WMM element information */
561 struct hostapd_wmm_ac_params prev_wmm[WMM_AC_NUM];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700562};
563
564/* hostapd.c */
Dmitry Shmidt04949592012-07-19 12:16:46 -0700565int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
566 int (*cb)(struct hostapd_iface *iface,
567 void *ctx), void *ctx);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700568int hostapd_reload_config(struct hostapd_iface *iface);
Hai Shalomce48b4a2018-09-05 11:41:35 -0700569void hostapd_reconfig_encryption(struct hostapd_data *hapd);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700570struct hostapd_data *
571hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
572 struct hostapd_config *conf,
573 struct hostapd_bss_config *bss);
574int hostapd_setup_interface(struct hostapd_iface *iface);
575int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
576void hostapd_interface_deinit(struct hostapd_iface *iface);
577void hostapd_interface_free(struct hostapd_iface *iface);
Dmitry Shmidtaca489e2016-09-28 15:44:14 -0700578struct hostapd_iface * hostapd_alloc_iface(void);
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800579struct hostapd_iface * hostapd_init(struct hapd_interfaces *interfaces,
580 const char *config_file);
581struct hostapd_iface *
582hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
583 const char *config_fname, int debug);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700584void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
585 int reassoc);
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700586void hostapd_interface_deinit_free(struct hostapd_iface *iface);
587int hostapd_enable_iface(struct hostapd_iface *hapd_iface);
588int hostapd_reload_iface(struct hostapd_iface *hapd_iface);
589int hostapd_disable_iface(struct hostapd_iface *hapd_iface);
590int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf);
591int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf);
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800592void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator);
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800593void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s);
594const char * hostapd_state_text(enum hostapd_iface_state s);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800595int hostapd_csa_in_progress(struct hostapd_iface *iface);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700596void hostapd_chan_switch_vht_config(struct hostapd_data *hapd, int vht_enabled);
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800597int hostapd_switch_channel(struct hostapd_data *hapd,
598 struct csa_settings *settings);
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700599void
600hostapd_switch_channel_fallback(struct hostapd_iface *iface,
601 const struct hostapd_freq_params *freq_params);
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800602void hostapd_cleanup_cs_params(struct hostapd_data *hapd);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800603void hostapd_periodic_iface(struct hostapd_iface *iface);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700604int hostapd_owe_trans_get_info(struct hostapd_data *hapd);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700605
606/* utils.c */
607int hostapd_register_probereq_cb(struct hostapd_data *hapd,
608 int (*cb)(void *ctx, const u8 *sa,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800609 const u8 *da, const u8 *bssid,
Dmitry Shmidt04949592012-07-19 12:16:46 -0700610 const u8 *ie, size_t ie_len,
611 int ssi_signal),
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700612 void *ctx);
613void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
614
615/* drv_callbacks.c (TODO: move to somewhere else?) */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700616void hostapd_notify_assoc_fils_finish(struct hostapd_data *hapd,
617 struct sta_info *sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700618int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
619 const u8 *ie, size_t ielen, int reassoc);
620void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
621void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
Dmitry Shmidtf8623282013-02-20 14:34:59 -0800622void hostapd_event_connect_failed_reason(struct hostapd_data *hapd,
623 const u8 *addr, int reason_code);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800624int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
Dmitry Shmidt04949592012-07-19 12:16:46 -0700625 const u8 *bssid, const u8 *ie, size_t ie_len,
626 int ssi_signal);
627void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
Hai Shalom81f62d82019-07-22 12:10:00 -0700628 int offset, int width, int cf1, int cf2,
629 int finished);
Dmitry Shmidt014a3ff2015-12-28 13:27:49 -0800630struct survey_results;
631void hostapd_event_get_survey(struct hostapd_iface *iface,
632 struct survey_results *survey_results);
633void hostapd_acs_channel_selected(struct hostapd_data *hapd,
634 struct acs_selected_channels *acs_res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700635
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800636const struct hostapd_eap_user *
637hostapd_get_eap_user(struct hostapd_data *hapd, const u8 *identity,
638 size_t identity_len, int phase2);
639
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800640struct hostapd_data * hostapd_get_iface(struct hapd_interfaces *interfaces,
641 const char *ifname);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700642void hostapd_event_sta_opmode_changed(struct hostapd_data *hapd, const u8 *addr,
643 enum smps_mode smps_mode,
644 enum chan_width chan_width, u8 rx_nss);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800645
646#ifdef CONFIG_FST
647void fst_hostapd_fill_iface_obj(struct hostapd_data *hapd,
648 struct fst_wpa_obj *iface_obj);
649#endif /* CONFIG_FST */
650
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700651#endif /* HOSTAPD_H */