hostapd: fix parsing HT secondary channel offset
authorFelix Fietkau <nbd@nbd.name>
Sat, 2 Sep 2023 17:36:21 +0000 (19:36 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 2 Sep 2023 17:39:24 +0000 (19:39 +0200)
It returned the wrong value when using HT40-

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/services/hostapd/src/wpa_supplicant/ucode.c

index d0a78d16253539ba6810ed30036d07278d1cba5d..d120ed6217d6e9ad71db8c31caa413e0bf1f0b0b 100644 (file)
@@ -211,12 +211,13 @@ uc_wpas_iface_status(uc_vm_t *vm, size_t nargs)
                ie = wpa_bss_get_ie(bss, WLAN_EID_HT_OPERATION);
                if (ie && ie[1] >= 2) {
                        const struct ieee80211_ht_operation *ht_oper;
+                       int sec;
 
                        ht_oper = (const void *) (ie + 2);
-                       if (ht_oper->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE)
+                       sec = ht_oper->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
+                       if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE)
                                sec_chan = 1;
-                       else if (ht_oper->ht_param &
-                                HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW)
+                       else if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW)
                                sec_chan = -1;
                }