]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - src/ap/ap_config.c
macsec: Add configuration parameters for hostapd
[thirdparty/hostap.git] / src / ap / ap_config.c
index e640e9984b70ef8bded3e18eda042f037d671dbf..48d09bcf9d121f71601529e21ad4778d3d288c3b 100644 (file)
 #include "crypto/tls.h"
 #include "radius/radius_client.h"
 #include "common/ieee802_11_defs.h"
+#include "common/ieee802_1x_defs.h"
 #include "common/eapol_common.h"
 #include "common/dhcp.h"
 #include "eap_common/eap_wsc_common.h"
 #include "eap_server/eap.h"
 #include "wpa_auth.h"
 #include "sta_info.h"
+#include "airtime_policy.h"
 #include "ap_config.h"
 
 
@@ -138,6 +140,11 @@ void hostapd_config_defaults_bss(struct hostapd_bss_config *bss)
        bss->hs20_release = (HS20_VERSION >> 4) + 1;
 #endif /* CONFIG_HS20 */
 
+#ifdef CONFIG_MACSEC
+       bss->mka_priority = DEFAULT_PRIO_NOT_KEY_SERVER;
+       bss->macsec_port = 1;
+#endif /* CONFIG_MACSEC */
+
        /* Default to strict CRL checking. */
        bss->check_crl_strict = 1;
 }
@@ -236,6 +243,13 @@ struct hostapd_config * hostapd_config_defaults(void)
        conf->acs_num_scans = 5;
 #endif /* CONFIG_ACS */
 
+#ifdef CONFIG_IEEE80211AX
+       conf->he_op.he_rts_threshold = HE_OPERATION_RTS_THRESHOLD_MASK >>
+               HE_OPERATION_RTS_THRESHOLD_OFFSET;
+       /* Set default basic MCS/NSS set to single stream MCS 0-7 */
+       conf->he_op.he_basic_mcs_nss_set = 0xfffc;
+#endif /* CONFIG_IEEE80211AX */
+
        /* The third octet of the country string uses an ASCII space character
         * by default to indicate that the regulations encompass all
         * environments for the current frequency band in the country. */
@@ -244,6 +258,10 @@ struct hostapd_config * hostapd_config_defaults(void)
        conf->rssi_reject_assoc_rssi = 0;
        conf->rssi_reject_assoc_timeout = 30;
 
+#ifdef CONFIG_AIRTIME_POLICY
+       conf->airtime_update_interval = AIRTIME_DEFAULT_UPDATE_INTERVAL;
+#endif /* CONFIG_AIRTIME_POLICY */
+
        return conf;
 }
 
@@ -559,6 +577,20 @@ static void hostapd_config_free_sae_passwords(struct hostapd_bss_config *conf)
 }
 
 
+#ifdef CONFIG_DPP2
+static void hostapd_dpp_controller_conf_free(struct dpp_controller_conf *conf)
+{
+       struct dpp_controller_conf *prev;
+
+       while (conf) {
+               prev = conf;
+               conf = conf->next;
+               os_free(prev);
+       }
+}
+#endif /* CONFIG_DPP2 */
+
+
 void hostapd_config_free_bss(struct hostapd_bss_config *conf)
 {
        if (conf == NULL)
@@ -740,10 +772,27 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)
        os_free(conf->dpp_connector);
        wpabuf_free(conf->dpp_netaccesskey);
        wpabuf_free(conf->dpp_csign);
+#ifdef CONFIG_DPP2
+       hostapd_dpp_controller_conf_free(conf->dpp_controller);
+#endif /* CONFIG_DPP2 */
 #endif /* CONFIG_DPP */
 
        hostapd_config_free_sae_passwords(conf);
 
+#ifdef CONFIG_AIRTIME_POLICY
+       {
+               struct airtime_sta_weight *wt, *wt_prev;
+
+               wt = conf->airtime_weight_list;
+               conf->airtime_weight_list = NULL;
+               while (wt) {
+                       wt_prev = wt;
+                       wt = wt->next;
+                       os_free(wt_prev);
+               }
+       }
+#endif /* CONFIG_AIRTIME_POLICY */
+
        os_free(conf);
 }
 
@@ -1140,6 +1189,13 @@ int hostapd_config_check(struct hostapd_config *conf, int full_config)
                return -1;
        }
 
+#ifdef CONFIG_AIRTIME_POLICY
+       if (full_config && conf->airtime_mode > AIRTIME_MODE_STATIC &&
+           !conf->airtime_update_interval) {
+               wpa_printf(MSG_ERROR, "Airtime update interval cannot be zero");
+               return -1;
+       }
+#endif /* CONFIG_AIRTIME_POLICY */
        for (i = 0; i < NUM_TX_QUEUES; i++) {
                if (hostapd_config_check_cw(conf, i))
                        return -1;