13ff40c12SJohn Marino /* 23ff40c12SJohn Marino * hostapd / Initialization and configuration 3*a1157835SDaniel Fojt * Copyright (c) 2002-2014, Jouni Malinen <j@w1.fi> 43ff40c12SJohn Marino * 53ff40c12SJohn Marino * This software may be distributed under the terms of the BSD license. 63ff40c12SJohn Marino * See README for more details. 73ff40c12SJohn Marino */ 83ff40c12SJohn Marino 93ff40c12SJohn Marino #ifndef HOSTAPD_H 103ff40c12SJohn Marino #define HOSTAPD_H 113ff40c12SJohn Marino 12*a1157835SDaniel Fojt #ifdef CONFIG_SQLITE 13*a1157835SDaniel Fojt #include <sqlite3.h> 14*a1157835SDaniel Fojt #endif /* CONFIG_SQLITE */ 15*a1157835SDaniel Fojt 163ff40c12SJohn Marino #include "common/defs.h" 17*a1157835SDaniel Fojt #include "utils/list.h" 183ff40c12SJohn Marino #include "ap_config.h" 193ff40c12SJohn Marino #include "drivers/driver.h" 203ff40c12SJohn Marino 21*a1157835SDaniel Fojt #define OCE_STA_CFON_ENABLED(hapd) \ 22*a1157835SDaniel Fojt ((hapd->conf->oce & OCE_STA_CFON) && \ 23*a1157835SDaniel Fojt (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_OCE_STA_CFON)) 24*a1157835SDaniel Fojt #define OCE_AP_ENABLED(hapd) \ 25*a1157835SDaniel Fojt ((hapd->conf->oce & OCE_AP) && \ 26*a1157835SDaniel Fojt (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_OCE_AP)) 27*a1157835SDaniel Fojt 283ff40c12SJohn Marino struct wpa_ctrl_dst; 293ff40c12SJohn Marino struct radius_server_data; 303ff40c12SJohn Marino struct upnp_wps_device_sm; 313ff40c12SJohn Marino struct hostapd_data; 323ff40c12SJohn Marino struct sta_info; 333ff40c12SJohn Marino struct ieee80211_ht_capabilities; 343ff40c12SJohn Marino struct full_dynamic_vlan; 353ff40c12SJohn Marino enum wps_event; 363ff40c12SJohn Marino union wps_event_data; 37*a1157835SDaniel Fojt #ifdef CONFIG_MESH 38*a1157835SDaniel Fojt struct mesh_conf; 39*a1157835SDaniel Fojt #endif /* CONFIG_MESH */ 403ff40c12SJohn Marino 413ff40c12SJohn Marino struct hostapd_iface; 423ff40c12SJohn Marino 433ff40c12SJohn Marino struct hapd_interfaces { 443ff40c12SJohn Marino int (*reload_config)(struct hostapd_iface *iface); 453ff40c12SJohn Marino struct hostapd_config * (*config_read_cb)(const char *config_fname); 463ff40c12SJohn Marino int (*ctrl_iface_init)(struct hostapd_data *hapd); 473ff40c12SJohn Marino void (*ctrl_iface_deinit)(struct hostapd_data *hapd); 483ff40c12SJohn Marino int (*for_each_interface)(struct hapd_interfaces *interfaces, 493ff40c12SJohn Marino int (*cb)(struct hostapd_iface *iface, 503ff40c12SJohn Marino void *ctx), void *ctx); 513ff40c12SJohn Marino int (*driver_init)(struct hostapd_iface *iface); 523ff40c12SJohn Marino 533ff40c12SJohn Marino size_t count; 543ff40c12SJohn Marino int global_ctrl_sock; 55*a1157835SDaniel Fojt struct dl_list global_ctrl_dst; 563ff40c12SJohn Marino char *global_iface_path; 573ff40c12SJohn Marino char *global_iface_name; 583ff40c12SJohn Marino #ifndef CONFIG_NATIVE_WINDOWS 593ff40c12SJohn Marino gid_t ctrl_iface_group; 603ff40c12SJohn Marino #endif /* CONFIG_NATIVE_WINDOWS */ 613ff40c12SJohn Marino struct hostapd_iface **iface; 623ff40c12SJohn Marino 633ff40c12SJohn Marino size_t terminate_on_error; 64*a1157835SDaniel Fojt #ifndef CONFIG_NO_VLAN 65*a1157835SDaniel Fojt struct dynamic_iface *vlan_priv; 66*a1157835SDaniel Fojt #endif /* CONFIG_NO_VLAN */ 67*a1157835SDaniel Fojt #ifdef CONFIG_ETH_P_OUI 68*a1157835SDaniel Fojt struct dl_list eth_p_oui; /* OUI Extended EtherType handlers */ 69*a1157835SDaniel Fojt #endif /* CONFIG_ETH_P_OUI */ 70*a1157835SDaniel Fojt int eloop_initialized; 71*a1157835SDaniel Fojt 72*a1157835SDaniel Fojt #ifdef CONFIG_DPP 73*a1157835SDaniel Fojt struct dpp_global *dpp; 74*a1157835SDaniel Fojt #endif /* CONFIG_DPP */ 753ff40c12SJohn Marino }; 763ff40c12SJohn Marino 773ff40c12SJohn Marino enum hostapd_chan_status { 783ff40c12SJohn Marino HOSTAPD_CHAN_VALID = 0, /* channel is ready */ 793ff40c12SJohn Marino HOSTAPD_CHAN_INVALID = 1, /* no usable channel found */ 803ff40c12SJohn Marino HOSTAPD_CHAN_ACS = 2, /* ACS work being performed */ 813ff40c12SJohn Marino }; 823ff40c12SJohn Marino 833ff40c12SJohn Marino struct hostapd_probereq_cb { 843ff40c12SJohn Marino int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid, 853ff40c12SJohn Marino const u8 *ie, size_t ie_len, int ssi_signal); 863ff40c12SJohn Marino void *ctx; 873ff40c12SJohn Marino }; 883ff40c12SJohn Marino 893ff40c12SJohn Marino #define HOSTAPD_RATE_BASIC 0x00000001 903ff40c12SJohn Marino 913ff40c12SJohn Marino struct hostapd_rate_data { 923ff40c12SJohn Marino int rate; /* rate in 100 kbps */ 933ff40c12SJohn Marino int flags; /* HOSTAPD_RATE_ flags */ 943ff40c12SJohn Marino }; 953ff40c12SJohn Marino 963ff40c12SJohn Marino struct hostapd_frame_info { 97*a1157835SDaniel Fojt unsigned int freq; 983ff40c12SJohn Marino u32 channel; 993ff40c12SJohn Marino u32 datarate; 1003ff40c12SJohn Marino int ssi_signal; /* dBm */ 1013ff40c12SJohn Marino }; 1023ff40c12SJohn Marino 1033ff40c12SJohn Marino enum wps_status { 1043ff40c12SJohn Marino WPS_STATUS_SUCCESS = 1, 1053ff40c12SJohn Marino WPS_STATUS_FAILURE 1063ff40c12SJohn Marino }; 1073ff40c12SJohn Marino 1083ff40c12SJohn Marino enum pbc_status { 1093ff40c12SJohn Marino WPS_PBC_STATUS_DISABLE, 1103ff40c12SJohn Marino WPS_PBC_STATUS_ACTIVE, 1113ff40c12SJohn Marino WPS_PBC_STATUS_TIMEOUT, 1123ff40c12SJohn Marino WPS_PBC_STATUS_OVERLAP 1133ff40c12SJohn Marino }; 1143ff40c12SJohn Marino 1153ff40c12SJohn Marino struct wps_stat { 1163ff40c12SJohn Marino enum wps_status status; 1173ff40c12SJohn Marino enum wps_error_indication failure_reason; 1183ff40c12SJohn Marino enum pbc_status pbc_status; 1193ff40c12SJohn Marino u8 peer_addr[ETH_ALEN]; 1203ff40c12SJohn Marino }; 1213ff40c12SJohn Marino 122*a1157835SDaniel Fojt struct hostapd_neighbor_entry { 123*a1157835SDaniel Fojt struct dl_list list; 124*a1157835SDaniel Fojt u8 bssid[ETH_ALEN]; 125*a1157835SDaniel Fojt struct wpa_ssid_value ssid; 126*a1157835SDaniel Fojt struct wpabuf *nr; 127*a1157835SDaniel Fojt struct wpabuf *lci; 128*a1157835SDaniel Fojt struct wpabuf *civic; 129*a1157835SDaniel Fojt /* LCI update time */ 130*a1157835SDaniel Fojt struct os_time lci_date; 131*a1157835SDaniel Fojt int stationary; 132*a1157835SDaniel Fojt }; 133*a1157835SDaniel Fojt 134*a1157835SDaniel Fojt struct hostapd_sae_commit_queue { 135*a1157835SDaniel Fojt struct dl_list list; 136*a1157835SDaniel Fojt int rssi; 137*a1157835SDaniel Fojt size_t len; 138*a1157835SDaniel Fojt u8 msg[]; 139*a1157835SDaniel Fojt }; 1403ff40c12SJohn Marino 1413ff40c12SJohn Marino /** 1423ff40c12SJohn Marino * struct hostapd_data - hostapd per-BSS data structure 1433ff40c12SJohn Marino */ 1443ff40c12SJohn Marino struct hostapd_data { 1453ff40c12SJohn Marino struct hostapd_iface *iface; 1463ff40c12SJohn Marino struct hostapd_config *iconf; 1473ff40c12SJohn Marino struct hostapd_bss_config *conf; 1483ff40c12SJohn Marino int interface_added; /* virtual interface added for this BSS */ 1493ff40c12SJohn Marino unsigned int started:1; 150*a1157835SDaniel Fojt unsigned int disabled:1; 151*a1157835SDaniel Fojt unsigned int reenable_beacon:1; 1523ff40c12SJohn Marino 1533ff40c12SJohn Marino u8 own_addr[ETH_ALEN]; 1543ff40c12SJohn Marino 1553ff40c12SJohn Marino int num_sta; /* number of entries in sta_list */ 1563ff40c12SJohn Marino struct sta_info *sta_list; /* STA info list head */ 1573ff40c12SJohn Marino #define STA_HASH_SIZE 256 1583ff40c12SJohn Marino #define STA_HASH(sta) (sta[5]) 1593ff40c12SJohn Marino struct sta_info *sta_hash[STA_HASH_SIZE]; 1603ff40c12SJohn Marino 1613ff40c12SJohn Marino /* 1623ff40c12SJohn Marino * Bitfield for indicating which AIDs are allocated. Only AID values 1633ff40c12SJohn Marino * 1-2007 are used and as such, the bit at index 0 corresponds to AID 1643ff40c12SJohn Marino * 1. 1653ff40c12SJohn Marino */ 1663ff40c12SJohn Marino #define AID_WORDS ((2008 + 31) / 32) 1673ff40c12SJohn Marino u32 sta_aid[AID_WORDS]; 1683ff40c12SJohn Marino 1693ff40c12SJohn Marino const struct wpa_driver_ops *driver; 1703ff40c12SJohn Marino void *drv_priv; 1713ff40c12SJohn Marino 1723ff40c12SJohn Marino void (*new_assoc_sta_cb)(struct hostapd_data *hapd, 1733ff40c12SJohn Marino struct sta_info *sta, int reassoc); 1743ff40c12SJohn Marino 1753ff40c12SJohn Marino void *msg_ctx; /* ctx for wpa_msg() calls */ 1763ff40c12SJohn Marino void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */ 1773ff40c12SJohn Marino 1783ff40c12SJohn Marino struct radius_client_data *radius; 179*a1157835SDaniel Fojt u64 acct_session_id; 1803ff40c12SJohn Marino struct radius_das_data *radius_das; 1813ff40c12SJohn Marino 1823ff40c12SJohn Marino struct iapp_data *iapp; 1833ff40c12SJohn Marino 1843ff40c12SJohn Marino struct hostapd_cached_radius_acl *acl_cache; 1853ff40c12SJohn Marino struct hostapd_acl_query_data *acl_queries; 1863ff40c12SJohn Marino 1873ff40c12SJohn Marino struct wpa_authenticator *wpa_auth; 1883ff40c12SJohn Marino struct eapol_authenticator *eapol_auth; 1893ff40c12SJohn Marino 1903ff40c12SJohn Marino struct rsn_preauth_interface *preauth_iface; 1913ff40c12SJohn Marino struct os_reltime michael_mic_failure; 1923ff40c12SJohn Marino int michael_mic_failures; 1933ff40c12SJohn Marino int tkip_countermeasures; 1943ff40c12SJohn Marino 1953ff40c12SJohn Marino int ctrl_sock; 196*a1157835SDaniel Fojt struct dl_list ctrl_dst; 1973ff40c12SJohn Marino 1983ff40c12SJohn Marino void *ssl_ctx; 1993ff40c12SJohn Marino void *eap_sim_db_priv; 2003ff40c12SJohn Marino struct radius_server_data *radius_srv; 201*a1157835SDaniel Fojt struct dl_list erp_keys; /* struct eap_server_erp_key */ 2023ff40c12SJohn Marino 2033ff40c12SJohn Marino int parameter_set_count; 2043ff40c12SJohn Marino 2053ff40c12SJohn Marino /* Time Advertisement */ 2063ff40c12SJohn Marino u8 time_update_counter; 2073ff40c12SJohn Marino struct wpabuf *time_adv; 2083ff40c12SJohn Marino 2093ff40c12SJohn Marino #ifdef CONFIG_FULL_DYNAMIC_VLAN 2103ff40c12SJohn Marino struct full_dynamic_vlan *full_dynamic_vlan; 2113ff40c12SJohn Marino #endif /* CONFIG_FULL_DYNAMIC_VLAN */ 2123ff40c12SJohn Marino 2133ff40c12SJohn Marino struct l2_packet_data *l2; 214*a1157835SDaniel Fojt 215*a1157835SDaniel Fojt #ifdef CONFIG_IEEE80211R_AP 216*a1157835SDaniel Fojt struct dl_list l2_queue; 217*a1157835SDaniel Fojt struct dl_list l2_oui_queue; 218*a1157835SDaniel Fojt struct eth_p_oui_ctx *oui_pull; 219*a1157835SDaniel Fojt struct eth_p_oui_ctx *oui_resp; 220*a1157835SDaniel Fojt struct eth_p_oui_ctx *oui_push; 221*a1157835SDaniel Fojt struct eth_p_oui_ctx *oui_sreq; 222*a1157835SDaniel Fojt struct eth_p_oui_ctx *oui_sresp; 223*a1157835SDaniel Fojt #endif /* CONFIG_IEEE80211R_AP */ 224*a1157835SDaniel Fojt 2253ff40c12SJohn Marino struct wps_context *wps; 2263ff40c12SJohn Marino 2273ff40c12SJohn Marino int beacon_set_done; 2283ff40c12SJohn Marino struct wpabuf *wps_beacon_ie; 2293ff40c12SJohn Marino struct wpabuf *wps_probe_resp_ie; 2303ff40c12SJohn Marino #ifdef CONFIG_WPS 2313ff40c12SJohn Marino unsigned int ap_pin_failures; 2323ff40c12SJohn Marino unsigned int ap_pin_failures_consecutive; 2333ff40c12SJohn Marino struct upnp_wps_device_sm *wps_upnp; 2343ff40c12SJohn Marino unsigned int ap_pin_lockout_time; 2353ff40c12SJohn Marino 2363ff40c12SJohn Marino struct wps_stat wps_stats; 2373ff40c12SJohn Marino #endif /* CONFIG_WPS */ 2383ff40c12SJohn Marino 239*a1157835SDaniel Fojt #ifdef CONFIG_MACSEC 240*a1157835SDaniel Fojt struct ieee802_1x_kay *kay; 241*a1157835SDaniel Fojt #endif /* CONFIG_MACSEC */ 242*a1157835SDaniel Fojt 2433ff40c12SJohn Marino struct hostapd_probereq_cb *probereq_cb; 2443ff40c12SJohn Marino size_t num_probereq_cb; 2453ff40c12SJohn Marino 2463ff40c12SJohn Marino void (*public_action_cb)(void *ctx, const u8 *buf, size_t len, 2473ff40c12SJohn Marino int freq); 2483ff40c12SJohn Marino void *public_action_cb_ctx; 2493ff40c12SJohn Marino void (*public_action_cb2)(void *ctx, const u8 *buf, size_t len, 2503ff40c12SJohn Marino int freq); 2513ff40c12SJohn Marino void *public_action_cb2_ctx; 2523ff40c12SJohn Marino 2533ff40c12SJohn Marino int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len, 2543ff40c12SJohn Marino int freq); 2553ff40c12SJohn Marino void *vendor_action_cb_ctx; 2563ff40c12SJohn Marino 2573ff40c12SJohn Marino void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr, 2583ff40c12SJohn Marino const u8 *uuid_e); 2593ff40c12SJohn Marino void *wps_reg_success_cb_ctx; 2603ff40c12SJohn Marino 2613ff40c12SJohn Marino void (*wps_event_cb)(void *ctx, enum wps_event event, 2623ff40c12SJohn Marino union wps_event_data *data); 2633ff40c12SJohn Marino void *wps_event_cb_ctx; 2643ff40c12SJohn Marino 2653ff40c12SJohn Marino void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr, 2663ff40c12SJohn Marino int authorized, const u8 *p2p_dev_addr); 2673ff40c12SJohn Marino void *sta_authorized_cb_ctx; 2683ff40c12SJohn Marino 2693ff40c12SJohn Marino void (*setup_complete_cb)(void *ctx); 2703ff40c12SJohn Marino void *setup_complete_cb_ctx; 2713ff40c12SJohn Marino 2723ff40c12SJohn Marino void (*new_psk_cb)(void *ctx, const u8 *mac_addr, 2733ff40c12SJohn Marino const u8 *p2p_dev_addr, const u8 *psk, 2743ff40c12SJohn Marino size_t psk_len); 2753ff40c12SJohn Marino void *new_psk_cb_ctx; 2763ff40c12SJohn Marino 277*a1157835SDaniel Fojt /* channel switch parameters */ 278*a1157835SDaniel Fojt struct hostapd_freq_params cs_freq_params; 279*a1157835SDaniel Fojt u8 cs_count; 280*a1157835SDaniel Fojt int cs_block_tx; 281*a1157835SDaniel Fojt unsigned int cs_c_off_beacon; 282*a1157835SDaniel Fojt unsigned int cs_c_off_proberesp; 283*a1157835SDaniel Fojt int csa_in_progress; 284*a1157835SDaniel Fojt unsigned int cs_c_off_ecsa_beacon; 285*a1157835SDaniel Fojt unsigned int cs_c_off_ecsa_proberesp; 286*a1157835SDaniel Fojt 2873ff40c12SJohn Marino #ifdef CONFIG_P2P 2883ff40c12SJohn Marino struct p2p_data *p2p; 2893ff40c12SJohn Marino struct p2p_group *p2p_group; 2903ff40c12SJohn Marino struct wpabuf *p2p_beacon_ie; 2913ff40c12SJohn Marino struct wpabuf *p2p_probe_resp_ie; 2923ff40c12SJohn Marino 2933ff40c12SJohn Marino /* Number of non-P2P association stations */ 2943ff40c12SJohn Marino int num_sta_no_p2p; 2953ff40c12SJohn Marino 2963ff40c12SJohn Marino /* Periodic NoA (used only when no non-P2P clients in the group) */ 2973ff40c12SJohn Marino int noa_enabled; 2983ff40c12SJohn Marino int noa_start; 2993ff40c12SJohn Marino int noa_duration; 3003ff40c12SJohn Marino #endif /* CONFIG_P2P */ 301*a1157835SDaniel Fojt #ifdef CONFIG_PROXYARP 302*a1157835SDaniel Fojt struct l2_packet_data *sock_dhcp; 303*a1157835SDaniel Fojt struct l2_packet_data *sock_ndisc; 304*a1157835SDaniel Fojt #endif /* CONFIG_PROXYARP */ 305*a1157835SDaniel Fojt #ifdef CONFIG_MESH 306*a1157835SDaniel Fojt int num_plinks; 307*a1157835SDaniel Fojt int max_plinks; 308*a1157835SDaniel Fojt void (*mesh_sta_free_cb)(struct hostapd_data *hapd, 309*a1157835SDaniel Fojt struct sta_info *sta); 310*a1157835SDaniel Fojt struct wpabuf *mesh_pending_auth; 311*a1157835SDaniel Fojt struct os_reltime mesh_pending_auth_time; 312*a1157835SDaniel Fojt u8 mesh_required_peer[ETH_ALEN]; 313*a1157835SDaniel Fojt #endif /* CONFIG_MESH */ 3143ff40c12SJohn Marino 3153ff40c12SJohn Marino #ifdef CONFIG_SQLITE 3163ff40c12SJohn Marino struct hostapd_eap_user tmp_eap_user; 3173ff40c12SJohn Marino #endif /* CONFIG_SQLITE */ 3183ff40c12SJohn Marino 3193ff40c12SJohn Marino #ifdef CONFIG_SAE 3203ff40c12SJohn Marino /** Key used for generating SAE anti-clogging tokens */ 3213ff40c12SJohn Marino u8 sae_token_key[8]; 3223ff40c12SJohn Marino struct os_reltime last_sae_token_key_update; 323*a1157835SDaniel Fojt u16 sae_token_idx; 324*a1157835SDaniel Fojt u16 sae_pending_token_idx[256]; 325*a1157835SDaniel Fojt int dot11RSNASAERetransPeriod; /* msec */ 326*a1157835SDaniel Fojt struct dl_list sae_commit_queue; /* struct hostapd_sae_commit_queue */ 3273ff40c12SJohn Marino #endif /* CONFIG_SAE */ 3283ff40c12SJohn Marino 3293ff40c12SJohn Marino #ifdef CONFIG_TESTING_OPTIONS 330*a1157835SDaniel Fojt unsigned int ext_mgmt_frame_handling:1; 331*a1157835SDaniel Fojt unsigned int ext_eapol_frame_io:1; 332*a1157835SDaniel Fojt 333*a1157835SDaniel Fojt struct l2_packet_data *l2_test; 334*a1157835SDaniel Fojt 335*a1157835SDaniel Fojt enum wpa_alg last_gtk_alg; 336*a1157835SDaniel Fojt int last_gtk_key_idx; 337*a1157835SDaniel Fojt u8 last_gtk[WPA_GTK_MAX_LEN]; 338*a1157835SDaniel Fojt size_t last_gtk_len; 339*a1157835SDaniel Fojt 340*a1157835SDaniel Fojt #ifdef CONFIG_IEEE80211W 341*a1157835SDaniel Fojt enum wpa_alg last_igtk_alg; 342*a1157835SDaniel Fojt int last_igtk_key_idx; 343*a1157835SDaniel Fojt u8 last_igtk[WPA_IGTK_MAX_LEN]; 344*a1157835SDaniel Fojt size_t last_igtk_len; 345*a1157835SDaniel Fojt #endif /* CONFIG_IEEE80211W */ 3463ff40c12SJohn Marino #endif /* CONFIG_TESTING_OPTIONS */ 347*a1157835SDaniel Fojt 348*a1157835SDaniel Fojt #ifdef CONFIG_MBO 349*a1157835SDaniel Fojt unsigned int mbo_assoc_disallow; 350*a1157835SDaniel Fojt #endif /* CONFIG_MBO */ 351*a1157835SDaniel Fojt 352*a1157835SDaniel Fojt struct dl_list nr_db; 353*a1157835SDaniel Fojt 354*a1157835SDaniel Fojt u8 beacon_req_token; 355*a1157835SDaniel Fojt u8 lci_req_token; 356*a1157835SDaniel Fojt u8 range_req_token; 357*a1157835SDaniel Fojt unsigned int lci_req_active:1; 358*a1157835SDaniel Fojt unsigned int range_req_active:1; 359*a1157835SDaniel Fojt 360*a1157835SDaniel Fojt int dhcp_sock; /* UDP socket used with the DHCP server */ 361*a1157835SDaniel Fojt 362*a1157835SDaniel Fojt #ifdef CONFIG_DPP 363*a1157835SDaniel Fojt int dpp_init_done; 364*a1157835SDaniel Fojt struct dpp_authentication *dpp_auth; 365*a1157835SDaniel Fojt u8 dpp_allowed_roles; 366*a1157835SDaniel Fojt int dpp_qr_mutual; 367*a1157835SDaniel Fojt int dpp_auth_ok_on_ack; 368*a1157835SDaniel Fojt int dpp_in_response_listen; 369*a1157835SDaniel Fojt struct gas_query_ap *gas; 370*a1157835SDaniel Fojt struct dpp_pkex *dpp_pkex; 371*a1157835SDaniel Fojt struct dpp_bootstrap_info *dpp_pkex_bi; 372*a1157835SDaniel Fojt char *dpp_pkex_code; 373*a1157835SDaniel Fojt char *dpp_pkex_identifier; 374*a1157835SDaniel Fojt char *dpp_pkex_auth_cmd; 375*a1157835SDaniel Fojt char *dpp_configurator_params; 376*a1157835SDaniel Fojt struct os_reltime dpp_last_init; 377*a1157835SDaniel Fojt struct os_reltime dpp_init_iter_start; 378*a1157835SDaniel Fojt unsigned int dpp_init_max_tries; 379*a1157835SDaniel Fojt unsigned int dpp_init_retry_time; 380*a1157835SDaniel Fojt unsigned int dpp_resp_wait_time; 381*a1157835SDaniel Fojt unsigned int dpp_resp_max_tries; 382*a1157835SDaniel Fojt unsigned int dpp_resp_retry_time; 383*a1157835SDaniel Fojt #ifdef CONFIG_TESTING_OPTIONS 384*a1157835SDaniel Fojt char *dpp_config_obj_override; 385*a1157835SDaniel Fojt char *dpp_discovery_override; 386*a1157835SDaniel Fojt char *dpp_groups_override; 387*a1157835SDaniel Fojt unsigned int dpp_ignore_netaccesskey_mismatch:1; 388*a1157835SDaniel Fojt #endif /* CONFIG_TESTING_OPTIONS */ 389*a1157835SDaniel Fojt #endif /* CONFIG_DPP */ 390*a1157835SDaniel Fojt 391*a1157835SDaniel Fojt #ifdef CONFIG_AIRTIME_POLICY 392*a1157835SDaniel Fojt unsigned int num_backlogged_sta; 393*a1157835SDaniel Fojt unsigned int airtime_weight; 394*a1157835SDaniel Fojt #endif /* CONFIG_AIRTIME_POLICY */ 395*a1157835SDaniel Fojt 396*a1157835SDaniel Fojt u8 last_1x_eapol_key_replay_counter[8]; 397*a1157835SDaniel Fojt 398*a1157835SDaniel Fojt #ifdef CONFIG_SQLITE 399*a1157835SDaniel Fojt sqlite3 *rad_attr_db; 400*a1157835SDaniel Fojt #endif /* CONFIG_SQLITE */ 4013ff40c12SJohn Marino }; 4023ff40c12SJohn Marino 4033ff40c12SJohn Marino 404*a1157835SDaniel Fojt struct hostapd_sta_info { 405*a1157835SDaniel Fojt struct dl_list list; 406*a1157835SDaniel Fojt u8 addr[ETH_ALEN]; 407*a1157835SDaniel Fojt struct os_reltime last_seen; 408*a1157835SDaniel Fojt int ssi_signal; 409*a1157835SDaniel Fojt #ifdef CONFIG_TAXONOMY 410*a1157835SDaniel Fojt struct wpabuf *probe_ie_taxonomy; 411*a1157835SDaniel Fojt #endif /* CONFIG_TAXONOMY */ 412*a1157835SDaniel Fojt }; 413*a1157835SDaniel Fojt 4143ff40c12SJohn Marino /** 4153ff40c12SJohn Marino * struct hostapd_iface - hostapd per-interface data structure 4163ff40c12SJohn Marino */ 4173ff40c12SJohn Marino struct hostapd_iface { 4183ff40c12SJohn Marino struct hapd_interfaces *interfaces; 4193ff40c12SJohn Marino void *owner; 4203ff40c12SJohn Marino char *config_fname; 4213ff40c12SJohn Marino struct hostapd_config *conf; 4223ff40c12SJohn Marino char phy[16]; /* Name of the PHY (radio) */ 4233ff40c12SJohn Marino 4243ff40c12SJohn Marino enum hostapd_iface_state { 4253ff40c12SJohn Marino HAPD_IFACE_UNINITIALIZED, 4263ff40c12SJohn Marino HAPD_IFACE_DISABLED, 4273ff40c12SJohn Marino HAPD_IFACE_COUNTRY_UPDATE, 4283ff40c12SJohn Marino HAPD_IFACE_ACS, 4293ff40c12SJohn Marino HAPD_IFACE_HT_SCAN, 4303ff40c12SJohn Marino HAPD_IFACE_DFS, 4313ff40c12SJohn Marino HAPD_IFACE_ENABLED 4323ff40c12SJohn Marino } state; 4333ff40c12SJohn Marino 434*a1157835SDaniel Fojt #ifdef CONFIG_MESH 435*a1157835SDaniel Fojt struct mesh_conf *mconf; 436*a1157835SDaniel Fojt #endif /* CONFIG_MESH */ 437*a1157835SDaniel Fojt 4383ff40c12SJohn Marino size_t num_bss; 4393ff40c12SJohn Marino struct hostapd_data **bss; 4403ff40c12SJohn Marino 4413ff40c12SJohn Marino unsigned int wait_channel_update:1; 4423ff40c12SJohn Marino unsigned int cac_started:1; 443*a1157835SDaniel Fojt #ifdef CONFIG_FST 444*a1157835SDaniel Fojt struct fst_iface *fst; 445*a1157835SDaniel Fojt const struct wpabuf *fst_ies; 446*a1157835SDaniel Fojt #endif /* CONFIG_FST */ 447*a1157835SDaniel Fojt 448*a1157835SDaniel Fojt /* 449*a1157835SDaniel Fojt * When set, indicates that the driver will handle the AP 450*a1157835SDaniel Fojt * teardown: delete global keys, station keys, and stations. 451*a1157835SDaniel Fojt */ 452*a1157835SDaniel Fojt unsigned int driver_ap_teardown:1; 453*a1157835SDaniel Fojt 454*a1157835SDaniel Fojt /* 455*a1157835SDaniel Fojt * When set, indicates that this interface is part of list of 456*a1157835SDaniel Fojt * interfaces that need to be started together (synchronously). 457*a1157835SDaniel Fojt */ 458*a1157835SDaniel Fojt unsigned int need_to_start_in_sync:1; 459*a1157835SDaniel Fojt 460*a1157835SDaniel Fojt /* Ready to start but waiting for other interfaces to become ready. */ 461*a1157835SDaniel Fojt unsigned int ready_to_start_in_sync:1; 4623ff40c12SJohn Marino 4633ff40c12SJohn Marino int num_ap; /* number of entries in ap_list */ 4643ff40c12SJohn Marino struct ap_info *ap_list; /* AP info list head */ 4653ff40c12SJohn Marino struct ap_info *ap_hash[STA_HASH_SIZE]; 4663ff40c12SJohn Marino 467*a1157835SDaniel Fojt u64 drv_flags; 468*a1157835SDaniel Fojt 469*a1157835SDaniel Fojt /* SMPS modes supported by the driver (WPA_DRIVER_SMPS_MODE_*) */ 470*a1157835SDaniel Fojt unsigned int smps_modes; 4713ff40c12SJohn Marino 4723ff40c12SJohn Marino /* 4733ff40c12SJohn Marino * A bitmap of supported protocols for probe response offload. See 4743ff40c12SJohn Marino * struct wpa_driver_capa in driver.h 4753ff40c12SJohn Marino */ 4763ff40c12SJohn Marino unsigned int probe_resp_offloads; 4773ff40c12SJohn Marino 4783ff40c12SJohn Marino /* extended capabilities supported by the driver */ 4793ff40c12SJohn Marino const u8 *extended_capa, *extended_capa_mask; 4803ff40c12SJohn Marino unsigned int extended_capa_len; 4813ff40c12SJohn Marino 4823ff40c12SJohn Marino unsigned int drv_max_acl_mac_addrs; 4833ff40c12SJohn Marino 4843ff40c12SJohn Marino struct hostapd_hw_modes *hw_features; 4853ff40c12SJohn Marino int num_hw_features; 4863ff40c12SJohn Marino struct hostapd_hw_modes *current_mode; 4873ff40c12SJohn Marino /* Rates that are currently used (i.e., filtered copy of 4883ff40c12SJohn Marino * current_mode->channels */ 4893ff40c12SJohn Marino int num_rates; 4903ff40c12SJohn Marino struct hostapd_rate_data *current_rates; 4913ff40c12SJohn Marino int *basic_rates; 4923ff40c12SJohn Marino int freq; 4933ff40c12SJohn Marino 4943ff40c12SJohn Marino u16 hw_flags; 4953ff40c12SJohn Marino 4963ff40c12SJohn Marino /* Number of associated Non-ERP stations (i.e., stations using 802.11b 4973ff40c12SJohn Marino * in 802.11g BSS) */ 4983ff40c12SJohn Marino int num_sta_non_erp; 4993ff40c12SJohn Marino 5003ff40c12SJohn Marino /* Number of associated stations that do not support Short Slot Time */ 5013ff40c12SJohn Marino int num_sta_no_short_slot_time; 5023ff40c12SJohn Marino 5033ff40c12SJohn Marino /* Number of associated stations that do not support Short Preamble */ 5043ff40c12SJohn Marino int num_sta_no_short_preamble; 5053ff40c12SJohn Marino 5063ff40c12SJohn Marino int olbc; /* Overlapping Legacy BSS Condition */ 5073ff40c12SJohn Marino 5083ff40c12SJohn Marino /* Number of HT associated stations that do not support greenfield */ 5093ff40c12SJohn Marino int num_sta_ht_no_gf; 5103ff40c12SJohn Marino 5113ff40c12SJohn Marino /* Number of associated non-HT stations */ 5123ff40c12SJohn Marino int num_sta_no_ht; 5133ff40c12SJohn Marino 5143ff40c12SJohn Marino /* Number of HT associated stations 20 MHz */ 5153ff40c12SJohn Marino int num_sta_ht_20mhz; 5163ff40c12SJohn Marino 517*a1157835SDaniel Fojt /* Number of HT40 intolerant stations */ 518*a1157835SDaniel Fojt int num_sta_ht40_intolerant; 519*a1157835SDaniel Fojt 5203ff40c12SJohn Marino /* Overlapping BSS information */ 5213ff40c12SJohn Marino int olbc_ht; 5223ff40c12SJohn Marino 5233ff40c12SJohn Marino u16 ht_op_mode; 5243ff40c12SJohn Marino 5253ff40c12SJohn Marino /* surveying helpers */ 5263ff40c12SJohn Marino 5273ff40c12SJohn Marino /* number of channels surveyed */ 5283ff40c12SJohn Marino unsigned int chans_surveyed; 5293ff40c12SJohn Marino 5303ff40c12SJohn Marino /* lowest observed noise floor in dBm */ 5313ff40c12SJohn Marino s8 lowest_nf; 5323ff40c12SJohn Marino 533*a1157835SDaniel Fojt /* channel utilization calculation */ 534*a1157835SDaniel Fojt u64 last_channel_time; 535*a1157835SDaniel Fojt u64 last_channel_time_busy; 536*a1157835SDaniel Fojt u8 channel_utilization; 537*a1157835SDaniel Fojt 538*a1157835SDaniel Fojt unsigned int chan_util_samples_sum; 539*a1157835SDaniel Fojt unsigned int chan_util_num_sample_periods; 540*a1157835SDaniel Fojt unsigned int chan_util_average; 541*a1157835SDaniel Fojt 542*a1157835SDaniel Fojt /* eCSA IE will be added only if operating class is specified */ 543*a1157835SDaniel Fojt u8 cs_oper_class; 544*a1157835SDaniel Fojt 545*a1157835SDaniel Fojt unsigned int dfs_cac_ms; 546*a1157835SDaniel Fojt struct os_reltime dfs_cac_start; 547*a1157835SDaniel Fojt 548*a1157835SDaniel Fojt /* Latched with the actual secondary channel information and will be 549*a1157835SDaniel Fojt * used while juggling between HT20 and HT40 modes. */ 550*a1157835SDaniel Fojt int secondary_ch; 5513ff40c12SJohn Marino 5523ff40c12SJohn Marino #ifdef CONFIG_ACS 5533ff40c12SJohn Marino unsigned int acs_num_completed_scans; 5543ff40c12SJohn Marino #endif /* CONFIG_ACS */ 5553ff40c12SJohn Marino 5563ff40c12SJohn Marino void (*scan_cb)(struct hostapd_iface *iface); 557*a1157835SDaniel Fojt int num_ht40_scan_tries; 5583ff40c12SJohn Marino 559*a1157835SDaniel Fojt struct dl_list sta_seen; /* struct hostapd_sta_info */ 560*a1157835SDaniel Fojt unsigned int num_sta_seen; 561*a1157835SDaniel Fojt 562*a1157835SDaniel Fojt u8 dfs_domain; 563*a1157835SDaniel Fojt #ifdef CONFIG_AIRTIME_POLICY 564*a1157835SDaniel Fojt unsigned int airtime_quantum; 565*a1157835SDaniel Fojt #endif /* CONFIG_AIRTIME_POLICY */ 566*a1157835SDaniel Fojt 567*a1157835SDaniel Fojt /* Previous WMM element information */ 568*a1157835SDaniel Fojt struct hostapd_wmm_ac_params prev_wmm[WMM_AC_NUM]; 5693ff40c12SJohn Marino }; 5703ff40c12SJohn Marino 5713ff40c12SJohn Marino /* hostapd.c */ 5723ff40c12SJohn Marino int hostapd_for_each_interface(struct hapd_interfaces *interfaces, 5733ff40c12SJohn Marino int (*cb)(struct hostapd_iface *iface, 5743ff40c12SJohn Marino void *ctx), void *ctx); 5753ff40c12SJohn Marino int hostapd_reload_config(struct hostapd_iface *iface); 576*a1157835SDaniel Fojt void hostapd_reconfig_encryption(struct hostapd_data *hapd); 5773ff40c12SJohn Marino struct hostapd_data * 5783ff40c12SJohn Marino hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, 5793ff40c12SJohn Marino struct hostapd_config *conf, 5803ff40c12SJohn Marino struct hostapd_bss_config *bss); 5813ff40c12SJohn Marino int hostapd_setup_interface(struct hostapd_iface *iface); 5823ff40c12SJohn Marino int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err); 5833ff40c12SJohn Marino void hostapd_interface_deinit(struct hostapd_iface *iface); 5843ff40c12SJohn Marino void hostapd_interface_free(struct hostapd_iface *iface); 585*a1157835SDaniel Fojt struct hostapd_iface * hostapd_alloc_iface(void); 5863ff40c12SJohn Marino struct hostapd_iface * hostapd_init(struct hapd_interfaces *interfaces, 5873ff40c12SJohn Marino const char *config_file); 5883ff40c12SJohn Marino struct hostapd_iface * 5893ff40c12SJohn Marino hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy, 5903ff40c12SJohn Marino const char *config_fname, int debug); 5913ff40c12SJohn Marino void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, 5923ff40c12SJohn Marino int reassoc); 5933ff40c12SJohn Marino void hostapd_interface_deinit_free(struct hostapd_iface *iface); 5943ff40c12SJohn Marino int hostapd_enable_iface(struct hostapd_iface *hapd_iface); 5953ff40c12SJohn Marino int hostapd_reload_iface(struct hostapd_iface *hapd_iface); 5963ff40c12SJohn Marino int hostapd_disable_iface(struct hostapd_iface *hapd_iface); 5973ff40c12SJohn Marino int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf); 5983ff40c12SJohn Marino int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf); 5993ff40c12SJohn Marino void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator); 6003ff40c12SJohn Marino void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s); 6013ff40c12SJohn Marino const char * hostapd_state_text(enum hostapd_iface_state s); 602*a1157835SDaniel Fojt int hostapd_csa_in_progress(struct hostapd_iface *iface); 603*a1157835SDaniel Fojt void hostapd_chan_switch_vht_config(struct hostapd_data *hapd, int vht_enabled); 6043ff40c12SJohn Marino int hostapd_switch_channel(struct hostapd_data *hapd, 6053ff40c12SJohn Marino struct csa_settings *settings); 606*a1157835SDaniel Fojt void 607*a1157835SDaniel Fojt hostapd_switch_channel_fallback(struct hostapd_iface *iface, 608*a1157835SDaniel Fojt const struct hostapd_freq_params *freq_params); 6093ff40c12SJohn Marino void hostapd_cleanup_cs_params(struct hostapd_data *hapd); 610*a1157835SDaniel Fojt void hostapd_periodic_iface(struct hostapd_iface *iface); 611*a1157835SDaniel Fojt int hostapd_owe_trans_get_info(struct hostapd_data *hapd); 6123ff40c12SJohn Marino 6133ff40c12SJohn Marino /* utils.c */ 6143ff40c12SJohn Marino int hostapd_register_probereq_cb(struct hostapd_data *hapd, 6153ff40c12SJohn Marino int (*cb)(void *ctx, const u8 *sa, 6163ff40c12SJohn Marino const u8 *da, const u8 *bssid, 6173ff40c12SJohn Marino const u8 *ie, size_t ie_len, 6183ff40c12SJohn Marino int ssi_signal), 6193ff40c12SJohn Marino void *ctx); 6203ff40c12SJohn Marino void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr); 6213ff40c12SJohn Marino 6223ff40c12SJohn Marino /* drv_callbacks.c (TODO: move to somewhere else?) */ 623*a1157835SDaniel Fojt void hostapd_notify_assoc_fils_finish(struct hostapd_data *hapd, 624*a1157835SDaniel Fojt struct sta_info *sta); 6253ff40c12SJohn Marino int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, 6263ff40c12SJohn Marino const u8 *ie, size_t ielen, int reassoc); 6273ff40c12SJohn Marino void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr); 6283ff40c12SJohn Marino void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr); 6293ff40c12SJohn Marino void hostapd_event_connect_failed_reason(struct hostapd_data *hapd, 6303ff40c12SJohn Marino const u8 *addr, int reason_code); 6313ff40c12SJohn Marino int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da, 6323ff40c12SJohn Marino const u8 *bssid, const u8 *ie, size_t ie_len, 6333ff40c12SJohn Marino int ssi_signal); 6343ff40c12SJohn Marino void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht, 635*a1157835SDaniel Fojt int offset, int width, int cf1, int cf2, 636*a1157835SDaniel Fojt int finished); 637*a1157835SDaniel Fojt struct survey_results; 638*a1157835SDaniel Fojt void hostapd_event_get_survey(struct hostapd_iface *iface, 639*a1157835SDaniel Fojt struct survey_results *survey_results); 640*a1157835SDaniel Fojt void hostapd_acs_channel_selected(struct hostapd_data *hapd, 641*a1157835SDaniel Fojt struct acs_selected_channels *acs_res); 6423ff40c12SJohn Marino 6433ff40c12SJohn Marino const struct hostapd_eap_user * 6443ff40c12SJohn Marino hostapd_get_eap_user(struct hostapd_data *hapd, const u8 *identity, 6453ff40c12SJohn Marino size_t identity_len, int phase2); 6463ff40c12SJohn Marino 647*a1157835SDaniel Fojt struct hostapd_data * hostapd_get_iface(struct hapd_interfaces *interfaces, 648*a1157835SDaniel Fojt const char *ifname); 649*a1157835SDaniel Fojt void hostapd_event_sta_opmode_changed(struct hostapd_data *hapd, const u8 *addr, 650*a1157835SDaniel Fojt enum smps_mode smps_mode, 651*a1157835SDaniel Fojt enum chan_width chan_width, u8 rx_nss); 652*a1157835SDaniel Fojt 653*a1157835SDaniel Fojt #ifdef CONFIG_FST 654*a1157835SDaniel Fojt void fst_hostapd_fill_iface_obj(struct hostapd_data *hapd, 655*a1157835SDaniel Fojt struct fst_wpa_obj *iface_obj); 656*a1157835SDaniel Fojt #endif /* CONFIG_FST */ 657*a1157835SDaniel Fojt 6583ff40c12SJohn Marino #endif /* HOSTAPD_H */ 659