From fe28ed3f29617e6b5f3e366fd5673c4fe2c65464 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 6 Feb 2016 21:24:48 +0200 Subject: [PATCH] tests: Secure mesh network plink counting during reconnection This verifies that num_plinks is decremented properly if a peer mesh STA reconnects without closing the link explicitly. Signed-off-by: Jouni Malinen --- tests/hwsim/test_wpas_mesh.py | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py index 3b56df36a..a05f686e2 100644 --- a/tests/hwsim/test_wpas_mesh.py +++ b/tests/hwsim/test_wpas_mesh.py @@ -663,3 +663,39 @@ def test_mesh_wpa_auth_init_oom(dev, apdev): ev = dev[0].wait_event(["MESH-GROUP-STARTED"], timeout=0.2) if ev is not None: raise Exception("Unexpected mesh group start during OOM") + +def test_wpas_mesh_reconnect(dev, apdev): + """Secure mesh network plink counting during reconnection""" + check_mesh_support(dev[0]) + try: + _test_wpas_mesh_reconnect(dev) + finally: + dev[0].request("SET max_peer_links 99") + +def _test_wpas_mesh_reconnect(dev): + dev[0].request("SET max_peer_links 2") + dev[0].request("SET sae_groups ") + id = add_mesh_secure_net(dev[0]) + dev[0].set_network(id, "beacon_int", "100") + dev[0].mesh_group_add(id) + dev[1].request("SET sae_groups ") + id = add_mesh_secure_net(dev[1]) + dev[1].mesh_group_add(id) + check_mesh_group_added(dev[0]) + check_mesh_group_added(dev[1]) + check_mesh_peer_connected(dev[0]) + check_mesh_peer_connected(dev[1]) + + for i in range(3): + # Drop incoming management frames to avoid handling link close + dev[0].request("SET ext_mgmt_frame_handling 1") + dev[1].mesh_group_remove() + check_mesh_group_removed(dev[1]) + dev[1].request("FLUSH") + dev[0].request("SET ext_mgmt_frame_handling 0") + id = add_mesh_secure_net(dev[1]) + dev[1].mesh_group_add(id) + check_mesh_group_added(dev[1]) + check_mesh_peer_connected(dev[1]) + dev[0].dump_monitor() + dev[1].dump_monitor()