]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: P2P_UNAUTHORIZE to unauthorize a peer
authorJouni Malinen <j@w1.fi>
Sat, 13 Dec 2014 23:01:56 +0000 (01:01 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 14 Dec 2014 00:28:03 +0000 (02:28 +0200)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_p2p_grpform.py

index 86070e33c115f3a55c4f810873b61c4cfb7b87ef..07e46d55b9fc777c0a9ccce1ca2b2cbfedd98a90 100644 (file)
@@ -874,3 +874,23 @@ def test_invalid_p2p_connect_command(dev):
 
     if "FAIL-CHANNEL-UNSUPPORTED" not in dev[0].request("P2P_CONNECT 00:11:22:33:44:55 pin freq=3000"):
         raise Exception("Unsupported channel not reported")
+
+def test_p2p_unauthorize(dev):
+    """P2P_UNAUTHORIZE to unauthorize a peer"""
+    if "FAIL" not in dev[0].request("P2P_UNAUTHORIZE foo"):
+        raise Exception("Invalid P2P_UNAUTHORIZE accepted")
+    if "FAIL" not in dev[0].request("P2P_UNAUTHORIZE 00:11:22:33:44:55"):
+        raise Exception("P2P_UNAUTHORIZE for unknown peer accepted")
+
+    addr0 = dev[0].p2p_dev_addr()
+    addr1 = dev[1].p2p_dev_addr()
+    dev[1].p2p_listen()
+    pin = dev[0].wps_read_pin()
+    dev[0].p2p_go_neg_auth(addr1, pin, "display")
+    dev[0].p2p_listen()
+    if "OK" not in dev[0].request("P2P_UNAUTHORIZE " + addr1):
+        raise Exception("P2P_UNAUTHORIZE failed")
+    dev[1].p2p_go_neg_init(addr0, pin, "keypad", timeout=0)
+    ev = dev[0].wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=10)
+    if ev is None:
+        raise Exception("No GO Negotiation Request RX reported")