config.h 8.6 KB

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