config.h 9.1 KB

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