]>
Commit | Line | Data |
---|---|---|
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" |
6fc6879b | 21 | |
41d719d6 JM |
22 | #define MAX_STA_COUNT 2007 |
23 | #define MAX_VLAN_ID 4094 | |
24 | ||
6fc6879b JM |
25 | typedef u8 macaddr[ETH_ALEN]; |
26 | ||
271d2830 JM |
27 | struct mac_acl_entry { |
28 | macaddr addr; | |
29 | int vlan_id; | |
30 | }; | |
31 | ||
6fc6879b JM |
32 | struct hostapd_radius_servers; |
33 | struct ft_remote_r0kh; | |
34 | struct ft_remote_r1kh; | |
35 | ||
36 | #define HOSTAPD_MAX_SSID_LEN 32 | |
37 | ||
38 | #define NUM_WEP_KEYS 4 | |
39 | struct hostapd_wep_keys { | |
40 | u8 idx; | |
41 | u8 *key[NUM_WEP_KEYS]; | |
42 | size_t len[NUM_WEP_KEYS]; | |
43 | int keys_set; | |
44 | size_t default_len; /* key length used for dynamic key generation */ | |
45 | }; | |
46 | ||
47 | typedef enum hostap_security_policy { | |
48 | SECURITY_PLAINTEXT = 0, | |
49 | SECURITY_STATIC_WEP = 1, | |
50 | SECURITY_IEEE_802_1X = 2, | |
51 | SECURITY_WPA_PSK = 3, | |
52 | SECURITY_WPA = 4 | |
53 | } secpolicy; | |
54 | ||
55 | struct hostapd_ssid { | |
56 | char ssid[HOSTAPD_MAX_SSID_LEN + 1]; | |
57 | size_t ssid_len; | |
58 | int ssid_set; | |
59 | ||
60 | char vlan[IFNAMSIZ + 1]; | |
61 | secpolicy security_policy; | |
62 | ||
63 | struct hostapd_wpa_psk *wpa_psk; | |
64 | char *wpa_passphrase; | |
65 | char *wpa_psk_file; | |
66 | ||
67 | struct hostapd_wep_keys wep; | |
68 | ||
69 | #define DYNAMIC_VLAN_DISABLED 0 | |
70 | #define DYNAMIC_VLAN_OPTIONAL 1 | |
71 | #define DYNAMIC_VLAN_REQUIRED 2 | |
72 | int dynamic_vlan; | |
73 | #ifdef CONFIG_FULL_DYNAMIC_VLAN | |
74 | char *vlan_tagged_interface; | |
75 | #endif /* CONFIG_FULL_DYNAMIC_VLAN */ | |
76 | struct hostapd_wep_keys **dyn_vlan_keys; | |
77 | size_t max_dyn_vlan_keys; | |
78 | }; | |
79 | ||
80 | ||
81 | #define VLAN_ID_WILDCARD -1 | |
82 | ||
83 | struct hostapd_vlan { | |
84 | struct hostapd_vlan *next; | |
85 | int vlan_id; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */ | |
86 | char ifname[IFNAMSIZ + 1]; | |
87 | int dynamic_vlan; | |
88 | #ifdef CONFIG_FULL_DYNAMIC_VLAN | |
89 | ||
90 | #define DVLAN_CLEAN_BR 0x1 | |
91 | #define DVLAN_CLEAN_VLAN 0x2 | |
92 | #define DVLAN_CLEAN_VLAN_PORT 0x4 | |
93 | #define DVLAN_CLEAN_WLAN_PORT 0x8 | |
94 | int clean; | |
95 | #endif /* CONFIG_FULL_DYNAMIC_VLAN */ | |
96 | }; | |
97 | ||
98 | #define PMK_LEN 32 | |
99 | struct hostapd_wpa_psk { | |
100 | struct hostapd_wpa_psk *next; | |
101 | int group; | |
102 | u8 psk[PMK_LEN]; | |
103 | u8 addr[ETH_ALEN]; | |
104 | }; | |
105 | ||
106 | #define EAP_USER_MAX_METHODS 8 | |
107 | struct hostapd_eap_user { | |
108 | struct hostapd_eap_user *next; | |
109 | u8 *identity; | |
110 | size_t identity_len; | |
111 | struct { | |
112 | int vendor; | |
113 | u32 method; | |
114 | } methods[EAP_USER_MAX_METHODS]; | |
115 | u8 *password; | |
116 | size_t password_len; | |
117 | int phase2; | |
118 | int force_version; | |
119 | unsigned int wildcard_prefix:1; | |
120 | unsigned int password_hash:1; /* whether password is hashed with | |
121 | * nt_password_hash() */ | |
122 | int ttls_auth; /* EAP_TTLS_AUTH_* bitfield */ | |
123 | }; | |
124 | ||
125 | ||
126 | #define NUM_TX_QUEUES 8 | |
127 | ||
128 | struct 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 */ | |
133 | int configured; | |
134 | }; | |
135 | ||
3ae0800c | 136 | struct 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 | */ | |
148 | struct hostapd_bss_config { | |
149 | char iface[IFNAMSIZ + 1]; | |
150 | char bridge[IFNAMSIZ + 1]; | |
151 | ||
152 | enum hostapd_logger_level logger_syslog_level, logger_stdout_level; | |
153 | ||
154 | unsigned int logger_syslog; /* module bitfield */ | |
155 | unsigned int logger_stdout; /* module bitfield */ | |
156 | ||
157 | char *dump_log_name; /* file name for state dump (SIGUSR1) */ | |
158 | ||
159 | int max_num_sta; /* maximum number of STAs in station table */ | |
160 | ||
161 | int dtim_period; | |
162 | ||
163 | int ieee802_1x; /* use IEEE 802.1X */ | |
164 | int eapol_version; | |
165 | int eap_server; /* Use internal EAP server instead of external | |
166 | * RADIUS server */ | |
167 | struct hostapd_eap_user *eap_user; | |
168 | char *eap_sim_db; | |
169 | struct hostapd_ip_addr own_ip_addr; | |
170 | char *nas_identifier; | |
171 | struct hostapd_radius_servers *radius; | |
5843e1c9 | 172 | int acct_interim_interval; |
6fc6879b JM |
173 | |
174 | struct hostapd_ssid ssid; | |
175 | ||
176 | char *eap_req_id_text; /* optional displayable message sent with | |
177 | * EAP Request-Identity */ | |
178 | size_t eap_req_id_text_len; | |
179 | int eapol_key_index_workaround; | |
180 | ||
181 | size_t default_wep_key_len; | |
182 | int individual_wep_key_len; | |
183 | int wep_rekeying_period; | |
184 | int broadcast_key_idx_min, broadcast_key_idx_max; | |
185 | int eap_reauth_period; | |
186 | ||
187 | int ieee802_11f; /* use IEEE 802.11f (IAPP) */ | |
188 | char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast | |
189 | * frames */ | |
190 | ||
6fc6879b JM |
191 | enum { |
192 | ACCEPT_UNLESS_DENIED = 0, | |
193 | DENY_UNLESS_ACCEPTED = 1, | |
194 | USE_EXTERNAL_RADIUS_AUTH = 2 | |
195 | } macaddr_acl; | |
271d2830 | 196 | struct mac_acl_entry *accept_mac; |
6fc6879b | 197 | int num_accept_mac; |
271d2830 | 198 | struct mac_acl_entry *deny_mac; |
6fc6879b | 199 | int num_deny_mac; |
fbbfcbac | 200 | int wds_sta; |
6fc6879b JM |
201 | |
202 | int auth_algs; /* bitfield of allowed IEEE 802.11 authentication | |
203 | * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */ | |
204 | ||
205 | int wpa; /* bitfield of WPA_PROTO_WPA, WPA_PROTO_RSN */ | |
206 | int wpa_key_mgmt; | |
207 | #ifdef CONFIG_IEEE80211W | |
c746331b | 208 | enum mfp_options ieee80211w; |
45c94154 JM |
209 | /* dot11AssociationSAQueryMaximumTimeout (in TUs) */ |
210 | unsigned int assoc_sa_query_max_timeout; | |
211 | /* dot11AssociationSAQueryRetryTimeout (in TUs) */ | |
212 | int assoc_sa_query_retry_timeout; | |
6fc6879b JM |
213 | #endif /* CONFIG_IEEE80211W */ |
214 | int wpa_pairwise; | |
215 | int wpa_group; | |
216 | int wpa_group_rekey; | |
217 | int wpa_strict_rekey; | |
218 | int wpa_gmk_rekey; | |
581a8cde | 219 | int wpa_ptk_rekey; |
6fc6879b JM |
220 | int rsn_pairwise; |
221 | int rsn_preauth; | |
222 | char *rsn_preauth_interfaces; | |
223 | int peerkey; | |
224 | ||
225 | #ifdef CONFIG_IEEE80211R | |
226 | /* IEEE 802.11r - Fast BSS Transition */ | |
227 | u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN]; | |
228 | u8 r1_key_holder[FT_R1KH_ID_LEN]; | |
229 | u32 r0_key_lifetime; | |
230 | u32 reassociation_deadline; | |
231 | struct ft_remote_r0kh *r0kh_list; | |
232 | struct ft_remote_r1kh *r1kh_list; | |
233 | int pmk_r1_push; | |
234 | #endif /* CONFIG_IEEE80211R */ | |
235 | ||
236 | char *ctrl_interface; /* directory for UNIX domain sockets */ | |
237 | gid_t ctrl_interface_gid; | |
238 | int ctrl_interface_gid_set; | |
239 | ||
240 | char *ca_cert; | |
241 | char *server_cert; | |
242 | char *private_key; | |
243 | char *private_key_passwd; | |
244 | int check_crl; | |
245 | char *dh_file; | |
246 | u8 *pac_opaque_encr_key; | |
2d867244 JM |
247 | u8 *eap_fast_a_id; |
248 | size_t eap_fast_a_id_len; | |
249 | char *eap_fast_a_id_info; | |
378eae5e | 250 | int eap_fast_prov; |
a11c90a6 JM |
251 | int pac_key_lifetime; |
252 | int pac_key_refresh_time; | |
6fc6879b | 253 | int eap_sim_aka_result_ind; |
da08a7c7 | 254 | int tnc; |
6fc6879b JM |
255 | |
256 | char *radius_server_clients; | |
257 | int radius_server_auth_port; | |
258 | int radius_server_ipv6; | |
259 | ||
260 | char *test_socket; /* UNIX domain socket path for driver_test */ | |
261 | ||
262 | int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group | |
263 | * address instead of individual address | |
264 | * (for driver_wired.c). | |
265 | */ | |
266 | ||
267 | int ap_max_inactivity; | |
268 | int ignore_broadcast_ssid; | |
269 | ||
3ae0800c | 270 | int wmm_enabled; |
6fc6879b JM |
271 | |
272 | struct hostapd_vlan *vlan, *vlan_tail; | |
273 | ||
274 | macaddr bssid; | |
b0194fe0 JM |
275 | |
276 | /* | |
277 | * Maximum listen interval that STAs can use when associating with this | |
278 | * BSS. If a STA tries to use larger value, the association will be | |
279 | * denied with status code 51. | |
280 | */ | |
281 | u16 max_listen_interval; | |
bf98f7f3 JM |
282 | |
283 | int okc; /* Opportunistic Key Caching */ | |
ad08c363 JM |
284 | |
285 | int wps_state; | |
286 | #ifdef CONFIG_WPS | |
287 | int ap_setup_locked; | |
288 | u8 uuid[16]; | |
289 | char *wps_pin_requests; | |
290 | char *device_name; | |
291 | char *manufacturer; | |
292 | char *model_name; | |
293 | char *model_number; | |
294 | char *serial_number; | |
295 | char *device_type; | |
296 | char *config_methods; | |
297 | u8 os_version[4]; | |
298 | char *ap_pin; | |
6fa68a0e JM |
299 | int skip_cred_build; |
300 | u8 *extra_cred; | |
301 | size_t extra_cred_len; | |
d745c7cc | 302 | int wps_cred_processing; |
4c29cae9 JM |
303 | u8 *ap_settings; |
304 | size_t ap_settings_len; | |
f620268f JM |
305 | char *upnp_iface; |
306 | char *friendly_name; | |
307 | char *manufacturer_url; | |
308 | char *model_description; | |
309 | char *model_url; | |
310 | char *upc; | |
ad08c363 | 311 | #endif /* CONFIG_WPS */ |
6fc6879b JM |
312 | }; |
313 | ||
314 | ||
6fc6879b JM |
315 | /** |
316 | * struct hostapd_config - Per-radio interface configuration | |
317 | */ | |
318 | struct hostapd_config { | |
319 | struct hostapd_bss_config *bss, *last_bss; | |
6fc6879b JM |
320 | size_t num_bss; |
321 | ||
322 | u16 beacon_int; | |
323 | int rts_threshold; | |
324 | int fragm_threshold; | |
325 | u8 send_probe_response; | |
326 | u8 channel; | |
327 | hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */ | |
328 | enum { | |
329 | LONG_PREAMBLE = 0, | |
330 | SHORT_PREAMBLE = 1 | |
331 | } preamble; | |
332 | enum { | |
333 | CTS_PROTECTION_AUTOMATIC = 0, | |
334 | CTS_PROTECTION_FORCE_ENABLED = 1, | |
335 | CTS_PROTECTION_FORCE_DISABLED = 2, | |
336 | CTS_PROTECTION_AUTOMATIC_NO_OLBC = 3, | |
337 | } cts_protection_type; | |
338 | ||
339 | int *supported_rates; | |
340 | int *basic_rates; | |
341 | ||
c5121837 | 342 | const struct wpa_driver_ops *driver; |
6fc6879b | 343 | |
6fc6879b JM |
344 | int ap_table_max_size; |
345 | int ap_table_expiration_time; | |
346 | ||
347 | char country[3]; /* first two octets: country code as described in | |
348 | * ISO/IEC 3166-1. Third octet: | |
349 | * ' ' (ascii 32): all environments | |
350 | * 'O': Outdoor environemnt only | |
351 | * 'I': Indoor environment only | |
352 | */ | |
353 | ||
354 | int ieee80211d; | |
6fc6879b JM |
355 | |
356 | struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES]; | |
357 | ||
358 | /* | |
3ae0800c | 359 | * WMM AC parameters, in same order as 802.1D, i.e. |
6fc6879b JM |
360 | * 0 = BE (best effort) |
361 | * 1 = BK (background) | |
362 | * 2 = VI (video) | |
363 | * 3 = VO (voice) | |
364 | */ | |
3ae0800c | 365 | struct hostapd_wmm_ac_params wmm_ac_params[4]; |
6fc6879b | 366 | |
9d2a76a2 JM |
367 | int ht_op_mode_fixed; |
368 | u16 ht_capab; | |
cfb7e8a0 | 369 | int ieee80211n; |
95da9bbc | 370 | int secondary_channel; |
6fc6879b JM |
371 | }; |
372 | ||
373 | ||
374 | int hostapd_mac_comp(const void *a, const void *b); | |
375 | int hostapd_mac_comp_empty(const void *a); | |
89111f3b | 376 | struct hostapd_config * hostapd_config_defaults(void); |
41d719d6 | 377 | void hostapd_config_defaults_bss(struct hostapd_bss_config *bss); |
6fc6879b | 378 | void hostapd_config_free(struct hostapd_config *conf); |
271d2830 JM |
379 | int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries, |
380 | const u8 *addr, int *vlan_id); | |
6fc6879b JM |
381 | int hostapd_rate_found(int *list, int rate); |
382 | int hostapd_wep_key_cmp(struct hostapd_wep_keys *a, | |
383 | struct hostapd_wep_keys *b); | |
384 | const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf, | |
385 | const u8 *addr, const u8 *prev_psk); | |
386 | int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf); | |
387 | const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan, | |
388 | int vlan_id); | |
389 | const struct hostapd_eap_user * | |
390 | hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity, | |
391 | size_t identity_len, int phase2); | |
392 | ||
094393b1 | 393 | #endif /* HOSTAPD_CONFIG_H */ |