tests: Fix wlan.mesh.config.cap workaround for test_wpas_mesh_max_peering

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@sipsolutions.net>
Fixes: 2cbaf0de22 ("tests: Work around tshark bug in wpas_mesh_max_peering")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
Sven Eckelmann 2019-07-12 12:48:53 +02:00 committed by Jouni Malinen
parent 05822609d1
commit d1fcf34cb5

View file

@ -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: