tests: Close wlan5 control interface monitor more explicitly
There were couple of common cases where the control interface for the dynamic wpa_supplicant instance could have been left in attached state until Python ends up cleaning up the instance. This could result in issues if many monitor interface events were queued for that attached socket. Make this less likely to cause issues by explicitly detaching and closing control interfaces before moving to the next test case. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
0efcad2c30
commit
a66d2248a0
3 changed files with 16 additions and 2 deletions
|
@ -48,6 +48,7 @@ def reset_devs(dev, apdev):
|
|||
print str(e)
|
||||
ok = False
|
||||
|
||||
wpas = None
|
||||
try:
|
||||
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
|
||||
ifaces = wpas.global_request("INTERFACES").splitlines()
|
||||
|
@ -56,6 +57,8 @@ def reset_devs(dev, apdev):
|
|||
wpas.interface_remove(iface)
|
||||
except Exception, e:
|
||||
pass
|
||||
if wpas:
|
||||
wpas.close_ctrl()
|
||||
|
||||
try:
|
||||
hapd = HostapdGlobal()
|
||||
|
@ -455,14 +458,16 @@ def main():
|
|||
logger.info("Failed to issue TEST-STOP after {} for {}".format(name, d.ifname))
|
||||
logger.info(e)
|
||||
result = "FAIL"
|
||||
wpas = None
|
||||
try:
|
||||
wpas = WpaSupplicant("/tmp/wpas-wlan5")
|
||||
d.dump_monitor()
|
||||
wpas = WpaSupplicant(global_iface="/tmp/wpas-wlan5")
|
||||
rename_log(args.logdir, 'log5', name, wpas)
|
||||
if not args.no_reset:
|
||||
wpas.remove_ifname()
|
||||
except Exception, e:
|
||||
pass
|
||||
if wpas:
|
||||
wpas.close_ctrl()
|
||||
if args.no_reset:
|
||||
print "Leaving devices in current state"
|
||||
else:
|
||||
|
|
|
@ -22,6 +22,7 @@ def get_wext_interface():
|
|||
try:
|
||||
wpas.interface_add("wlan5", driver="wext")
|
||||
except Exception, e:
|
||||
wpas.close_ctrl()
|
||||
raise HwsimSkip("WEXT driver support not included in wpa_supplicant")
|
||||
return wpas
|
||||
|
||||
|
@ -59,6 +60,7 @@ def test_wext_wpa_psk(dev, apdev):
|
|||
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
|
||||
testfile = "/sys/kernel/debug/ieee80211/%s/netdev:%s/tkip_mic_test" % (hapd.get_driver_status_field("phyname"), apdev[0]['ifname'])
|
||||
if not os.path.exists(testfile):
|
||||
wpas.close_ctrl()
|
||||
raise HwsimSkip("tkip_mic_test not supported in mac80211")
|
||||
|
||||
wpas.connect("wext-wpa-psk", psk="12345678")
|
||||
|
|
|
@ -33,6 +33,13 @@ class WpaSupplicant:
|
|||
else:
|
||||
self.global_mon = None
|
||||
|
||||
def close_ctrl(self):
|
||||
if self.global_mon:
|
||||
self.global_mon.detach()
|
||||
self.global_mon = None
|
||||
self.global_ctrl = None
|
||||
self.remove_ifname()
|
||||
|
||||
def set_ifname(self, ifname):
|
||||
self.ifname = ifname
|
||||
self.ctrl = wpaspy.Ctrl(os.path.join(wpas_ctrl, ifname))
|
||||
|
|
Loading…
Reference in a new issue