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