]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Permit autogo_scan to work with dedicated P2P device removal
authorBenjamin Berg <benjamin.berg@intel.com>
Wed, 15 Oct 2025 15:43:59 +0000 (17:43 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 13 Dec 2025 17:47:18 +0000 (19:47 +0200)
The next commit will end up removing the dedicated P2P device when
p2p_disabled is set. The test will trigger this when
support_p2p_device=1 is used and that would lead to a test failure as
the device is not configured correctly and may have changed its address.

Fix this by repeating the setup after the dedicated P2P device has been
recreated.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
tests/hwsim/test_p2p_autogo.py

index 394cefb57299ee53c92e2054f74abf12a9d62338..3a5196d9f6cea3aa7e6c94dd18f6401b142e68a7 100644 (file)
@@ -818,7 +818,6 @@ def rx_pd_req(dev):
 def test_autogo_scan(dev):
     """P2P autonomous GO and no P2P IE in Probe Response scan results"""
     addr0 = dev[0].p2p_dev_addr()
-    addr1 = dev[1].p2p_dev_addr()
     dev[0].p2p_start_go(freq=2412, persistent=True)
     bssid = dev[0].p2p_interface_addr()
 
@@ -828,9 +827,6 @@ def test_autogo_scan(dev):
     time.sleep(0.1)
     dev[1].flush_scan_cache()
 
-    pin = dev[1].wps_read_pin()
-    dev[0].group_request("WPS_PIN any " + pin)
-
     try:
         dev[1].request("SET p2p_disabled 1")
         dev[1].request("SCAN freq=2412")
@@ -840,6 +836,17 @@ def test_autogo_scan(dev):
     finally:
         dev[1].request("SET p2p_disabled 0")
 
+    # When dev[1] has a dedicated P2P Device interface, then p2p_disabled
+    # will remove it. So get the address now and repeat some of the setup.
+    addr1 = dev[1].p2p_dev_addr()
+    pin = dev[1].wps_read_pin()
+    dev[0].group_request("WPS_PIN any " + pin)
+    dev[1].discover_peer(addr0)
+    dev[1].p2p_stop_find()
+    ev = dev[1].wait_global_event(["P2P-FIND-STOPPED"], timeout=2)
+    time.sleep(0.1)
+    dev[1].flush_scan_cache()
+
     for i in range(2):
         dev[1].request("SCAN freq=2412 passive=1")
         ev = dev[1].wait_event(["CTRL-EVENT-SCAN-RESULTS"])