config.h 9.1 KB

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