]> git.ipfire.org Git - thirdparty/hostap.git/blame - hostapd/config.h
Change the order of Result TLV and PAC TLV to avoid interop issues
[thirdparty/hostap.git] / hostapd / config.h
CommitLineData
6fc6879b
JM
1/*
2 * hostapd / Configuration file
3 * Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
71b6ae14 4 * Copyright (c) 2007-2008, Intel Corporation
6fc6879b
JM
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Alternatively, this software may be distributed under the terms of BSD
11 * license.
12 *
13 * See README and COPYING for more details.
14 */
15
16#ifndef CONFIG_H
17#define CONFIG_H
18
19#include "defs.h"
20#include "ip_addr.h"
21#include "wpa_common.h"
22
23#ifndef IFNAMSIZ
24#define IFNAMSIZ 16
25#endif
26
27typedef u8 macaddr[ETH_ALEN];
28
271d2830
JM
29struct mac_acl_entry {
30 macaddr addr;
31 int vlan_id;
32};
33
6fc6879b
JM
34struct hostapd_radius_servers;
35struct ft_remote_r0kh;
36struct ft_remote_r1kh;
37
38#define HOSTAPD_MAX_SSID_LEN 32
39
40#define NUM_WEP_KEYS 4
41struct hostapd_wep_keys {
42 u8 idx;
43 u8 *key[NUM_WEP_KEYS];
44 size_t len[NUM_WEP_KEYS];
45 int keys_set;
46 size_t default_len; /* key length used for dynamic key generation */
47};
48
49typedef enum hostap_security_policy {
50 SECURITY_PLAINTEXT = 0,
51 SECURITY_STATIC_WEP = 1,
52 SECURITY_IEEE_802_1X = 2,
53 SECURITY_WPA_PSK = 3,
54 SECURITY_WPA = 4
55} secpolicy;
56
57struct hostapd_ssid {
58 char ssid[HOSTAPD_MAX_SSID_LEN + 1];
59 size_t ssid_len;
60 int ssid_set;
61
62 char vlan[IFNAMSIZ + 1];
63 secpolicy security_policy;
64
65 struct hostapd_wpa_psk *wpa_psk;
66 char *wpa_passphrase;
67 char *wpa_psk_file;
68
69 struct hostapd_wep_keys wep;
70
71#define DYNAMIC_VLAN_DISABLED 0
72#define DYNAMIC_VLAN_OPTIONAL 1
73#define DYNAMIC_VLAN_REQUIRED 2
74 int dynamic_vlan;
75#ifdef CONFIG_FULL_DYNAMIC_VLAN
76 char *vlan_tagged_interface;
77#endif /* CONFIG_FULL_DYNAMIC_VLAN */
78 struct hostapd_wep_keys **dyn_vlan_keys;
79 size_t max_dyn_vlan_keys;
80};
81
82
83#define VLAN_ID_WILDCARD -1
84
85struct hostapd_vlan {
86 struct hostapd_vlan *next;
87 int vlan_id; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */
88 char ifname[IFNAMSIZ + 1];
89 int dynamic_vlan;
90#ifdef CONFIG_FULL_DYNAMIC_VLAN
91
92#define DVLAN_CLEAN_BR 0x1
93#define DVLAN_CLEAN_VLAN 0x2
94#define DVLAN_CLEAN_VLAN_PORT 0x4
95#define DVLAN_CLEAN_WLAN_PORT 0x8
96 int clean;
97#endif /* CONFIG_FULL_DYNAMIC_VLAN */
98};
99
100#define PMK_LEN 32
101struct hostapd_wpa_psk {
102 struct hostapd_wpa_psk *next;
103 int group;
104 u8 psk[PMK_LEN];
105 u8 addr[ETH_ALEN];
106};
107
108#define EAP_USER_MAX_METHODS 8
109struct hostapd_eap_user {
110 struct hostapd_eap_user *next;
111 u8 *identity;
112 size_t identity_len;
113 struct {
114 int vendor;
115 u32 method;
116 } methods[EAP_USER_MAX_METHODS];
117 u8 *password;
118 size_t password_len;
119 int phase2;
120 int force_version;
121 unsigned int wildcard_prefix:1;
122 unsigned int password_hash:1; /* whether password is hashed with
123 * nt_password_hash() */
124 int ttls_auth; /* EAP_TTLS_AUTH_* bitfield */
125};
126
127
128#define NUM_TX_QUEUES 8
129
130struct hostapd_tx_queue_params {
131 int aifs;
132 int cwmin;
133 int cwmax;
134 int burst; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */
135 int configured;
136};
137
138struct hostapd_wme_ac_params {
139 int cwmin;
140 int cwmax;
141 int aifs;
142 int txopLimit; /* in units of 32us */
143 int admission_control_mandatory;
144};
145
146
147/**
148 * struct hostapd_bss_config - Per-BSS configuration
149 */
150struct hostapd_bss_config {
151 char iface[IFNAMSIZ + 1];
152 char bridge[IFNAMSIZ + 1];
153
154 enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
155
156 unsigned int logger_syslog; /* module bitfield */
157 unsigned int logger_stdout; /* module bitfield */
158
159 char *dump_log_name; /* file name for state dump (SIGUSR1) */
160
161 int max_num_sta; /* maximum number of STAs in station table */
162
163 int dtim_period;
164
165 int ieee802_1x; /* use IEEE 802.1X */
166 int eapol_version;
167 int eap_server; /* Use internal EAP server instead of external
168 * RADIUS server */
169 struct hostapd_eap_user *eap_user;
170 char *eap_sim_db;
171 struct hostapd_ip_addr own_ip_addr;
172 char *nas_identifier;
173 struct hostapd_radius_servers *radius;
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 u8 assoc_ap_addr[ETH_ALEN];
193 int assoc_ap; /* whether assoc_ap_addr is set */
194
195 enum {
196 ACCEPT_UNLESS_DENIED = 0,
197 DENY_UNLESS_ACCEPTED = 1,
198 USE_EXTERNAL_RADIUS_AUTH = 2
199 } macaddr_acl;
271d2830 200 struct mac_acl_entry *accept_mac;
6fc6879b 201 int num_accept_mac;
271d2830 202 struct mac_acl_entry *deny_mac;
6fc6879b
JM
203 int num_deny_mac;
204
205 int auth_algs; /* bitfield of allowed IEEE 802.11 authentication
206 * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */
207
208 int wpa; /* bitfield of WPA_PROTO_WPA, WPA_PROTO_RSN */
209 int wpa_key_mgmt;
210#ifdef CONFIG_IEEE80211W
211 enum {
212 NO_IEEE80211W = 0,
213 IEEE80211W_OPTIONAL = 1,
214 IEEE80211W_REQUIRED = 2
215 } ieee80211w;
5d22a1d5
JM
216 /* dot11AssociationPingResponseTimeout (in TU) */
217 unsigned int assoc_ping_timeout;
218 /* dot11AssociationMaximumPingAttempts */
219 int assoc_ping_attempts;
6fc6879b
JM
220#endif /* CONFIG_IEEE80211W */
221 int wpa_pairwise;
222 int wpa_group;
223 int wpa_group_rekey;
224 int wpa_strict_rekey;
225 int wpa_gmk_rekey;
226 int rsn_pairwise;
227 int rsn_preauth;
228 char *rsn_preauth_interfaces;
229 int peerkey;
230
231#ifdef CONFIG_IEEE80211R
232 /* IEEE 802.11r - Fast BSS Transition */
233 u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
234 u8 r1_key_holder[FT_R1KH_ID_LEN];
235 u32 r0_key_lifetime;
236 u32 reassociation_deadline;
237 struct ft_remote_r0kh *r0kh_list;
238 struct ft_remote_r1kh *r1kh_list;
239 int pmk_r1_push;
240#endif /* CONFIG_IEEE80211R */
241
242 char *ctrl_interface; /* directory for UNIX domain sockets */
243 gid_t ctrl_interface_gid;
244 int ctrl_interface_gid_set;
245
246 char *ca_cert;
247 char *server_cert;
248 char *private_key;
249 char *private_key_passwd;
250 int check_crl;
251 char *dh_file;
252 u8 *pac_opaque_encr_key;
253 char *eap_fast_a_id;
254 int eap_sim_aka_result_ind;
da08a7c7 255 int tnc;
6fc6879b
JM
256
257 char *radius_server_clients;
258 int radius_server_auth_port;
259 int radius_server_ipv6;
260
261 char *test_socket; /* UNIX domain socket path for driver_test */
262
263 int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
264 * address instead of individual address
265 * (for driver_wired.c).
266 */
267
268 int ap_max_inactivity;
269 int ignore_broadcast_ssid;
270
271 int wme_enabled;
272
273 struct hostapd_vlan *vlan, *vlan_tail;
274
275 macaddr bssid;
b0194fe0
JM
276
277 /*
278 * Maximum listen interval that STAs can use when associating with this
279 * BSS. If a STA tries to use larger value, the association will be
280 * denied with status code 51.
281 */
282 u16 max_listen_interval;
bf98f7f3
JM
283
284 int okc; /* Opportunistic Key Caching */
6fc6879b
JM
285};
286
287
288typedef enum {
289 HOSTAPD_MODE_IEEE80211B,
290 HOSTAPD_MODE_IEEE80211G,
291 HOSTAPD_MODE_IEEE80211A,
292 NUM_HOSTAPD_MODES
293} hostapd_hw_mode;
294
295
296/**
297 * struct hostapd_config - Per-radio interface configuration
298 */
299struct hostapd_config {
300 struct hostapd_bss_config *bss, *last_bss;
301 struct hostapd_radius_servers *radius;
302 size_t num_bss;
303
304 u16 beacon_int;
305 int rts_threshold;
306 int fragm_threshold;
307 u8 send_probe_response;
308 u8 channel;
309 hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
310 enum {
311 LONG_PREAMBLE = 0,
312 SHORT_PREAMBLE = 1
313 } preamble;
314 enum {
315 CTS_PROTECTION_AUTOMATIC = 0,
316 CTS_PROTECTION_FORCE_ENABLED = 1,
317 CTS_PROTECTION_FORCE_DISABLED = 2,
318 CTS_PROTECTION_AUTOMATIC_NO_OLBC = 3,
319 } cts_protection_type;
320
321 int *supported_rates;
322 int *basic_rates;
323
324 const struct wpa_driver_ops *driver;
325
326 int passive_scan_interval; /* seconds, 0 = disabled */
327 int passive_scan_listen; /* usec */
328 int passive_scan_mode;
329 int ap_table_max_size;
330 int ap_table_expiration_time;
331
332 char country[3]; /* first two octets: country code as described in
333 * ISO/IEC 3166-1. Third octet:
334 * ' ' (ascii 32): all environments
335 * 'O': Outdoor environemnt only
336 * 'I': Indoor environment only
337 */
338
339 int ieee80211d;
340 unsigned int ieee80211h; /* Enable/Disable 80211h */
341
342 struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
343
344 /*
345 * WME AC parameters, in same order as 802.1D, i.e.
346 * 0 = BE (best effort)
347 * 1 = BK (background)
348 * 2 = VI (video)
349 * 3 = VO (voice)
350 */
351 struct hostapd_wme_ac_params wme_ac_params[4];
352
353 enum {
354 INTERNAL_BRIDGE_DO_NOT_CONTROL = -1,
355 INTERNAL_BRIDGE_DISABLED = 0,
356 INTERNAL_BRIDGE_ENABLED = 1
357 } bridge_packets;
9d2a76a2
JM
358
359#ifdef CONFIG_IEEE80211N
360 int ieee80211n;
361 int ht_op_mode_fixed;
362 u16 ht_capab;
363#endif /* CONFIG_IEEE80211N */
6fc6879b
JM
364};
365
366
367int hostapd_mac_comp(const void *a, const void *b);
368int hostapd_mac_comp_empty(const void *a);
369struct hostapd_config * hostapd_config_read(const char *fname);
370void hostapd_config_free(struct hostapd_config *conf);
271d2830
JM
371int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
372 const u8 *addr, int *vlan_id);
6fc6879b
JM
373int hostapd_rate_found(int *list, int rate);
374int hostapd_wep_key_cmp(struct hostapd_wep_keys *a,
375 struct hostapd_wep_keys *b);
376const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
377 const u8 *addr, const u8 *prev_psk);
378int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
379const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
380 int vlan_id);
381const struct hostapd_eap_user *
382hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
383 size_t identity_len, int phase2);
384
385#endif /* CONFIG_H */