]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/ap/ap_config.h
WPS: Move P2P extension generation for WSC IE in Beacon frames
[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
JM
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
13 */
14
094393b1
JM
15#ifndef HOSTAPD_CONFIG_H
16#define HOSTAPD_CONFIG_H
6fc6879b 17
90973fb2 18#include "common/defs.h"
6fc6879b 19#include "ip_addr.h"
90973fb2 20#include "common/wpa_common.h"
2f646b6e 21#include "wps/wps.h"
6fc6879b 22
41d719d6
JM
23#define MAX_STA_COUNT 2007
24#define MAX_VLAN_ID 4094
25
6fc6879b
JM
26typedef u8 macaddr[ETH_ALEN];
27
271d2830
JM
28struct mac_acl_entry {
29 macaddr addr;
30 int vlan_id;
31};
32
6fc6879b
JM
33struct hostapd_radius_servers;
34struct ft_remote_r0kh;
35struct ft_remote_r1kh;
36
37#define HOSTAPD_MAX_SSID_LEN 32
38
39#define NUM_WEP_KEYS 4
40struct hostapd_wep_keys {
41 u8 idx;
42 u8 *key[NUM_WEP_KEYS];
43 size_t len[NUM_WEP_KEYS];
44 int keys_set;
45 size_t default_len; /* key length used for dynamic key generation */
46};
47
48typedef enum hostap_security_policy {
49 SECURITY_PLAINTEXT = 0,
50 SECURITY_STATIC_WEP = 1,
51 SECURITY_IEEE_802_1X = 2,
52 SECURITY_WPA_PSK = 3,
53 SECURITY_WPA = 4
54} secpolicy;
55
56struct hostapd_ssid {
57 char ssid[HOSTAPD_MAX_SSID_LEN + 1];
58 size_t ssid_len;
59 int ssid_set;
60
61 char vlan[IFNAMSIZ + 1];
62 secpolicy security_policy;
63
64 struct hostapd_wpa_psk *wpa_psk;
65 char *wpa_passphrase;
66 char *wpa_psk_file;
67
68 struct hostapd_wep_keys wep;
69
70#define DYNAMIC_VLAN_DISABLED 0
71#define DYNAMIC_VLAN_OPTIONAL 1
72#define DYNAMIC_VLAN_REQUIRED 2
73 int dynamic_vlan;
74#ifdef CONFIG_FULL_DYNAMIC_VLAN
75 char *vlan_tagged_interface;
76#endif /* CONFIG_FULL_DYNAMIC_VLAN */
77 struct hostapd_wep_keys **dyn_vlan_keys;
78 size_t max_dyn_vlan_keys;
79};
80
81
82#define VLAN_ID_WILDCARD -1
83
84struct hostapd_vlan {
85 struct hostapd_vlan *next;
86 int vlan_id; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */
87 char ifname[IFNAMSIZ + 1];
88 int dynamic_vlan;
89#ifdef CONFIG_FULL_DYNAMIC_VLAN
90
91#define DVLAN_CLEAN_BR 0x1
92#define DVLAN_CLEAN_VLAN 0x2
93#define DVLAN_CLEAN_VLAN_PORT 0x4
94#define DVLAN_CLEAN_WLAN_PORT 0x8
95 int clean;
96#endif /* CONFIG_FULL_DYNAMIC_VLAN */
97};
98
99#define PMK_LEN 32
100struct hostapd_wpa_psk {
101 struct hostapd_wpa_psk *next;
102 int group;
103 u8 psk[PMK_LEN];
104 u8 addr[ETH_ALEN];
105};
106
107#define EAP_USER_MAX_METHODS 8
108struct hostapd_eap_user {
109 struct hostapd_eap_user *next;
110 u8 *identity;
111 size_t identity_len;
112 struct {
113 int vendor;
114 u32 method;
115 } methods[EAP_USER_MAX_METHODS];
116 u8 *password;
117 size_t password_len;
118 int phase2;
119 int force_version;
120 unsigned int wildcard_prefix:1;
121 unsigned int password_hash:1; /* whether password is hashed with
122 * nt_password_hash() */
123 int ttls_auth; /* EAP_TTLS_AUTH_* bitfield */
124};
125
126
7e3c1781 127#define NUM_TX_QUEUES 4
6fc6879b
JM
128
129struct hostapd_tx_queue_params {
130 int aifs;
131 int cwmin;
132 int cwmax;
133 int burst; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */
6fc6879b
JM
134};
135
3ae0800c 136struct hostapd_wmm_ac_params {
6fc6879b
JM
137 int cwmin;
138 int cwmax;
139 int aifs;
3ae0800c 140 int txop_limit; /* in units of 32us */
6fc6879b
JM
141 int admission_control_mandatory;
142};
143
144
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
JM
215#endif /* CONFIG_IEEE80211W */
216 int wpa_pairwise;
217 int wpa_group;
218 int wpa_group_rekey;
219 int wpa_strict_rekey;
220 int wpa_gmk_rekey;
581a8cde 221 int wpa_ptk_rekey;
6fc6879b
JM
222 int rsn_pairwise;
223 int rsn_preauth;
224 char *rsn_preauth_interfaces;
225 int peerkey;
226
227#ifdef CONFIG_IEEE80211R
228 /* IEEE 802.11r - Fast BSS Transition */
229 u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
230 u8 r1_key_holder[FT_R1KH_ID_LEN];
231 u32 r0_key_lifetime;
232 u32 reassociation_deadline;
233 struct ft_remote_r0kh *r0kh_list;
234 struct ft_remote_r1kh *r1kh_list;
235 int pmk_r1_push;
d7956add 236 int ft_over_ds;
6fc6879b
JM
237#endif /* CONFIG_IEEE80211R */
238
239 char *ctrl_interface; /* directory for UNIX domain sockets */
08230317 240#ifndef CONFIG_NATIVE_WINDOWS
6fc6879b 241 gid_t ctrl_interface_gid;
08230317 242#endif /* CONFIG_NATIVE_WINDOWS */
6fc6879b
JM
243 int ctrl_interface_gid_set;
244
245 char *ca_cert;
246 char *server_cert;
247 char *private_key;
248 char *private_key_passwd;
249 int check_crl;
250 char *dh_file;
251 u8 *pac_opaque_encr_key;
2d867244
JM
252 u8 *eap_fast_a_id;
253 size_t eap_fast_a_id_len;
254 char *eap_fast_a_id_info;
378eae5e 255 int eap_fast_prov;
a11c90a6
JM
256 int pac_key_lifetime;
257 int pac_key_refresh_time;
6fc6879b 258 int eap_sim_aka_result_ind;
da08a7c7 259 int tnc;
7f6ec672 260 int fragment_size;
df684d82 261 u16 pwd_group;
6fc6879b
JM
262
263 char *radius_server_clients;
264 int radius_server_auth_port;
265 int radius_server_ipv6;
266
267 char *test_socket; /* UNIX domain socket path for driver_test */
268
269 int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
270 * address instead of individual address
271 * (for driver_wired.c).
272 */
273
274 int ap_max_inactivity;
275 int ignore_broadcast_ssid;
276
3ae0800c 277 int wmm_enabled;
721abef9 278 int wmm_uapsd;
6fc6879b
JM
279
280 struct hostapd_vlan *vlan, *vlan_tail;
281
282 macaddr bssid;
b0194fe0
JM
283
284 /*
285 * Maximum listen interval that STAs can use when associating with this
286 * BSS. If a STA tries to use larger value, the association will be
287 * denied with status code 51.
288 */
289 u16 max_listen_interval;
bf98f7f3
JM
290
291 int okc; /* Opportunistic Key Caching */
ad08c363
JM
292
293 int wps_state;
294#ifdef CONFIG_WPS
295 int ap_setup_locked;
296 u8 uuid[16];
297 char *wps_pin_requests;
298 char *device_name;
299 char *manufacturer;
300 char *model_name;
301 char *model_number;
302 char *serial_number;
2f646b6e 303 u8 device_type[WPS_DEV_TYPE_LEN];
ad08c363
JM
304 char *config_methods;
305 u8 os_version[4];
306 char *ap_pin;
6fa68a0e
JM
307 int skip_cred_build;
308 u8 *extra_cred;
309 size_t extra_cred_len;
d745c7cc 310 int wps_cred_processing;
4c29cae9
JM
311 u8 *ap_settings;
312 size_t ap_settings_len;
f620268f
JM
313 char *upnp_iface;
314 char *friendly_name;
315 char *manufacturer_url;
316 char *model_description;
317 char *model_url;
318 char *upc;
ad08c363 319#endif /* CONFIG_WPS */
e44f8bf2
JM
320
321#define P2P_ENABLED BIT(0)
322#define P2P_GROUP_OWNER BIT(1)
323#define P2P_GROUP_FORMATION BIT(2)
962473c1
JM
324#define P2P_MANAGE BIT(3)
325#define P2P_ALLOW_CROSS_CONNECTION BIT(4)
e44f8bf2 326 int p2p;
0d7e5a3a
JB
327
328 int disassoc_low_ack;
1161ff1e
JM
329
330#define TDLS_PROHIBIT BIT(0)
331#define TDLS_PROHIBIT_CHAN_SWITCH BIT(1)
332 int tdls;
f39b07d7 333 int disable_11n;
6fc6879b
JM
334};
335
336
6fc6879b
JM
337/**
338 * struct hostapd_config - Per-radio interface configuration
339 */
340struct hostapd_config {
341 struct hostapd_bss_config *bss, *last_bss;
6fc6879b
JM
342 size_t num_bss;
343
344 u16 beacon_int;
345 int rts_threshold;
346 int fragm_threshold;
347 u8 send_probe_response;
348 u8 channel;
71934751 349 enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
6fc6879b
JM
350 enum {
351 LONG_PREAMBLE = 0,
352 SHORT_PREAMBLE = 1
353 } preamble;
354 enum {
355 CTS_PROTECTION_AUTOMATIC = 0,
356 CTS_PROTECTION_FORCE_ENABLED = 1,
357 CTS_PROTECTION_FORCE_DISABLED = 2,
358 CTS_PROTECTION_AUTOMATIC_NO_OLBC = 3,
359 } cts_protection_type;
360
361 int *supported_rates;
362 int *basic_rates;
363
c5121837 364 const struct wpa_driver_ops *driver;
6fc6879b 365
6fc6879b
JM
366 int ap_table_max_size;
367 int ap_table_expiration_time;
368
369 char country[3]; /* first two octets: country code as described in
370 * ISO/IEC 3166-1. Third octet:
371 * ' ' (ascii 32): all environments
372 * 'O': Outdoor environemnt only
373 * 'I': Indoor environment only
374 */
375
376 int ieee80211d;
6fc6879b
JM
377
378 struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
379
380 /*
3ae0800c 381 * WMM AC parameters, in same order as 802.1D, i.e.
6fc6879b
JM
382 * 0 = BE (best effort)
383 * 1 = BK (background)
384 * 2 = VI (video)
385 * 3 = VO (voice)
386 */
3ae0800c 387 struct hostapd_wmm_ac_params wmm_ac_params[4];
6fc6879b 388
9d2a76a2
JM
389 int ht_op_mode_fixed;
390 u16 ht_capab;
cfb7e8a0 391 int ieee80211n;
95da9bbc 392 int secondary_channel;
29448243 393 int require_ht;
6fc6879b
JM
394};
395
396
397int hostapd_mac_comp(const void *a, const void *b);
398int hostapd_mac_comp_empty(const void *a);
89111f3b 399struct hostapd_config * hostapd_config_defaults(void);
41d719d6 400void hostapd_config_defaults_bss(struct hostapd_bss_config *bss);
6fc6879b 401void hostapd_config_free(struct hostapd_config *conf);
271d2830
JM
402int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
403 const u8 *addr, int *vlan_id);
6fc6879b
JM
404int hostapd_rate_found(int *list, int rate);
405int hostapd_wep_key_cmp(struct hostapd_wep_keys *a,
406 struct hostapd_wep_keys *b);
407const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
408 const u8 *addr, const u8 *prev_psk);
409int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
410const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
411 int vlan_id);
412const struct hostapd_eap_user *
413hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
414 size_t identity_len, int phase2);
415
094393b1 416#endif /* HOSTAPD_CONFIG_H */