]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - hostapd/config_file.c
AP: Support Extended Key ID
[thirdparty/hostap.git] / hostapd / config_file.c
index e6033e7ab4385a75865e309355719445fe058e1f..2bc0679b5c3d4482a1284cc5d4949a737d903dd2 100644 (file)
@@ -793,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)
 {
@@ -843,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)
@@ -1151,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)
 {
@@ -1171,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]"))
@@ -1212,7 +1205,6 @@ static int hostapd_config_ht_capab(struct hostapd_config *conf,
 
        return 0;
 }
-#endif /* CONFIG_IEEE80211N */
 
 
 #ifdef CONFIG_IEEE80211AC
@@ -2674,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);
 
@@ -2701,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) {
@@ -2875,6 +2869,16 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                }
        } else if (os_strcmp(buf, "wpa") == 0) {
                bss->wpa = atoi(pos);
+       } else if (os_strcmp(buf, "extended_key_id") == 0) {
+               int val = atoi(pos);
+
+               if (bss->extended_key_id < 0 || bss->extended_key_id > 2) {
+                       wpa_printf(MSG_ERROR,
+                                  "Line %d: Invalid extended_key_id=%d; allowed range 0..2",
+                                  line, bss->extended_key_id);
+                       return 1;
+               }
+               bss->extended_key_id = val;
        } else if (os_strcmp(buf, "wpa_group_rekey") == 0) {
                bss->wpa_group_rekey = atoi(pos);
                bss->wpa_group_rekey_set = 1;
@@ -2884,6 +2888,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);
@@ -3136,6 +3149,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
@@ -3160,6 +3175,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                                   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
@@ -3301,6 +3325,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) {
@@ -3319,6 +3344,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);
@@ -3397,6 +3423,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) {
@@ -3417,7 +3445,6 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                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) {
@@ -3430,7 +3457,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);
@@ -3463,7 +3489,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) {
@@ -3751,6 +3780,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);
@@ -4154,6 +4186,26 @@ 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, "rsne_override_ft") == 0) {
+               wpabuf_free(bss->rsne_override_ft);
+               bss->rsne_override_ft = wpabuf_parse_bin(pos);
+       } else if (os_strcmp(buf, "rsnxe_override_ft") == 0) {
+               wpabuf_free(bss->rsnxe_override_ft);
+               bss->rsnxe_override_ft = 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);
+       } else if (os_strcmp(buf, "no_beacon_rsnxe") == 0) {
+               bss->no_beacon_rsnxe = atoi(pos);
 #endif /* CONFIG_TESTING_OPTIONS */
 #ifdef CONFIG_SAE
        } else if (os_strcmp(buf, "sae_password") == 0) {
@@ -4184,6 +4236,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                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) {
@@ -4387,9 +4441,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);