wpa_supplicant / hostapd 2.0

ap_config.h

Go to the documentation of this file.
00001 
00010 #ifndef HOSTAPD_CONFIG_H
00011 #define HOSTAPD_CONFIG_H
00012 
00013 #include "common/defs.h"
00014 #include "ip_addr.h"
00015 #include "common/wpa_common.h"
00016 #include "wps/wps.h"
00017 
00018 #define MAX_STA_COUNT 2007
00019 #define MAX_VLAN_ID 4094
00020 
00021 typedef u8 macaddr[ETH_ALEN];
00022 
00023 struct mac_acl_entry {
00024         macaddr addr;
00025         int vlan_id;
00026 };
00027 
00028 struct hostapd_radius_servers;
00029 struct ft_remote_r0kh;
00030 struct ft_remote_r1kh;
00031 
00032 #define HOSTAPD_MAX_SSID_LEN 32
00033 
00034 #define NUM_WEP_KEYS 4
00035 struct hostapd_wep_keys {
00036         u8 idx;
00037         u8 *key[NUM_WEP_KEYS];
00038         size_t len[NUM_WEP_KEYS];
00039         int keys_set;
00040         size_t default_len; /* key length used for dynamic key generation */
00041 };
00042 
00043 typedef enum hostap_security_policy {
00044         SECURITY_PLAINTEXT = 0,
00045         SECURITY_STATIC_WEP = 1,
00046         SECURITY_IEEE_802_1X = 2,
00047         SECURITY_WPA_PSK = 3,
00048         SECURITY_WPA = 4
00049 } secpolicy;
00050 
00051 struct hostapd_ssid {
00052         char ssid[HOSTAPD_MAX_SSID_LEN + 1];
00053         size_t ssid_len;
00054         int ssid_set;
00055 
00056         char vlan[IFNAMSIZ + 1];
00057         secpolicy security_policy;
00058 
00059         struct hostapd_wpa_psk *wpa_psk;
00060         char *wpa_passphrase;
00061         char *wpa_psk_file;
00062 
00063         struct hostapd_wep_keys wep;
00064 
00065 #define DYNAMIC_VLAN_DISABLED 0
00066 #define DYNAMIC_VLAN_OPTIONAL 1
00067 #define DYNAMIC_VLAN_REQUIRED 2
00068         int dynamic_vlan;
00069 #ifdef CONFIG_FULL_DYNAMIC_VLAN
00070         char *vlan_tagged_interface;
00071 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
00072         struct hostapd_wep_keys **dyn_vlan_keys;
00073         size_t max_dyn_vlan_keys;
00074 };
00075 
00076 
00077 #define VLAN_ID_WILDCARD -1
00078 
00079 struct hostapd_vlan {
00080         struct hostapd_vlan *next;
00081         int vlan_id; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */
00082         char ifname[IFNAMSIZ + 1];
00083         int dynamic_vlan;
00084 #ifdef CONFIG_FULL_DYNAMIC_VLAN
00085 
00086 #define DVLAN_CLEAN_BR  0x1
00087 #define DVLAN_CLEAN_VLAN        0x2
00088 #define DVLAN_CLEAN_VLAN_PORT   0x4
00089 #define DVLAN_CLEAN_WLAN_PORT   0x8
00090         int clean;
00091 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
00092 };
00093 
00094 #define PMK_LEN 32
00095 struct hostapd_wpa_psk {
00096         struct hostapd_wpa_psk *next;
00097         int group;
00098         u8 psk[PMK_LEN];
00099         u8 addr[ETH_ALEN];
00100 };
00101 
00102 struct hostapd_eap_user {
00103         struct hostapd_eap_user *next;
00104         u8 *identity;
00105         size_t identity_len;
00106         struct {
00107                 int vendor;
00108                 u32 method;
00109         } methods[EAP_MAX_METHODS];
00110         u8 *password;
00111         size_t password_len;
00112         int phase2;
00113         int force_version;
00114         unsigned int wildcard_prefix:1;
00115         unsigned int password_hash:1; /* whether password is hashed with
00116                                        * nt_password_hash() */
00117         int ttls_auth; /* EAP_TTLS_AUTH_* bitfield */
00118 };
00119 
00120 
00121 #define NUM_TX_QUEUES 4
00122 
00123 struct hostapd_tx_queue_params {
00124         int aifs;
00125         int cwmin;
00126         int cwmax;
00127         int burst; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */
00128 };
00129 
00130 struct hostapd_wmm_ac_params {
00131         int cwmin;
00132         int cwmax;
00133         int aifs;
00134         int txop_limit; /* in units of 32us */
00135         int admission_control_mandatory;
00136 };
00137 
00138 
00139 #define MAX_ROAMING_CONSORTIUM_LEN 15
00140 
00141 struct hostapd_roaming_consortium {
00142         u8 len;
00143         u8 oi[MAX_ROAMING_CONSORTIUM_LEN];
00144 };
00145 
00146 struct hostapd_venue_name {
00147         u8 lang[3];
00148         u8 name_len;
00149         u8 name[252];
00150 };
00151 
00156 struct hostapd_bss_config {
00157         char iface[IFNAMSIZ + 1];
00158         char bridge[IFNAMSIZ + 1];
00159         char wds_bridge[IFNAMSIZ + 1];
00160 
00161         enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
00162 
00163         unsigned int logger_syslog; /* module bitfield */
00164         unsigned int logger_stdout; /* module bitfield */
00165 
00166         char *dump_log_name; /* file name for state dump (SIGUSR1) */
00167 
00168         int max_num_sta; /* maximum number of STAs in station table */
00169 
00170         int dtim_period;
00171 
00172         int ieee802_1x; /* use IEEE 802.1X */
00173         int eapol_version;
00174         int eap_server; /* Use internal EAP server instead of external
00175                          * RADIUS server */
00176         struct hostapd_eap_user *eap_user;
00177         char *eap_sim_db;
00178         struct hostapd_ip_addr own_ip_addr;
00179         char *nas_identifier;
00180         struct hostapd_radius_servers *radius;
00181         int acct_interim_interval;
00182 
00183         struct hostapd_ssid ssid;
00184 
00185         char *eap_req_id_text; /* optional displayable message sent with
00186                                 * EAP Request-Identity */
00187         size_t eap_req_id_text_len;
00188         int eapol_key_index_workaround;
00189 
00190         size_t default_wep_key_len;
00191         int individual_wep_key_len;
00192         int wep_rekeying_period;
00193         int broadcast_key_idx_min, broadcast_key_idx_max;
00194         int eap_reauth_period;
00195 
00196         int ieee802_11f; /* use IEEE 802.11f (IAPP) */
00197         char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast
00198                                         * frames */
00199 
00200         enum {
00201                 ACCEPT_UNLESS_DENIED = 0,
00202                 DENY_UNLESS_ACCEPTED = 1,
00203                 USE_EXTERNAL_RADIUS_AUTH = 2
00204         } macaddr_acl;
00205         struct mac_acl_entry *accept_mac;
00206         int num_accept_mac;
00207         struct mac_acl_entry *deny_mac;
00208         int num_deny_mac;
00209         int wds_sta;
00210         int isolate;
00211 
00212         int auth_algs; /* bitfield of allowed IEEE 802.11 authentication
00213                         * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */
00214 
00215         int wpa; /* bitfield of WPA_PROTO_WPA, WPA_PROTO_RSN */
00216         int wpa_key_mgmt;
00217 #ifdef CONFIG_IEEE80211W
00218         enum mfp_options ieee80211w;
00219         /* dot11AssociationSAQueryMaximumTimeout (in TUs) */
00220         unsigned int assoc_sa_query_max_timeout;
00221         /* dot11AssociationSAQueryRetryTimeout (in TUs) */
00222         int assoc_sa_query_retry_timeout;
00223 #endif /* CONFIG_IEEE80211W */
00224         enum {
00225                 PSK_RADIUS_IGNORED = 0,
00226                 PSK_RADIUS_ACCEPTED = 1,
00227                 PSK_RADIUS_REQUIRED = 2
00228         } wpa_psk_radius;
00229         int wpa_pairwise;
00230         int wpa_group;
00231         int wpa_group_rekey;
00232         int wpa_strict_rekey;
00233         int wpa_gmk_rekey;
00234         int wpa_ptk_rekey;
00235         int rsn_pairwise;
00236         int rsn_preauth;
00237         char *rsn_preauth_interfaces;
00238         int peerkey;
00239 
00240 #ifdef CONFIG_IEEE80211R
00241         /* IEEE 802.11r - Fast BSS Transition */
00242         u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
00243         u8 r1_key_holder[FT_R1KH_ID_LEN];
00244         u32 r0_key_lifetime;
00245         u32 reassociation_deadline;
00246         struct ft_remote_r0kh *r0kh_list;
00247         struct ft_remote_r1kh *r1kh_list;
00248         int pmk_r1_push;
00249         int ft_over_ds;
00250 #endif /* CONFIG_IEEE80211R */
00251 
00252         char *ctrl_interface; /* directory for UNIX domain sockets */
00253 #ifndef CONFIG_NATIVE_WINDOWS
00254         gid_t ctrl_interface_gid;
00255 #endif /* CONFIG_NATIVE_WINDOWS */
00256         int ctrl_interface_gid_set;
00257 
00258         char *ca_cert;
00259         char *server_cert;
00260         char *private_key;
00261         char *private_key_passwd;
00262         int check_crl;
00263         char *dh_file;
00264         u8 *pac_opaque_encr_key;
00265         u8 *eap_fast_a_id;
00266         size_t eap_fast_a_id_len;
00267         char *eap_fast_a_id_info;
00268         int eap_fast_prov;
00269         int pac_key_lifetime;
00270         int pac_key_refresh_time;
00271         int eap_sim_aka_result_ind;
00272         int tnc;
00273         int fragment_size;
00274         u16 pwd_group;
00275 
00276         char *radius_server_clients;
00277         int radius_server_auth_port;
00278         int radius_server_ipv6;
00279 
00280         char *test_socket; /* UNIX domain socket path for driver_test */
00281 
00282         int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
00283                                  * address instead of individual address
00284                                  * (for driver_wired.c).
00285                                  */
00286 
00287         int ap_max_inactivity;
00288         int ignore_broadcast_ssid;
00289 
00290         int wmm_enabled;
00291         int wmm_uapsd;
00292 
00293         struct hostapd_vlan *vlan, *vlan_tail;
00294 
00295         macaddr bssid;
00296 
00297         /*
00298          * Maximum listen interval that STAs can use when associating with this
00299          * BSS. If a STA tries to use larger value, the association will be
00300          * denied with status code 51.
00301          */
00302         u16 max_listen_interval;
00303 
00304         int disable_pmksa_caching;
00305         int okc; /* Opportunistic Key Caching */
00306 
00307         int wps_state;
00308 #ifdef CONFIG_WPS
00309         int ap_setup_locked;
00310         u8 uuid[16];
00311         char *wps_pin_requests;
00312         char *device_name;
00313         char *manufacturer;
00314         char *model_name;
00315         char *model_number;
00316         char *serial_number;
00317         u8 device_type[WPS_DEV_TYPE_LEN];
00318         char *config_methods;
00319         u8 os_version[4];
00320         char *ap_pin;
00321         int skip_cred_build;
00322         u8 *extra_cred;
00323         size_t extra_cred_len;
00324         int wps_cred_processing;
00325         u8 *ap_settings;
00326         size_t ap_settings_len;
00327         char *upnp_iface;
00328         char *friendly_name;
00329         char *manufacturer_url;
00330         char *model_description;
00331         char *model_url;
00332         char *upc;
00333         struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
00334 #endif /* CONFIG_WPS */
00335         int pbc_in_m1;
00336 
00337 #define P2P_ENABLED BIT(0)
00338 #define P2P_GROUP_OWNER BIT(1)
00339 #define P2P_GROUP_FORMATION BIT(2)
00340 #define P2P_MANAGE BIT(3)
00341 #define P2P_ALLOW_CROSS_CONNECTION BIT(4)
00342         int p2p;
00343 
00344         int disassoc_low_ack;
00345         int skip_inactivity_poll;
00346 
00347 #define TDLS_PROHIBIT BIT(0)
00348 #define TDLS_PROHIBIT_CHAN_SWITCH BIT(1)
00349         int tdls;
00350         int disable_11n;
00351 
00352         /* IEEE 802.11v */
00353         int time_advertisement;
00354         char *time_zone;
00355 
00356         /* IEEE 802.11u - Interworking */
00357         int interworking;
00358         int access_network_type;
00359         int internet;
00360         int asra;
00361         int esr;
00362         int uesa;
00363         int venue_info_set;
00364         u8 venue_group;
00365         u8 venue_type;
00366         u8 hessid[ETH_ALEN];
00367 
00368         /* IEEE 802.11u - Roaming Consortium list */
00369         unsigned int roaming_consortium_count;
00370         struct hostapd_roaming_consortium *roaming_consortium;
00371 
00372         /* IEEE 802.11u - Venue Name duples */
00373         unsigned int venue_name_count;
00374         struct hostapd_venue_name *venue_name;
00375 
00376         u16 gas_comeback_delay;
00377         int gas_frag_limit;
00378 
00379         u8 wps_rf_bands; /* RF bands for WPS (WPS_RF_*) */
00380 
00381 #ifdef CONFIG_RADIUS_TEST
00382         char *dump_msk_file;
00383 #endif /* CONFIG_RADIUS_TEST */
00384 };
00385 
00386 
00391 struct hostapd_config {
00392         struct hostapd_bss_config *bss, *last_bss;
00393         size_t num_bss;
00394 
00395         u16 beacon_int;
00396         int rts_threshold;
00397         int fragm_threshold;
00398         u8 send_probe_response;
00399         u8 channel;
00400         enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
00401         enum {
00402                 LONG_PREAMBLE = 0,
00403                 SHORT_PREAMBLE = 1
00404         } preamble;
00405 
00406         int *supported_rates;
00407         int *basic_rates;
00408 
00409         const struct wpa_driver_ops *driver;
00410 
00411         int ap_table_max_size;
00412         int ap_table_expiration_time;
00413 
00414         char country[3]; /* first two octets: country code as described in
00415                           * ISO/IEC 3166-1. Third octet:
00416                           * ' ' (ascii 32): all environments
00417                           * 'O': Outdoor environemnt only
00418                           * 'I': Indoor environment only
00419                           */
00420 
00421         int ieee80211d;
00422 
00423         struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
00424 
00425         /*
00426          * WMM AC parameters, in same order as 802.1D, i.e.
00427          * 0 = BE (best effort)
00428          * 1 = BK (background)
00429          * 2 = VI (video)
00430          * 3 = VO (voice)
00431          */
00432         struct hostapd_wmm_ac_params wmm_ac_params[4];
00433 
00434         int ht_op_mode_fixed;
00435         u16 ht_capab;
00436         int ieee80211n;
00437         int secondary_channel;
00438         int require_ht;
00439 };
00440 
00441 
00442 int hostapd_mac_comp(const void *a, const void *b);
00443 int hostapd_mac_comp_empty(const void *a);
00444 struct hostapd_config * hostapd_config_defaults(void);
00445 void hostapd_config_defaults_bss(struct hostapd_bss_config *bss);
00446 void hostapd_config_free(struct hostapd_config *conf);
00447 int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
00448                           const u8 *addr, int *vlan_id);
00449 int hostapd_rate_found(int *list, int rate);
00450 int hostapd_wep_key_cmp(struct hostapd_wep_keys *a,
00451                         struct hostapd_wep_keys *b);
00452 const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
00453                            const u8 *addr, const u8 *prev_psk);
00454 int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
00455 const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
00456                                         int vlan_id);
00457 const struct hostapd_eap_user *
00458 hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
00459                      size_t identity_len, int phase2);
00460 
00461 #endif /* HOSTAPD_CONFIG_H */
00462 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines