tests: Invalid P2P_INVITE parameters

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-12-08 19:46:00 +02:00
parent edd1dfb2bd
commit e22335e5db
2 changed files with 18 additions and 0 deletions

View file

@ -174,3 +174,16 @@ def test_p2p_cli_invite(dev):
dev[0].remove_group() dev[0].remove_group()
dev[1].wait_go_ending_session() dev[1].wait_go_ending_session()
dev[2].wait_go_ending_session() dev[2].wait_go_ending_session()
def test_p2p_invite_invalid(dev):
"""Invalid parameters to P2P_INVITE"""
id = dev[0].add_network()
for cmd in [ "foo=bar",
"persistent=123 peer=foo",
"persistent=123",
"persistent=%d" % id,
"group=foo",
"group=foo peer=foo",
"group=foo peer=00:11:22:33:44:55 go_dev_addr=foo" ]:
if "FAIL" not in dev[0].request("P2P_INVITE " + cmd):
raise Exception("Invalid P2P_INVITE accepted: " + cmd)

View file

@ -470,6 +470,11 @@ def test_persistent_group_without_persistent_reconnect(dev):
sa = s[2] sa = s[2]
id = s[3] id = s[3]
freq = s[4] freq = s[4]
logger.info("Invalid P2P_INVITE test coverage")
if "FAIL" not in dev[0].global_request("P2P_INVITE persistent=" + id + " peer=" + sa + " freq=0"):
raise Exception("Invalid P2P_INVITE accepted")
if "FAIL" not in dev[0].global_request("P2P_INVITE persistent=" + id + " peer=" + sa + " pref=0"):
raise Exception("Invalid P2P_INVITE accepted")
logger.info("Re-initiate invitation based on upper layer acceptance") logger.info("Re-initiate invitation based on upper layer acceptance")
if "OK" not in dev[0].global_request("P2P_INVITE persistent=" + id + " peer=" + sa + " freq=" + freq): if "OK" not in dev[0].global_request("P2P_INVITE persistent=" + id + " peer=" + sa + " freq=" + freq):
raise Exception("Invitation command failed") raise Exception("Invitation command failed")