diff mbox series

HE: Fix Operation Parameters order

Message ID 20190324122406.5212-1-john@phrozen.org
State Superseded
Headers show
Series HE: Fix Operation Parameters order | expand

Commit Message

John Crispin March 24, 2019, 12:24 p.m. UTC
According to D4.0 - 9.4.2.238 HE Operation element the BSS Color
Information field is located behind the Parameters field.

This patch fixes the ordering and post-apply wireshark3.2 is able
to properly parse and display beacon frames.

Signed-off-by: John Crispin <john@phrozen.org>
---
 src/ap/ieee802_11_he.c       |  8 +++++---
 src/common/ieee802_11_defs.h | 29 ++++++++++++++++-------------
 2 files changed, 21 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c
index 072135863..09ba6f231 100644
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -64,9 +64,6 @@  u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid)
 	oper = (struct ieee80211_he_operation *) pos;
 	os_memset(oper, 0, sizeof(*oper));
 
-	if (hapd->iface->conf->he_op.he_bss_color)
-		oper->he_oper_params |= hapd->iface->conf->he_op.he_bss_color;
-
 	if (hapd->iface->conf->he_op.he_default_pe_duration)
 		oper->he_oper_params |=
 			(hapd->iface->conf->he_op.he_default_pe_duration <<
@@ -80,6 +77,11 @@  u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid)
 			(hapd->iface->conf->he_op.he_rts_threshold <<
 			 HE_OPERATION_RTS_THRESHOLD_OFFSET);
 
+	if (hapd->iface->conf->he_op.he_bss_color)
+		oper->he_oper_params |=
+			(hapd->iface->conf->he_op.he_bss_color <<
+			 HE_OPERATION_BSS_COLOR_OFFSET);
+
 	/* TODO: conditional MaxBSSID Indicator subfield */
 
 	pos += sizeof(*oper);
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index b285d13a7..ff811d851 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2128,21 +2128,24 @@  struct ieee80211_he_operation {
 
 /* HE Operation defines */
 /* HE Operation Parameters and BSS Color Information fields */
-#define HE_OPERATION_BSS_COLOR_MASK		((u32) (BIT(0) | BIT(1) | \
-							BIT(2) | BIT(3) | \
-							BIT(4) | BIT(5)))
-#define HE_OPERATION_PARTIAL_BSS_COLOR		((u32) BIT(6))
-#define HE_OPERATION_BSS_COLOR_DISABLED		((u32) BIT(7))
 #define HE_OPERATION_DFLT_PE_DURATION_MASK	((u32) (BIT(8) | BIT(9) | \
 							BIT(10)))
-#define HE_OPERATION_DFLT_PE_DURATION_OFFSET	8
-#define HE_OPERATION_TWT_REQUIRED		((u32) BIT(11))
-#define HE_OPERATION_RTS_THRESHOLD_MASK	((u32) (BIT(12) | BIT(13) | \
-						BIT(14) | BIT(15) | \
-						BIT(16) | BIT(17) | \
-						BIT(18) | BIT(19) | \
-						BIT(20) | BIT(21)))
-#define HE_OPERATION_RTS_THRESHOLD_OFFSET	12
+#define HE_OPERATION_DFLT_PE_DURATION_OFFSET	0
+#define HE_OPERATION_TWT_REQUIRED		((u32) BIT(3))
+#define HE_OPERATION_RTS_THRESHOLD_MASK	((u32) (BIT(4) | BIT(5) | \
+						BIT(6) | BIT(7) | \
+						BIT(8) | BIT(9) | \
+						BIT(10) | BIT(11) | \
+						BIT(12) | BIT(13)))
+#define HE_OPERATION_RTS_THRESHOLD_OFFSET	4
+#define HE_OPERATION_BSS_COLOR_MASK		((u32) (BIT(24) | BIT(25) | \
+							BIT(26) | BIT(27) | \
+							BIT(28) | BIT(29)))
+#define HE_OPERATION_PARTIAL_BSS_COLOR		((u32) BIT(30))
+#define HE_OPERATION_BSS_COLOR_DISABLED		((u32) BIT(31))
+#define HE_OPERATION_BSS_COLOR_OFFSET		24
+
+
 
 struct ieee80211_he_mu_edca_parameter_set {
 	u8 he_qos_info;