From 0b1b2044cc6c0edd016ab934270b5527ed9314bf Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 13 Jun 2016 00:04:47 +0300 Subject: [PATCH] tests: Add sniffer check to wpas_mesh_max_peering This verifies that the Accepting Additional Mesh Peerings field is being cleared properly when the maximum peer links count is reached. Signed-off-by: Jouni Malinen --- tests/hwsim/test_wpas_mesh.py | 36 ++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py index fc0abca6a..69762ab28 100644 --- a/tests/hwsim/test_wpas_mesh.py +++ b/tests/hwsim/test_wpas_mesh.py @@ -515,7 +515,7 @@ def test_wpas_mesh_dynamic_interface(dev): if mesh1: dev[1].request("MESH_GROUP_REMOVE " + mesh1) -def test_wpas_mesh_max_peering(dev, apdev): +def test_wpas_mesh_max_peering(dev, apdev, params): """Mesh max peering limit""" check_mesh_support(dev[0]) try: @@ -551,6 +551,40 @@ def test_wpas_mesh_max_peering(dev, apdev): finally: dev[0].request("SET max_peer_links 99") + addr0 = dev[0].own_addr() + addr1 = dev[1].own_addr() + addr2 = dev[2].own_addr() + + capfile = os.path.join(params['logdir'], "hwsim0.pcapng") + filt = "wlan.fc.type_subtype == 8" + out = run_tshark(capfile, filt, [ "wlan.sa", "wlan.mesh.config.cap" ]) + pkts = out.splitlines() + one = [ 0, 0, 0 ] + zero = [ 0, 0, 0 ] + for pkt in pkts: + addr, cap = pkt.split('\t') + cap = int(cap, 16) + if addr == addr0: + idx = 0 + elif addr == addr1: + idx = 1 + elif addr == addr2: + idx = 2 + else: + continue + if cap & 0x01: + one[idx] += 1 + else: + zero[idx] += 1 + logger.info("one: " + str(one)) + logger.info("zero: " + str(zero)) + if zero[0] == 0: + raise Exception("Accepting Additional Mesh Peerings not cleared") + if one[0] == 0: + raise Exception("Accepting Additional Mesh Peerings was not set in the first Beacon frame") + if zero[1] > 0 or zero[2] > 0 or one[1] == 0 or one[2] == 0: + raise Exception("Unexpected value in Accepting Additional Mesh Peerings from other STAs") + def test_wpas_mesh_open_5ghz(dev, apdev): """wpa_supplicant open MESH network on 5 GHz band""" try: