]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/ap/ap_config.h
Add hostapd_drv_send_action()
[thirdparty/hostap.git] / src / ap / ap_config.h
CommitLineData
6fc6879b 1/*
41d719d6 2 * hostapd / Configuration definitions and helpers functions
eb53b752 3 * Copyright (c) 2003-2009, 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
119
7e3c1781 120#define NUM_TX_QUEUES 4
6fc6879b
JM
121
122struct hostapd_tx_queue_params {
123 int aifs;
124 int cwmin;
125 int cwmax;
126 int burst; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */
6fc6879b
JM
127};
128
3ae0800c 129struct hostapd_wmm_ac_params {
6fc6879b
JM
130 int cwmin;
131 int cwmax;
132 int aifs;
3ae0800c 133 int txop_limit; /* in units of 32us */
6fc6879b
JM
134 int admission_control_mandatory;
135};
136
137
4b2a77ab
JM
138#define MAX_ROAMING_CONSORTIUM_LEN 15
139
140struct hostapd_roaming_consortium {
141 u8 len;
142 u8 oi[MAX_ROAMING_CONSORTIUM_LEN];
143};
144
6fc6879b
JM
145/**
146 * struct hostapd_bss_config - Per-BSS configuration
147 */
148struct hostapd_bss_config {
149 char iface[IFNAMSIZ + 1];
150 char bridge[IFNAMSIZ + 1];
d38ae2ea 151 char wds_bridge[IFNAMSIZ + 1];
6fc6879b
JM
152
153 enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
154
155 unsigned int logger_syslog; /* module bitfield */
156 unsigned int logger_stdout; /* module bitfield */
157
158 char *dump_log_name; /* file name for state dump (SIGUSR1) */
159
160 int max_num_sta; /* maximum number of STAs in station table */
161
162 int dtim_period;
163
164 int ieee802_1x; /* use IEEE 802.1X */
165 int eapol_version;
166 int eap_server; /* Use internal EAP server instead of external
167 * RADIUS server */
168 struct hostapd_eap_user *eap_user;
169 char *eap_sim_db;
170 struct hostapd_ip_addr own_ip_addr;
171 char *nas_identifier;
172 struct hostapd_radius_servers *radius;
5843e1c9 173 int acct_interim_interval;
6fc6879b
JM
174
175 struct hostapd_ssid ssid;
176
177 char *eap_req_id_text; /* optional displayable message sent with
178 * EAP Request-Identity */
179 size_t eap_req_id_text_len;
180 int eapol_key_index_workaround;
181
182 size_t default_wep_key_len;
183 int individual_wep_key_len;
184 int wep_rekeying_period;
185 int broadcast_key_idx_min, broadcast_key_idx_max;
186 int eap_reauth_period;
187
188 int ieee802_11f; /* use IEEE 802.11f (IAPP) */
189 char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast
190 * frames */
191
6fc6879b
JM
192 enum {
193 ACCEPT_UNLESS_DENIED = 0,
194 DENY_UNLESS_ACCEPTED = 1,
195 USE_EXTERNAL_RADIUS_AUTH = 2
196 } macaddr_acl;
271d2830 197 struct mac_acl_entry *accept_mac;
6fc6879b 198 int num_accept_mac;
271d2830 199 struct mac_acl_entry *deny_mac;
6fc6879b 200 int num_deny_mac;
fbbfcbac 201 int wds_sta;
d3b42869 202 int isolate;
6fc6879b
JM
203
204 int auth_algs; /* bitfield of allowed IEEE 802.11 authentication
205 * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */
206
207 int wpa; /* bitfield of WPA_PROTO_WPA, WPA_PROTO_RSN */
208 int wpa_key_mgmt;
209#ifdef CONFIG_IEEE80211W
c746331b 210 enum mfp_options ieee80211w;
45c94154
JM
211 /* dot11AssociationSAQueryMaximumTimeout (in TUs) */
212 unsigned int assoc_sa_query_max_timeout;
213 /* dot11AssociationSAQueryRetryTimeout (in TUs) */
214 int assoc_sa_query_retry_timeout;
6fc6879b 215#endif /* CONFIG_IEEE80211W */
05ab9712
MB
216 enum {
217 PSK_RADIUS_IGNORED = 0,
218 PSK_RADIUS_ACCEPTED = 1,
219 PSK_RADIUS_REQUIRED = 2
220 } wpa_psk_radius;
6fc6879b
JM
221 int wpa_pairwise;
222 int wpa_group;
223 int wpa_group_rekey;
224 int wpa_strict_rekey;
225 int wpa_gmk_rekey;
581a8cde 226 int wpa_ptk_rekey;
6fc6879b
JM
227 int rsn_pairwise;
228 int rsn_preauth;
229 char *rsn_preauth_interfaces;
230 int peerkey;
231
232#ifdef CONFIG_IEEE80211R
233 /* IEEE 802.11r - Fast BSS Transition */
234 u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
235 u8 r1_key_holder[FT_R1KH_ID_LEN];
236 u32 r0_key_lifetime;
237 u32 reassociation_deadline;
238 struct ft_remote_r0kh *r0kh_list;
239 struct ft_remote_r1kh *r1kh_list;
240 int pmk_r1_push;
d7956add 241 int ft_over_ds;
6fc6879b
JM
242#endif /* CONFIG_IEEE80211R */
243
244 char *ctrl_interface; /* directory for UNIX domain sockets */
08230317 245#ifndef CONFIG_NATIVE_WINDOWS
6fc6879b 246 gid_t ctrl_interface_gid;
08230317 247#endif /* CONFIG_NATIVE_WINDOWS */
6fc6879b
JM
248 int ctrl_interface_gid_set;
249
250 char *ca_cert;
251 char *server_cert;
252 char *private_key;
253 char *private_key_passwd;
254 int check_crl;
255 char *dh_file;
256 u8 *pac_opaque_encr_key;
2d867244
JM
257 u8 *eap_fast_a_id;
258 size_t eap_fast_a_id_len;
259 char *eap_fast_a_id_info;
378eae5e 260 int eap_fast_prov;
a11c90a6
JM
261 int pac_key_lifetime;
262 int pac_key_refresh_time;
6fc6879b 263 int eap_sim_aka_result_ind;
da08a7c7 264 int tnc;
7f6ec672 265 int fragment_size;
df684d82 266 u16 pwd_group;
6fc6879b
JM
267
268 char *radius_server_clients;
269 int radius_server_auth_port;
270 int radius_server_ipv6;
271
272 char *test_socket; /* UNIX domain socket path for driver_test */
273
274 int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
275 * address instead of individual address
276 * (for driver_wired.c).
277 */
278
279 int ap_max_inactivity;
280 int ignore_broadcast_ssid;
281
3ae0800c 282 int wmm_enabled;
721abef9 283 int wmm_uapsd;
6fc6879b
JM
284
285 struct hostapd_vlan *vlan, *vlan_tail;
286
287 macaddr bssid;
b0194fe0
JM
288
289 /*
290 * Maximum listen interval that STAs can use when associating with this
291 * BSS. If a STA tries to use larger value, the association will be
292 * denied with status code 51.
293 */
294 u16 max_listen_interval;
bf98f7f3 295
cb465555 296 int disable_pmksa_caching;
bf98f7f3 297 int okc; /* Opportunistic Key Caching */
ad08c363
JM
298
299 int wps_state;
300#ifdef CONFIG_WPS
301 int ap_setup_locked;
302 u8 uuid[16];
303 char *wps_pin_requests;
304 char *device_name;
305 char *manufacturer;
306 char *model_name;
307 char *model_number;
308 char *serial_number;
2f646b6e 309 u8 device_type[WPS_DEV_TYPE_LEN];
ad08c363
JM
310 char *config_methods;
311 u8 os_version[4];
312 char *ap_pin;
6fa68a0e
JM
313 int skip_cred_build;
314 u8 *extra_cred;
315 size_t extra_cred_len;
d745c7cc 316 int wps_cred_processing;
4c29cae9
JM
317 u8 *ap_settings;
318 size_t ap_settings_len;
f620268f
JM
319 char *upnp_iface;
320 char *friendly_name;
321 char *manufacturer_url;
322 char *model_description;
323 char *model_url;
324 char *upc;
4028a7fd 325 struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
ad08c363 326#endif /* CONFIG_WPS */
fa516558 327 int pbc_in_m1;
e44f8bf2
JM
328
329#define P2P_ENABLED BIT(0)
330#define P2P_GROUP_OWNER BIT(1)
331#define P2P_GROUP_FORMATION BIT(2)
962473c1
JM
332#define P2P_MANAGE BIT(3)
333#define P2P_ALLOW_CROSS_CONNECTION BIT(4)
e44f8bf2 334 int p2p;
0d7e5a3a
JB
335
336 int disassoc_low_ack;
ef01fa7b 337 int skip_inactivity_poll;
1161ff1e
JM
338
339#define TDLS_PROHIBIT BIT(0)
340#define TDLS_PROHIBIT_CHAN_SWITCH BIT(1)
341 int tdls;
f39b07d7 342 int disable_11n;
b83e3e93 343
39b97072
JM
344 /* IEEE 802.11v */
345 int time_advertisement;
346 char *time_zone;
347
b83e3e93
JM
348 /* IEEE 802.11u - Interworking */
349 int interworking;
350 int access_network_type;
351 int internet;
352 int asra;
353 int esr;
354 int uesa;
355 int venue_info_set;
356 u8 venue_group;
357 u8 venue_type;
358 u8 hessid[ETH_ALEN];
4b2a77ab
JM
359
360 /* IEEE 802.11u - Roaming Consortium list */
361 unsigned int roaming_consortium_count;
362 struct hostapd_roaming_consortium *roaming_consortium;
8e5f9134
BC
363
364 u8 wps_rf_bands; /* RF bands for WPS (WPS_RF_*) */
505a3694
JM
365
366#ifdef CONFIG_RADIUS_TEST
367 char *dump_msk_file;
368#endif /* CONFIG_RADIUS_TEST */
6fc6879b
JM
369};
370
371
6fc6879b
JM
372/**
373 * struct hostapd_config - Per-radio interface configuration
374 */
375struct hostapd_config {
376 struct hostapd_bss_config *bss, *last_bss;
6fc6879b
JM
377 size_t num_bss;
378
379 u16 beacon_int;
380 int rts_threshold;
381 int fragm_threshold;
382 u8 send_probe_response;
383 u8 channel;
71934751 384 enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
6fc6879b
JM
385 enum {
386 LONG_PREAMBLE = 0,
387 SHORT_PREAMBLE = 1
388 } preamble;
6fc6879b
JM
389
390 int *supported_rates;
391 int *basic_rates;
392
c5121837 393 const struct wpa_driver_ops *driver;
6fc6879b 394
6fc6879b
JM
395 int ap_table_max_size;
396 int ap_table_expiration_time;
397
398 char country[3]; /* first two octets: country code as described in
399 * ISO/IEC 3166-1. Third octet:
400 * ' ' (ascii 32): all environments
401 * 'O': Outdoor environemnt only
402 * 'I': Indoor environment only
403 */
404
405 int ieee80211d;
6fc6879b
JM
406
407 struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
408
409 /*
3ae0800c 410 * WMM AC parameters, in same order as 802.1D, i.e.
6fc6879b
JM
411 * 0 = BE (best effort)
412 * 1 = BK (background)
413 * 2 = VI (video)
414 * 3 = VO (voice)
415 */
3ae0800c 416 struct hostapd_wmm_ac_params wmm_ac_params[4];
6fc6879b 417
9d2a76a2
JM
418 int ht_op_mode_fixed;
419 u16 ht_capab;
cfb7e8a0 420 int ieee80211n;
95da9bbc 421 int secondary_channel;
29448243 422 int require_ht;
6fc6879b
JM
423};
424
425
426int hostapd_mac_comp(const void *a, const void *b);
427int hostapd_mac_comp_empty(const void *a);
89111f3b 428struct hostapd_config * hostapd_config_defaults(void);
41d719d6 429void hostapd_config_defaults_bss(struct hostapd_bss_config *bss);
6fc6879b 430void hostapd_config_free(struct hostapd_config *conf);
271d2830
JM
431int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
432 const u8 *addr, int *vlan_id);
6fc6879b
JM
433int hostapd_rate_found(int *list, int rate);
434int hostapd_wep_key_cmp(struct hostapd_wep_keys *a,
435 struct hostapd_wep_keys *b);
436const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
437 const u8 *addr, const u8 *prev_psk);
438int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
439const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
440 int vlan_id);
441const struct hostapd_eap_user *
442hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
443 size_t identity_len, int phase2);
444
094393b1 445#endif /* HOSTAPD_CONFIG_H */