difos/package/network/utils/iw/patches/102-iw-fix-HE-operation-on-Big-Endian-platforms.patch
Aleksander Jan Bajkowski b1215758e1 iw: fix WiFi 6 (HE) Scan on big endian platforms
On big endian platforms, scans show invalid info for WiFi 6 APs.
This commit backports patches to fix this issue.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://github.com/openwrt/openwrt/pull/18717
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-05-06 19:30:18 +02:00

36 lines
1.4 KiB
Diff

From 41a07a818090da424ddd24bf07f468cf5725cdc6 Mon Sep 17 00:00:00 2001
From: Aleksander Jan Bajkowski <olek2@wp.pl>
Date: Sat, 5 Apr 2025 20:48:06 +0200
Subject: [PATCH 2/2] iw: fix HE operation on Big Endian platforms
IE fields are encoded in Little Endian and are not correctly
printed on Big Endian platforms.
Fixes: 422419e06d55 ("scan: Add printing of HE Operation Element")
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://patch.msgid.link/20250405184807.701728-3-olek2@wp.pl
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/util.c
+++ b/util.c
@@ -1738,7 +1738,7 @@ void print_he_operation(const uint8_t *i
{
uint8_t oper_parameters[3] = {ie[0], ie[1], ie[2] };
uint8_t bss_color = ie[3];
- uint16_t nss_mcs_set = *(uint16_t*)(&ie[4]);
+ uint16_t nss_mcs_set = le16toh(*(uint16_t *)(&ie[4]));
uint8_t vht_oper_present = oper_parameters[1] & 0x40;
uint8_t co_hosted_bss_present = oper_parameters[1] & 0x80;
uint8_t uhb_operation_info_present = oper_parameters[2] & 0x02;
@@ -1751,7 +1751,7 @@ void print_he_operation(const uint8_t *i
printf("\t\t\tTWT Required\n");
printf("\t\t\tTXOP Duration RTS Threshold: %hu\n",
- (*(uint16_t*)(oper_parameters)) >> 4 & 0x03ff);
+ le16toh((*(uint16_t *)(oper_parameters))) >> 4 & 0x03ff);
if (oper_parameters[1] & 0x40)
printf("\t\t\tVHT Operation Information Present\n");