]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: P2P invitation rejected from unknown peer
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 28 May 2014 15:29:05 +0000 (18:29 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 29 May 2014 12:37:17 +0000 (15:37 +0300)
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/test_p2p_invitation.py

index 1ad0b651073a5fbfe25cc756f18bda53942cd653..edf0e7af7a756b10d811d9a653f739d917826147 100644 (file)
@@ -102,3 +102,34 @@ def test_p2p_go_invite_auth(dev):
     logger.info("Terminate group")
     dev[0].remove_group()
     dev[1].wait_go_ending_session()
+
+def test_p2p_go_invite_unknown(dev):
+    """P2P GO inviting a client that has not discovered the GO"""
+    try:
+        addr0 = dev[0].p2p_dev_addr()
+        addr1 = dev[1].p2p_dev_addr()
+
+        dev[1].p2p_listen()
+        if not dev[0].discover_peer(addr1, social=True):
+            raise Exception("Peer " + addr1 + " not found")
+        dev[1].global_request("P2P_FLUSH")
+        dev[1].p2p_listen()
+
+        dev[0].p2p_start_go(freq=2412)
+
+        logger.info("Invite peer to join the group")
+        # Prevent peer entry from being added for testing coverage
+        if "OK" not in dev[1].global_request("P2P_SET peer_filter 00:11:22:33:44:55"):
+            raise Exception("Failed to set peer_filter")
+        dev[0].p2p_go_authorize_client("12345670")
+        dev[0].global_request("P2P_INVITE group=" + dev[0].group_ifname + " peer=" + addr1)
+        ev = dev[1].wait_global_event(["P2P-INVITATION-RECEIVED"], timeout=15)
+        if ev is None:
+            raise Exception("Invitation Request not received")
+        ev = dev[0].wait_global_event(["P2P-INVITATION-RESULT"], timeout=15)
+        if ev is None:
+            raise Exception("Invitation Response not received")
+        if "status=1" not in ev:
+            raise Exception("Unexpected invitation result: " + ev)
+    finally:
+        dev[1].global_request("P2P_SET peer_filter 00:00:00:00:00:00")