]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: Add a csa_ie_only testing option
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 12 Jan 2025 08:30:54 +0000 (10:30 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 26 Jan 2025 16:20:34 +0000 (18:20 +0200)
This allows hostapd to be configured to add the CSA IE and not the ECSA
IE to mimic behavior of some APs.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.h
src/ap/beacon.c
tests/hwsim/test_ap_csa.py

index e9eaef7e5e7e54c74fa43400cd004158fbb4da52..a9d13f72a7964e94a07c86c0601e8c475d2b9c8e 100644 (file)
@@ -4501,6 +4501,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
        PARSE_TEST_PROBABILITY(corrupt_gtk_rekey_mic_probability)
        } else if (os_strcmp(buf, "ecsa_ie_only") == 0) {
                conf->ecsa_ie_only = atoi(pos);
+       } else if (os_strcmp(buf, "csa_ie_only") == 0) {
+               conf->csa_ie_only = atoi(pos);
        } else if (os_strcmp(buf, "bss_load_test") == 0) {
                WPA_PUT_LE16(bss->bss_load_test, atoi(pos));
                pos = os_strchr(pos, ':');
index aa56562bddda37cb7acfa7d7edc85f61460977d1..0d7310d17c39c548b9c1508081d7669c16af1089 100644 (file)
@@ -3350,6 +3350,10 @@ own_ip_addr=127.0.0.1
 # (channel switch operating class is needed)
 #ecsa_ie_only=0
 #
+# Include only CSA IE without ECSA IE
+# (the operating class is not mentioned)
+#csa_ie_only=0
+
 # Delay EAPOL-Key messages 1/4 and 3/4 by not sending the frame until the last
 # attempt (wpa_pairwise_update_count). This will trigger a timeout on all
 # previous attempts and thus delays the frame. (testing only)
index 97768f8e1a0fc73bfb3a14d98c5ec36f6ba29ed6..3d039d0e8be602c642578ea77b94abe586f9c206 100644 (file)
@@ -1154,6 +1154,7 @@ struct hostapd_config {
        double ignore_reassoc_probability;
        double corrupt_gtk_rekey_mic_probability;
        int ecsa_ie_only;
+       int csa_ie_only;
        bool delay_eapol_tx;
 #endif /* CONFIG_TESTING_OPTIONS */
 
index 5d50a9d9fc900961ffed70d01e0ae3ae6456f447..95332dae2b9abdf71d5aa675cf44eea124389a9d 100644 (file)
@@ -516,6 +516,11 @@ static u8 * hostapd_eid_ecsa(struct hostapd_data *hapd, u8 *eid)
        if (!hapd->cs_freq_params.channel || !hapd->iface->cs_oper_class)
                return eid;
 
+#ifdef CONFIG_TESTING_OPTIONS
+       if (hapd->iconf->csa_ie_only)
+               return eid;
+#endif /* CONFIG_TESTING_OPTIONS */
+
        *eid++ = WLAN_EID_EXT_CHANSWITCH_ANN;
        *eid++ = 4;
        *eid++ = hapd->cs_block_tx;
index ae1162c993099e22ad4d850a2bf3032b69b3820d..8adf77e68995a91b1632e05c354b7125d0925bdf 100644 (file)
@@ -172,6 +172,17 @@ def test_ap_csa_ecsa_only(dev, apdev):
     wait_channel_switch(dev[0], 2462)
     hwsim_utils.test_connectivity(dev[0], ap)
 
+@remote_compatible
+def test_ap_csa_csa_only(dev, apdev):
+    """AP Channel Switch, one switch with only CSA IE"""
+    csa_supported(dev[0])
+    ap = connect(dev[0], apdev, csa_ie_only="1")
+
+    hwsim_utils.test_connectivity(dev[0], ap)
+    switch_channel(ap, 10, 2462, extra="ht")
+    wait_channel_switch(dev[0], 2462)
+    hwsim_utils.test_connectivity(dev[0], ap)
+
 @remote_compatible
 def test_ap_csa_invalid(dev, apdev):
     """AP Channel Switch - invalid channel"""