OSDN Git Service

Accumulative patch from commit dc013f1e37df3462085cf01a13f0c432f146ad7a
[android-x86/external-wpa_supplicant_8.git] / src / ap / ap_config.c
index b9f5994..922f564 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * hostapd / Configuration helper functions
- * Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
  *
  * This software may be distributed under the terms of the BSD license.
  * See README for more details.
@@ -87,6 +87,10 @@ void hostapd_config_defaults_bss(struct hostapd_bss_config *bss)
 #ifdef CONFIG_IEEE80211R
        bss->ft_over_ds = 1;
 #endif /* CONFIG_IEEE80211R */
+
+       bss->radius_das_time_window = 300;
+
+       bss->sae_anti_clogging_threshold = 5;
 }
 
 
@@ -102,9 +106,9 @@ struct hostapd_config * hostapd_config_defaults(void)
        const struct hostapd_wmm_ac_params ac_be =
                { aCWmin, aCWmax, 3, 0, 0 }; /* best effort traffic */
        const struct hostapd_wmm_ac_params ac_vi = /* video traffic */
-               { aCWmin - 1, aCWmin, 2, 3000 / 32, 1 };
+               { aCWmin - 1, aCWmin, 2, 3000 / 32, 0 };
        const struct hostapd_wmm_ac_params ac_vo = /* voice traffic */
-               { aCWmin - 2, aCWmin - 1, 2, 1500 / 32, 1 };
+               { aCWmin - 2, aCWmin - 1, 2, 1500 / 32, 0 };
        const struct hostapd_tx_queue_params txq_bk =
                { 7, ecw2cw(aCWmin), ecw2cw(aCWmax), 0 };
        const struct hostapd_tx_queue_params txq_be =
@@ -156,6 +160,9 @@ struct hostapd_config * hostapd_config_defaults(void)
 
        conf->ht_capab = HT_CAP_INFO_SMPS_DISABLED;
 
+       conf->ap_table_max_size = 255;
+       conf->ap_table_expiration_time = 60;
+
        return conf;
 }
 
@@ -336,6 +343,30 @@ static void hostapd_config_free_radius(struct hostapd_radius_server *servers,
 }
 
 
+struct hostapd_radius_attr *
+hostapd_config_get_radius_attr(struct hostapd_radius_attr *attr, u8 type)
+{
+       for (; attr; attr = attr->next) {
+               if (attr->type == type)
+                       return attr;
+       }
+       return NULL;
+}
+
+
+static void hostapd_config_free_radius_attr(struct hostapd_radius_attr *attr)
+{
+       struct hostapd_radius_attr *prev;
+
+       while (attr) {
+               prev = attr;
+               attr = attr->next;
+               wpabuf_free(prev->val);
+               os_free(prev);
+       }
+}
+
+
 static void hostapd_config_free_eap_user(struct hostapd_eap_user *user)
 {
        os_free(user->identity);
@@ -382,6 +413,7 @@ static void hostapd_config_free_bss(struct hostapd_bss_config *conf)
                user = user->next;
                hostapd_config_free_eap_user(prev_user);
        }
+       os_free(conf->eap_user_sqlite);
 
        os_free(conf->dump_log_name);
        os_free(conf->eap_req_id_text);
@@ -392,6 +424,8 @@ static void hostapd_config_free_bss(struct hostapd_bss_config *conf)
                                   conf->radius->num_auth_servers);
        hostapd_config_free_radius(conf->radius->acct_servers,
                                   conf->radius->num_acct_servers);
+       hostapd_config_free_radius_attr(conf->radius_auth_req_attr);
+       hostapd_config_free_radius_attr(conf->radius_acct_req_attr);
        os_free(conf->rsn_preauth_interfaces);
        os_free(conf->ctrl_interface);
        os_free(conf->ca_cert);
@@ -406,6 +440,7 @@ static void hostapd_config_free_bss(struct hostapd_bss_config *conf)
        os_free(conf->radius_server_clients);
        os_free(conf->test_socket);
        os_free(conf->radius);
+       os_free(conf->radius_das_shared_secret);
        hostapd_config_free_vlan(conf);
        if (conf->ssid.dyn_vlan_keys) {
                struct hostapd_ssid *ssid = &conf->ssid;
@@ -445,9 +480,6 @@ static void hostapd_config_free_bss(struct hostapd_bss_config *conf)
        }
 #endif /* CONFIG_IEEE80211R */
 
-#ifdef ANDROID_P2P
-       os_free(conf->prioritize);
-#endif
 #ifdef CONFIG_WPS
        os_free(conf->wps_pin_requests);
        os_free(conf->device_name);
@@ -465,13 +497,32 @@ static void hostapd_config_free_bss(struct hostapd_bss_config *conf)
        os_free(conf->model_description);
        os_free(conf->model_url);
        os_free(conf->upc);
+       wpabuf_free(conf->wps_nfc_dh_pubkey);
+       wpabuf_free(conf->wps_nfc_dh_privkey);
+       wpabuf_free(conf->wps_nfc_dev_pw);
 #endif /* CONFIG_WPS */
 
        os_free(conf->roaming_consortium);
+       os_free(conf->venue_name);
+       os_free(conf->nai_realm_data);
+       os_free(conf->network_auth_type);
+       os_free(conf->anqp_3gpp_cell_net);
+       os_free(conf->domain_name);
 
 #ifdef CONFIG_RADIUS_TEST
        os_free(conf->dump_msk_file);
 #endif /* CONFIG_RADIUS_TEST */
+
+#ifdef CONFIG_HS20
+       os_free(conf->hs20_oper_friendly_name);
+       os_free(conf->hs20_wan_metrics);
+       os_free(conf->hs20_connection_capability);
+       os_free(conf->hs20_operating_class);
+#endif /* CONFIG_HS20 */
+
+       wpabuf_free(conf->vendor_elements);
+
+       os_free(conf->sae_groups);
 }
 
 
@@ -576,57 +627,3 @@ const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
 
        return NULL;
 }
-
-
-const struct hostapd_eap_user *
-hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
-                    size_t identity_len, int phase2)
-{
-       struct hostapd_eap_user *user = conf->eap_user;
-
-#ifdef CONFIG_WPS
-       if (conf->wps_state && identity_len == WSC_ID_ENROLLEE_LEN &&
-           os_memcmp(identity, WSC_ID_ENROLLEE, WSC_ID_ENROLLEE_LEN) == 0) {
-               static struct hostapd_eap_user wsc_enrollee;
-               os_memset(&wsc_enrollee, 0, sizeof(wsc_enrollee));
-               wsc_enrollee.methods[0].method = eap_server_get_type(
-                       "WSC", &wsc_enrollee.methods[0].vendor);
-               return &wsc_enrollee;
-       }
-
-       if (conf->wps_state && identity_len == WSC_ID_REGISTRAR_LEN &&
-           os_memcmp(identity, WSC_ID_REGISTRAR, WSC_ID_REGISTRAR_LEN) == 0) {
-               static struct hostapd_eap_user wsc_registrar;
-               os_memset(&wsc_registrar, 0, sizeof(wsc_registrar));
-               wsc_registrar.methods[0].method = eap_server_get_type(
-                       "WSC", &wsc_registrar.methods[0].vendor);
-               wsc_registrar.password = (u8 *) conf->ap_pin;
-               wsc_registrar.password_len = conf->ap_pin ?
-                       os_strlen(conf->ap_pin) : 0;
-               return &wsc_registrar;
-       }
-#endif /* CONFIG_WPS */
-
-       while (user) {
-               if (!phase2 && user->identity == NULL) {
-                       /* Wildcard match */
-                       break;
-               }
-
-               if (user->phase2 == !!phase2 && user->wildcard_prefix &&
-                   identity_len >= user->identity_len &&
-                   os_memcmp(user->identity, identity, user->identity_len) ==
-                   0) {
-                       /* Wildcard prefix match */
-                       break;
-               }
-
-               if (user->phase2 == !!phase2 &&
-                   user->identity_len == identity_len &&
-                   os_memcmp(user->identity, identity, identity_len) == 0)
-                       break;
-               user = user->next;
-       }
-
-       return user;
-}