]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Do not attach wpa_supplicant monitor interface unnecessarily
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 14 Dec 2016 11:56:15 +0000 (13:56 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 14 Dec 2016 11:56:15 +0000 (13:56 +0200)
There is no need to attach the monitor interface was events when issuing
only a single INTERFACES command.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/run-tests.py
tests/hwsim/wpasupplicant.py

index 499263f2dc23c9988438632e2fa700801afe39fb..0ec9d23471436dec11639c2cf25d009d8de5eb46 100755 (executable)
@@ -54,7 +54,7 @@ def reset_devs(dev, apdev):
 
     wpas = None
     try:
-        wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+        wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5', monitor=False)
         ifaces = wpas.global_request("INTERFACES").splitlines()
         for iface in ifaces:
             if iface.startswith("wlan"):
index 5247829f3043d1ec3b0fb1b055c793fb5c40d372..f106ab01c665fd2b59130531dc28b4b88a64a8d4 100644 (file)
@@ -19,7 +19,8 @@ wpas_ctrl = '/var/run/wpa_supplicant'
 
 class WpaSupplicant:
     def __init__(self, ifname=None, global_iface=None, hostname=None,
-                 port=9877, global_port=9878):
+                 port=9877, global_port=9878, monitor=True):
+        self.monitor = monitor
         self.hostname = hostname
         self.group_ifname = None
         self.gctrl_mon = None
@@ -37,15 +38,19 @@ class WpaSupplicant:
 
         self.global_iface = global_iface
         if global_iface:
+            self.global_mon = None
             if hostname != None:
                 self.global_ctrl = wpaspy.Ctrl(hostname, global_port)
-                self.global_mon = wpaspy.Ctrl(hostname, global_port)
+                if self.monitor:
+                    self.global_mon = wpaspy.Ctrl(hostname, global_port)
                 self.global_dbg = hostname + "/" + str(global_port) + "/"
             else:
                 self.global_ctrl = wpaspy.Ctrl(global_iface)
-                self.global_mon = wpaspy.Ctrl(global_iface)
+                if self.monitor:
+                    self.global_mon = wpaspy.Ctrl(global_iface)
                 self.global_dbg = ""
-            self.global_mon.attach()
+            if self.monitor:
+                self.global_mon.attach()
         else:
             self.global_mon = None
 
@@ -81,14 +86,17 @@ class WpaSupplicant:
         self.ifname = ifname
         if hostname != None:
             self.ctrl = wpaspy.Ctrl(hostname, port)
-            self.mon = wpaspy.Ctrl(hostname, port)
+            if self.monitor:
+                self.mon = wpaspy.Ctrl(hostname, port)
             self.host = remotehost.Host(hostname, ifname)
             self.dbg = hostname + "/" + ifname
         else:
             self.ctrl = wpaspy.Ctrl(os.path.join(wpas_ctrl, ifname))
-            self.mon = wpaspy.Ctrl(os.path.join(wpas_ctrl, ifname))
+            if self.monitor:
+                self.mon = wpaspy.Ctrl(os.path.join(wpas_ctrl, ifname))
             self.dbg = ifname
-        self.mon.attach()
+        if self.monitor:
+            self.mon.attach()
 
     def remove_ifname(self):
         if self.ifname: