]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: remote: Allow passing of parameters with monitor interface
authorJanusz Dziedzic <janusz.dziedzic@gmail.com>
Sat, 26 Sep 2020 11:26:59 +0000 (13:26 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 9 Oct 2020 08:21:05 +0000 (11:21 +0300)
This is mainly for standalone monitor in case we know and would like to
setup specific monitor configuration.

-m monitor:<chan>,<bw>, <cf1>, <cf2>:...

For example:
-m monitor:1,40,3,0
-m e4300:1,40,3,0:11,40,9,0

This also supports monitor with multiple interfaces (one pcap).

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
tests/hwsim/remotehost.py
tests/remote/monitor.py

index a1ef1f34bd9dbc357d7115eb0d1124d6c9692ed8..dec1ad5a8cd699c05b0533ae8f9bb7cd4c7b7750 100644 (file)
@@ -57,6 +57,7 @@ class Host():
         self.ifname = ifname
         self.port = port
         self.dev = None
+        self.monitor_params = []
         if self.name == "" and host != None:
             self.name = host
 
index a97eaf92892a7ff8f0db4e0da378084b32e65c8f..5bd801c6179c5daa24f96e57aa0e8fe92fb807a9 100644 (file)
@@ -26,7 +26,8 @@ def create(devices, setup_params, refs, duts, monitors):
             mons.append(monitor)
 
     for mon in mons:
-        dev = config.get_device(devices, mon)
+        word = mon.split(":")
+        dev = config.get_device(devices, word[0])
         if dev is None:
             continue
 
@@ -35,6 +36,15 @@ def create(devices, setup_params, refs, duts, monitors):
                     port=dev['port'],
                     name=dev['name'])
 
+        for iface_param in word[1:]:
+            params = iface_param.split(",")
+            if len(params) > 3:
+                monitor_param = { "freq" : rutils.c2f(params[0]),
+                                  "bw" : params[1],
+                                  "center_freq1" : rutils.c2f(params[2]),
+                                  "center_freq2" : rutils.c2f(params[3]) }
+                host.monitor_params.append(monitor_param)
+
         try:
             host.execute(["iw", "reg", "set", setup_params['country']])
             rutils.setup_hw_host(host, setup_params, True)
@@ -49,11 +59,15 @@ def destroy(devices, hosts):
         stop(host)
         for monitor in host.monitors:
             host.execute(["ifconfig", monitor, "down"])
+        host.monitor_params = []
 
-def setup(host, monitor_params):
+def setup(host, monitor_params=None):
     if host is None:
         return
 
+    if monitor_params == None:
+        monitor_params = host.monitor_params
+
     ifaces = re.split('; | |, ', host.ifname)
     count = 0
     for param in monitor_params: