config.h 9.2 KB

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