blob: 28b3a1cda3a6f796254246acfaa24f766261af5d [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
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070017struct wpa_ctrl_dst;
18struct radius_server_data;
19struct upnp_wps_device_sm;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070020struct hostapd_data;
21struct sta_info;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070022struct ieee80211_ht_capabilities;
23struct full_dynamic_vlan;
24enum wps_event;
25union wps_event_data;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080026#ifdef CONFIG_MESH
27struct mesh_conf;
28#endif /* CONFIG_MESH */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070029
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070030struct hostapd_iface;
31
Dmitry Shmidt04949592012-07-19 12:16:46 -070032struct hapd_interfaces {
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070033 int (*reload_config)(struct hostapd_iface *iface);
34 struct hostapd_config * (*config_read_cb)(const char *config_fname);
35 int (*ctrl_iface_init)(struct hostapd_data *hapd);
36 void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
37 int (*for_each_interface)(struct hapd_interfaces *interfaces,
38 int (*cb)(struct hostapd_iface *iface,
39 void *ctx), void *ctx);
40 int (*driver_init)(struct hostapd_iface *iface);
41
Dmitry Shmidt04949592012-07-19 12:16:46 -070042 size_t count;
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070043 int global_ctrl_sock;
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -080044 struct dl_list global_ctrl_dst;
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070045 char *global_iface_path;
46 char *global_iface_name;
Dmitry Shmidtfa3fc4a2013-11-21 13:34:38 -080047#ifndef CONFIG_NATIVE_WINDOWS
Dmitry Shmidt0ccb66e2013-03-29 16:41:28 -070048 gid_t ctrl_iface_group;
Dmitry Shmidtfa3fc4a2013-11-21 13:34:38 -080049#endif /* CONFIG_NATIVE_WINDOWS */
Dmitry Shmidt04949592012-07-19 12:16:46 -070050 struct hostapd_iface **iface;
Dmitry Shmidtb96dad42013-11-05 10:07:29 -080051
52 size_t terminate_on_error;
Dmitry Shmidta3dc3092015-06-23 11:21:28 -070053#ifndef CONFIG_NO_VLAN
54 struct dynamic_iface *vlan_priv;
55#endif /* CONFIG_NO_VLAN */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070056#ifdef CONFIG_ETH_P_OUI
57 struct dl_list eth_p_oui; /* OUI Extended EtherType handlers */
58#endif /* CONFIG_ETH_P_OUI */
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -070059 int eloop_initialized;
Roshan Pius3a1667e2018-07-03 15:17:14 -070060
61#ifdef CONFIG_DPP
62 int dpp_init_done;
63 struct dl_list dpp_bootstrap; /* struct dpp_bootstrap_info */
64 struct dl_list dpp_configurator; /* struct dpp_configurator */
65#endif /* CONFIG_DPP */
Dmitry Shmidt04949592012-07-19 12:16:46 -070066};
67
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -070068enum hostapd_chan_status {
69 HOSTAPD_CHAN_VALID = 0, /* channel is ready */
70 HOSTAPD_CHAN_INVALID = 1, /* no usable channel found */
71 HOSTAPD_CHAN_ACS = 2, /* ACS work being performed */
72};
Dmitry Shmidt04949592012-07-19 12:16:46 -070073
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070074struct hostapd_probereq_cb {
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080075 int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
Dmitry Shmidt04949592012-07-19 12:16:46 -070076 const u8 *ie, size_t ie_len, int ssi_signal);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070077 void *ctx;
78};
79
80#define HOSTAPD_RATE_BASIC 0x00000001
81
82struct hostapd_rate_data {
83 int rate; /* rate in 100 kbps */
84 int flags; /* HOSTAPD_RATE_ flags */
85};
86
87struct hostapd_frame_info {
Roshan Pius3a1667e2018-07-03 15:17:14 -070088 unsigned int freq;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070089 u32 channel;
90 u32 datarate;
Dmitry Shmidt04949592012-07-19 12:16:46 -070091 int ssi_signal; /* dBm */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070092};
93
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -070094enum wps_status {
95 WPS_STATUS_SUCCESS = 1,
96 WPS_STATUS_FAILURE
97};
98
99enum pbc_status {
100 WPS_PBC_STATUS_DISABLE,
101 WPS_PBC_STATUS_ACTIVE,
102 WPS_PBC_STATUS_TIMEOUT,
103 WPS_PBC_STATUS_OVERLAP
104};
105
106struct wps_stat {
107 enum wps_status status;
108 enum wps_error_indication failure_reason;
109 enum pbc_status pbc_status;
110 u8 peer_addr[ETH_ALEN];
111};
112
Dmitry Shmidt849734c2016-05-27 09:59:01 -0700113struct hostapd_neighbor_entry {
114 struct dl_list list;
115 u8 bssid[ETH_ALEN];
116 struct wpa_ssid_value ssid;
117 struct wpabuf *nr;
118 struct wpabuf *lci;
119 struct wpabuf *civic;
120 /* LCI update time */
121 struct os_time lci_date;
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800122 int stationary;
Dmitry Shmidt849734c2016-05-27 09:59:01 -0700123};
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700124
125/**
126 * struct hostapd_data - hostapd per-BSS data structure
127 */
128struct hostapd_data {
129 struct hostapd_iface *iface;
130 struct hostapd_config *iconf;
131 struct hostapd_bss_config *conf;
Dmitry Shmidt54605472013-11-08 11:10:19 -0800132 int interface_added; /* virtual interface added for this BSS */
133 unsigned int started:1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800134 unsigned int disabled:1;
135 unsigned int reenable_beacon:1;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700136
137 u8 own_addr[ETH_ALEN];
138
139 int num_sta; /* number of entries in sta_list */
140 struct sta_info *sta_list; /* STA info list head */
141#define STA_HASH_SIZE 256
142#define STA_HASH(sta) (sta[5])
143 struct sta_info *sta_hash[STA_HASH_SIZE];
144
145 /*
146 * Bitfield for indicating which AIDs are allocated. Only AID values
147 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
148 * 1.
149 */
150#define AID_WORDS ((2008 + 31) / 32)
151 u32 sta_aid[AID_WORDS];
152
153 const struct wpa_driver_ops *driver;
154 void *drv_priv;
155
156 void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
157 struct sta_info *sta, int reassoc);
158
159 void *msg_ctx; /* ctx for wpa_msg() calls */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800160 void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700161
162 struct radius_client_data *radius;
Dmitry Shmidtb97e4282016-02-08 10:16:07 -0800163 u64 acct_session_id;
Dmitry Shmidt04949592012-07-19 12:16:46 -0700164 struct radius_das_data *radius_das;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700165
166 struct iapp_data *iapp;
167
168 struct hostapd_cached_radius_acl *acl_cache;
169 struct hostapd_acl_query_data *acl_queries;
170
171 struct wpa_authenticator *wpa_auth;
172 struct eapol_authenticator *eapol_auth;
173
174 struct rsn_preauth_interface *preauth_iface;
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800175 struct os_reltime michael_mic_failure;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700176 int michael_mic_failures;
177 int tkip_countermeasures;
178
179 int ctrl_sock;
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800180 struct dl_list ctrl_dst;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700181
182 void *ssl_ctx;
183 void *eap_sim_db_priv;
184 struct radius_server_data *radius_srv;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800185 struct dl_list erp_keys; /* struct eap_server_erp_key */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700186
187 int parameter_set_count;
188
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800189 /* Time Advertisement */
190 u8 time_update_counter;
191 struct wpabuf *time_adv;
192
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700193#ifdef CONFIG_FULL_DYNAMIC_VLAN
194 struct full_dynamic_vlan *full_dynamic_vlan;
195#endif /* CONFIG_FULL_DYNAMIC_VLAN */
196
197 struct l2_packet_data *l2;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700198
199#ifdef CONFIG_IEEE80211R_AP
200 struct dl_list l2_queue;
201 struct dl_list l2_oui_queue;
202 struct eth_p_oui_ctx *oui_pull;
203 struct eth_p_oui_ctx *oui_resp;
204 struct eth_p_oui_ctx *oui_push;
205 struct eth_p_oui_ctx *oui_sreq;
206 struct eth_p_oui_ctx *oui_sresp;
207#endif /* CONFIG_IEEE80211R_AP */
208
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700209 struct wps_context *wps;
210
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800211 int beacon_set_done;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700212 struct wpabuf *wps_beacon_ie;
213 struct wpabuf *wps_probe_resp_ie;
214#ifdef CONFIG_WPS
215 unsigned int ap_pin_failures;
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -0800216 unsigned int ap_pin_failures_consecutive;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700217 struct upnp_wps_device_sm *wps_upnp;
218 unsigned int ap_pin_lockout_time;
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -0700219
220 struct wps_stat wps_stats;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700221#endif /* CONFIG_WPS */
222
223 struct hostapd_probereq_cb *probereq_cb;
224 size_t num_probereq_cb;
225
226 void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
227 int freq);
228 void *public_action_cb_ctx;
Dmitry Shmidt4b9d52f2013-02-05 17:44:43 -0800229 void (*public_action_cb2)(void *ctx, const u8 *buf, size_t len,
230 int freq);
231 void *public_action_cb2_ctx;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700232
233 int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
234 int freq);
235 void *vendor_action_cb_ctx;
236
237 void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
238 const u8 *uuid_e);
239 void *wps_reg_success_cb_ctx;
240
241 void (*wps_event_cb)(void *ctx, enum wps_event event,
242 union wps_event_data *data);
243 void *wps_event_cb_ctx;
244
245 void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800246 int authorized, const u8 *p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700247 void *sta_authorized_cb_ctx;
248
249 void (*setup_complete_cb)(void *ctx);
250 void *setup_complete_cb_ctx;
251
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700252 void (*new_psk_cb)(void *ctx, const u8 *mac_addr,
253 const u8 *p2p_dev_addr, const u8 *psk,
254 size_t psk_len);
255 void *new_psk_cb_ctx;
256
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700257 /* channel switch parameters */
258 struct hostapd_freq_params cs_freq_params;
259 u8 cs_count;
260 int cs_block_tx;
261 unsigned int cs_c_off_beacon;
262 unsigned int cs_c_off_proberesp;
263 int csa_in_progress;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800264 unsigned int cs_c_off_ecsa_beacon;
265 unsigned int cs_c_off_ecsa_proberesp;
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700266
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700267#ifdef CONFIG_P2P
268 struct p2p_data *p2p;
269 struct p2p_group *p2p_group;
270 struct wpabuf *p2p_beacon_ie;
271 struct wpabuf *p2p_probe_resp_ie;
272
273 /* Number of non-P2P association stations */
274 int num_sta_no_p2p;
275
276 /* Periodic NoA (used only when no non-P2P clients in the group) */
277 int noa_enabled;
278 int noa_start;
279 int noa_duration;
280#endif /* CONFIG_P2P */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800281#ifdef CONFIG_PROXYARP
282 struct l2_packet_data *sock_dhcp;
283 struct l2_packet_data *sock_ndisc;
284#endif /* CONFIG_PROXYARP */
285#ifdef CONFIG_MESH
286 int num_plinks;
287 int max_plinks;
Dmitry Shmidtb97e4282016-02-08 10:16:07 -0800288 void (*mesh_sta_free_cb)(struct hostapd_data *hapd,
289 struct sta_info *sta);
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800290 struct wpabuf *mesh_pending_auth;
291 struct os_reltime mesh_pending_auth_time;
Dmitry Shmidte4663042016-04-04 10:07:49 -0700292 u8 mesh_required_peer[ETH_ALEN];
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800293#endif /* CONFIG_MESH */
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800294
295#ifdef CONFIG_SQLITE
296 struct hostapd_eap_user tmp_eap_user;
297#endif /* CONFIG_SQLITE */
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -0800298
299#ifdef CONFIG_SAE
300 /** Key used for generating SAE anti-clogging tokens */
301 u8 sae_token_key[8];
Dmitry Shmidt04f534e2013-12-09 15:50:16 -0800302 struct os_reltime last_sae_token_key_update;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800303 int dot11RSNASAERetransPeriod; /* msec */
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -0800304#endif /* CONFIG_SAE */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800305
306#ifdef CONFIG_TESTING_OPTIONS
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800307 unsigned int ext_mgmt_frame_handling:1;
308 unsigned int ext_eapol_frame_io:1;
309
310 struct l2_packet_data *l2_test;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700311
312 enum wpa_alg last_gtk_alg;
313 int last_gtk_key_idx;
314 u8 last_gtk[WPA_GTK_MAX_LEN];
315 size_t last_gtk_len;
316
317#ifdef CONFIG_IEEE80211W
318 enum wpa_alg last_igtk_alg;
319 int last_igtk_key_idx;
320 u8 last_igtk[WPA_IGTK_MAX_LEN];
321 size_t last_igtk_len;
322#endif /* CONFIG_IEEE80211W */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800323#endif /* CONFIG_TESTING_OPTIONS */
Dmitry Shmidt57c2d392016-02-23 13:40:19 -0800324
325#ifdef CONFIG_MBO
326 unsigned int mbo_assoc_disallow;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700327 /**
328 * enable_oce - Enable OCE if it is enabled by user and device also
329 * supports OCE.
330 */
331 u8 enable_oce;
Dmitry Shmidt57c2d392016-02-23 13:40:19 -0800332#endif /* CONFIG_MBO */
Dmitry Shmidt849734c2016-05-27 09:59:01 -0700333
334 struct dl_list nr_db;
335
Dmitry Shmidt29333592017-01-09 12:27:11 -0800336 u8 beacon_req_token;
Dmitry Shmidt849734c2016-05-27 09:59:01 -0700337 u8 lci_req_token;
338 u8 range_req_token;
339 unsigned int lci_req_active:1;
340 unsigned int range_req_active:1;
Dmitry Shmidtebd93af2017-02-21 13:40:44 -0800341
342 int dhcp_sock; /* UDP socket used with the DHCP server */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700343
344#ifdef CONFIG_DPP
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700345 int dpp_init_done;
346 struct dpp_authentication *dpp_auth;
347 u8 dpp_allowed_roles;
348 int dpp_qr_mutual;
349 int dpp_auth_ok_on_ack;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700350 int dpp_in_response_listen;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700351 struct gas_query_ap *gas;
352 struct dpp_pkex *dpp_pkex;
353 struct dpp_bootstrap_info *dpp_pkex_bi;
354 char *dpp_pkex_code;
355 char *dpp_pkex_identifier;
356 char *dpp_pkex_auth_cmd;
357 char *dpp_configurator_params;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700358 struct os_reltime dpp_last_init;
359 struct os_reltime dpp_init_iter_start;
360 unsigned int dpp_init_max_tries;
361 unsigned int dpp_init_retry_time;
362 unsigned int dpp_resp_wait_time;
363 unsigned int dpp_resp_max_tries;
364 unsigned int dpp_resp_retry_time;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700365#ifdef CONFIG_TESTING_OPTIONS
366 char *dpp_config_obj_override;
367 char *dpp_discovery_override;
368 char *dpp_groups_override;
369 unsigned int dpp_ignore_netaccesskey_mismatch:1;
370#endif /* CONFIG_TESTING_OPTIONS */
371#endif /* CONFIG_DPP */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700372};
373
374
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800375struct hostapd_sta_info {
376 struct dl_list list;
377 u8 addr[ETH_ALEN];
378 struct os_reltime last_seen;
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800379 int ssi_signal;
Dmitry Shmidtaca489e2016-09-28 15:44:14 -0700380#ifdef CONFIG_TAXONOMY
381 struct wpabuf *probe_ie_taxonomy;
382#endif /* CONFIG_TAXONOMY */
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800383};
384
Roshan Piuscc817562017-12-22 14:45:05 -0800385enum hostapd_iface_state {
386 HAPD_IFACE_UNINITIALIZED,
387 HAPD_IFACE_DISABLED,
388 HAPD_IFACE_COUNTRY_UPDATE,
389 HAPD_IFACE_ACS,
390 HAPD_IFACE_HT_SCAN,
391 HAPD_IFACE_DFS,
392 HAPD_IFACE_ENABLED
393};
394
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700395/**
396 * struct hostapd_iface - hostapd per-interface data structure
397 */
398struct hostapd_iface {
399 struct hapd_interfaces *interfaces;
400 void *owner;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700401 char *config_fname;
402 struct hostapd_config *conf;
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800403 char phy[16]; /* Name of the PHY (radio) */
404
Roshan Piuscc817562017-12-22 14:45:05 -0800405 enum hostapd_iface_state state;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800406#ifdef CONFIG_MESH
407 struct mesh_conf *mconf;
408#endif /* CONFIG_MESH */
409
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700410 size_t num_bss;
411 struct hostapd_data **bss;
412
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800413 unsigned int wait_channel_update:1;
414 unsigned int cac_started:1;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800415#ifdef CONFIG_FST
416 struct fst_iface *fst;
417 const struct wpabuf *fst_ies;
418#endif /* CONFIG_FST */
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800419
Dmitry Shmidta38abf92014-03-06 13:38:44 -0800420 /*
421 * When set, indicates that the driver will handle the AP
422 * teardown: delete global keys, station keys, and stations.
423 */
424 unsigned int driver_ap_teardown:1;
425
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800426 /*
427 * When set, indicates that this interface is part of list of
428 * interfaces that need to be started together (synchronously).
429 */
430 unsigned int need_to_start_in_sync:1;
431
432 /* Ready to start but waiting for other interfaces to become ready. */
433 unsigned int ready_to_start_in_sync:1;
434
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700435 int num_ap; /* number of entries in ap_list */
436 struct ap_info *ap_list; /* AP info list head */
437 struct ap_info *ap_hash[STA_HASH_SIZE];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700438
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800439 u64 drv_flags;
440
441 /* SMPS modes supported by the driver (WPA_DRIVER_SMPS_MODE_*) */
442 unsigned int smps_modes;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800443
444 /*
445 * A bitmap of supported protocols for probe response offload. See
446 * struct wpa_driver_capa in driver.h
447 */
448 unsigned int probe_resp_offloads;
449
Dmitry Shmidt444d5672013-04-01 13:08:44 -0700450 /* extended capabilities supported by the driver */
451 const u8 *extended_capa, *extended_capa_mask;
452 unsigned int extended_capa_len;
453
Dmitry Shmidt8bae4132013-06-06 11:25:10 -0700454 unsigned int drv_max_acl_mac_addrs;
455
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700456 struct hostapd_hw_modes *hw_features;
457 int num_hw_features;
458 struct hostapd_hw_modes *current_mode;
459 /* Rates that are currently used (i.e., filtered copy of
460 * current_mode->channels */
461 int num_rates;
462 struct hostapd_rate_data *current_rates;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800463 int *basic_rates;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700464 int freq;
465
466 u16 hw_flags;
467
468 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
469 * in 802.11g BSS) */
470 int num_sta_non_erp;
471
472 /* Number of associated stations that do not support Short Slot Time */
473 int num_sta_no_short_slot_time;
474
475 /* Number of associated stations that do not support Short Preamble */
476 int num_sta_no_short_preamble;
477
478 int olbc; /* Overlapping Legacy BSS Condition */
479
480 /* Number of HT associated stations that do not support greenfield */
481 int num_sta_ht_no_gf;
482
483 /* Number of associated non-HT stations */
484 int num_sta_no_ht;
485
486 /* Number of HT associated stations 20 MHz */
487 int num_sta_ht_20mhz;
488
Dmitry Shmidt7832adb2014-04-29 10:53:02 -0700489 /* Number of HT40 intolerant stations */
490 int num_sta_ht40_intolerant;
491
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700492 /* Overlapping BSS information */
493 int olbc_ht;
494
495 u16 ht_op_mode;
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -0700496
497 /* surveying helpers */
498
499 /* number of channels surveyed */
500 unsigned int chans_surveyed;
501
502 /* lowest observed noise floor in dBm */
503 s8 lowest_nf;
504
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800505 /* channel utilization calculation */
506 u64 last_channel_time;
507 u64 last_channel_time_busy;
508 u8 channel_utilization;
509
Roshan Pius3a1667e2018-07-03 15:17:14 -0700510 unsigned int chan_util_samples_sum;
511 unsigned int chan_util_num_sample_periods;
512 unsigned int chan_util_average;
513
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800514 /* eCSA IE will be added only if operating class is specified */
515 u8 cs_oper_class;
516
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -0700517 unsigned int dfs_cac_ms;
518 struct os_reltime dfs_cac_start;
519
Dmitry Shmidt7832adb2014-04-29 10:53:02 -0700520 /* Latched with the actual secondary channel information and will be
521 * used while juggling between HT20 and HT40 modes. */
522 int secondary_ch;
523
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700524#ifdef CONFIG_ACS
525 unsigned int acs_num_completed_scans;
526#endif /* CONFIG_ACS */
527
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700528 void (*scan_cb)(struct hostapd_iface *iface);
Dmitry Shmidt7832adb2014-04-29 10:53:02 -0700529 int num_ht40_scan_tries;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800530
531 struct dl_list sta_seen; /* struct hostapd_sta_info */
532 unsigned int num_sta_seen;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700533
534 u8 dfs_domain;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700535};
536
537/* hostapd.c */
Dmitry Shmidt04949592012-07-19 12:16:46 -0700538int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
539 int (*cb)(struct hostapd_iface *iface,
540 void *ctx), void *ctx);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700541int hostapd_reload_config(struct hostapd_iface *iface);
Hai Shalomce48b4a2018-09-05 11:41:35 -0700542void hostapd_reconfig_encryption(struct hostapd_data *hapd);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700543struct hostapd_data *
544hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
545 struct hostapd_config *conf,
546 struct hostapd_bss_config *bss);
547int hostapd_setup_interface(struct hostapd_iface *iface);
548int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
549void hostapd_interface_deinit(struct hostapd_iface *iface);
550void hostapd_interface_free(struct hostapd_iface *iface);
Dmitry Shmidtaca489e2016-09-28 15:44:14 -0700551struct hostapd_iface * hostapd_alloc_iface(void);
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800552struct hostapd_iface * hostapd_init(struct hapd_interfaces *interfaces,
553 const char *config_file);
554struct hostapd_iface *
555hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
556 const char *config_fname, int debug);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700557void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
558 int reassoc);
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700559void hostapd_interface_deinit_free(struct hostapd_iface *iface);
560int hostapd_enable_iface(struct hostapd_iface *hapd_iface);
561int hostapd_reload_iface(struct hostapd_iface *hapd_iface);
562int hostapd_disable_iface(struct hostapd_iface *hapd_iface);
563int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf);
564int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf);
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800565void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator);
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800566void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s);
567const char * hostapd_state_text(enum hostapd_iface_state s);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800568int hostapd_csa_in_progress(struct hostapd_iface *iface);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700569void hostapd_chan_switch_vht_config(struct hostapd_data *hapd, int vht_enabled);
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800570int hostapd_switch_channel(struct hostapd_data *hapd,
571 struct csa_settings *settings);
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700572void
573hostapd_switch_channel_fallback(struct hostapd_iface *iface,
574 const struct hostapd_freq_params *freq_params);
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800575void hostapd_cleanup_cs_params(struct hostapd_data *hapd);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800576void hostapd_periodic_iface(struct hostapd_iface *iface);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700577int hostapd_owe_trans_get_info(struct hostapd_data *hapd);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700578
579/* utils.c */
580int hostapd_register_probereq_cb(struct hostapd_data *hapd,
581 int (*cb)(void *ctx, const u8 *sa,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800582 const u8 *da, const u8 *bssid,
Dmitry Shmidt04949592012-07-19 12:16:46 -0700583 const u8 *ie, size_t ie_len,
584 int ssi_signal),
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700585 void *ctx);
586void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
587
588/* drv_callbacks.c (TODO: move to somewhere else?) */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700589void hostapd_notify_assoc_fils_finish(struct hostapd_data *hapd,
590 struct sta_info *sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700591int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
592 const u8 *ie, size_t ielen, int reassoc);
593void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
594void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
Dmitry Shmidtf8623282013-02-20 14:34:59 -0800595void hostapd_event_connect_failed_reason(struct hostapd_data *hapd,
596 const u8 *addr, int reason_code);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800597int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
Dmitry Shmidt04949592012-07-19 12:16:46 -0700598 const u8 *bssid, const u8 *ie, size_t ie_len,
599 int ssi_signal);
600void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
Dmitry Shmidt04f534e2013-12-09 15:50:16 -0800601 int offset, int width, int cf1, int cf2);
Dmitry Shmidt014a3ff2015-12-28 13:27:49 -0800602struct survey_results;
603void hostapd_event_get_survey(struct hostapd_iface *iface,
604 struct survey_results *survey_results);
605void hostapd_acs_channel_selected(struct hostapd_data *hapd,
606 struct acs_selected_channels *acs_res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700607
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800608const struct hostapd_eap_user *
609hostapd_get_eap_user(struct hostapd_data *hapd, const u8 *identity,
610 size_t identity_len, int phase2);
611
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800612struct hostapd_data * hostapd_get_iface(struct hapd_interfaces *interfaces,
613 const char *ifname);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700614void hostapd_event_sta_opmode_changed(struct hostapd_data *hapd, const u8 *addr,
615 enum smps_mode smps_mode,
616 enum chan_width chan_width, u8 rx_nss);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800617
618#ifdef CONFIG_FST
619void fst_hostapd_fill_iface_obj(struct hostapd_data *hapd,
620 struct fst_wpa_obj *iface_obj);
621#endif /* CONFIG_FST */
622
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700623#endif /* HOSTAPD_H */