]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/ap/ap_config.h
Interworking: Add Domain Name element (AP)
[thirdparty/hostap.git] / src / ap / ap_config.h
CommitLineData
6fc6879b 1/*
41d719d6 2 * hostapd / Configuration definitions and helpers functions
86f6053a 3 * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
6fc6879b 4 *
0f3d578e
JM
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
6fc6879b
JM
7 */
8
094393b1
JM
9#ifndef HOSTAPD_CONFIG_H
10#define HOSTAPD_CONFIG_H
6fc6879b 11
90973fb2 12#include "common/defs.h"
6fc6879b 13#include "ip_addr.h"
90973fb2 14#include "common/wpa_common.h"
2f646b6e 15#include "wps/wps.h"
6fc6879b 16
41d719d6
JM
17#define MAX_STA_COUNT 2007
18#define MAX_VLAN_ID 4094
19
6fc6879b
JM
20typedef u8 macaddr[ETH_ALEN];
21
271d2830
JM
22struct mac_acl_entry {
23 macaddr addr;
24 int vlan_id;
25};
26
6fc6879b
JM
27struct hostapd_radius_servers;
28struct ft_remote_r0kh;
29struct ft_remote_r1kh;
30
31#define HOSTAPD_MAX_SSID_LEN 32
32
33#define NUM_WEP_KEYS 4
34struct hostapd_wep_keys {
35 u8 idx;
36 u8 *key[NUM_WEP_KEYS];
37 size_t len[NUM_WEP_KEYS];
38 int keys_set;
39 size_t default_len; /* key length used for dynamic key generation */
40};
41
42typedef enum hostap_security_policy {
43 SECURITY_PLAINTEXT = 0,
44 SECURITY_STATIC_WEP = 1,
45 SECURITY_IEEE_802_1X = 2,
46 SECURITY_WPA_PSK = 3,
47 SECURITY_WPA = 4
48} secpolicy;
49
50struct hostapd_ssid {
51 char ssid[HOSTAPD_MAX_SSID_LEN + 1];
52 size_t ssid_len;
53 int ssid_set;
54
55 char vlan[IFNAMSIZ + 1];
56 secpolicy security_policy;
57
58 struct hostapd_wpa_psk *wpa_psk;
59 char *wpa_passphrase;
60 char *wpa_psk_file;
61
62 struct hostapd_wep_keys wep;
63
64#define DYNAMIC_VLAN_DISABLED 0
65#define DYNAMIC_VLAN_OPTIONAL 1
66#define DYNAMIC_VLAN_REQUIRED 2
67 int dynamic_vlan;
68#ifdef CONFIG_FULL_DYNAMIC_VLAN
69 char *vlan_tagged_interface;
70#endif /* CONFIG_FULL_DYNAMIC_VLAN */
71 struct hostapd_wep_keys **dyn_vlan_keys;
72 size_t max_dyn_vlan_keys;
73};
74
75
76#define VLAN_ID_WILDCARD -1
77
78struct hostapd_vlan {
79 struct hostapd_vlan *next;
80 int vlan_id; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */
81 char ifname[IFNAMSIZ + 1];
82 int dynamic_vlan;
83#ifdef CONFIG_FULL_DYNAMIC_VLAN
84
85#define DVLAN_CLEAN_BR 0x1
86#define DVLAN_CLEAN_VLAN 0x2
87#define DVLAN_CLEAN_VLAN_PORT 0x4
88#define DVLAN_CLEAN_WLAN_PORT 0x8
89 int clean;
90#endif /* CONFIG_FULL_DYNAMIC_VLAN */
91};
92
93#define PMK_LEN 32
94struct hostapd_wpa_psk {
95 struct hostapd_wpa_psk *next;
96 int group;
97 u8 psk[PMK_LEN];
98 u8 addr[ETH_ALEN];
99};
100
6fc6879b
JM
101struct hostapd_eap_user {
102 struct hostapd_eap_user *next;
103 u8 *identity;
104 size_t identity_len;
105 struct {
106 int vendor;
107 u32 method;
e9447a94 108 } methods[EAP_MAX_METHODS];
6fc6879b
JM
109 u8 *password;
110 size_t password_len;
111 int phase2;
112 int force_version;
113 unsigned int wildcard_prefix:1;
114 unsigned int password_hash:1; /* whether password is hashed with
115 * nt_password_hash() */
116 int ttls_auth; /* EAP_TTLS_AUTH_* bitfield */
117};
118
af35e7af
JM
119struct hostapd_radius_attr {
120 u8 type;
121 struct wpabuf *val;
122 struct hostapd_radius_attr *next;
123};
124
6fc6879b 125
7e3c1781 126#define NUM_TX_QUEUES 4
6fc6879b
JM
127
128struct hostapd_tx_queue_params {
129 int aifs;
130 int cwmin;
131 int cwmax;
132 int burst; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */
6fc6879b
JM
133};
134
3ae0800c 135struct hostapd_wmm_ac_params {
6fc6879b
JM
136 int cwmin;
137 int cwmax;
138 int aifs;
3ae0800c 139 int txop_limit; /* in units of 32us */
6fc6879b
JM
140 int admission_control_mandatory;
141};
142
143
4b2a77ab
JM
144#define MAX_ROAMING_CONSORTIUM_LEN 15
145
146struct hostapd_roaming_consortium {
147 u8 len;
148 u8 oi[MAX_ROAMING_CONSORTIUM_LEN];
149};
150
648cc711
JM
151struct hostapd_venue_name {
152 u8 lang[3];
153 u8 name_len;
154 u8 name[252];
155};
156
6fc6879b
JM
157/**
158 * struct hostapd_bss_config - Per-BSS configuration
159 */
160struct hostapd_bss_config {
161 char iface[IFNAMSIZ + 1];
162 char bridge[IFNAMSIZ + 1];
d38ae2ea 163 char wds_bridge[IFNAMSIZ + 1];
6fc6879b
JM
164
165 enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
166
167 unsigned int logger_syslog; /* module bitfield */
168 unsigned int logger_stdout; /* module bitfield */
169
170 char *dump_log_name; /* file name for state dump (SIGUSR1) */
171
172 int max_num_sta; /* maximum number of STAs in station table */
173
174 int dtim_period;
175
176 int ieee802_1x; /* use IEEE 802.1X */
177 int eapol_version;
178 int eap_server; /* Use internal EAP server instead of external
179 * RADIUS server */
180 struct hostapd_eap_user *eap_user;
181 char *eap_sim_db;
182 struct hostapd_ip_addr own_ip_addr;
183 char *nas_identifier;
184 struct hostapd_radius_servers *radius;
5843e1c9 185 int acct_interim_interval;
86f6053a 186 int radius_request_cui;
af35e7af
JM
187 struct hostapd_radius_attr *radius_auth_req_attr;
188 struct hostapd_radius_attr *radius_acct_req_attr;
b031338c 189 int radius_das_port;
bde7ba6c
JM
190 unsigned int radius_das_time_window;
191 int radius_das_require_event_timestamp;
b031338c
JM
192 struct hostapd_ip_addr radius_das_client_addr;
193 u8 *radius_das_shared_secret;
194 size_t radius_das_shared_secret_len;
6fc6879b
JM
195
196 struct hostapd_ssid ssid;
197
198 char *eap_req_id_text; /* optional displayable message sent with
199 * EAP Request-Identity */
200 size_t eap_req_id_text_len;
201 int eapol_key_index_workaround;
202
203 size_t default_wep_key_len;
204 int individual_wep_key_len;
205 int wep_rekeying_period;
206 int broadcast_key_idx_min, broadcast_key_idx_max;
207 int eap_reauth_period;
208
209 int ieee802_11f; /* use IEEE 802.11f (IAPP) */
210 char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast
211 * frames */
212
6fc6879b
JM
213 enum {
214 ACCEPT_UNLESS_DENIED = 0,
215 DENY_UNLESS_ACCEPTED = 1,
216 USE_EXTERNAL_RADIUS_AUTH = 2
217 } macaddr_acl;
271d2830 218 struct mac_acl_entry *accept_mac;
6fc6879b 219 int num_accept_mac;
271d2830 220 struct mac_acl_entry *deny_mac;
6fc6879b 221 int num_deny_mac;
fbbfcbac 222 int wds_sta;
d3b42869 223 int isolate;
6fc6879b
JM
224
225 int auth_algs; /* bitfield of allowed IEEE 802.11 authentication
226 * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */
227
228 int wpa; /* bitfield of WPA_PROTO_WPA, WPA_PROTO_RSN */
229 int wpa_key_mgmt;
230#ifdef CONFIG_IEEE80211W
c746331b 231 enum mfp_options ieee80211w;
45c94154
JM
232 /* dot11AssociationSAQueryMaximumTimeout (in TUs) */
233 unsigned int assoc_sa_query_max_timeout;
234 /* dot11AssociationSAQueryRetryTimeout (in TUs) */
235 int assoc_sa_query_retry_timeout;
6fc6879b 236#endif /* CONFIG_IEEE80211W */
05ab9712
MB
237 enum {
238 PSK_RADIUS_IGNORED = 0,
239 PSK_RADIUS_ACCEPTED = 1,
240 PSK_RADIUS_REQUIRED = 2
241 } wpa_psk_radius;
6fc6879b
JM
242 int wpa_pairwise;
243 int wpa_group;
244 int wpa_group_rekey;
245 int wpa_strict_rekey;
246 int wpa_gmk_rekey;
581a8cde 247 int wpa_ptk_rekey;
6fc6879b
JM
248 int rsn_pairwise;
249 int rsn_preauth;
250 char *rsn_preauth_interfaces;
251 int peerkey;
252
253#ifdef CONFIG_IEEE80211R
254 /* IEEE 802.11r - Fast BSS Transition */
255 u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
256 u8 r1_key_holder[FT_R1KH_ID_LEN];
257 u32 r0_key_lifetime;
258 u32 reassociation_deadline;
259 struct ft_remote_r0kh *r0kh_list;
260 struct ft_remote_r1kh *r1kh_list;
261 int pmk_r1_push;
d7956add 262 int ft_over_ds;
6fc6879b
JM
263#endif /* CONFIG_IEEE80211R */
264
265 char *ctrl_interface; /* directory for UNIX domain sockets */
08230317 266#ifndef CONFIG_NATIVE_WINDOWS
6fc6879b 267 gid_t ctrl_interface_gid;
08230317 268#endif /* CONFIG_NATIVE_WINDOWS */
6fc6879b
JM
269 int ctrl_interface_gid_set;
270
271 char *ca_cert;
272 char *server_cert;
273 char *private_key;
274 char *private_key_passwd;
275 int check_crl;
276 char *dh_file;
277 u8 *pac_opaque_encr_key;
2d867244
JM
278 u8 *eap_fast_a_id;
279 size_t eap_fast_a_id_len;
280 char *eap_fast_a_id_info;
378eae5e 281 int eap_fast_prov;
a11c90a6
JM
282 int pac_key_lifetime;
283 int pac_key_refresh_time;
6fc6879b 284 int eap_sim_aka_result_ind;
da08a7c7 285 int tnc;
7f6ec672 286 int fragment_size;
df684d82 287 u16 pwd_group;
6fc6879b
JM
288
289 char *radius_server_clients;
290 int radius_server_auth_port;
291 int radius_server_ipv6;
292
293 char *test_socket; /* UNIX domain socket path for driver_test */
294
295 int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
296 * address instead of individual address
297 * (for driver_wired.c).
298 */
299
300 int ap_max_inactivity;
301 int ignore_broadcast_ssid;
302
3ae0800c 303 int wmm_enabled;
721abef9 304 int wmm_uapsd;
6fc6879b
JM
305
306 struct hostapd_vlan *vlan, *vlan_tail;
307
308 macaddr bssid;
b0194fe0
JM
309
310 /*
311 * Maximum listen interval that STAs can use when associating with this
312 * BSS. If a STA tries to use larger value, the association will be
313 * denied with status code 51.
314 */
315 u16 max_listen_interval;
bf98f7f3 316
cb465555 317 int disable_pmksa_caching;
bf98f7f3 318 int okc; /* Opportunistic Key Caching */
ad08c363
JM
319
320 int wps_state;
321#ifdef CONFIG_WPS
322 int ap_setup_locked;
323 u8 uuid[16];
324 char *wps_pin_requests;
325 char *device_name;
326 char *manufacturer;
327 char *model_name;
328 char *model_number;
329 char *serial_number;
2f646b6e 330 u8 device_type[WPS_DEV_TYPE_LEN];
ad08c363
JM
331 char *config_methods;
332 u8 os_version[4];
333 char *ap_pin;
6fa68a0e
JM
334 int skip_cred_build;
335 u8 *extra_cred;
336 size_t extra_cred_len;
d745c7cc 337 int wps_cred_processing;
4c29cae9
JM
338 u8 *ap_settings;
339 size_t ap_settings_len;
f620268f
JM
340 char *upnp_iface;
341 char *friendly_name;
342 char *manufacturer_url;
343 char *model_description;
344 char *model_url;
345 char *upc;
4028a7fd 346 struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
ffdaa05a
JM
347 int wps_nfc_dev_pw_id;
348 struct wpabuf *wps_nfc_dh_pubkey;
349 struct wpabuf *wps_nfc_dh_privkey;
350 struct wpabuf *wps_nfc_dev_pw;
ad08c363 351#endif /* CONFIG_WPS */
fa516558 352 int pbc_in_m1;
e44f8bf2
JM
353
354#define P2P_ENABLED BIT(0)
355#define P2P_GROUP_OWNER BIT(1)
356#define P2P_GROUP_FORMATION BIT(2)
962473c1
JM
357#define P2P_MANAGE BIT(3)
358#define P2P_ALLOW_CROSS_CONNECTION BIT(4)
e44f8bf2 359 int p2p;
0d7e5a3a
JB
360
361 int disassoc_low_ack;
ef01fa7b 362 int skip_inactivity_poll;
1161ff1e
JM
363
364#define TDLS_PROHIBIT BIT(0)
365#define TDLS_PROHIBIT_CHAN_SWITCH BIT(1)
366 int tdls;
f39b07d7 367 int disable_11n;
efe45d14 368 int disable_11ac;
b83e3e93 369
39b97072
JM
370 /* IEEE 802.11v */
371 int time_advertisement;
372 char *time_zone;
373
b83e3e93
JM
374 /* IEEE 802.11u - Interworking */
375 int interworking;
376 int access_network_type;
377 int internet;
378 int asra;
379 int esr;
380 int uesa;
381 int venue_info_set;
382 u8 venue_group;
383 u8 venue_type;
384 u8 hessid[ETH_ALEN];
4b2a77ab
JM
385
386 /* IEEE 802.11u - Roaming Consortium list */
387 unsigned int roaming_consortium_count;
388 struct hostapd_roaming_consortium *roaming_consortium;
8e5f9134 389
648cc711
JM
390 /* IEEE 802.11u - Venue Name duples */
391 unsigned int venue_name_count;
392 struct hostapd_venue_name *venue_name;
393
550a3958
JK
394 /* IEEE 802.11u - Network Authentication Type */
395 u8 *network_auth_type;
396 size_t network_auth_type_len;
397
78bda93e
JK
398 /* IEEE 802.11u - IP Address Type Availability */
399 u8 ipaddr_type_availability;
400 u8 ipaddr_type_configured;
401
26fac8b6
JK
402 /* IEEE 802.11u - Domain Name */
403 u8 *domain_name;
404 size_t domain_name_len;
405
dca30c3f
JK
406 u16 gas_comeback_delay;
407 int gas_frag_limit;
408
159c89ab
JK
409#ifdef CONFIG_HS20
410 int hs20;
83421850 411 int disable_dgaf;
159c89ab
JK
412#endif /* CONFIG_HS20 */
413
8e5f9134 414 u8 wps_rf_bands; /* RF bands for WPS (WPS_RF_*) */
505a3694
JM
415
416#ifdef CONFIG_RADIUS_TEST
417 char *dump_msk_file;
418#endif /* CONFIG_RADIUS_TEST */
6fc6879b
JM
419};
420
421
6fc6879b
JM
422/**
423 * struct hostapd_config - Per-radio interface configuration
424 */
425struct hostapd_config {
426 struct hostapd_bss_config *bss, *last_bss;
6fc6879b
JM
427 size_t num_bss;
428
429 u16 beacon_int;
430 int rts_threshold;
431 int fragm_threshold;
432 u8 send_probe_response;
433 u8 channel;
71934751 434 enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
6fc6879b
JM
435 enum {
436 LONG_PREAMBLE = 0,
437 SHORT_PREAMBLE = 1
438 } preamble;
6fc6879b
JM
439
440 int *supported_rates;
441 int *basic_rates;
442
c5121837 443 const struct wpa_driver_ops *driver;
6fc6879b 444
6fc6879b
JM
445 int ap_table_max_size;
446 int ap_table_expiration_time;
447
448 char country[3]; /* first two octets: country code as described in
449 * ISO/IEC 3166-1. Third octet:
450 * ' ' (ascii 32): all environments
451 * 'O': Outdoor environemnt only
452 * 'I': Indoor environment only
453 */
454
455 int ieee80211d;
6fc6879b
JM
456
457 struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
458
459 /*
3ae0800c 460 * WMM AC parameters, in same order as 802.1D, i.e.
6fc6879b
JM
461 * 0 = BE (best effort)
462 * 1 = BK (background)
463 * 2 = VI (video)
464 * 3 = VO (voice)
465 */
3ae0800c 466 struct hostapd_wmm_ac_params wmm_ac_params[4];
6fc6879b 467
9d2a76a2
JM
468 int ht_op_mode_fixed;
469 u16 ht_capab;
cfb7e8a0 470 int ieee80211n;
95da9bbc 471 int secondary_channel;
29448243 472 int require_ht;
efe45d14
MP
473 u32 vht_capab;
474 int ieee80211ac;
475 u8 vht_oper_chwidth;
6fc6879b
JM
476};
477
478
479int hostapd_mac_comp(const void *a, const void *b);
480int hostapd_mac_comp_empty(const void *a);
89111f3b 481struct hostapd_config * hostapd_config_defaults(void);
41d719d6 482void hostapd_config_defaults_bss(struct hostapd_bss_config *bss);
6fc6879b 483void hostapd_config_free(struct hostapd_config *conf);
271d2830
JM
484int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
485 const u8 *addr, int *vlan_id);
6fc6879b
JM
486int hostapd_rate_found(int *list, int rate);
487int hostapd_wep_key_cmp(struct hostapd_wep_keys *a,
488 struct hostapd_wep_keys *b);
489const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
490 const u8 *addr, const u8 *prev_psk);
491int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
492const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
493 int vlan_id);
494const struct hostapd_eap_user *
495hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
496 size_t identity_len, int phase2);
af35e7af
JM
497struct hostapd_radius_attr *
498hostapd_config_get_radius_attr(struct hostapd_radius_attr *attr, u8 type);
6fc6879b 499
094393b1 500#endif /* HOSTAPD_CONFIG_H */