[][MAC80211][hostapd][Fix rnr ie length when no need to report bss]
[Description]
Fix rnr ie length when no need to report bss. If we don't have content in
TBTT information, then don't change the length of the ie (*size_offset).
[Release-log]
N/A
Change-Id: Iab43fe50d9872b6a0287b3b9b54cbf134b598485
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7844854
diff --git a/autobuild_mac80211_release/package/network/services/hostapd_new/patches/mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch b/autobuild_mac80211_release/package/network/services/hostapd_new/patches/mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
new file mode 100644
index 0000000..9218f9b
--- /dev/null
+++ b/autobuild_mac80211_release/package/network/services/hostapd_new/patches/mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
@@ -0,0 +1,34 @@
+From ea3e20d6cc8d11750e509a701131297da81ef35d Mon Sep 17 00:00:00 2001
+From: "Allen.Ye" <allen.ye@mediatek.com>
+Date: Mon, 7 Aug 2023 15:27:27 +0800
+Subject: [PATCH 39/39] hostapd: mtk: Fix rnr ie length when no need to report
+ bss
+
+Fix rnr ie length when no need to report bss. If we don't have content in
+TBTT then don't change the length of the ie (*size_offset).
+
+Signed-off-by: Allen.Ye <allen.ye@mediatek.com>
+---
+ src/ap/ieee802_11.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
+index f20073c..ef520c8 100755
+--- a/src/ap/ieee802_11.c
++++ b/src/ap/ieee802_11.c
+@@ -7494,8 +7494,10 @@ static u8 * hostapd_eid_rnr_iface(struct hostapd_data *hapd,
+ }
+
+ start = i;
+- *tbtt_count_pos = RNR_TBTT_INFO_COUNT(tbtt_count - 1);
+- *size_offset = (eid - size_offset) - 1;
++ if (tbtt_count != 0) {
++ *tbtt_count_pos = RNR_TBTT_INFO_COUNT(tbtt_count - 1);
++ *size_offset = (eid - size_offset) - 1;
++ }
+ }
+
+ if (tbtt_count == 0)
+--
+2.18.0
+