]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Change list_networks() to use global interface with P2P
authorBen Rosenfeld <ben.rosenfeld@intel.com>
Tue, 5 May 2015 09:36:58 +0000 (12:36 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 8 May 2015 15:29:03 +0000 (18:29 +0300)
list_networks() always used the wlanX control interface to query for the
current list of networks. However, when a dedicated P2P Device is used,
the global control interface should be used when checking persistent
group network profiles.

Fix this by adding an optional parameter indicating that the P2P
networks are requested, and in such a case use the global control
interface.

In addition update test_p2p_persistent to use the argument when needed.

Signed-off-by: Ben Rosenfeld <ben.rosenfeld@intel.com>
tests/hwsim/test_p2p_persistent.py
tests/hwsim/wpasupplicant.py

index 65bf904c035b14c0c8b49d6c5ff3d2529e81c549..65bbc314587598c0a637ce7c6f3f8646f6b2578a 100644 (file)
@@ -119,7 +119,7 @@ def test_persistent_group(dev):
 
     logger.info("Remove group on the client and try to invite from GO")
     id = None
-    for n in dev[0].list_networks():
+    for n in dev[0].list_networks(p2p=True):
         if "[P2P-PERSISTENT]" in n['flags']:
             id = n['id']
             break
@@ -143,7 +143,7 @@ def test_persistent_group(dev):
     if "FAIL" not in dev[1].request("REMOVE_NETWORK 1234567"):
         raise Exception("REMOVE_NETWORK succeeded unexpectedly")
     dev[1].request("REMOVE_NETWORK all")
-    if len(dev[1].list_networks()) > 0:
+    if len(dev[1].list_networks(p2p=True)) > 0:
         raise Exception("Unexpected network block remaining")
     invite(dev[0], dev[1])
     ev = dev[0].wait_global_event(["P2P-INVITATION-RESULT"], timeout=10)
@@ -201,7 +201,7 @@ def test_persistent_group_per_sta_psk(dev):
     dev[2].dump_monitor()
 
     for i in range(0, 3):
-        networks = dev[i].list_networks()
+        networks = dev[i].list_networks(p2p=True)
         if len(networks) != 1:
             raise Exception("Unexpected number of networks")
         if "[P2P-PERSISTENT]" not in networks[0]['flags']:
@@ -399,7 +399,7 @@ def test_persistent_go_client_list(dev):
 
     res = dev[0].p2p_start_go(persistent=True)
     id = None
-    for n in dev[0].list_networks():
+    for n in dev[0].list_networks(p2p=True):
         if "[P2P-PERSISTENT]" in n['flags']:
             id = n['id']
             break
@@ -548,7 +548,7 @@ def test_persistent_group_already_running(dev):
     listen_freq = peer['listen_freq']
     dev[0].dump_monitor()
     dev[1].dump_monitor()
-    networks = dev[0].list_networks()
+    networks = dev[0].list_networks(p2p=True)
     if len(networks) != 1:
         raise Exception("Unexpected number of networks")
     if "[P2P-PERSISTENT]" not in networks[0]['flags']:
index 1cdcc0965a6906576019e2e4d64d5f9a983c09c8..cbb73f26e19293093aac30cab60bec2389369612 100644 (file)
@@ -198,8 +198,11 @@ class WpaSupplicant:
             raise Exception("SET_NETWORK failed")
         return None
 
-    def list_networks(self):
-        res = self.request("LIST_NETWORKS")
+    def list_networks(self, p2p=False):
+        if p2p:
+            res = self.global_request("LIST_NETWORKS")
+        else:
+            res = self.request("LIST_NETWORKS")
         lines = res.splitlines()
         networks = []
         for l in lines: