[PATCH] AP: Add a csa_ie_only testing option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Emmanuel Grumbach <emmanuel.grumbach@xxxxxxxxx>

This allows to configure hostapd to add the CSA IE and not the
ECSA IE, to mimic behaviour of some AP's.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@xxxxxxxxx>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@xxxxxxxxx>
---
 hostapd/config_file.c      |  2 ++
 hostapd/hostapd.conf       |  4 ++++
 src/ap/ap_config.h         |  1 +
 src/ap/beacon.c            |  5 +++++
 tests/hwsim/test_ap_csa.py | 11 +++++++++++
 5 files changed, 23 insertions(+)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 12d1d9fb0d..8f637fdb60 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -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, ':');
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index b1e8ac5bba..eea39c8155 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -3340,6 +3340,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)
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 2f9ed3af88..b936702df6 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1153,6 +1153,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 */
 
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 542768daa4..225f314b34 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -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;
diff --git a/tests/hwsim/test_ap_csa.py b/tests/hwsim/test_ap_csa.py
index ae1162c993..8adf77e689 100644
--- a/tests/hwsim/test_ap_csa.py
+++ b/tests/hwsim/test_ap_csa.py
@@ -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"""
-- 
2.43.0


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux