1 /*
2 * hostapd / Configuration definitions and helpers functions
3 * Copyright (c) 2003-2024, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8
9 #ifndef HOSTAPD_CONFIG_H
10 #define HOSTAPD_CONFIG_H
11
12 #include "common/defs.h"
13 #include "utils/list.h"
14 #include "ip_addr.h"
15 #include "common/wpa_common.h"
16 #include "common/ieee802_11_defs.h"
17 #include "common/ieee802_11_common.h"
18 #include "crypto/sha256.h"
19 #include "wps/wps.h"
20 #include "fst/fst.h"
21 #include "vlan.h"
22
23 enum macaddr_acl {
24 ACCEPT_UNLESS_DENIED = 0,
25 DENY_UNLESS_ACCEPTED = 1,
26 USE_EXTERNAL_RADIUS_AUTH = 2
27 };
28
29 /**
30 * mesh_conf - local MBSS state and settings
31 */
32 struct mesh_conf {
33 u8 meshid[32];
34 u8 meshid_len;
35 /* Active Path Selection Protocol Identifier */
36 u8 mesh_pp_id;
37 /* Active Path Selection Metric Identifier */
38 u8 mesh_pm_id;
39 /* Congestion Control Mode Identifier */
40 u8 mesh_cc_id;
41 /* Synchronization Protocol Identifier */
42 u8 mesh_sp_id;
43 /* Authentication Protocol Identifier */
44 u8 mesh_auth_id;
45 u8 *rsn_ie;
46 int rsn_ie_len;
47 #define MESH_CONF_SEC_NONE BIT(0)
48 #define MESH_CONF_SEC_AUTH BIT(1)
49 #define MESH_CONF_SEC_AMPE BIT(2)
50 unsigned int security;
51 enum mfp_options ieee80211w;
52 int ocv;
53 unsigned int pairwise_cipher;
54 unsigned int group_cipher;
55 unsigned int mgmt_group_cipher;
56 int dot11MeshMaxRetries;
57 int dot11MeshRetryTimeout; /* msec */
58 int dot11MeshConfirmTimeout; /* msec */
59 int dot11MeshHoldingTimeout; /* msec */
60 int mesh_fwding;
61 };
62
63 #define MAX_STA_COUNT 2007
64 #define MAX_VLAN_ID 4094
65
66 typedef u8 macaddr[ETH_ALEN];
67
68 struct mac_acl_entry {
69 macaddr addr;
70 struct vlan_description vlan_id;
71 };
72
73 struct hostapd_radius_servers;
74 struct ft_remote_r0kh;
75 struct ft_remote_r1kh;
76
77 #ifdef CONFIG_WEP
78 #define NUM_WEP_KEYS 4
79 struct hostapd_wep_keys {
80 u8 idx;
81 u8 *key[NUM_WEP_KEYS];
82 size_t len[NUM_WEP_KEYS];
83 int keys_set;
84 size_t default_len; /* key length used for dynamic key generation */
85 };
86 #endif /* CONFIG_WEP */
87
88 typedef enum hostap_security_policy {
89 SECURITY_PLAINTEXT = 0,
90 #ifdef CONFIG_WEP
91 SECURITY_STATIC_WEP = 1,
92 #endif /* CONFIG_WEP */
93 SECURITY_IEEE_802_1X = 2,
94 SECURITY_WPA_PSK = 3,
95 SECURITY_WPA = 4,
96 } secpolicy;
97
98 struct hostapd_ssid {
99 u8 ssid[SSID_MAX_LEN];
100 size_t ssid_len;
101 u32 short_ssid;
102 unsigned int ssid_set:1;
103 unsigned int utf8_ssid:1;
104 unsigned int wpa_passphrase_set:1;
105 unsigned int wpa_psk_set:1;
106
107 char vlan[IFNAMSIZ + 1];
108 secpolicy security_policy;
109
110 struct hostapd_wpa_psk *wpa_psk;
111 char *wpa_passphrase;
112 char *wpa_psk_file;
113 struct sae_pt *pt;
114
115 #ifdef CONFIG_WEP
116 struct hostapd_wep_keys wep;
117 #endif /* CONFIG_WEP */
118
119 #define DYNAMIC_VLAN_DISABLED 0
120 #define DYNAMIC_VLAN_OPTIONAL 1
121 #define DYNAMIC_VLAN_REQUIRED 2
122 int dynamic_vlan;
123 #define DYNAMIC_VLAN_NAMING_WITHOUT_DEVICE 0
124 #define DYNAMIC_VLAN_NAMING_WITH_DEVICE 1
125 #define DYNAMIC_VLAN_NAMING_END 2
126 int vlan_naming;
127 int per_sta_vif;
128 #ifdef CONFIG_FULL_DYNAMIC_VLAN
129 char *vlan_tagged_interface;
130 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
131 };
132
133
134 #define VLAN_ID_WILDCARD -1
135
136 struct hostapd_vlan {
137 struct hostapd_vlan *next;
138 int vlan_id; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */
139 struct vlan_description vlan_desc;
140 char ifname[IFNAMSIZ + 1];
141 char bridge[IFNAMSIZ + 1];
142 int configured;
143 int dynamic_vlan;
144 #ifdef CONFIG_FULL_DYNAMIC_VLAN
145
146 #define DVLAN_CLEAN_WLAN_PORT 0x8
147 int clean;
148 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
149 };
150
151 #define PMK_LEN 32
152 #define KEYID_LEN 32
153 #define MIN_PASSPHRASE_LEN 8
154 #define MAX_PASSPHRASE_LEN 63
155 struct hostapd_sta_wpa_psk_short {
156 struct hostapd_sta_wpa_psk_short *next;
157 unsigned int is_passphrase:1;
158 u8 psk[PMK_LEN];
159 char passphrase[MAX_PASSPHRASE_LEN + 1];
160 int ref; /* (number of references held) - 1 */
161 };
162
163 struct hostapd_wpa_psk {
164 struct hostapd_wpa_psk *next;
165 int group;
166 char keyid[KEYID_LEN];
167 int wps;
168 u8 psk[PMK_LEN];
169 u8 addr[ETH_ALEN];
170 u8 p2p_dev_addr[ETH_ALEN];
171 int vlan_id;
172 };
173
174 struct hostapd_eap_user {
175 struct hostapd_eap_user *next;
176 u8 *identity;
177 size_t identity_len;
178 struct {
179 int vendor;
180 u32 method;
181 } methods[EAP_MAX_METHODS];
182 u8 *password;
183 size_t password_len;
184 u8 *salt;
185 size_t salt_len; /* non-zero when password is salted */
186 int phase2;
187 int force_version;
188 unsigned int wildcard_prefix:1;
189 unsigned int password_hash:1; /* whether password is hashed with
190 * nt_password_hash() */
191 unsigned int macacl:1;
192 int ttls_auth; /* EAP_TTLS_AUTH_* bitfield */
193 struct hostapd_radius_attr *accept_attr;
194 u32 t_c_timestamp;
195 };
196
197 struct hostapd_radius_attr {
198 u8 type;
199 struct wpabuf *val;
200 struct hostapd_radius_attr *next;
201 };
202
203
204 #define NUM_TX_QUEUES 4
205 #define MAX_ROAMING_CONSORTIUM_LEN 15
206
207 struct hostapd_roaming_consortium {
208 u8 len;
209 u8 oi[MAX_ROAMING_CONSORTIUM_LEN];
210 };
211
212 struct hostapd_lang_string {
213 u8 lang[3];
214 u8 name_len;
215 u8 name[252];
216 };
217
218 struct hostapd_venue_url {
219 u8 venue_number;
220 u8 url_len;
221 u8 url[254];
222 };
223
224 #define MAX_NAI_REALMS 10
225 #define MAX_NAI_REALMLEN 255
226 #define MAX_NAI_EAP_METHODS 5
227 #define MAX_NAI_AUTH_TYPES 4
228 struct hostapd_nai_realm_data {
229 u8 encoding;
230 char realm_buf[MAX_NAI_REALMLEN + 1];
231 char *realm[MAX_NAI_REALMS];
232 u8 eap_method_count;
233 struct hostapd_nai_realm_eap {
234 u8 eap_method;
235 u8 num_auths;
236 u8 auth_id[MAX_NAI_AUTH_TYPES];
237 u8 auth_val[MAX_NAI_AUTH_TYPES];
238 } eap_method[MAX_NAI_EAP_METHODS];
239 };
240
241 struct anqp_element {
242 struct dl_list list;
243 u16 infoid;
244 struct wpabuf *payload;
245 };
246
247 struct fils_realm {
248 struct dl_list list;
249 u8 hash[2];
250 char realm[];
251 };
252
253 struct sae_password_entry {
254 struct sae_password_entry *next;
255 char *password;
256 char *identifier;
257 u8 peer_addr[ETH_ALEN];
258 int vlan_id;
259 struct sae_pt *pt;
260 struct sae_pk *pk;
261 u8 *success_mac;
262 unsigned int num_success_mac, next_success_mac;
263 u8 *fail_mac;
264 unsigned int num_fail_mac, next_fail_mac;
265 };
266
267 struct dpp_controller_conf {
268 struct dpp_controller_conf *next;
269 u8 pkhash[SHA256_MAC_LEN];
270 struct hostapd_ip_addr ipaddr;
271 };
272
273 struct airtime_sta_weight {
274 struct airtime_sta_weight *next;
275 unsigned int weight;
276 u8 addr[ETH_ALEN];
277 };
278
279 #define EXT_CAPA_MAX_LEN 15
280
281 /**
282 * struct hostapd_bss_config - Per-BSS configuration
283 */
284 struct hostapd_bss_config {
285 char iface[IFNAMSIZ + 1];
286 char bridge[IFNAMSIZ + 1];
287 char vlan_bridge[IFNAMSIZ + 1];
288 char wds_bridge[IFNAMSIZ + 1];
289 int bridge_hairpin; /* hairpin_mode on bridge members */
290
291 enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
292
293 unsigned int logger_syslog; /* module bitfield */
294 unsigned int logger_stdout; /* module bitfield */
295
296 int max_num_sta; /* maximum number of STAs in station table */
297
298 enum beacon_rate_type rate_type;
299 unsigned int beacon_rate;
300
301 int dtim_period;
302 unsigned int bss_load_update_period;
303 unsigned int chan_util_avg_period;
304
305 int ieee802_1x; /* use IEEE 802.1X */
306 int eapol_version;
307 int eap_server; /* Use internal EAP server instead of external
308 * RADIUS server */
309 struct hostapd_eap_user *eap_user;
310 char *eap_user_sqlite;
311 char *eap_sim_db;
312 unsigned int eap_sim_db_timeout;
313 int eap_server_erp; /* Whether ERP is enabled on internal EAP server */
314 struct hostapd_ip_addr own_ip_addr;
315 char *nas_identifier;
316 struct hostapd_radius_servers *radius;
317 int radius_require_message_authenticator;
318 int acct_interim_interval;
319 int radius_request_cui;
320 struct hostapd_radius_attr *radius_auth_req_attr;
321 struct hostapd_radius_attr *radius_acct_req_attr;
322 char *radius_req_attr_sqlite;
323 int radius_das_port;
324 unsigned int radius_das_time_window;
325 int radius_das_require_event_timestamp;
326 int radius_das_require_message_authenticator;
327 struct hostapd_ip_addr radius_das_client_addr;
328 u8 *radius_das_shared_secret;
329 size_t radius_das_shared_secret_len;
330
331 struct hostapd_ssid ssid;
332
333 int *supported_rates;
334 int *basic_rates;
335
336 char *eap_req_id_text; /* optional displayable message sent with
337 * EAP Request-Identity */
338 size_t eap_req_id_text_len;
339 int eapol_key_index_workaround;
340
341 #ifdef CONFIG_WEP
342 size_t default_wep_key_len;
343 int individual_wep_key_len;
344 int wep_rekeying_period;
345 int broadcast_key_idx_min, broadcast_key_idx_max;
346 #endif /* CONFIG_WEP */
347 int eap_reauth_period;
348 int erp_send_reauth_start;
349 char *erp_domain;
350 #ifdef CONFIG_TESTING_OPTIONS
351 bool eap_skip_prot_success;
352 #endif /* CONFIG_TESTING_OPTIONS */
353
354 enum macaddr_acl macaddr_acl;
355 struct mac_acl_entry *accept_mac;
356 int num_accept_mac;
357 struct mac_acl_entry *deny_mac;
358 int num_deny_mac;
359 int wds_sta;
360 int isolate;
361 int start_disabled;
362
363 int auth_algs; /* bitfield of allowed IEEE 802.11 authentication
364 * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */
365
366 int wpa; /* bitfield of WPA_PROTO_WPA, WPA_PROTO_RSN */
367 int extended_key_id;
368 int wpa_key_mgmt;
369 int rsn_override_key_mgmt;
370 int rsn_override_key_mgmt_2;
371 enum mfp_options ieee80211w;
372 enum mfp_options rsn_override_mfp;
373 enum mfp_options rsn_override_mfp_2;
374 int group_mgmt_cipher;
375 int beacon_prot;
376 /* dot11AssociationSAQueryMaximumTimeout (in TUs) */
377 unsigned int assoc_sa_query_max_timeout;
378 /* dot11AssociationSAQueryRetryTimeout (in TUs) */
379 int assoc_sa_query_retry_timeout;
380 #ifdef CONFIG_OCV
381 int ocv; /* Operating Channel Validation */
382 #endif /* CONFIG_OCV */
383 enum {
384 PSK_RADIUS_IGNORED = 0,
385 PSK_RADIUS_ACCEPTED = 1,
386 PSK_RADIUS_REQUIRED = 2,
387 PSK_RADIUS_DURING_4WAY_HS = 3,
388 } wpa_psk_radius;
389 int wpa_pairwise;
390 int group_cipher; /* wpa_group value override from configuation */
391 int wpa_group;
392 int wpa_group_rekey;
393 int wpa_group_rekey_set;
394 int wpa_strict_rekey;
395 int wpa_gmk_rekey;
396 int wpa_ptk_rekey;
397 enum ptk0_rekey_handling wpa_deny_ptk0_rekey;
398 u32 wpa_group_update_count;
399 u32 wpa_pairwise_update_count;
400 int wpa_disable_eapol_key_retries;
401 int rsn_pairwise;
402 int rsn_override_pairwise;
403 int rsn_override_pairwise_2;
404 int rsn_preauth;
405 char *rsn_preauth_interfaces;
406
407 int rsn_override_omit_rsnxe;
408 int rsn_override_mlo_compat;
409
410 #ifdef CONFIG_IEEE80211R_AP
411 /* IEEE 802.11r - Fast BSS Transition */
412 u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
413 u8 r1_key_holder[FT_R1KH_ID_LEN];
414 u32 r0_key_lifetime; /* PMK-R0 lifetime seconds */
415 int rkh_pos_timeout;
416 int rkh_neg_timeout;
417 int rkh_pull_timeout; /* ms */
418 int rkh_pull_retries;
419 u32 reassociation_deadline;
420 struct ft_remote_r0kh *r0kh_list;
421 struct ft_remote_r1kh *r1kh_list;
422 int pmk_r1_push;
423 int ft_over_ds;
424 int ft_psk_generate_local;
425 int r1_max_key_lifetime;
426 char *rxkh_file;
427 #endif /* CONFIG_IEEE80211R_AP */
428
429 char *ctrl_interface; /* directory for UNIX domain sockets */
430 #ifndef CONFIG_NATIVE_WINDOWS
431 gid_t ctrl_interface_gid;
432 #endif /* CONFIG_NATIVE_WINDOWS */
433 int ctrl_interface_gid_set;
434
435 char *ca_cert;
436 char *server_cert;
437 char *server_cert2;
438 char *private_key;
439 char *private_key2;
440 char *private_key_passwd;
441 char *private_key_passwd2;
442 char *check_cert_subject;
443 int check_crl;
444 int check_crl_strict;
445 unsigned int crl_reload_interval;
446 unsigned int tls_session_lifetime;
447 unsigned int tls_flags;
448 unsigned int max_auth_rounds;
449 unsigned int max_auth_rounds_short;
450 char *ocsp_stapling_response;
451 char *ocsp_stapling_response_multi;
452 char *dh_file;
453 char *openssl_ciphers;
454 char *openssl_ecdh_curves;
455 u8 *pac_opaque_encr_key;
456 u8 *eap_fast_a_id;
457 size_t eap_fast_a_id_len;
458 char *eap_fast_a_id_info;
459 int eap_fast_prov;
460 int pac_key_lifetime;
461 int pac_key_refresh_time;
462 int eap_teap_auth;
463 int eap_teap_separate_result;
464 int eap_teap_id;
465 int eap_teap_method_sequence;
466 int eap_sim_aka_result_ind;
467 int eap_sim_id;
468 char *imsi_privacy_key;
469 int eap_sim_aka_fast_reauth_limit;
470 int tnc;
471 int fragment_size;
472 u16 pwd_group;
473
474 char *radius_server_clients;
475 int radius_server_auth_port;
476 int radius_server_acct_port;
477 int radius_server_acct_log;
478 int radius_server_ipv6;
479
480 int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
481 * address instead of individual address
482 * (for driver_wired.c).
483 */
484
485 int ap_max_inactivity;
486 int bss_max_idle;
487 int max_acceptable_idle_period;
488 bool no_disconnect_on_group_keyerror;
489 int ignore_broadcast_ssid;
490 int no_probe_resp_if_max_sta;
491
492 int wmm_enabled;
493 int wmm_uapsd;
494
495 struct hostapd_vlan *vlan;
496
497 macaddr bssid;
498
499 /*
500 * Maximum listen interval that STAs can use when associating with this
501 * BSS. If a STA tries to use larger value, the association will be
502 * denied with status code 51.
503 */
504 u16 max_listen_interval;
505
506 int disable_pmksa_caching;
507 int okc; /* Opportunistic Key Caching */
508
509 int wps_state;
510 #ifdef CONFIG_WPS
511 int wps_independent;
512 int ap_setup_locked;
513 u8 uuid[16];
514 char *wps_pin_requests;
515 char *device_name;
516 char *manufacturer;
517 char *model_name;
518 char *model_number;
519 char *serial_number;
520 u8 device_type[WPS_DEV_TYPE_LEN];
521 char *config_methods;
522 u8 os_version[4];
523 char *ap_pin;
524 int skip_cred_build;
525 u8 *extra_cred;
526 size_t extra_cred_len;
527 int wps_cred_processing;
528 int wps_cred_add_sae;
529 int force_per_enrollee_psk;
530 u8 *ap_settings;
531 size_t ap_settings_len;
532 struct hostapd_ssid multi_ap_backhaul_ssid;
533 char *upnp_iface;
534 char *friendly_name;
535 char *manufacturer_url;
536 char *model_description;
537 char *model_url;
538 char *upc;
539 struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
540 struct wpabuf *wps_application_ext;
541 int wps_nfc_pw_from_config;
542 int wps_nfc_dev_pw_id;
543 struct wpabuf *wps_nfc_dh_pubkey;
544 struct wpabuf *wps_nfc_dh_privkey;
545 struct wpabuf *wps_nfc_dev_pw;
546 #endif /* CONFIG_WPS */
547 int pbc_in_m1;
548 char *server_id;
549
550 #define P2P_ENABLED BIT(0)
551 #define P2P_GROUP_OWNER BIT(1)
552 #define P2P_GROUP_FORMATION BIT(2)
553 #define P2P_MANAGE BIT(3)
554 #define P2P_ALLOW_CROSS_CONNECTION BIT(4)
555 int p2p;
556 #ifdef CONFIG_P2P
557 u8 ip_addr_go[4];
558 u8 ip_addr_mask[4];
559 u8 ip_addr_start[4];
560 u8 ip_addr_end[4];
561 #endif /* CONFIG_P2P */
562
563 int disassoc_low_ack;
564 int skip_inactivity_poll;
565
566 #define TDLS_PROHIBIT BIT(0)
567 #define TDLS_PROHIBIT_CHAN_SWITCH BIT(1)
568 int tdls;
569 bool disable_11n;
570 bool disable_11ac;
571 bool disable_11ax;
572 bool disable_11be;
573
574 #ifdef CONFIG_IEEE80211BE
575 bool bss_require_eht;
576 #endif /* CONFIG_IEEE80211BE */
577
578 /* IEEE 802.11v */
579 int time_advertisement;
580 char *time_zone;
581 int wnm_sleep_mode;
582 int wnm_sleep_mode_no_keys;
583 int bss_transition;
584
585 /* IEEE 802.11u - Interworking */
586 int interworking;
587 int access_network_type;
588 int internet;
589 int asra;
590 int esr;
591 int uesa;
592 int venue_info_set;
593 u8 venue_group;
594 u8 venue_type;
595 u8 hessid[ETH_ALEN];
596
597 /* IEEE 802.11u - Roaming Consortium list */
598 unsigned int roaming_consortium_count;
599 struct hostapd_roaming_consortium *roaming_consortium;
600
601 /* IEEE 802.11u - Venue Name duples */
602 unsigned int venue_name_count;
603 struct hostapd_lang_string *venue_name;
604
605 /* Venue URL duples */
606 unsigned int venue_url_count;
607 struct hostapd_venue_url *venue_url;
608
609 /* IEEE 802.11u - Network Authentication Type */
610 u8 *network_auth_type;
611 size_t network_auth_type_len;
612
613 /* IEEE 802.11u - IP Address Type Availability */
614 u8 ipaddr_type_availability;
615 u8 ipaddr_type_configured;
616
617 /* IEEE 802.11u - 3GPP Cellular Network */
618 u8 *anqp_3gpp_cell_net;
619 size_t anqp_3gpp_cell_net_len;
620
621 /* IEEE 802.11u - Domain Name */
622 u8 *domain_name;
623 size_t domain_name_len;
624
625 unsigned int nai_realm_count;
626 struct hostapd_nai_realm_data *nai_realm_data;
627
628 struct dl_list anqp_elem; /* list of struct anqp_element */
629
630 u16 gas_comeback_delay;
631 size_t gas_frag_limit;
632 int gas_address3;
633
634 u8 qos_map_set[16 + 2 * 21];
635 unsigned int qos_map_set_len;
636
637 int proxy_arp;
638 int na_mcast_to_ucast;
639
640 #ifdef CONFIG_HS20
641 int hs20;
642 int hs20_release;
643 int disable_dgaf;
644 u16 anqp_domain_id;
645 unsigned int hs20_oper_friendly_name_count;
646 struct hostapd_lang_string *hs20_oper_friendly_name;
647 u8 *hs20_wan_metrics;
648 u8 *hs20_connection_capability;
649 size_t hs20_connection_capability_len;
650 u8 *hs20_operating_class;
651 u8 hs20_operating_class_len;
652 unsigned int hs20_deauth_req_timeout;
653 char *t_c_filename;
654 u32 t_c_timestamp;
655 char *t_c_server_url;
656 #endif /* CONFIG_HS20 */
657
658 u8 wps_rf_bands; /* RF bands for WPS (WPS_RF_*) */
659
660 #ifdef CONFIG_RADIUS_TEST
661 char *dump_msk_file;
662 #endif /* CONFIG_RADIUS_TEST */
663
664 struct wpabuf *vendor_elements;
665 struct wpabuf *assocresp_elements;
666
667 unsigned int anti_clogging_threshold;
668 unsigned int sae_sync;
669 int sae_require_mfp;
670 int sae_confirm_immediate;
671 enum sae_pwe sae_pwe;
672 /* Accept an SAE association even when the STA advertises SAE H2E
673 * support in the RSNXE but authenticated using hunting-and-pecking.
674 * This is a workaround for WPA3-Personal Compatibility Mode and
675 * RSNXE-override interoperability (e.g., some MLO STAs that add only
676 * the RSNXE Override element and do not use H2E on 2.4/5 GHz) */
677 bool sae_accept_h2e_without_use;
678 int *sae_groups;
679 struct sae_password_entry *sae_passwords;
680 int sae_password_psk;
681 int sae_track_password;
682 struct wpabuf *sae_pw_id_key;
683 unsigned int sae_pw_id_num;
684
685 char *wowlan_triggers; /* Wake-on-WLAN triggers */
686
687 #ifdef CONFIG_TESTING_OPTIONS
688 u8 bss_load_test[5];
689 u8 bss_load_test_set;
690 struct wpabuf *own_ie_override;
691 struct wpabuf *rsne_override;
692 struct wpabuf *rsnoe_override;
693 struct wpabuf *rsno2e_override;
694 struct wpabuf *rsnxe_override;
695 struct wpabuf *rsnxoe_override;
696 int sae_reflection_attack;
697 int sae_commit_status;
698 int sae_pk_omit;
699 int sae_pk_password_check_skip;
700 struct wpabuf *sae_commit_override;
701 struct wpabuf *rsne_override_eapol;
702 struct wpabuf *rsnxe_override_eapol;
703 struct wpabuf *rsne_override_ft;
704 struct wpabuf *rsnxe_override_ft;
705 struct wpabuf *gtk_rsc_override;
706 struct wpabuf *igtk_rsc_override;
707 int no_beacon_rsnxe;
708 int skip_prune_assoc;
709 int ft_rsnxe_used;
710 unsigned int oci_freq_override_eapol_m3;
711 unsigned int oci_freq_override_eapol_g1;
712 unsigned int oci_freq_override_saquery_req;
713 unsigned int oci_freq_override_saquery_resp;
714 unsigned int oci_freq_override_ft_assoc;
715 unsigned int oci_freq_override_fils_assoc;
716 unsigned int oci_freq_override_wnm_sleep;
717 struct wpabuf *eapol_m1_elements;
718 struct wpabuf *eapol_m3_elements;
719 bool eapol_m3_no_encrypt;
720 bool eapol_key_reserved_random;
721 int test_assoc_comeback_type;
722 struct wpabuf *presp_elements;
723 int association_response_status_code;
724
725 #ifdef CONFIG_IEEE80211BE
726 u16 eht_oper_puncturing_override;
727 #endif /* CONFIG_IEEE80211BE */
728 #endif /* CONFIG_TESTING_OPTIONS */
729
730 #define MESH_ENABLED BIT(0)
731 int mesh;
732 int mesh_fwding;
733
734 u8 radio_measurements[RRM_CAPABILITIES_IE_LEN];
735
736 int vendor_vht;
737 int use_sta_nsts;
738
739 char *no_probe_resp_if_seen_on;
740 char *no_auth_if_seen_on;
741
742 int pbss;
743
744 #ifdef CONFIG_MBO
745 int mbo_enabled;
746 /**
747 * oce - Enable OCE in AP and/or STA-CFON mode
748 * - BIT(0) is Reserved
749 * - Set BIT(1) to enable OCE in STA-CFON mode
750 * - Set BIT(2) to enable OCE in AP mode
751 */
752 unsigned int oce;
753 int mbo_cell_data_conn_pref;
754 #endif /* CONFIG_MBO */
755
756 int ftm_responder;
757 int ftm_initiator;
758
759 #ifdef CONFIG_FILS
760 u8 fils_cache_id[FILS_CACHE_ID_LEN];
761 int fils_cache_id_set;
762 struct dl_list fils_realms; /* list of struct fils_realm */
763 int fils_dh_group;
764 struct hostapd_ip_addr dhcp_server;
765 int dhcp_rapid_commit_proxy;
766 unsigned int fils_hlp_wait_time;
767 u16 dhcp_server_port;
768 u16 dhcp_relay_port;
769 u32 fils_discovery_min_int;
770 u32 fils_discovery_max_int;
771 #endif /* CONFIG_FILS */
772
773 int multicast_to_unicast;
774 int bridge_multicast_to_unicast;
775
776 int broadcast_deauth;
777
778 int notify_mgmt_frames;
779
780 #ifdef CONFIG_DPP
781 char *dpp_name;
782 char *dpp_mud_url;
783 char *dpp_extra_conf_req_name;
784 char *dpp_extra_conf_req_value;
785 char *dpp_connector;
786 struct wpabuf *dpp_netaccesskey;
787 unsigned int dpp_netaccesskey_expiry;
788 struct wpabuf *dpp_csign;
789 #ifdef CONFIG_DPP2
790 struct dpp_controller_conf *dpp_controller;
791 int dpp_relay_port;
792 int dpp_configurator_connectivity;
793 int dpp_pfs;
794 #endif /* CONFIG_DPP2 */
795 #endif /* CONFIG_DPP */
796
797 #ifdef CONFIG_OWE
798 macaddr owe_transition_bssid;
799 u8 owe_transition_ssid[SSID_MAX_LEN];
800 size_t owe_transition_ssid_len;
801 char owe_transition_ifname[IFNAMSIZ + 1];
802 int *owe_groups;
803 int owe_ptk_workaround;
804 #endif /* CONFIG_OWE */
805
806 int coloc_intf_reporting;
807
808 u8 send_probe_response;
809
810 u8 transition_disable;
811
812 #define BACKHAUL_BSS 1
813 #define FRONTHAUL_BSS 2
814 int multi_ap; /* bitmap of BACKHAUL_BSS, FRONTHAUL_BSS */
815 int multi_ap_profile;
816 /* Multi-AP Profile-1 clients not allowed to connect */
817 #define PROFILE1_CLIENT_ASSOC_DISALLOW BIT(0)
818 /* Multi-AP Profile-2 clients not allowed to connect */
819 #define PROFILE2_CLIENT_ASSOC_DISALLOW BIT(1)
820 unsigned int multi_ap_client_disallow;
821 /* Primary VLAN ID to use in Multi-AP */
822 int multi_ap_vlanid;
823
824 #ifdef CONFIG_AIRTIME_POLICY
825 unsigned int airtime_weight;
826 int airtime_limit;
827 struct airtime_sta_weight *airtime_weight_list;
828 #endif /* CONFIG_AIRTIME_POLICY */
829
830 #ifdef CONFIG_MACSEC
831 /**
832 * macsec_policy - Determines the policy for MACsec secure session
833 *
834 * 0: MACsec not in use (default)
835 * 1: MACsec enabled - Should secure, accept key server's advice to
836 * determine whether to use a secure session or not.
837 */
838 int macsec_policy;
839
840 /**
841 * macsec_integ_only - Determines how MACsec are transmitted
842 *
843 * This setting applies only when MACsec is in use, i.e.,
844 * - macsec_policy is enabled
845 * - the key server has decided to enable MACsec
846 *
847 * 0: Encrypt traffic (default)
848 * 1: Integrity only
849 */
850 int macsec_integ_only;
851
852 /**
853 * macsec_replay_protect - Enable MACsec replay protection
854 *
855 * This setting applies only when MACsec is in use, i.e.,
856 * - macsec_policy is enabled
857 * - the key server has decided to enable MACsec
858 *
859 * 0: Replay protection disabled (default)
860 * 1: Replay protection enabled
861 */
862 int macsec_replay_protect;
863
864 /**
865 * macsec_replay_window - MACsec replay protection window
866 *
867 * A window in which replay is tolerated, to allow receipt of frames
868 * that have been misordered by the network.
869 *
870 * This setting applies only when MACsec replay protection active, i.e.,
871 * - macsec_replay_protect is enabled
872 * - the key server has decided to enable MACsec
873 *
874 * 0: No replay window, strict check (default)
875 * 1..2^32-1: number of packets that could be misordered
876 */
877 u32 macsec_replay_window;
878
879 /**
880 * macsec_offload - Enable MACsec offload
881 *
882 * This setting applies only when MACsec is in use, i.e.,
883 * - macsec_policy is enabled
884 * - the key server has decided to enable MACsec
885 *
886 * 0 = MACSEC_OFFLOAD_OFF (default)
887 * 1 = MACSEC_OFFLOAD_PHY
888 * 2 = MACSEC_OFFLOAD_MAC
889 */
890 int macsec_offload;
891
892 /**
893 * macsec_port - MACsec port (in SCI)
894 *
895 * Port component of the SCI.
896 *
897 * Range: 1-65534 (default: 1)
898 */
899 int macsec_port;
900
901 /**
902 * mka_priority - Priority of MKA Actor
903 *
904 * Range: 0-255 (default: 255)
905 */
906 int mka_priority;
907
908 /**
909 * macsec_csindex - Cipher suite index for MACsec
910 *
911 * Range: 0-1 (default: 0)
912 */
913 int macsec_csindex;
914
915 /**
916 * macsec_icv_indicator - Always include ICV Indicator
917 * (for compatibility with older MACsec switches)
918 *
919 * Range: 0-1 (default: 0)
920 */
921 int macsec_icv_indicator;
922
923 /**
924 * mka_ckn - MKA pre-shared CKN
925 */
926 #define MACSEC_CKN_MAX_LEN 32
927 size_t mka_ckn_len;
928 u8 mka_ckn[MACSEC_CKN_MAX_LEN];
929
930 /**
931 * mka_cak - MKA pre-shared CAK
932 */
933 #define MACSEC_CAK_MAX_LEN 32
934 size_t mka_cak_len;
935 u8 mka_cak[MACSEC_CAK_MAX_LEN];
936
937 #define MKA_PSK_SET_CKN BIT(0)
938 #define MKA_PSK_SET_CAK BIT(1)
939 #define MKA_PSK_SET (MKA_PSK_SET_CKN | MKA_PSK_SET_CAK)
940 /**
941 * mka_psk_set - Whether mka_ckn and mka_cak are set
942 */
943 u8 mka_psk_set;
944 #endif /* CONFIG_MACSEC */
945
946 #ifdef CONFIG_PASN
947 /* Whether to allow PASN-UNAUTH */
948 int pasn_noauth;
949
950 #ifdef CONFIG_ENC_ASSOC
951 /* Whether to allow unauthenticated EPPKE (EPPKE without base AKM) */
952 bool eppke_unauth;
953 #endif /* CONFIG_ENC_ASSOC */
954
955 #ifdef CONFIG_TESTING_OPTIONS
956 /*
957 * Normally, KDK should be derived if and only if both sides support
958 * secure LTF. Allow forcing KDK derivation for testing purposes.
959 */
960 int force_kdk_derivation;
961
962 /* If set, corrupt the MIC in the 2nd Authentication frame of PASN */
963 int pasn_corrupt_mic;
964
965 /*
966 * If set, override Supported Groups element in the 2nd Authentication
967 * frame of PASN for group negotiation testing.
968 */
969 int *pasn_test_groups;
970 #endif /* CONFIG_TESTING_OPTIONS */
971
972 int *pasn_groups;
973
974 /*
975 * The time in TUs after which the non-AP STA is requested to retry the
976 * PASN authentication in case there are too many parallel operations.
977 */
978 u16 pasn_comeback_after;
979 #endif /* CONFIG_PASN */
980
981 int urnm_mfpr_x20;
982 int urnm_mfpr;
983
984 unsigned int unsol_bcast_probe_resp_interval;
985
986 u8 ext_capa_mask[EXT_CAPA_MAX_LEN];
987 u8 ext_capa[EXT_CAPA_MAX_LEN];
988
989 u8 rnr;
990 char *config_id;
991
992 bool ssid_protection;
993 bool known_sta_identification;
994
995 #ifdef CONFIG_IEEE80211BE
996 /* The AP is part of an AP MLD */
997 u8 mld_ap;
998
999 /* The MLD ID to which the AP MLD is affiliated with */
1000 u8 mld_id;
1001
1002 /* The AP's MLD MAC address within the AP MLD */
1003 u8 mld_addr[ETH_ALEN];
1004
1005 #ifdef CONFIG_TESTING_OPTIONS
1006 /*
1007 * If set indicate the AP as disabled in the RNR element included in the
1008 * other APs in the AP MLD.
1009 */
1010 bool mld_indicate_disabled;
1011 #endif /* CONFIG_TESTING_OPTIONS */
1012 #endif /* CONFIG_IEEE80211BE */
1013 int mbssid_index;
1014
1015 bool spp_amsdu;
1016 #ifdef CONFIG_ENC_ASSOC
1017 unsigned int assoc_frame_encryption:1;
1018 unsigned int pmksa_caching_privacy:1;
1019 unsigned int eap_using_authentication_frames:1;
1020 #endif /* CONFIG_ENC_ASSOC */
1021 };
1022
1023 /**
1024 * struct he_phy_capabilities_info - HE PHY capabilities
1025 */
1026 struct he_phy_capabilities_info {
1027 bool he_su_beamformer;
1028 bool he_su_beamformee;
1029 bool he_mu_beamformer;
1030 };
1031
1032 /**
1033 * struct he_operation - HE operation
1034 */
1035 struct he_operation {
1036 u8 he_bss_color;
1037 u8 he_bss_color_disabled;
1038 u8 he_bss_color_partial;
1039 u8 he_default_pe_duration;
1040 u8 he_twt_required;
1041 u8 he_twt_responder;
1042 u16 he_rts_threshold;
1043 u8 he_er_su_disable;
1044 u16 he_basic_mcs_nss_set;
1045 };
1046
1047 /**
1048 * struct spatial_reuse - Spatial reuse
1049 */
1050 struct spatial_reuse {
1051 u8 sr_control;
1052 u8 non_srg_obss_pd_max_offset;
1053 u8 srg_obss_pd_min_offset;
1054 u8 srg_obss_pd_max_offset;
1055 u8 srg_bss_color_bitmap[8];
1056 u8 srg_partial_bssid_bitmap[8];
1057 };
1058
1059 /**
1060 * struct eht_phy_capabilities_info - EHT PHY capabilities
1061 */
1062 struct eht_phy_capabilities_info {
1063 bool su_beamformer;
1064 bool su_beamformee;
1065 bool mu_beamformer;
1066 };
1067
1068 /**
1069 * struct hostapd_config - Per-radio interface configuration
1070 */
1071 struct hostapd_config {
1072 struct hostapd_bss_config **bss, *last_bss;
1073 size_t num_bss;
1074
1075 u16 beacon_int;
1076 int rts_threshold;
1077 int fragm_threshold;
1078 u8 op_class;
1079 u8 channel;
1080 int enable_edmg;
1081 u8 edmg_channel;
1082 u8 acs;
1083 struct wpa_freq_range_list acs_ch_list;
1084 struct wpa_freq_range_list acs_freq_list;
1085 u8 acs_freq_list_present;
1086 int acs_exclude_dfs;
1087 u8 min_tx_power;
1088 enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
1089 bool hw_mode_set;
1090 int acs_exclude_6ghz_non_psc;
1091 int enable_background_radar;
1092 enum {
1093 LONG_PREAMBLE = 0,
1094 SHORT_PREAMBLE = 1
1095 } preamble;
1096
1097 const struct wpa_driver_ops *driver;
1098 char *driver_params;
1099
1100 int ap_table_max_size;
1101 int ap_table_expiration_time;
1102
1103 unsigned int track_sta_max_num;
1104 unsigned int track_sta_max_age;
1105
1106 char country[3]; /* first two octets: country code as described in
1107 * ISO/IEC 3166-1. Third octet:
1108 * ' ' (ascii 32): all environments
1109 * 'O': Outdoor environemnt only
1110 * 'I': Indoor environment only
1111 * 'X': Used with noncountry entity ("XXX")
1112 * 0x00..0x31: identifying IEEE 802.11 standard
1113 * Annex E table (0x04 = global table)
1114 */
1115
1116 int ieee80211d;
1117
1118 int ieee80211h; /* DFS */
1119
1120 /*
1121 * Local power constraint is an octet encoded as an unsigned integer in
1122 * units of decibels. Invalid value -1 indicates that Power Constraint
1123 * element will not be added.
1124 */
1125 int local_pwr_constraint;
1126
1127 /* Control Spectrum Management bit */
1128 int spectrum_mgmt_required;
1129
1130 struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
1131
1132 /*
1133 * WMM AC parameters, in same order as 802.1D, i.e.
1134 * 0 = BE (best effort)
1135 * 1 = BK (background)
1136 * 2 = VI (video)
1137 * 3 = VO (voice)
1138 */
1139 struct hostapd_wmm_ac_params wmm_ac_params[4];
1140
1141 int ht_op_mode_fixed;
1142 u16 ht_capab;
1143 int ieee80211n;
1144 int secondary_channel;
1145 int no_pri_sec_switch;
1146 int require_ht;
1147 int obss_interval;
1148 u32 vht_capab;
1149 int ieee80211ac;
1150 int require_vht;
1151 enum oper_chan_width vht_oper_chwidth;
1152 u8 vht_oper_centr_freq_seg0_idx;
1153 u8 vht_oper_centr_freq_seg1_idx;
1154 u8 ht40_plus_minus_allowed;
1155
1156 /* Use driver-generated interface addresses when adding multiple BSSs */
1157 u8 use_driver_iface_addr;
1158
1159 #ifdef CONFIG_FST
1160 struct fst_iface_cfg fst_cfg;
1161 #endif /* CONFIG_FST */
1162
1163 #ifdef CONFIG_P2P
1164 u8 p2p_go_ctwindow;
1165 #endif /* CONFIG_P2P */
1166
1167 #ifdef CONFIG_TESTING_OPTIONS
1168 double ignore_probe_probability;
1169 double ignore_auth_probability;
1170 double ignore_assoc_probability;
1171 double ignore_reassoc_probability;
1172 double corrupt_gtk_rekey_mic_probability;
1173 int ecsa_ie_only;
1174 int csa_ie_only;
1175 bool delay_eapol_tx;
1176 #endif /* CONFIG_TESTING_OPTIONS */
1177
1178 #ifdef CONFIG_ACS
1179 unsigned int acs_num_scans;
1180 struct acs_bias {
1181 int channel;
1182 double bias;
1183 } *acs_chan_bias;
1184 unsigned int num_acs_chan_bias;
1185 #endif /* CONFIG_ACS */
1186
1187 struct wpabuf *lci;
1188 struct wpabuf *civic;
1189 int stationary_ap;
1190
1191 int ieee80211ax;
1192 #ifdef CONFIG_IEEE80211AX
1193 struct he_phy_capabilities_info he_phy_capab;
1194 struct he_operation he_op;
1195 struct ieee80211_he_mu_edca_parameter_set he_mu_edca;
1196 struct spatial_reuse spr;
1197 enum oper_chan_width he_oper_chwidth;
1198 u8 he_oper_centr_freq_seg0_idx;
1199 u8 he_oper_centr_freq_seg1_idx;
1200 u8 he_6ghz_max_mpdu;
1201 u8 he_6ghz_max_ampdu_len_exp;
1202 u8 he_6ghz_rx_ant_pat;
1203 u8 he_6ghz_tx_ant_pat;
1204 u8 he_6ghz_reg_pwr_type;
1205
1206 int reg_def_cli_eirp_psd;
1207 int reg_sub_cli_eirp_psd;
1208
1209 /*
1210 * This value should be used when regulatory client EIRP PSD values
1211 * advertised by an AP that is an SP AP or an indoor SP AP are
1212 * insufficient to ensure that regulatory client limits on total EIRP
1213 * are always met for all transmission bandwidths within the bandwidth
1214 * of the AP’s BSS.
1215 */
1216 int reg_def_cli_eirp;
1217
1218 bool require_he;
1219 #endif /* CONFIG_IEEE80211AX */
1220
1221 /* VHT enable/disable config from CHAN_SWITCH */
1222 #define CH_SWITCH_VHT_ENABLED BIT(0)
1223 #define CH_SWITCH_VHT_DISABLED BIT(1)
1224 unsigned int ch_switch_vht_config;
1225
1226 /* HE enable/disable config from CHAN_SWITCH */
1227 #define CH_SWITCH_HE_ENABLED BIT(0)
1228 #define CH_SWITCH_HE_DISABLED BIT(1)
1229 unsigned int ch_switch_he_config;
1230
1231 int rssi_reject_assoc_rssi;
1232 int rssi_reject_assoc_timeout;
1233 int rssi_ignore_probe_request;
1234
1235 #ifdef CONFIG_AIRTIME_POLICY
1236 enum {
1237 AIRTIME_MODE_OFF = 0,
1238 AIRTIME_MODE_STATIC = 1,
1239 AIRTIME_MODE_DYNAMIC = 2,
1240 AIRTIME_MODE_LIMIT = 3,
1241 __AIRTIME_MODE_MAX,
1242 } airtime_mode;
1243 unsigned int airtime_update_interval;
1244 #define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1)
1245 #endif /* CONFIG_AIRTIME_POLICY */
1246
1247 int ieee80211be;
1248 #ifdef CONFIG_IEEE80211BE
1249 enum oper_chan_width eht_oper_chwidth;
1250 u8 eht_oper_centr_freq_seg0_idx;
1251 struct eht_phy_capabilities_info eht_phy_capab;
1252 u16 punct_bitmap; /* a bitmap of disabled 20 MHz channels */
1253 u8 punct_acs_threshold;
1254 u8 eht_default_pe_duration;
1255 u8 eht_bw320_offset;
1256 bool require_eht;
1257 #endif /* CONFIG_IEEE80211BE */
1258
1259 /* EHT enable/disable config from CHAN_SWITCH */
1260 #define CH_SWITCH_EHT_ENABLED BIT(0)
1261 #define CH_SWITCH_EHT_DISABLED BIT(1)
1262 unsigned int ch_switch_eht_config;
1263
1264 enum mbssid {
1265 MBSSID_DISABLED = 0,
1266 MBSSID_ENABLED = 1,
1267 ENHANCED_MBSSID_ENABLED = 2,
1268 } mbssid;
1269 unsigned int mbssid_max;
1270
1271 /* Whether to enable TWT responder in HT and VHT modes */
1272 bool ht_vht_twt_responder;
1273
1274 bool channel_usage;
1275 bool peer_to_peer_twt;
1276
1277 /* Set I2R LMR policy to allow LMR response from ISTA */
1278 bool i2r_lmr_policy;
1279
1280 /* Disable MCS15 Subfield in EHT operation element */
1281 bool disable_mcs15_rx;
1282
1283 #ifdef CONFIG_AFC
1284 struct {
1285 char *socket;
1286 struct {
1287 char *version;
1288 char *sn;
1289 } request;
1290 unsigned int n_cert_ids;
1291 struct afc_cert_id {
1292 char *ruleset;
1293 char *id;
1294 } *cert_ids;
1295 struct {
1296 enum afc_location_type {
1297 AFC_ELLIPSE,
1298 AFC_LINEAR_POLYGON,
1299 AFC_RADIAL_POLYGON,
1300 } type;
1301 unsigned int n_linear_polygon_data;
1302 struct afc_linear_polygon {
1303 double longitude;
1304 double latitude;
1305 } *linear_polygon_data;
1306 unsigned int n_radial_polygon_data;
1307 struct afc_radial_polygon {
1308 double length;
1309 double angle;
1310 } *radial_polygon_data;
1311 int major_axis;
1312 int minor_axis;
1313 int orientation;
1314 double height;
1315 char *height_type;
1316 int vertical_tolerance;
1317 } location;
1318 struct wpa_freq_range_list freqs;
1319 int *op_class; /* int array */
1320 int min_power;
1321 } afc;
1322 #endif /* CONFIG_AFC */
1323 };
1324
1325
1326 static inline enum oper_chan_width
hostapd_get_oper_chwidth(struct hostapd_config * conf)1327 hostapd_get_oper_chwidth(struct hostapd_config *conf)
1328 {
1329 #ifdef CONFIG_IEEE80211BE
1330 if (conf->ieee80211be)
1331 return conf->eht_oper_chwidth;
1332 #endif /* CONFIG_IEEE80211BE */
1333 #ifdef CONFIG_IEEE80211AX
1334 if (conf->ieee80211ax)
1335 return conf->he_oper_chwidth;
1336 #endif /* CONFIG_IEEE80211AX */
1337 return conf->vht_oper_chwidth;
1338 }
1339
1340 static inline void
hostapd_set_oper_chwidth(struct hostapd_config * conf,enum oper_chan_width oper_chwidth)1341 hostapd_set_oper_chwidth(struct hostapd_config *conf,
1342 enum oper_chan_width oper_chwidth)
1343 {
1344 #ifdef CONFIG_IEEE80211BE
1345 if (conf->ieee80211be)
1346 conf->eht_oper_chwidth = oper_chwidth;
1347 if (oper_chwidth == CONF_OPER_CHWIDTH_320MHZ)
1348 oper_chwidth = CONF_OPER_CHWIDTH_160MHZ;
1349 #endif /* CONFIG_IEEE80211BE */
1350 #ifdef CONFIG_IEEE80211AX
1351 if (conf->ieee80211ax)
1352 conf->he_oper_chwidth = oper_chwidth;
1353 #endif /* CONFIG_IEEE80211AX */
1354 conf->vht_oper_chwidth = oper_chwidth;
1355 }
1356
1357 static inline u8
hostapd_get_oper_centr_freq_seg0_idx(struct hostapd_config * conf)1358 hostapd_get_oper_centr_freq_seg0_idx(struct hostapd_config *conf)
1359 {
1360 #ifdef CONFIG_IEEE80211BE
1361 if (conf->ieee80211be)
1362 return conf->eht_oper_centr_freq_seg0_idx;
1363 #endif /* CONFIG_IEEE80211BE */
1364 #ifdef CONFIG_IEEE80211AX
1365 if (conf->ieee80211ax)
1366 return conf->he_oper_centr_freq_seg0_idx;
1367 #endif /* CONFIG_IEEE80211AX */
1368 return conf->vht_oper_centr_freq_seg0_idx;
1369 }
1370
1371 static inline void
hostapd_set_oper_centr_freq_seg0_idx(struct hostapd_config * conf,u8 oper_centr_freq_seg0_idx)1372 hostapd_set_oper_centr_freq_seg0_idx(struct hostapd_config *conf,
1373 u8 oper_centr_freq_seg0_idx)
1374 {
1375 #ifdef CONFIG_IEEE80211BE
1376 if (conf->ieee80211be)
1377 conf->eht_oper_centr_freq_seg0_idx = oper_centr_freq_seg0_idx;
1378 if (is_6ghz_op_class(conf->op_class) &&
1379 center_idx_to_bw_6ghz(oper_centr_freq_seg0_idx) == 4)
1380 oper_centr_freq_seg0_idx +=
1381 conf->channel > oper_centr_freq_seg0_idx ? 16 : -16;
1382 #endif /* CONFIG_IEEE80211BE */
1383 #ifdef CONFIG_IEEE80211AX
1384 if (conf->ieee80211ax)
1385 conf->he_oper_centr_freq_seg0_idx = oper_centr_freq_seg0_idx;
1386 #endif /* CONFIG_IEEE80211AX */
1387 conf->vht_oper_centr_freq_seg0_idx = oper_centr_freq_seg0_idx;
1388 }
1389
1390 static inline u8
hostapd_get_oper_centr_freq_seg1_idx(struct hostapd_config * conf)1391 hostapd_get_oper_centr_freq_seg1_idx(struct hostapd_config *conf)
1392 {
1393 #ifdef CONFIG_IEEE80211AX
1394 if (conf->ieee80211ax)
1395 return conf->he_oper_centr_freq_seg1_idx;
1396 #endif /* CONFIG_IEEE80211AX */
1397 return conf->vht_oper_centr_freq_seg1_idx;
1398 }
1399
1400 static inline void
hostapd_set_oper_centr_freq_seg1_idx(struct hostapd_config * conf,u8 oper_centr_freq_seg1_idx)1401 hostapd_set_oper_centr_freq_seg1_idx(struct hostapd_config *conf,
1402 u8 oper_centr_freq_seg1_idx)
1403 {
1404 #ifdef CONFIG_IEEE80211AX
1405 if (conf->ieee80211ax)
1406 conf->he_oper_centr_freq_seg1_idx = oper_centr_freq_seg1_idx;
1407 #endif /* CONFIG_IEEE80211AX */
1408 conf->vht_oper_centr_freq_seg1_idx = oper_centr_freq_seg1_idx;
1409 }
1410
1411 static inline u8
hostapd_get_bw320_offset(struct hostapd_config * conf)1412 hostapd_get_bw320_offset(struct hostapd_config *conf)
1413 {
1414 #ifdef CONFIG_IEEE80211BE
1415 if (conf->ieee80211be && is_6ghz_op_class(conf->op_class) &&
1416 hostapd_get_oper_chwidth(conf) == CONF_OPER_CHWIDTH_320MHZ)
1417 return conf->eht_bw320_offset;
1418 #endif /* CONFIG_IEEE80211BE */
1419 return 0;
1420 }
1421
1422 static inline void
hostapd_set_and_check_bw320_offset(struct hostapd_config * conf,u8 bw320_offset)1423 hostapd_set_and_check_bw320_offset(struct hostapd_config *conf,
1424 u8 bw320_offset)
1425 {
1426 #ifdef CONFIG_IEEE80211BE
1427 if (conf->ieee80211be && is_6ghz_op_class(conf->op_class) &&
1428 op_class_to_ch_width(conf->op_class) == CONF_OPER_CHWIDTH_320MHZ) {
1429 if (conf->channel) {
1430 /* If the channel is set, then calculate bw320_offset
1431 * by center frequency segment 0.
1432 */
1433 u8 seg0 = hostapd_get_oper_centr_freq_seg0_idx(conf);
1434
1435 conf->eht_bw320_offset = (seg0 - 31) % 64 ? 2 : 1;
1436 } else {
1437 /* If the channel is not set, bw320_offset indicates
1438 * preferred offset of 320 MHz.
1439 */
1440 conf->eht_bw320_offset = bw320_offset;
1441 }
1442 } else {
1443 conf->eht_bw320_offset = 0;
1444 }
1445 #endif /* CONFIG_IEEE80211BE */
1446 }
1447
1448
1449 int hostapd_mac_comp(const void *a, const void *b);
1450 struct hostapd_config * hostapd_config_defaults(void);
1451 void hostapd_config_defaults_bss(struct hostapd_bss_config *bss);
1452 void hostapd_config_free_radius_attr(struct hostapd_radius_attr *attr);
1453 void hostapd_config_free_eap_user(struct hostapd_eap_user *user);
1454 void hostapd_config_free_eap_users(struct hostapd_eap_user *user);
1455 void hostapd_config_clear_wpa_psk(struct hostapd_wpa_psk **p);
1456 void hostapd_config_clear_rxkhs(struct hostapd_bss_config *conf);
1457 void hostapd_config_free_bss(struct hostapd_bss_config *conf);
1458 void hostapd_config_free(struct hostapd_config *conf);
1459 int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
1460 const u8 *addr, struct vlan_description *vlan_id);
1461 const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
1462 const u8 *addr, const u8 *p2p_dev_addr,
1463 const u8 *prev_psk, int *vlan_id);
1464 int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
1465 int hostapd_vlan_valid(struct hostapd_vlan *vlan,
1466 struct vlan_description *vlan_desc);
1467 const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
1468 int vlan_id);
1469 struct hostapd_radius_attr *
1470 hostapd_config_get_radius_attr(struct hostapd_radius_attr *attr, u8 type);
1471 struct hostapd_radius_attr * hostapd_parse_radius_attr(const char *value);
1472 int hostapd_config_check(struct hostapd_config *conf, int full_config);
1473 void hostapd_set_security_params(struct hostapd_bss_config *bss,
1474 int full_config);
1475 int hostapd_sae_pw_id_in_use(struct hostapd_bss_config *conf);
1476 bool hostapd_sae_pk_in_use(struct hostapd_bss_config *conf);
1477 bool hostapd_sae_pk_exclusively(struct hostapd_bss_config *conf);
1478 int hostapd_setup_sae_pt(struct hostapd_bss_config *conf);
1479 int hostapd_acl_comp(const void *a, const void *b);
1480 int hostapd_add_acl_maclist(struct mac_acl_entry **acl, int *num,
1481 int vlan_id, const u8 *addr);
1482 void hostapd_remove_acl_mac(struct mac_acl_entry **acl, int *num,
1483 const u8 *addr);
1484 bool hostapd_config_check_bss_6g(struct hostapd_bss_config *bss);
1485 void hostapd_config_free_afc_cert_ids(struct hostapd_config *conf);
1486
1487 #endif /* HOSTAPD_CONFIG_H */
1488