[2/2] supplicant: Support disabling the supported-oper-class IE.

Message ID 1535137289-5425-2-git-send-email-greearb@candelatech.com
State New
Headers show
Series
  • [1/2] supported op class should take freq-list into account.
Related show

Commit Message

Ben Greear Aug. 24, 2018, 7:01 p.m.
From: Ben Greear <greearb@candelatech.com>

This provides a work-around for cases where the AP (most likely)
has bugs when this element exists and/or has 5Ghz elements when
the AP is evidently unexpecting that.

Test case that required this fix is a DPC3941 AP, configured with
2.4G radio to have WPA2 PSK.  Client station is ath10k 9880.
The symptom is that the client radio does not ack the 1/4 eapol.
I do not know exactly why, but maybe it is corrupted in some suble
way that I did not notice.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 wpa_supplicant/config.c            |  1 +
 wpa_supplicant/config.h            | 10 ++++++++++
 wpa_supplicant/sme.c               | 10 ++++++----
 wpa_supplicant/wpa_supplicant.c    |  2 +-
 wpa_supplicant/wpa_supplicant.conf |  9 +++++++++
 5 files changed, 27 insertions(+), 5 deletions(-)

Patch

diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 9b751ec..6e5c5d8 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -4745,6 +4745,7 @@  static const struct global_parse_data global_fields[] = {
 	{ INT(p2p_go_max_inactivity), 0 },
 	{ INT_RANGE(auto_interworking, 0, 1), 0 },
 	{ INT(okc), 0 },
+	{ INT(no_oper_classes_ie), 0 },
 	{ INT(pmf), 0 },
 	{ FUNC(sae_groups), 0 },
 	{ INT(dtim_period), 0 },
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index f9afd7a..8f562c8 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -1165,6 +1165,16 @@  struct wpa_config {
 	int okc;
 
 	/**
+	 * At least some APs (dpc3941) will not reliably associate a station on the
+	 * 2.4Ghz radio with at least some client devices (ath10k 9880) if the
+	 * supported operating classes IE advertises 2.4 and 5Ghz range
+	 * (81, 83, 84, 115 ... 130)
+	 * So, allow users to disable the operating-class IE in order to work around
+	 * this.
+	 */
+	int no_oper_classes_ie;
+
+	/**
 	 * pmf - Whether to enable/require PMF by default
 	 *
 	 * By default, PMF is disabled unless enabled by the per-network
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 90d0353..16dd61f 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -473,10 +473,12 @@  static void sme_send_authentication(struct wpa_supplicant *wpa_s,
 
 	sme_auth_handle_rrm(wpa_s, bss);
 
-	wpa_s->sme.assoc_req_ie_len += wpas_supp_op_class_ie(
-		wpa_s, bss->freq,
-		wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len,
-		sizeof(wpa_s->sme.assoc_req_ie) - wpa_s->sme.assoc_req_ie_len);
+	if (!wpa_s->conf->no_oper_classes_ie) {
+		wpa_s->sme.assoc_req_ie_len += wpas_supp_op_class_ie(
+			wpa_s, bss->freq,
+			wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len,
+			sizeof(wpa_s->sme.assoc_req_ie) - wpa_s->sme.assoc_req_ie_len);
+	}
 
 	if (params.p2p)
 		wpa_drv_get_ext_capa(wpa_s, WPA_IF_P2P_CLIENT);
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 2aef867..533cdd7 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2655,7 +2655,7 @@  static u8 * wpas_populate_assoc_ies(
 	os_memset(wpa_s->p2p_ip_addr_info, 0, sizeof(wpa_s->p2p_ip_addr_info));
 #endif /* CONFIG_P2P */
 
-	if (bss) {
+	if (bss && !(wpa_s->conf->no_oper_classes_ie)) {
 		wpa_ie_len += wpas_supp_op_class_ie(wpa_s, bss->freq,
 						    wpa_ie + wpa_ie_len,
 						    max_wpa_ie_len -
diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
index e3a5bcb..010695b 100644
--- a/wpa_supplicant/wpa_supplicant.conf
+++ b/wpa_supplicant/wpa_supplicant.conf
@@ -370,6 +370,15 @@  fast_reauth=1
 # can be disabled with per-network proactive_key_caching=0 parameter.
 #okc=0
 
+# At least some APs (dpc3941) will not reliably associate a station on the
+# 2.4Ghz radio with at least some client devices (ath10k 9880) if the
+# supported operating classes IE advertises 2.4 and 5Ghz range
+# (81, 83, 84, 115 ... 130)
+# So, allow users to disable the operating-class IE in order to work around
+# this.  Default is to set this to 0 (enable oper-classes-ie)
+# Set it to 1 to disable the oper-classes-ie
+#no_oper_classes_ie=0
+
 # Protected Management Frames default
 # This parameter can be used to set the default behavior for the ieee80211w
 # parameter for RSN networks. By default, PMF is disabled unless enabled with