aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-01-01 15:37:08 (GMT)
committerJouni Malinen <j@w1.fi>2014-01-01 15:37:08 (GMT)
commit9a170ed2448c1878b003f49d30a3b6fa456d4994 (patch)
tree438a4aa455c6c94cf7edfa465f93ede4d7a45d13
parentf7fb676633b592d81d38155b9a3079964f2e051e (diff)
downloadhostap-9a170ed2448c1878b003f49d30a3b6fa456d4994.zip
hostap-9a170ed2448c1878b003f49d30a3b6fa456d4994.tar.gz
hostap-9a170ed2448c1878b003f49d30a3b6fa456d4994.tar.bz2
tests: Add some coverage for Device Discoverability exchange
This is not really perfect, but something to get a bit more testing coverage.. For proper discoverability mechanism validation, the P2P client would need to go to sleep to avoid acknowledging the GO Negotiation Request frame. Offchannel Listen mode operation on the P2P Client with mac80211_hwsim is apparently not enough to avoid the acknowledgement on the operating channel, so need to disconnect from the group which removes the GO-to-P2P Client part of the discoverability exchange in practice. Signed-hostap: Jouni Malinen <j@w1.fi>
-rw-r--r--tests/hwsim/test_p2p_discovery.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py
index 84bd36e..8fd4af4 100644
--- a/tests/hwsim/test_p2p_discovery.py
+++ b/tests/hwsim/test_p2p_discovery.py
@@ -89,3 +89,33 @@ def test_discovery_group_client(dev):
logger.info("Try to discover a P2P client in a group")
if not dev[2].discover_peer(dev[1].p2p_dev_addr(), social=False):
raise Exception("Could not discover group client")
+
+ # This is not really perfect, but something to get a bit more testing
+ # coverage.. For proper discoverability mechanism validation, the P2P
+ # client would need to go to sleep to avoid acknowledging the GO Negotiation
+ # Request frame. Offchannel Listen mode operation on the P2P Client with
+ # mac80211_hwsim is apparently not enough to avoid the acknowledgement on
+ # the operating channel, so need to disconnect from the group which removes
+ # the GO-to-P2P Client part of the discoverability exchange in practice.
+
+ pin = dev[2].wps_read_pin()
+ # make group client non-responsive on operating channel
+ dev[1].dump_monitor()
+ dev[1].group_request("DISCONNECT")
+ ev = dev[1].wait_event(["CTRL-EVENT-DISCONNECTED"])
+ if ev is None:
+ raise Exception("Timeout on waiting disconnection")
+ dev[2].request("P2P_CONNECT {} {} display".format(dev[1].p2p_dev_addr(),
+ pin))
+ ev = dev[1].wait_event(["P2P-GO-NEG-REQUEST"], timeout=2)
+ if ev:
+ raise Exception("Unexpected frame RX on P2P client")
+ # make group client available on operating channe
+ dev[1].request("REASSOCIATE")
+ ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED", "P2P-GO-NEG-REQUEST"])
+ if ev is None:
+ raise Exception("Timeout on reconnection to group")
+ if "P2P-GO-NEG-REQUEST" not in ev:
+ ev = dev[1].wait_event(["P2P-GO-NEG-REQUEST"])
+ if ev is None:
+ raise Exception("Timeout on waiting for GO Negotiation Request")