[PATCH] tests: Fix wlan.mesh.config.cap workaround for test_wpas_mesh_max_peering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The wlan.mesh.config doesn't have to be the last element of beacon. Things
like VHT or HE oper/cap are usually follow the mesh configuration element.

The workaround must first get the position of a correct reference value in
wlan.mesh.config (ps_protocol) and then calculate the correct
wlan.mesh.config.cap offset based on that.

Reported-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
Fixes: 2cbaf0de223b ("tests: Work around tshark bug in wpas_mesh_max_peering")
Signed-off-by: Sven Eckelmann <sven@xxxxxxxxxxxxx>
---
Just as additional information:

This problem was introduced for wireshark in commit 3c427376579a ("802.11:
Use proto_tree_add_bitmask") - part of 2.4.0-rc0. The fix was added after
3.0.0 with commit f3ef8575d462 ("ieee80211: fix wrong offset for mesh
configuration capability bitmask")
---
 tests/hwsim/test_wpas_mesh.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py
index 5b8b16602..cb1bb8c31 100644
--- a/tests/hwsim/test_wpas_mesh.py
+++ b/tests/hwsim/test_wpas_mesh.py
@@ -877,8 +877,21 @@ def test_wpas_mesh_max_peering(dev, apdev, params):
             out = run_tshark_json(capfile, filt + " && wlan.sa == " + addr)
             pkts = json.loads(out)
             for pkt in pkts:
+                wlan = pkt["_source"]["layers"]["wlan"]
+                if "wlan.tagged.all" not in wlan:
+                    continue
+
+                tagged = wlan["wlan.tagged.all"]
+                if "wlan.tag" not in tagged:
+                    continue
+
+                wlan_tag = tagged["wlan.tag"]
+                if "wlan.mesh.config.ps_protocol_raw" not in wlan_tag:
+                    continue
+
                 frame = pkt["_source"]["layers"]["frame_raw"][0]
-                cap = int(frame[-2:], 16)
+                cap_offset = wlan_tag["wlan.mesh.config.ps_protocol_raw"][1] + 6
+                cap = int(frame[(cap_offset * 2):(cap_offset * 2 + 2)], 16)
                 if cap & 0x01:
                     one[idx] += 1
                 else:
-- 
2.20.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux