Skip to contentSkip to conversation

auto-t: fix hostapd.ungraceful_restart

PATCH New James Prestwood 1 participant 1 message Jul 13, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 auto-t: fix hostapd.ungraceful_restart

This was killing hostapd, but not re-initializing any of the control socket information so any use of hostapd.wait_for_event after hostapd.ungraceful_restart would cause an exception.

---
 autotests/util/hostapd.py | 5 +++++
 1 file changed, 5 insertions(+)
autotests/util/hostapd.py +5 -0
index 49047f38..c3a4a0d0 100644
@@ -193,6 +193,8 @@ class HostapdCLI:
         '''
             Ungracefully kill and restart hostapd
         '''
+        self.ctrl_sock.close()
+
         intf = hostapd_map[self.ifname]
         os.system('killall -9 hostapd')
         os.system('ifconfig %s down' % intf.name)
@@ -203,6 +205,9 @@ class HostapdCLI:
         # set flag so hostapd can be killed after the test
         self._hostapd_restarted = True
 
+        # New hostapd process, so re-init
+        self.__init__(intf)
+
     def req_beacon(self, addr, request):
         '''
             Send a RRM Beacon request
Signature · 1 line
2.21.1