From 7cac255632e61f07bb33ba102e7b4370a26a9a02 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 16 Apr 2019 14:33:59 +0200 Subject: [PATCH] HE: Fix Operation Parameters order According to P802.11ax/D4.0 9.4.2.238 (HE Operation element) the BSS Color Information field is located after the HE Operation Parameters field. Fix the ordering of the bit masks/offsets for fields in these 3+1 octets used as a single 32-bit value. With these changes, Wireshark 3.2 is able to properly parse and display Beacon frames. Signed-off-by: Shashidhar Lakkavalli Signed-off-by: John Crispin --- src/ap/ieee802_11_he.c | 8 +++++--- src/common/ieee802_11_defs.h | 31 ++++++++++++++++--------------- 2 files changed, 21 insertions(+), 18 deletions(-) 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 adaa89310..edc7909db 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -2128,21 +2128,22 @@ 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_MASK ((u32) (BIT(0) | BIT(1) | \ + BIT(2))) +#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;