diff --git a/tests/hwsim/test_p2p_persistent.py b/tests/hwsim/test_p2p_persistent.py index be510961b..6a75e6d45 100644 --- a/tests/hwsim/test_p2p_persistent.py +++ b/tests/hwsim/test_p2p_persistent.py @@ -377,3 +377,24 @@ def test_persistent_go_client_list(dev): peer = dev[0].get_peer(addr2) if 'persistent' not in peer or peer['persistent'] != id: raise Exception("Persistent group client not recognized(2)") + +def test_persistent_group_in_grpform(dev): + """P2P persistent group parameters re-used in group formation""" + addr0 = dev[0].p2p_dev_addr() + addr1 = dev[1].p2p_dev_addr() + form(dev[0], dev[1]) + dev[1].p2p_listen() + if not dev[0].discover_peer(addr1, social=True): + raise Exception("Could not discover peer") + peer = dev[0].get_peer(addr1) + if "persistent" not in peer: + raise Exception("Could not map peer to a persistent group") + + pin = dev[1].wps_read_pin() + dev[1].p2p_go_neg_auth(addr0, pin, "display", go_intent=0) + i_res = dev[0].p2p_go_neg_init(addr1, pin, "enter", timeout=20, + go_intent=15, + persistent_id=peer['persistent']) + r_res = dev[1].p2p_go_neg_auth_result() + logger.debug("i_res: " + str(i_res)) + logger.debug("r_res: " + str(r_res)) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index a00489cac..c46054a21 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -476,7 +476,7 @@ class WpaSupplicant: self.dump_monitor() return self.group_form_result(ev, expect_failure, go_neg_res) - def p2p_go_neg_init(self, peer, pin, method, timeout=0, go_intent=None, expect_failure=False, persistent=False, freq=None, provdisc=False): + def p2p_go_neg_init(self, peer, pin, method, timeout=0, go_intent=None, expect_failure=False, persistent=False, persistent_id=None, freq=None, provdisc=False): if not self.discover_peer(peer): raise Exception("Peer " + peer + " not found") self.dump_monitor() @@ -490,6 +490,8 @@ class WpaSupplicant: cmd = cmd + ' freq=' + str(freq) if persistent: cmd = cmd + " persistent" + elif persistent_id: + cmd = cmd + " persistent=" + persistent_id if provdisc: cmd = cmd + " provdisc" if "OK" in self.global_request(cmd):