]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Verify P2P SD request cancel
authorJouni Malinen <j@w1.fi>
Wed, 1 Jan 2014 17:56:24 +0000 (19:56 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 1 Jan 2014 17:56:24 +0000 (19:56 +0200)
Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/test_p2p_service.py

index bfab78d82f77e9fe7ecbe30618e09c2f0c3f4cdc..aa57c2cd14a9b79de3d5b1b8ed13cd3e073a4a88 100644 (file)
@@ -122,3 +122,20 @@ def test_p2p_service_discovery_ws(dev):
         raise Exception("Unexpected service discovery response contents (UPnP not expected)")
     if "0300030101" not in ev:
         raise Exception("Unexpected service discovery response contents (WS)")
+
+def test_p2p_service_discovery_req_cancel(dev):
+    """Cancel a P2P service discovery request"""
+    if "FAIL" not in dev[0].request("P2P_SERV_DISC_CANCEL_REQ ab"):
+        raise Exception("Unexpected SD cancel success")
+    query = dev[0].request("P2P_SERV_DISC_REQ " + dev[1].p2p_dev_addr() + " 02000001")
+    if "OK" not in dev[0].request("P2P_SERV_DISC_CANCEL_REQ " + query):
+        raise Exception("Unexpected SD cancel failure")
+    query1 = dev[0].request("P2P_SERV_DISC_REQ " + dev[1].p2p_dev_addr() + " 02000001")
+    query2 = dev[0].request("P2P_SERV_DISC_REQ " + dev[1].p2p_dev_addr() + " 02000002")
+    query3 = dev[0].request("P2P_SERV_DISC_REQ " + dev[1].p2p_dev_addr() + " 02000003")
+    if "OK" not in dev[0].request("P2P_SERV_DISC_CANCEL_REQ " + query2):
+        raise Exception("Unexpected SD cancel failure")
+    if "OK" not in dev[0].request("P2P_SERV_DISC_CANCEL_REQ " + query1):
+        raise Exception("Unexpected SD cancel failure")
+    if "OK" not in dev[0].request("P2P_SERV_DISC_CANCEL_REQ " + query3):
+        raise Exception("Unexpected SD cancel failure")