]> git.ipfire.org Git - thirdparty/hostap.git/blob - src/ap/ap_config.h
a95ebe9acb8829371977b8b1b4f6348925be3336
[thirdparty/hostap.git] / src / ap / ap_config.h
1 /*
2 * hostapd / Configuration definitions and helpers functions
3 * Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
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
15 #ifndef HOSTAPD_CONFIG_H
16 #define HOSTAPD_CONFIG_H
17
18 #include "common/defs.h"
19 #include "ip_addr.h"
20 #include "common/wpa_common.h"
21
22 #define MAX_STA_COUNT 2007
23 #define MAX_VLAN_ID 4094
24
25 typedef u8 macaddr[ETH_ALEN];
26
27 struct mac_acl_entry {
28 macaddr addr;
29 int vlan_id;
30 };
31
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 4
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
136 struct hostapd_wmm_ac_params {
137 int cwmin;
138 int cwmax;
139 int aifs;
140 int txop_limit; /* in units of 32us */
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 char wds_bridge[IFNAMSIZ + 1];
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;
173 int acct_interim_interval;
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
192 enum {
193 ACCEPT_UNLESS_DENIED = 0,
194 DENY_UNLESS_ACCEPTED = 1,
195 USE_EXTERNAL_RADIUS_AUTH = 2
196 } macaddr_acl;
197 struct mac_acl_entry *accept_mac;
198 int num_accept_mac;
199 struct mac_acl_entry *deny_mac;
200 int num_deny_mac;
201 int wds_sta;
202 int isolate;
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
210 enum mfp_options ieee80211w;
211 /* dot11AssociationSAQueryMaximumTimeout (in TUs) */
212 unsigned int assoc_sa_query_max_timeout;
213 /* dot11AssociationSAQueryRetryTimeout (in TUs) */
214 int assoc_sa_query_retry_timeout;
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;
221 int wpa_ptk_rekey;
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;
236 #endif /* CONFIG_IEEE80211R */
237
238 char *ctrl_interface; /* directory for UNIX domain sockets */
239 #ifndef CONFIG_NATIVE_WINDOWS
240 gid_t ctrl_interface_gid;
241 #endif /* CONFIG_NATIVE_WINDOWS */
242 int ctrl_interface_gid_set;
243
244 char *ca_cert;
245 char *server_cert;
246 char *private_key;
247 char *private_key_passwd;
248 int check_crl;
249 char *dh_file;
250 u8 *pac_opaque_encr_key;
251 u8 *eap_fast_a_id;
252 size_t eap_fast_a_id_len;
253 char *eap_fast_a_id_info;
254 int eap_fast_prov;
255 int pac_key_lifetime;
256 int pac_key_refresh_time;
257 int eap_sim_aka_result_ind;
258 int tnc;
259 int fragment_size;
260 u16 pwd_group;
261
262 char *radius_server_clients;
263 int radius_server_auth_port;
264 int radius_server_ipv6;
265
266 char *test_socket; /* UNIX domain socket path for driver_test */
267
268 int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
269 * address instead of individual address
270 * (for driver_wired.c).
271 */
272
273 int ap_max_inactivity;
274 int ignore_broadcast_ssid;
275
276 int wmm_enabled;
277 int wmm_uapsd;
278
279 struct hostapd_vlan *vlan, *vlan_tail;
280
281 macaddr bssid;
282
283 /*
284 * Maximum listen interval that STAs can use when associating with this
285 * BSS. If a STA tries to use larger value, the association will be
286 * denied with status code 51.
287 */
288 u16 max_listen_interval;
289
290 int okc; /* Opportunistic Key Caching */
291
292 int wps_state;
293 #ifdef CONFIG_WPS
294 int ap_setup_locked;
295 u8 uuid[16];
296 char *wps_pin_requests;
297 char *device_name;
298 char *manufacturer;
299 char *model_name;
300 char *model_number;
301 char *serial_number;
302 char *device_type;
303 char *config_methods;
304 u8 os_version[4];
305 char *ap_pin;
306 int skip_cred_build;
307 u8 *extra_cred;
308 size_t extra_cred_len;
309 int wps_cred_processing;
310 u8 *ap_settings;
311 size_t ap_settings_len;
312 char *upnp_iface;
313 char *friendly_name;
314 char *manufacturer_url;
315 char *model_description;
316 char *model_url;
317 char *upc;
318 #endif /* CONFIG_WPS */
319
320 #define P2P_ENABLED BIT(0)
321 #define P2P_GROUP_OWNER BIT(1)
322 #define P2P_GROUP_FORMATION BIT(2)
323 #define P2P_MANAGE BIT(3)
324 #define P2P_ALLOW_CROSS_CONNECTION BIT(4)
325 int p2p;
326 };
327
328
329 /**
330 * struct hostapd_config - Per-radio interface configuration
331 */
332 struct hostapd_config {
333 struct hostapd_bss_config *bss, *last_bss;
334 size_t num_bss;
335
336 u16 beacon_int;
337 int rts_threshold;
338 int fragm_threshold;
339 u8 send_probe_response;
340 u8 channel;
341 enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
342 enum {
343 LONG_PREAMBLE = 0,
344 SHORT_PREAMBLE = 1
345 } preamble;
346 enum {
347 CTS_PROTECTION_AUTOMATIC = 0,
348 CTS_PROTECTION_FORCE_ENABLED = 1,
349 CTS_PROTECTION_FORCE_DISABLED = 2,
350 CTS_PROTECTION_AUTOMATIC_NO_OLBC = 3,
351 } cts_protection_type;
352
353 int *supported_rates;
354 int *basic_rates;
355
356 const struct wpa_driver_ops *driver;
357
358 int ap_table_max_size;
359 int ap_table_expiration_time;
360
361 char country[3]; /* first two octets: country code as described in
362 * ISO/IEC 3166-1. Third octet:
363 * ' ' (ascii 32): all environments
364 * 'O': Outdoor environemnt only
365 * 'I': Indoor environment only
366 */
367
368 int ieee80211d;
369
370 struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
371
372 /*
373 * WMM AC parameters, in same order as 802.1D, i.e.
374 * 0 = BE (best effort)
375 * 1 = BK (background)
376 * 2 = VI (video)
377 * 3 = VO (voice)
378 */
379 struct hostapd_wmm_ac_params wmm_ac_params[4];
380
381 int ht_op_mode_fixed;
382 u16 ht_capab;
383 int ieee80211n;
384 int secondary_channel;
385 };
386
387
388 int hostapd_mac_comp(const void *a, const void *b);
389 int hostapd_mac_comp_empty(const void *a);
390 struct hostapd_config * hostapd_config_defaults(void);
391 void hostapd_config_defaults_bss(struct hostapd_bss_config *bss);
392 void hostapd_config_free(struct hostapd_config *conf);
393 int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
394 const u8 *addr, int *vlan_id);
395 int hostapd_rate_found(int *list, int rate);
396 int hostapd_wep_key_cmp(struct hostapd_wep_keys *a,
397 struct hostapd_wep_keys *b);
398 const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
399 const u8 *addr, const u8 *prev_psk);
400 int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
401 const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
402 int vlan_id);
403 const struct hostapd_eap_user *
404 hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
405 size_t identity_len, int phase2);
406
407 #endif /* HOSTAPD_CONFIG_H */