config.h 8.8 KB

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