tests: Remove mesh before trying to clear BSS cache

The flush_scan_cache() operations in the finally part of these test
cases ended up getting called when the mesh group was still operating.
This could result in unexpected behavior due to offchannel scan being
performed before the device becomes idle. Clean this up by explicitly
removing the mesh group before cleaning up.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2017-01-29 16:27:07 +02:00
parent 8b19401679
commit 3ca712028d

View file

@ -748,6 +748,8 @@ def test_wpas_mesh_open_5ghz(dev, apdev):
try: try:
_test_wpas_mesh_open_5ghz(dev, apdev) _test_wpas_mesh_open_5ghz(dev, apdev)
finally: finally:
dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname)
dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname)
subprocess.call(['iw', 'reg', 'set', '00']) subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache() dev[0].flush_scan_cache()
dev[1].flush_scan_cache() dev[1].flush_scan_cache()
@ -775,11 +777,20 @@ def _test_wpas_mesh_open_5ghz(dev, apdev):
# Test connectivity 0->1 and 1->0 # Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1]) hwsim_utils.test_connectivity(dev[0], dev[1])
dev[0].mesh_group_remove()
dev[1].mesh_group_remove()
check_mesh_group_removed(dev[0])
check_mesh_group_removed(dev[1])
dev[0].dump_monitor()
dev[1].dump_monitor()
def test_wpas_mesh_open_5ghz_coex(dev, apdev): def test_wpas_mesh_open_5ghz_coex(dev, apdev):
"""Mesh network on 5 GHz band and 20/40 coex change""" """Mesh network on 5 GHz band and 20/40 coex change"""
try: try:
_test_wpas_mesh_open_5ghz_coex(dev, apdev) _test_wpas_mesh_open_5ghz_coex(dev, apdev)
finally: finally:
dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname)
dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname)
set_world_reg(apdev0=apdev[0], dev0=dev[0]) set_world_reg(apdev0=apdev[0], dev0=dev[0])
dev[0].flush_scan_cache() dev[0].flush_scan_cache()
dev[1].flush_scan_cache() dev[1].flush_scan_cache()
@ -820,12 +831,20 @@ def _test_wpas_mesh_open_5ghz_coex(dev, apdev):
raise Exception("Unexpected SIGNAL_POLL output: " + str(sig)) raise Exception("Unexpected SIGNAL_POLL output: " + str(sig))
hapd.disable() hapd.disable()
dev[0].mesh_group_remove()
dev[1].mesh_group_remove()
check_mesh_group_removed(dev[0])
check_mesh_group_removed(dev[1])
dev[0].dump_monitor()
dev[1].dump_monitor()
def test_wpas_mesh_open_vht_80p80(dev, apdev): def test_wpas_mesh_open_vht_80p80(dev, apdev):
"""wpa_supplicant open MESH network on VHT 80+80 MHz channel""" """wpa_supplicant open MESH network on VHT 80+80 MHz channel"""
try: try:
_test_wpas_mesh_open_vht_80p80(dev, apdev) _test_wpas_mesh_open_vht_80p80(dev, apdev)
finally: finally:
dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname)
dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname)
subprocess.call(['iw', 'reg', 'set', '00']) subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache() dev[0].flush_scan_cache()
dev[1].flush_scan_cache() dev[1].flush_scan_cache()
@ -869,11 +888,20 @@ def _test_wpas_mesh_open_vht_80p80(dev, apdev):
if "CENTER_FRQ2=5775" not in sig: if "CENTER_FRQ2=5775" not in sig:
raise Exception("Unexpected SIGNAL_POLL value(4b): " + str(sig)) raise Exception("Unexpected SIGNAL_POLL value(4b): " + str(sig))
dev[0].mesh_group_remove()
dev[1].mesh_group_remove()
check_mesh_group_removed(dev[0])
check_mesh_group_removed(dev[1])
dev[0].dump_monitor()
dev[1].dump_monitor()
def test_mesh_open_vht_160(dev, apdev): def test_mesh_open_vht_160(dev, apdev):
"""Open mesh network on VHT 160 MHz channel""" """Open mesh network on VHT 160 MHz channel"""
try: try:
_test_mesh_open_vht_160(dev, apdev) _test_mesh_open_vht_160(dev, apdev)
finally: finally:
dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname)
dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname)
subprocess.call(['iw', 'reg', 'set', '00']) subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache() dev[0].flush_scan_cache()
dev[1].flush_scan_cache() dev[1].flush_scan_cache()
@ -908,6 +936,8 @@ def _test_mesh_open_vht_160(dev, apdev):
# Check for peer connected # Check for peer connected
check_mesh_peer_connected(dev[0]) check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1]) check_mesh_peer_connected(dev[1])
dev[0].dump_monitor()
dev[1].dump_monitor()
# Test connectivity 0->1 and 1->0 # Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1]) hwsim_utils.test_connectivity(dev[0], dev[1])
@ -924,6 +954,13 @@ def _test_mesh_open_vht_160(dev, apdev):
if "FREQUENCY=5520" not in sig: if "FREQUENCY=5520" not in sig:
raise Exception("Unexpected SIGNAL_POLL value(3b): " + str(sig)) raise Exception("Unexpected SIGNAL_POLL value(3b): " + str(sig))
dev[0].mesh_group_remove()
dev[1].mesh_group_remove()
check_mesh_group_removed(dev[0])
check_mesh_group_removed(dev[1])
dev[0].dump_monitor()
dev[1].dump_monitor()
def test_wpas_mesh_password_mismatch(dev, apdev): def test_wpas_mesh_password_mismatch(dev, apdev):
"""Mesh network and one device with mismatching password""" """Mesh network and one device with mismatching password"""
check_mesh_support(dev[0], secure=True) check_mesh_support(dev[0], secure=True)