mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-20 19:12:33 +01:00
auto-t: add ungraceful restart to hostapd util
For testing SA Query, the autotest needs the ablility to force kill (and restart) hostapd without giving it time to deauth its stations gracefully. A method was added to the HostapdCLI class which does a killall -9 hostapd, resets the wlnX interface, and restarts hostapd with the same arguments as it had before.
This commit is contained in:
parent
f82eb13f65
commit
0db0ce43b8
@ -15,6 +15,12 @@ class HostapdCLI:
|
||||
self.cmdline = 'hostapd_cli -p"' + socket_path + '" -i"' + \
|
||||
self.ifname + '"'
|
||||
|
||||
self._hostapd_restarted = False
|
||||
|
||||
def __del__(self):
|
||||
if self._hostapd_restarted:
|
||||
os.system('killall hostapd')
|
||||
|
||||
def wps_push_button(self):
|
||||
os.system(self.cmdline + ' wps_pbc')
|
||||
|
||||
@ -66,3 +72,21 @@ class HostapdCLI:
|
||||
@staticmethod
|
||||
def kill_all():
|
||||
os.system('killall hostapd')
|
||||
|
||||
def ungraceful_restart(self):
|
||||
'''
|
||||
Ungracefully kill and restart hostapd
|
||||
'''
|
||||
for wname in wiphy.wiphy_map:
|
||||
name = wiphy.wiphy_map[wname]
|
||||
intf = list(name.values())[0]
|
||||
if intf.use == 'hostapd':
|
||||
os.system('killall -9 hostapd')
|
||||
os.system('ifconfig %s down' % intf.name)
|
||||
os.system('ifconfig %s up' % intf.name)
|
||||
os.system('hostapd -g %s -i %s %s &' %
|
||||
(intf.ctrl_interface, intf.name, intf.config))
|
||||
break;
|
||||
|
||||
# set flag so hostapd can be killed after the test
|
||||
self._hostapd_restarted = True
|
||||
|
Loading…
Reference in New Issue
Block a user