]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - hostapd/config_file.c
Allow RSNE in EAPOL-Key msg 3/4 to be replaced for testing purposes
[thirdparty/hostap.git] / hostapd / config_file.c
index 4a2f12d94dafbe9d3e56b2b39b9e3b95a0c9db9b..98e9fd21b605a5591c02676dbd8de3100da895b1 100644 (file)
@@ -711,12 +711,10 @@ static int hostapd_config_parse_key_mgmt(int line, const char *value)
                        val |= WPA_KEY_MGMT_FT_IEEE8021X_SHA384;
 #endif /* CONFIG_SHA384 */
 #endif /* CONFIG_IEEE80211R_AP */
-#ifdef CONFIG_IEEE80211W
                else if (os_strcmp(start, "WPA-PSK-SHA256") == 0)
                        val |= WPA_KEY_MGMT_PSK_SHA256;
                else if (os_strcmp(start, "WPA-EAP-SHA256") == 0)
                        val |= WPA_KEY_MGMT_IEEE8021X_SHA256;
-#endif /* CONFIG_IEEE80211W */
 #ifdef CONFIG_SAE
                else if (os_strcmp(start, "SAE") == 0)
                        val |= WPA_KEY_MGMT_SAE;
@@ -795,6 +793,7 @@ static int hostapd_config_parse_cipher(int line, const char *value)
 }
 
 
+#ifdef CONFIG_WEP
 static int hostapd_config_read_wep(struct hostapd_wep_keys *wep, int keyidx,
                                   char *val)
 {
@@ -845,6 +844,7 @@ static int hostapd_config_read_wep(struct hostapd_wep_keys *wep, int keyidx,
 
        return 0;
 }
+#endif /* CONFIG_WEP */
 
 
 static int hostapd_parse_chanlist(struct hostapd_config *conf, char *val)
@@ -1153,7 +1153,6 @@ static int add_r1kh(struct hostapd_bss_config *bss, char *value)
 #endif /* CONFIG_IEEE80211R_AP */
 
 
-#ifdef CONFIG_IEEE80211N
 static int hostapd_config_ht_capab(struct hostapd_config *conf,
                                   const char *capab)
 {
@@ -1173,14 +1172,6 @@ static int hostapd_config_ht_capab(struct hostapd_config *conf,
        }
        if (!os_strstr(capab, "[HT40+]") && !os_strstr(capab, "[HT40-]"))
                conf->secondary_channel = 0;
-       if (os_strstr(capab, "[SMPS-STATIC]")) {
-               conf->ht_capab &= ~HT_CAP_INFO_SMPS_MASK;
-               conf->ht_capab |= HT_CAP_INFO_SMPS_STATIC;
-       }
-       if (os_strstr(capab, "[SMPS-DYNAMIC]")) {
-               conf->ht_capab &= ~HT_CAP_INFO_SMPS_MASK;
-               conf->ht_capab |= HT_CAP_INFO_SMPS_DYNAMIC;
-       }
        if (os_strstr(capab, "[GF]"))
                conf->ht_capab |= HT_CAP_INFO_GREEN_FIELD;
        if (os_strstr(capab, "[SHORT-GI-20]"))
@@ -1214,7 +1205,6 @@ static int hostapd_config_ht_capab(struct hostapd_config *conf,
 
        return 0;
 }
-#endif /* CONFIG_IEEE80211N */
 
 
 #ifdef CONFIG_IEEE80211AC
@@ -2547,6 +2537,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                bss->tls_session_lifetime = atoi(pos);
        } else if (os_strcmp(buf, "tls_flags") == 0) {
                bss->tls_flags = parse_tls_flags(pos);
+       } else if (os_strcmp(buf, "max_auth_rounds") == 0) {
+               bss->max_auth_rounds = atoi(pos);
+       } else if (os_strcmp(buf, "max_auth_rounds_short") == 0) {
+               bss->max_auth_rounds_short = atoi(pos);
        } else if (os_strcmp(buf, "ocsp_stapling_response") == 0) {
                os_free(bss->ocsp_stapling_response);
                bss->ocsp_stapling_response = os_strdup(pos);
@@ -2672,6 +2666,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
        } else if (os_strcmp(buf, "erp_domain") == 0) {
                os_free(bss->erp_domain);
                bss->erp_domain = os_strdup(pos);
+#ifdef CONFIG_WEP
        } else if (os_strcmp(buf, "wep_key_len_broadcast") == 0) {
                int val = atoi(pos);
 
@@ -2699,6 +2694,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                                   line, bss->wep_rekeying_period);
                        return 1;
                }
+#endif /* CONFIG_WEP */
        } else if (os_strcmp(buf, "eap_reauth_period") == 0) {
                bss->eap_reauth_period = atoi(pos);
                if (bss->eap_reauth_period < 0) {
@@ -2710,8 +2706,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                bss->eapol_key_index_workaround = atoi(pos);
 #ifdef CONFIG_IAPP
        } else if (os_strcmp(buf, "iapp_interface") == 0) {
-               bss->ieee802_11f = 1;
-               os_strlcpy(bss->iapp_iface, pos, sizeof(bss->iapp_iface));
+               wpa_printf(MSG_INFO, "DEPRECATED: iapp_interface not used");
 #endif /* CONFIG_IAPP */
        } else if (os_strcmp(buf, "own_ip_addr") == 0) {
                if (hostapd_parse_ip_addr(pos, &bss->own_ip_addr)) {
@@ -2883,6 +2878,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                bss->wpa_gmk_rekey = atoi(pos);
        } else if (os_strcmp(buf, "wpa_ptk_rekey") == 0) {
                bss->wpa_ptk_rekey = atoi(pos);
+       } else if (os_strcmp(buf, "wpa_deny_ptk0_rekey") == 0) {
+               bss->wpa_deny_ptk0_rekey = atoi(pos);
+               if (bss->wpa_deny_ptk0_rekey < 0 ||
+                   bss->wpa_deny_ptk0_rekey > 2) {
+                       wpa_printf(MSG_ERROR,
+                                  "Line %d: Invalid wpa_deny_ptk0_rekey=%d; allowed range 0..2",
+                                  line, bss->wpa_deny_ptk0_rekey);
+                       return 1;
+               }
        } else if (os_strcmp(buf, "wpa_group_update_count") == 0) {
                char *endp;
                unsigned long val = strtoul(pos, &endp, 0);
@@ -3135,6 +3139,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                }
        } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) {
                conf->acs_exclude_dfs = atoi(pos);
+       } else if (os_strcmp(buf, "op_class") == 0) {
+               conf->op_class = atoi(pos);
        } else if (os_strcmp(buf, "channel") == 0) {
                if (os_strcmp(pos, "acs_survey") == 0) {
 #ifndef CONFIG_ACS
@@ -3149,12 +3155,25 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                        conf->channel = atoi(pos);
                        conf->acs = conf->channel == 0;
                }
+       } else if (os_strcmp(buf, "edmg_channel") == 0) {
+               conf->edmg_channel = atoi(pos);
+       } else if (os_strcmp(buf, "enable_edmg") == 0) {
+               conf->enable_edmg = atoi(pos);
        } else if (os_strcmp(buf, "chanlist") == 0) {
                if (hostapd_parse_chanlist(conf, pos)) {
                        wpa_printf(MSG_ERROR, "Line %d: invalid channel list",
                                   line);
                        return 1;
                }
+       } else if (os_strcmp(buf, "freqlist") == 0) {
+               if (freq_range_list_parse(&conf->acs_freq_list, pos)) {
+                       wpa_printf(MSG_ERROR, "Line %d: invalid frequency list",
+                                  line);
+                       return 1;
+               }
+               conf->acs_freq_list_present = 1;
+       } else if (os_strcmp(buf, "acs_exclude_6ghz_non_psc") == 0) {
+               conf->acs_exclude_6ghz_non_psc = atoi(pos);
        } else if (os_strcmp(buf, "beacon_int") == 0) {
                int val = atoi(pos);
                /* MIB defines range as 1..65535, but very small values
@@ -3296,6 +3315,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                bss->ignore_broadcast_ssid = atoi(pos);
        } else if (os_strcmp(buf, "no_probe_resp_if_max_sta") == 0) {
                bss->no_probe_resp_if_max_sta = atoi(pos);
+#ifdef CONFIG_WEP
        } else if (os_strcmp(buf, "wep_default_key") == 0) {
                bss->ssid.wep.idx = atoi(pos);
                if (bss->ssid.wep.idx > 3) {
@@ -3314,6 +3334,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                                   line, buf);
                        return 1;
                }
+#endif /* CONFIG_WEP */
 #ifndef CONFIG_NO_VLAN
        } else if (os_strcmp(buf, "dynamic_vlan") == 0) {
                bss->ssid.dynamic_vlan = atoi(pos);
@@ -3376,7 +3397,6 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                }
        } else if (os_strcmp(buf, "use_driver_iface_addr") == 0) {
                conf->use_driver_iface_addr = atoi(pos);
-#ifdef CONFIG_IEEE80211W
        } else if (os_strcmp(buf, "ieee80211w") == 0) {
                bss->ieee80211w = atoi(pos);
        } else if (os_strcmp(buf, "group_mgmt_cipher") == 0) {
@@ -3393,6 +3413,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                                   line, pos);
                        return 1;
                }
+       } else if (os_strcmp(buf, "beacon_prot") == 0) {
+               bss->beacon_prot = atoi(pos);
        } else if (os_strcmp(buf, "assoc_sa_query_max_timeout") == 0) {
                bss->assoc_sa_query_max_timeout = atoi(pos);
                if (bss->assoc_sa_query_max_timeout == 0) {
@@ -3407,14 +3429,12 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                                   line);
                        return 1;
                }
-#endif /* CONFIG_IEEE80211W */
 #ifdef CONFIG_OCV
        } else if (os_strcmp(buf, "ocv") == 0) {
                bss->ocv = atoi(pos);
                if (bss->ocv && !bss->ieee80211w)
                        bss->ieee80211w = 1;
 #endif /* CONFIG_OCV */
-#ifdef CONFIG_IEEE80211N
        } else if (os_strcmp(buf, "ieee80211n") == 0) {
                conf->ieee80211n = atoi(pos);
        } else if (os_strcmp(buf, "ht_capab") == 0) {
@@ -3427,7 +3447,6 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                conf->require_ht = atoi(pos);
        } else if (os_strcmp(buf, "obss_interval") == 0) {
                conf->obss_interval = atoi(pos);
-#endif /* CONFIG_IEEE80211N */
 #ifdef CONFIG_IEEE80211AC
        } else if (os_strcmp(buf, "ieee80211ac") == 0) {
                conf->ieee80211ac = atoi(pos);
@@ -3460,7 +3479,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
        } else if (os_strcmp(buf, "he_mu_beamformer") == 0) {
                conf->he_phy_capab.he_mu_beamformer = atoi(pos);
        } else if (os_strcmp(buf, "he_bss_color") == 0) {
-               conf->he_op.he_bss_color = atoi(pos);
+               conf->he_op.he_bss_color = atoi(pos) & 0x3f;
+               conf->he_op.he_bss_color_disabled = 0;
+       } else if (os_strcmp(buf, "he_bss_color_partial") == 0) {
+               conf->he_op.he_bss_color_partial = atoi(pos);
        } else if (os_strcmp(buf, "he_default_pe_duration") == 0) {
                conf->he_op.he_default_pe_duration = atoi(pos);
        } else if (os_strcmp(buf, "he_twt_required") == 0) {
@@ -3748,6 +3770,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
        } else if (os_strcmp(buf, "server_id") == 0) {
                os_free(bss->server_id);
                bss->server_id = os_strdup(pos);
+       } else if (os_strcmp(buf, "wps_application_ext") == 0) {
+               wpabuf_free(bss->wps_application_ext);
+               bss->wps_application_ext = wpabuf_parse_bin(pos);
 #ifdef CONFIG_WPS_NFC
        } else if (os_strcmp(buf, "wps_nfc_dev_pw_id") == 0) {
                bss->wps_nfc_dev_pw_id = atoi(pos);
@@ -4151,6 +4176,18 @@ static int hostapd_config_fill(struct hostapd_config *conf,
        } else if (os_strcmp(buf, "sae_commit_override") == 0) {
                wpabuf_free(bss->sae_commit_override);
                bss->sae_commit_override = wpabuf_parse_bin(pos);
+       } else if (os_strcmp(buf, "rsne_override_eapol") == 0) {
+               wpabuf_free(bss->rsne_override_eapol);
+               bss->rsne_override_eapol = wpabuf_parse_bin(pos);
+       } else if (os_strcmp(buf, "rsnxe_override_eapol") == 0) {
+               wpabuf_free(bss->rsnxe_override_eapol);
+               bss->rsnxe_override_eapol = wpabuf_parse_bin(pos);
+       } else if (os_strcmp(buf, "gtk_rsc_override") == 0) {
+               wpabuf_free(bss->gtk_rsc_override);
+               bss->gtk_rsc_override = wpabuf_parse_bin(pos);
+       } else if (os_strcmp(buf, "igtk_rsc_override") == 0) {
+               wpabuf_free(bss->igtk_rsc_override);
+               bss->igtk_rsc_override = wpabuf_parse_bin(pos);
 #endif /* CONFIG_TESTING_OPTIONS */
 #ifdef CONFIG_SAE
        } else if (os_strcmp(buf, "sae_password") == 0) {
@@ -4179,6 +4216,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                }
        } else if (os_strcmp(buf, "sae_require_mfp") == 0) {
                bss->sae_require_mfp = atoi(pos);
+       } else if (os_strcmp(buf, "sae_confirm_immediate") == 0) {
+               bss->sae_confirm_immediate = atoi(pos);
+       } else if (os_strcmp(buf, "sae_pwe") == 0) {
+               bss->sae_pwe = atoi(pos);
        } else if (os_strcmp(buf, "local_pwr_constraint") == 0) {
                int val = atoi(pos);
                if (val < 0 || val > 255) {
@@ -4328,6 +4369,12 @@ static int hostapd_config_fill(struct hostapd_config *conf,
        } else if (os_strcmp(buf, "broadcast_deauth") == 0) {
                bss->broadcast_deauth = atoi(pos);
 #ifdef CONFIG_DPP
+       } else if (os_strcmp(buf, "dpp_name") == 0) {
+               os_free(bss->dpp_name);
+               bss->dpp_name = os_strdup(pos);
+       } else if (os_strcmp(buf, "dpp_mud_url") == 0) {
+               os_free(bss->dpp_mud_url);
+               bss->dpp_mud_url = os_strdup(pos);
        } else if (os_strcmp(buf, "dpp_connector") == 0) {
                os_free(bss->dpp_connector);
                bss->dpp_connector = os_strdup(pos);
@@ -4376,9 +4423,11 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                                   line, pos);
                        return 1;
                }
+       } else if (os_strcmp(buf, "owe_ptk_workaround") == 0) {
+               bss->owe_ptk_workaround = atoi(pos);
+#endif /* CONFIG_OWE */
        } else if (os_strcmp(buf, "coloc_intf_reporting") == 0) {
                bss->coloc_intf_reporting = atoi(pos);
-#endif /* CONFIG_OWE */
        } else if (os_strcmp(buf, "multi_ap") == 0) {
                int val = atoi(pos);