config.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  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. typedef u8 macaddr[ETH_ALEN];
  21. struct mac_acl_entry {
  22. macaddr addr;
  23. int vlan_id;
  24. };
  25. struct hostapd_radius_servers;
  26. struct ft_remote_r0kh;
  27. struct ft_remote_r1kh;
  28. #define HOSTAPD_MAX_SSID_LEN 32
  29. #define NUM_WEP_KEYS 4
  30. struct hostapd_wep_keys {
  31. u8 idx;
  32. u8 *key[NUM_WEP_KEYS];
  33. size_t len[NUM_WEP_KEYS];
  34. int keys_set;
  35. size_t default_len; /* key length used for dynamic key generation */
  36. };
  37. typedef enum hostap_security_policy {
  38. SECURITY_PLAINTEXT = 0,
  39. SECURITY_STATIC_WEP = 1,
  40. SECURITY_IEEE_802_1X = 2,
  41. SECURITY_WPA_PSK = 3,
  42. SECURITY_WPA = 4
  43. } secpolicy;
  44. struct hostapd_ssid {
  45. char ssid[HOSTAPD_MAX_SSID_LEN + 1];
  46. size_t ssid_len;
  47. int ssid_set;
  48. char vlan[IFNAMSIZ + 1];
  49. secpolicy security_policy;
  50. struct hostapd_wpa_psk *wpa_psk;
  51. char *wpa_passphrase;
  52. char *wpa_psk_file;
  53. struct hostapd_wep_keys wep;
  54. #define DYNAMIC_VLAN_DISABLED 0
  55. #define DYNAMIC_VLAN_OPTIONAL 1
  56. #define DYNAMIC_VLAN_REQUIRED 2
  57. int dynamic_vlan;
  58. #ifdef CONFIG_FULL_DYNAMIC_VLAN
  59. char *vlan_tagged_interface;
  60. #endif /* CONFIG_FULL_DYNAMIC_VLAN */
  61. struct hostapd_wep_keys **dyn_vlan_keys;
  62. size_t max_dyn_vlan_keys;
  63. };
  64. #define VLAN_ID_WILDCARD -1
  65. struct hostapd_vlan {
  66. struct hostapd_vlan *next;
  67. int vlan_id; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */
  68. char ifname[IFNAMSIZ + 1];
  69. int dynamic_vlan;
  70. #ifdef CONFIG_FULL_DYNAMIC_VLAN
  71. #define DVLAN_CLEAN_BR 0x1
  72. #define DVLAN_CLEAN_VLAN 0x2
  73. #define DVLAN_CLEAN_VLAN_PORT 0x4
  74. #define DVLAN_CLEAN_WLAN_PORT 0x8
  75. int clean;
  76. #endif /* CONFIG_FULL_DYNAMIC_VLAN */
  77. };
  78. #define PMK_LEN 32
  79. struct hostapd_wpa_psk {
  80. struct hostapd_wpa_psk *next;
  81. int group;
  82. u8 psk[PMK_LEN];
  83. u8 addr[ETH_ALEN];
  84. };
  85. #define EAP_USER_MAX_METHODS 8
  86. struct hostapd_eap_user {
  87. struct hostapd_eap_user *next;
  88. u8 *identity;
  89. size_t identity_len;
  90. struct {
  91. int vendor;
  92. u32 method;
  93. } methods[EAP_USER_MAX_METHODS];
  94. u8 *password;
  95. size_t password_len;
  96. int phase2;
  97. int force_version;
  98. unsigned int wildcard_prefix:1;
  99. unsigned int password_hash:1; /* whether password is hashed with
  100. * nt_password_hash() */
  101. int ttls_auth; /* EAP_TTLS_AUTH_* bitfield */
  102. };
  103. #define NUM_TX_QUEUES 8
  104. struct hostapd_tx_queue_params {
  105. int aifs;
  106. int cwmin;
  107. int cwmax;
  108. int burst; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */
  109. int configured;
  110. };
  111. struct hostapd_wmm_ac_params {
  112. int cwmin;
  113. int cwmax;
  114. int aifs;
  115. int txop_limit; /* in units of 32us */
  116. int admission_control_mandatory;
  117. };
  118. /**
  119. * struct hostapd_bss_config - Per-BSS configuration
  120. */
  121. struct hostapd_bss_config {
  122. char iface[IFNAMSIZ + 1];
  123. char bridge[IFNAMSIZ + 1];
  124. enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
  125. unsigned int logger_syslog; /* module bitfield */
  126. unsigned int logger_stdout; /* module bitfield */
  127. char *dump_log_name; /* file name for state dump (SIGUSR1) */
  128. int max_num_sta; /* maximum number of STAs in station table */
  129. int dtim_period;
  130. int ieee802_1x; /* use IEEE 802.1X */
  131. int eapol_version;
  132. int eap_server; /* Use internal EAP server instead of external
  133. * RADIUS server */
  134. struct hostapd_eap_user *eap_user;
  135. char *eap_sim_db;
  136. struct hostapd_ip_addr own_ip_addr;
  137. char *nas_identifier;
  138. struct hostapd_radius_servers *radius;
  139. struct hostapd_ssid ssid;
  140. char *eap_req_id_text; /* optional displayable message sent with
  141. * EAP Request-Identity */
  142. size_t eap_req_id_text_len;
  143. int eapol_key_index_workaround;
  144. size_t default_wep_key_len;
  145. int individual_wep_key_len;
  146. int wep_rekeying_period;
  147. int broadcast_key_idx_min, broadcast_key_idx_max;
  148. int eap_reauth_period;
  149. int ieee802_11f; /* use IEEE 802.11f (IAPP) */
  150. char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast
  151. * frames */
  152. enum {
  153. ACCEPT_UNLESS_DENIED = 0,
  154. DENY_UNLESS_ACCEPTED = 1,
  155. USE_EXTERNAL_RADIUS_AUTH = 2
  156. } macaddr_acl;
  157. struct mac_acl_entry *accept_mac;
  158. int num_accept_mac;
  159. struct mac_acl_entry *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 mfp_options ieee80211w;
  167. /* dot11AssociationSAQueryMaximumTimeout (in TUs) */
  168. unsigned int assoc_sa_query_max_timeout;
  169. /* dot11AssociationSAQueryRetryTimeout (in TUs) */
  170. int assoc_sa_query_retry_timeout;
  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 wpa_ptk_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. u8 *eap_fast_a_id;
  203. size_t eap_fast_a_id_len;
  204. char *eap_fast_a_id_info;
  205. int eap_fast_prov;
  206. int pac_key_lifetime;
  207. int pac_key_refresh_time;
  208. int eap_sim_aka_result_ind;
  209. int tnc;
  210. char *radius_server_clients;
  211. int radius_server_auth_port;
  212. int radius_server_ipv6;
  213. char *test_socket; /* UNIX domain socket path for driver_test */
  214. int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
  215. * address instead of individual address
  216. * (for driver_wired.c).
  217. */
  218. int ap_max_inactivity;
  219. int ignore_broadcast_ssid;
  220. int wmm_enabled;
  221. struct hostapd_vlan *vlan, *vlan_tail;
  222. macaddr bssid;
  223. /*
  224. * Maximum listen interval that STAs can use when associating with this
  225. * BSS. If a STA tries to use larger value, the association will be
  226. * denied with status code 51.
  227. */
  228. u16 max_listen_interval;
  229. int okc; /* Opportunistic Key Caching */
  230. int wps_state;
  231. #ifdef CONFIG_WPS
  232. int ap_setup_locked;
  233. u8 uuid[16];
  234. char *wps_pin_requests;
  235. char *device_name;
  236. char *manufacturer;
  237. char *model_name;
  238. char *model_number;
  239. char *serial_number;
  240. char *device_type;
  241. char *config_methods;
  242. u8 os_version[4];
  243. char *ap_pin;
  244. int skip_cred_build;
  245. u8 *extra_cred;
  246. size_t extra_cred_len;
  247. int wps_cred_processing;
  248. u8 *ap_settings;
  249. size_t ap_settings_len;
  250. char *upnp_iface;
  251. char *friendly_name;
  252. char *manufacturer_url;
  253. char *model_description;
  254. char *model_url;
  255. char *upc;
  256. #endif /* CONFIG_WPS */
  257. };
  258. /**
  259. * struct hostapd_config - Per-radio interface configuration
  260. */
  261. struct hostapd_config {
  262. struct hostapd_bss_config *bss, *last_bss;
  263. size_t num_bss;
  264. u16 beacon_int;
  265. int rts_threshold;
  266. int fragm_threshold;
  267. u8 send_probe_response;
  268. u8 channel;
  269. hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
  270. enum {
  271. LONG_PREAMBLE = 0,
  272. SHORT_PREAMBLE = 1
  273. } preamble;
  274. enum {
  275. CTS_PROTECTION_AUTOMATIC = 0,
  276. CTS_PROTECTION_FORCE_ENABLED = 1,
  277. CTS_PROTECTION_FORCE_DISABLED = 2,
  278. CTS_PROTECTION_AUTOMATIC_NO_OLBC = 3,
  279. } cts_protection_type;
  280. int *supported_rates;
  281. int *basic_rates;
  282. const struct wpa_driver_ops *driver;
  283. int ap_table_max_size;
  284. int ap_table_expiration_time;
  285. char country[3]; /* first two octets: country code as described in
  286. * ISO/IEC 3166-1. Third octet:
  287. * ' ' (ascii 32): all environments
  288. * 'O': Outdoor environemnt only
  289. * 'I': Indoor environment only
  290. */
  291. int ieee80211d;
  292. struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
  293. /*
  294. * WMM AC parameters, in same order as 802.1D, i.e.
  295. * 0 = BE (best effort)
  296. * 1 = BK (background)
  297. * 2 = VI (video)
  298. * 3 = VO (voice)
  299. */
  300. struct hostapd_wmm_ac_params wmm_ac_params[4];
  301. enum {
  302. INTERNAL_BRIDGE_DO_NOT_CONTROL = -1,
  303. INTERNAL_BRIDGE_DISABLED = 0,
  304. INTERNAL_BRIDGE_ENABLED = 1
  305. } bridge_packets;
  306. #ifdef CONFIG_IEEE80211N
  307. int ht_op_mode_fixed;
  308. u16 ht_capab;
  309. #endif /* CONFIG_IEEE80211N */
  310. int ieee80211n;
  311. int secondary_channel;
  312. };
  313. int hostapd_mac_comp(const void *a, const void *b);
  314. int hostapd_mac_comp_empty(const void *a);
  315. struct hostapd_config * hostapd_config_defaults(void);
  316. struct hostapd_config * hostapd_config_read(const char *fname);
  317. void hostapd_config_free(struct hostapd_config *conf);
  318. int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
  319. const u8 *addr, int *vlan_id);
  320. int hostapd_rate_found(int *list, int rate);
  321. int hostapd_wep_key_cmp(struct hostapd_wep_keys *a,
  322. struct hostapd_wep_keys *b);
  323. const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
  324. const u8 *addr, const u8 *prev_psk);
  325. int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
  326. const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
  327. int vlan_id);
  328. const struct hostapd_eap_user *
  329. hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
  330. size_t identity_len, int phase2);
  331. #endif /* CONFIG_H */