config.h
Go to the documentation of this file.00001
00017 #ifndef CONFIG_H
00018 #define CONFIG_H
00019
00020 #include "defs.h"
00021 #include "ip_addr.h"
00022 #include "wpa_common.h"
00023
00024 typedef u8 macaddr[ETH_ALEN];
00025
00026 struct mac_acl_entry {
00027 macaddr addr;
00028 int vlan_id;
00029 };
00030
00031 struct hostapd_radius_servers;
00032 struct ft_remote_r0kh;
00033 struct ft_remote_r1kh;
00034
00035 #define HOSTAPD_MAX_SSID_LEN 32
00036
00037 #define NUM_WEP_KEYS 4
00038 struct hostapd_wep_keys {
00039 u8 idx;
00040 u8 *key[NUM_WEP_KEYS];
00041 size_t len[NUM_WEP_KEYS];
00042 int keys_set;
00043 size_t default_len;
00044 };
00045
00046 typedef enum hostap_security_policy {
00047 SECURITY_PLAINTEXT = 0,
00048 SECURITY_STATIC_WEP = 1,
00049 SECURITY_IEEE_802_1X = 2,
00050 SECURITY_WPA_PSK = 3,
00051 SECURITY_WPA = 4
00052 } secpolicy;
00053
00054 struct hostapd_ssid {
00055 char ssid[HOSTAPD_MAX_SSID_LEN + 1];
00056 size_t ssid_len;
00057 int ssid_set;
00058
00059 char vlan[IFNAMSIZ + 1];
00060 secpolicy security_policy;
00061
00062 struct hostapd_wpa_psk *wpa_psk;
00063 char *wpa_passphrase;
00064 char *wpa_psk_file;
00065
00066 struct hostapd_wep_keys wep;
00067
00068 #define DYNAMIC_VLAN_DISABLED 0
00069 #define DYNAMIC_VLAN_OPTIONAL 1
00070 #define DYNAMIC_VLAN_REQUIRED 2
00071 int dynamic_vlan;
00072 #ifdef CONFIG_FULL_DYNAMIC_VLAN
00073 char *vlan_tagged_interface;
00074 #endif
00075 struct hostapd_wep_keys **dyn_vlan_keys;
00076 size_t max_dyn_vlan_keys;
00077 };
00078
00079
00080 #define VLAN_ID_WILDCARD -1
00081
00082 struct hostapd_vlan {
00083 struct hostapd_vlan *next;
00084 int vlan_id;
00085 char ifname[IFNAMSIZ + 1];
00086 int dynamic_vlan;
00087 #ifdef CONFIG_FULL_DYNAMIC_VLAN
00088
00089 #define DVLAN_CLEAN_BR 0x1
00090 #define DVLAN_CLEAN_VLAN 0x2
00091 #define DVLAN_CLEAN_VLAN_PORT 0x4
00092 #define DVLAN_CLEAN_WLAN_PORT 0x8
00093 int clean;
00094 #endif
00095 };
00096
00097 #define PMK_LEN 32
00098 struct hostapd_wpa_psk {
00099 struct hostapd_wpa_psk *next;
00100 int group;
00101 u8 psk[PMK_LEN];
00102 u8 addr[ETH_ALEN];
00103 };
00104
00105 #define EAP_USER_MAX_METHODS 8
00106 struct hostapd_eap_user {
00107 struct hostapd_eap_user *next;
00108 u8 *identity;
00109 size_t identity_len;
00110 struct {
00111 int vendor;
00112 u32 method;
00113 } methods[EAP_USER_MAX_METHODS];
00114 u8 *password;
00115 size_t password_len;
00116 int phase2;
00117 int force_version;
00118 unsigned int wildcard_prefix:1;
00119 unsigned int password_hash:1;
00120
00121 int ttls_auth;
00122 };
00123
00124
00125 #define NUM_TX_QUEUES 8
00126
00127 struct hostapd_tx_queue_params {
00128 int aifs;
00129 int cwmin;
00130 int cwmax;
00131 int burst;
00132 int configured;
00133 };
00134
00135 struct hostapd_wmm_ac_params {
00136 int cwmin;
00137 int cwmax;
00138 int aifs;
00139 int txop_limit;
00140 int admission_control_mandatory;
00141 };
00142
00143
00148 struct hostapd_bss_config {
00149 char iface[IFNAMSIZ + 1];
00150 char bridge[IFNAMSIZ + 1];
00151
00152 enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
00153
00154 unsigned int logger_syslog;
00155 unsigned int logger_stdout;
00156
00157 char *dump_log_name;
00158
00159 int max_num_sta;
00160
00161 int dtim_period;
00162
00163 int ieee802_1x;
00164 int eapol_version;
00165 int eap_server;
00166
00167 struct hostapd_eap_user *eap_user;
00168 char *eap_sim_db;
00169 struct hostapd_ip_addr own_ip_addr;
00170 char *nas_identifier;
00171 struct hostapd_radius_servers *radius;
00172 int acct_interim_interval;
00173
00174 struct hostapd_ssid ssid;
00175
00176 char *eap_req_id_text;
00177
00178 size_t eap_req_id_text_len;
00179 int eapol_key_index_workaround;
00180
00181 size_t default_wep_key_len;
00182 int individual_wep_key_len;
00183 int wep_rekeying_period;
00184 int broadcast_key_idx_min, broadcast_key_idx_max;
00185 int eap_reauth_period;
00186
00187 int ieee802_11f;
00188 char iapp_iface[IFNAMSIZ + 1];
00189
00190
00191 enum {
00192 ACCEPT_UNLESS_DENIED = 0,
00193 DENY_UNLESS_ACCEPTED = 1,
00194 USE_EXTERNAL_RADIUS_AUTH = 2
00195 } macaddr_acl;
00196 struct mac_acl_entry *accept_mac;
00197 int num_accept_mac;
00198 struct mac_acl_entry *deny_mac;
00199 int num_deny_mac;
00200
00201 int auth_algs;
00202
00203
00204 int wpa;
00205 int wpa_key_mgmt;
00206 #ifdef CONFIG_IEEE80211W
00207 enum mfp_options ieee80211w;
00208
00209 unsigned int assoc_sa_query_max_timeout;
00210
00211 int assoc_sa_query_retry_timeout;
00212 #endif
00213 int wpa_pairwise;
00214 int wpa_group;
00215 int wpa_group_rekey;
00216 int wpa_strict_rekey;
00217 int wpa_gmk_rekey;
00218 int wpa_ptk_rekey;
00219 int rsn_pairwise;
00220 int rsn_preauth;
00221 char *rsn_preauth_interfaces;
00222 int peerkey;
00223
00224 #ifdef CONFIG_IEEE80211R
00225
00226 u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
00227 u8 r1_key_holder[FT_R1KH_ID_LEN];
00228 u32 r0_key_lifetime;
00229 u32 reassociation_deadline;
00230 struct ft_remote_r0kh *r0kh_list;
00231 struct ft_remote_r1kh *r1kh_list;
00232 int pmk_r1_push;
00233 #endif
00234
00235 char *ctrl_interface;
00236 gid_t ctrl_interface_gid;
00237 int ctrl_interface_gid_set;
00238
00239 char *ca_cert;
00240 char *server_cert;
00241 char *private_key;
00242 char *private_key_passwd;
00243 int check_crl;
00244 char *dh_file;
00245 u8 *pac_opaque_encr_key;
00246 u8 *eap_fast_a_id;
00247 size_t eap_fast_a_id_len;
00248 char *eap_fast_a_id_info;
00249 int eap_fast_prov;
00250 int pac_key_lifetime;
00251 int pac_key_refresh_time;
00252 int eap_sim_aka_result_ind;
00253 int tnc;
00254
00255 char *radius_server_clients;
00256 int radius_server_auth_port;
00257 int radius_server_ipv6;
00258
00259 char *test_socket;
00260
00261 int use_pae_group_addr;
00262
00263
00264
00265
00266 int ap_max_inactivity;
00267 int ignore_broadcast_ssid;
00268
00269 int wmm_enabled;
00270
00271 struct hostapd_vlan *vlan, *vlan_tail;
00272
00273 macaddr bssid;
00274
00275
00276
00277
00278
00279
00280 u16 max_listen_interval;
00281
00282 int okc;
00283
00284 int wps_state;
00285 #ifdef CONFIG_WPS
00286 int ap_setup_locked;
00287 u8 uuid[16];
00288 char *wps_pin_requests;
00289 char *device_name;
00290 char *manufacturer;
00291 char *model_name;
00292 char *model_number;
00293 char *serial_number;
00294 char *device_type;
00295 char *config_methods;
00296 u8 os_version[4];
00297 char *ap_pin;
00298 int skip_cred_build;
00299 u8 *extra_cred;
00300 size_t extra_cred_len;
00301 int wps_cred_processing;
00302 u8 *ap_settings;
00303 size_t ap_settings_len;
00304 char *upnp_iface;
00305 char *friendly_name;
00306 char *manufacturer_url;
00307 char *model_description;
00308 char *model_url;
00309 char *upc;
00310 #endif
00311 };
00312
00313
00318 struct hostapd_config {
00319 struct hostapd_bss_config *bss, *last_bss;
00320 size_t num_bss;
00321
00322 u16 beacon_int;
00323 int rts_threshold;
00324 int fragm_threshold;
00325 u8 send_probe_response;
00326 u8 channel;
00327 hostapd_hw_mode hw_mode;
00328 enum {
00329 LONG_PREAMBLE = 0,
00330 SHORT_PREAMBLE = 1
00331 } preamble;
00332 enum {
00333 CTS_PROTECTION_AUTOMATIC = 0,
00334 CTS_PROTECTION_FORCE_ENABLED = 1,
00335 CTS_PROTECTION_FORCE_DISABLED = 2,
00336 CTS_PROTECTION_AUTOMATIC_NO_OLBC = 3,
00337 } cts_protection_type;
00338
00339 int *supported_rates;
00340 int *basic_rates;
00341
00342 const struct wpa_driver_ops *driver;
00343
00344 int ap_table_max_size;
00345 int ap_table_expiration_time;
00346
00347 char country[3];
00348
00349
00350
00351
00352
00353
00354 int ieee80211d;
00355
00356 struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
00357
00358
00359
00360
00361
00362
00363
00364
00365 struct hostapd_wmm_ac_params wmm_ac_params[4];
00366
00367 enum {
00368 INTERNAL_BRIDGE_DO_NOT_CONTROL = -1,
00369 INTERNAL_BRIDGE_DISABLED = 0,
00370 INTERNAL_BRIDGE_ENABLED = 1
00371 } bridge_packets;
00372
00373 #ifdef CONFIG_IEEE80211N
00374 int ht_op_mode_fixed;
00375 u16 ht_capab;
00376 #endif
00377 int ieee80211n;
00378 int secondary_channel;
00379 };
00380
00381
00382 int hostapd_mac_comp(const void *a, const void *b);
00383 int hostapd_mac_comp_empty(const void *a);
00384 struct hostapd_config * hostapd_config_defaults(void);
00385 struct hostapd_config * hostapd_config_read(const char *fname);
00386 void hostapd_config_free(struct hostapd_config *conf);
00387 int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
00388 const u8 *addr, int *vlan_id);
00389 int hostapd_rate_found(int *list, int rate);
00390 int hostapd_wep_key_cmp(struct hostapd_wep_keys *a,
00391 struct hostapd_wep_keys *b);
00392 const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
00393 const u8 *addr, const u8 *prev_psk);
00394 int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
00395 const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
00396 int vlan_id);
00397 const struct hostapd_eap_user *
00398 hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
00399 size_t identity_len, int phase2);
00400
00401 #endif
00402