]> git.ipfire.org Git - thirdparty/hostap.git/blame - hostapd/config.h
driver_ralink: Make sure assoc_{req,resp}_ies do not get double-freed
[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;
245
246 char *radius_server_clients;
247 int radius_server_auth_port;
248 int radius_server_ipv6;
249
250 char *test_socket; /* UNIX domain socket path for driver_test */
251
252 int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
253 * address instead of individual address
254 * (for driver_wired.c).
255 */
256
257 int ap_max_inactivity;
258 int ignore_broadcast_ssid;
259
260 int wme_enabled;
261
262 struct hostapd_vlan *vlan, *vlan_tail;
263
264 macaddr bssid;
265};
266
267
268typedef enum {
269 HOSTAPD_MODE_IEEE80211B,
270 HOSTAPD_MODE_IEEE80211G,
271 HOSTAPD_MODE_IEEE80211A,
272 NUM_HOSTAPD_MODES
273} hostapd_hw_mode;
274
275
276/**
277 * struct hostapd_config - Per-radio interface configuration
278 */
279struct hostapd_config {
280 struct hostapd_bss_config *bss, *last_bss;
281 struct hostapd_radius_servers *radius;
282 size_t num_bss;
283
284 u16 beacon_int;
285 int rts_threshold;
286 int fragm_threshold;
287 u8 send_probe_response;
288 u8 channel;
289 hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
290 enum {
291 LONG_PREAMBLE = 0,
292 SHORT_PREAMBLE = 1
293 } preamble;
294 enum {
295 CTS_PROTECTION_AUTOMATIC = 0,
296 CTS_PROTECTION_FORCE_ENABLED = 1,
297 CTS_PROTECTION_FORCE_DISABLED = 2,
298 CTS_PROTECTION_AUTOMATIC_NO_OLBC = 3,
299 } cts_protection_type;
300
301 int *supported_rates;
302 int *basic_rates;
303
304 const struct wpa_driver_ops *driver;
305
306 int passive_scan_interval; /* seconds, 0 = disabled */
307 int passive_scan_listen; /* usec */
308 int passive_scan_mode;
309 int ap_table_max_size;
310 int ap_table_expiration_time;
311
312 char country[3]; /* first two octets: country code as described in
313 * ISO/IEC 3166-1. Third octet:
314 * ' ' (ascii 32): all environments
315 * 'O': Outdoor environemnt only
316 * 'I': Indoor environment only
317 */
318
319 int ieee80211d;
320 unsigned int ieee80211h; /* Enable/Disable 80211h */
321
322 struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
323
324 /*
325 * WME AC parameters, in same order as 802.1D, i.e.
326 * 0 = BE (best effort)
327 * 1 = BK (background)
328 * 2 = VI (video)
329 * 3 = VO (voice)
330 */
331 struct hostapd_wme_ac_params wme_ac_params[4];
332
333 enum {
334 INTERNAL_BRIDGE_DO_NOT_CONTROL = -1,
335 INTERNAL_BRIDGE_DISABLED = 0,
336 INTERNAL_BRIDGE_ENABLED = 1
337 } bridge_packets;
338};
339
340
341int hostapd_mac_comp(const void *a, const void *b);
342int hostapd_mac_comp_empty(const void *a);
343struct hostapd_config * hostapd_config_read(const char *fname);
344void hostapd_config_free(struct hostapd_config *conf);
345int hostapd_maclist_found(macaddr *list, int num_entries, const u8 *addr);
346int hostapd_rate_found(int *list, int rate);
347int hostapd_wep_key_cmp(struct hostapd_wep_keys *a,
348 struct hostapd_wep_keys *b);
349const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
350 const u8 *addr, const u8 *prev_psk);
351int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
352const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
353 int vlan_id);
354const struct hostapd_eap_user *
355hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
356 size_t identity_len, int phase2);
357
358#endif /* CONFIG_H */