test_p2p_autogo.py 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. # P2P autonomous GO test cases
  2. # Copyright (c) 2013-2014, Jouni Malinen <j@w1.fi>
  3. #
  4. # This software may be distributed under the terms of the BSD license.
  5. # See README for more details.
  6. import time
  7. import subprocess
  8. import logging
  9. logger = logging.getLogger()
  10. import hwsim_utils
  11. import utils
  12. from utils import HwsimSkip
  13. from wlantest import Wlantest
  14. from wpasupplicant import WpaSupplicant
  15. def autogo(go, freq=None, persistent=None):
  16. logger.info("Start autonomous GO " + go.ifname)
  17. res = go.p2p_start_go(freq=freq, persistent=persistent)
  18. logger.debug("res: " + str(res))
  19. return res
  20. def connect_cli(go, client, social=False, freq=None):
  21. logger.info("Try to connect the client to the GO")
  22. pin = client.wps_read_pin()
  23. go.p2p_go_authorize_client(pin)
  24. res = client.p2p_connect_group(go.p2p_dev_addr(), pin, timeout=60,
  25. social=social, freq=freq)
  26. logger.info("Client connected")
  27. hwsim_utils.test_connectivity_p2p(go, client)
  28. return res
  29. def test_autogo(dev):
  30. """P2P autonomous GO and client joining group"""
  31. addr0 = dev[0].p2p_dev_addr()
  32. addr2 = dev[2].p2p_dev_addr()
  33. res = autogo(dev[0])
  34. if "p2p-wlan" in res['ifname']:
  35. raise Exception("Unexpected group interface name on GO")
  36. res = connect_cli(dev[0], dev[1])
  37. if "p2p-wlan" in res['ifname']:
  38. raise Exception("Unexpected group interface name on client")
  39. bss = dev[1].get_bss("p2p_dev_addr=" + addr0, res['ifname'])
  40. if not bss or bss['bssid'] != dev[0].p2p_interface_addr():
  41. raise Exception("Unexpected BSSID in the BSS entry for the GO")
  42. id = bss['id']
  43. bss = dev[1].get_bss("ID-" + id, res['ifname'])
  44. if not bss or bss['id'] != id:
  45. raise Exception("Could not find BSS entry based on id")
  46. res = dev[1].group_request("BSS RANGE=" + id + "- MASK=0x1")
  47. if "id=" + id not in res:
  48. raise Exception("Could not find BSS entry based on id range")
  49. res = dev[1].request("SCAN_RESULTS")
  50. if "[P2P]" not in res:
  51. raise Exception("P2P flag missing from scan results: " + res)
  52. # Presence request to increase testing coverage
  53. if "FAIL" not in dev[1].group_request("P2P_PRESENCE_REQ 30000"):
  54. raise Exception("Invald P2P_PRESENCE_REQ accepted")
  55. if "FAIL" not in dev[1].group_request("P2P_PRESENCE_REQ 30000 102400 30001"):
  56. raise Exception("Invald P2P_PRESENCE_REQ accepted")
  57. if "FAIL" in dev[1].group_request("P2P_PRESENCE_REQ 30000 102400"):
  58. raise Exception("Could not send presence request")
  59. ev = dev[1].wait_event(["P2P-PRESENCE-RESPONSE"])
  60. if ev is None:
  61. raise Exception("Timeout while waiting for Presence Response")
  62. if "FAIL" in dev[1].group_request("P2P_PRESENCE_REQ 30000 102400 20000 102400"):
  63. raise Exception("Could not send presence request")
  64. ev = dev[1].wait_event(["P2P-PRESENCE-RESPONSE"])
  65. if ev is None:
  66. raise Exception("Timeout while waiting for Presence Response")
  67. if "FAIL" in dev[1].group_request("P2P_PRESENCE_REQ"):
  68. raise Exception("Could not send presence request")
  69. ev = dev[1].wait_event(["P2P-PRESENCE-RESPONSE"])
  70. if ev is None:
  71. raise Exception("Timeout while waiting for Presence Response")
  72. if not dev[2].discover_peer(addr0):
  73. raise Exception("Could not discover GO")
  74. dev[0].dump_monitor()
  75. dev[2].global_request("P2P_PROV_DISC " + addr0 + " display join")
  76. ev = dev[0].wait_global_event(["P2P-PROV-DISC-SHOW-PIN"], timeout=10)
  77. if ev is None:
  78. raise Exception("GO did not report P2P-PROV-DISC-SHOW-PIN")
  79. if "p2p_dev_addr=" + addr2 not in ev:
  80. raise Exception("Unexpected P2P Device Address in event: " + ev)
  81. if "group=" + dev[0].group_ifname not in ev:
  82. raise Exception("Unexpected group interface in event: " + ev)
  83. ev = dev[2].wait_global_event(["P2P-PROV-DISC-ENTER-PIN"], timeout=10)
  84. if ev is None:
  85. raise Exception("P2P-PROV-DISC-ENTER-PIN not reported")
  86. dev[0].remove_group()
  87. dev[1].wait_go_ending_session()
  88. def test_autogo2(dev):
  89. """P2P autonomous GO with a separate group interface and client joining group"""
  90. dev[0].request("SET p2p_no_group_iface 0")
  91. res = autogo(dev[0], freq=2437)
  92. if "p2p-wlan" not in res['ifname']:
  93. raise Exception("Unexpected group interface name on GO")
  94. if res['ifname'] not in utils.get_ifnames():
  95. raise Exception("Could not find group interface netdev")
  96. connect_cli(dev[0], dev[1], social=True, freq=2437)
  97. dev[0].remove_group()
  98. dev[1].wait_go_ending_session()
  99. if res['ifname'] in utils.get_ifnames():
  100. raise Exception("Group interface netdev was not removed")
  101. def test_autogo3(dev):
  102. """P2P autonomous GO and client with a separate group interface joining group"""
  103. dev[1].request("SET p2p_no_group_iface 0")
  104. autogo(dev[0], freq=2462)
  105. res = connect_cli(dev[0], dev[1], social=True, freq=2462)
  106. if "p2p-wlan" not in res['ifname']:
  107. raise Exception("Unexpected group interface name on client")
  108. if res['ifname'] not in utils.get_ifnames():
  109. raise Exception("Could not find group interface netdev")
  110. dev[0].remove_group()
  111. dev[1].wait_go_ending_session()
  112. dev[1].ping()
  113. if res['ifname'] in utils.get_ifnames():
  114. raise Exception("Group interface netdev was not removed")
  115. def test_autogo4(dev):
  116. """P2P autonomous GO and client joining group (both with a separate group interface)"""
  117. dev[0].request("SET p2p_no_group_iface 0")
  118. dev[1].request("SET p2p_no_group_iface 0")
  119. res1 = autogo(dev[0], freq=2412)
  120. res2 = connect_cli(dev[0], dev[1], social=True, freq=2412)
  121. if "p2p-wlan" not in res1['ifname']:
  122. raise Exception("Unexpected group interface name on GO")
  123. if "p2p-wlan" not in res2['ifname']:
  124. raise Exception("Unexpected group interface name on client")
  125. ifnames = utils.get_ifnames()
  126. if res1['ifname'] not in ifnames:
  127. raise Exception("Could not find GO group interface netdev")
  128. if res2['ifname'] not in ifnames:
  129. raise Exception("Could not find client group interface netdev")
  130. dev[0].remove_group()
  131. dev[1].wait_go_ending_session()
  132. dev[1].ping()
  133. ifnames = utils.get_ifnames()
  134. if res1['ifname'] in ifnames:
  135. raise Exception("GO group interface netdev was not removed")
  136. if res2['ifname'] in ifnames:
  137. raise Exception("Client group interface netdev was not removed")
  138. def test_autogo_m2d(dev):
  139. """P2P autonomous GO and clients not authorized"""
  140. autogo(dev[0], freq=2412)
  141. go_addr = dev[0].p2p_dev_addr()
  142. dev[1].request("SET p2p_no_group_iface 0")
  143. if not dev[1].discover_peer(go_addr, social=True):
  144. raise Exception("GO " + go_addr + " not found")
  145. dev[1].dump_monitor()
  146. if not dev[2].discover_peer(go_addr, social=True):
  147. raise Exception("GO " + go_addr + " not found")
  148. dev[2].dump_monitor()
  149. logger.info("Trying to join the group when GO has not authorized the client")
  150. pin = dev[1].wps_read_pin()
  151. cmd = "P2P_CONNECT " + go_addr + " " + pin + " join"
  152. if "OK" not in dev[1].global_request(cmd):
  153. raise Exception("P2P_CONNECT join failed")
  154. pin = dev[2].wps_read_pin()
  155. cmd = "P2P_CONNECT " + go_addr + " " + pin + " join"
  156. if "OK" not in dev[2].global_request(cmd):
  157. raise Exception("P2P_CONNECT join failed")
  158. ev = dev[1].wait_global_event(["WPS-M2D"], timeout=10)
  159. if ev is None:
  160. raise Exception("No global M2D event")
  161. ifaces = dev[1].request("INTERFACES").splitlines()
  162. iface = ifaces[0] if "p2p-wlan" in ifaces[0] else ifaces[1]
  163. wpas = WpaSupplicant(ifname=iface)
  164. ev = wpas.wait_event(["WPS-M2D"], timeout=10)
  165. if ev is None:
  166. raise Exception("No M2D event on group interface")
  167. ev = dev[2].wait_global_event(["WPS-M2D"], timeout=10)
  168. if ev is None:
  169. raise Exception("No global M2D event (2)")
  170. ev = dev[2].wait_event(["WPS-M2D"], timeout=10)
  171. if ev is None:
  172. raise Exception("No M2D event on group interface (2)")
  173. def test_autogo_fail(dev):
  174. """P2P autonomous GO and incorrect PIN"""
  175. autogo(dev[0], freq=2412)
  176. go_addr = dev[0].p2p_dev_addr()
  177. dev[0].p2p_go_authorize_client("00000000")
  178. dev[1].request("SET p2p_no_group_iface 0")
  179. if not dev[1].discover_peer(go_addr, social=True):
  180. raise Exception("GO " + go_addr + " not found")
  181. dev[1].dump_monitor()
  182. logger.info("Trying to join the group when GO has not authorized the client")
  183. pin = dev[1].wps_read_pin()
  184. cmd = "P2P_CONNECT " + go_addr + " " + pin + " join"
  185. if "OK" not in dev[1].global_request(cmd):
  186. raise Exception("P2P_CONNECT join failed")
  187. ev = dev[1].wait_global_event(["WPS-FAIL"], timeout=10)
  188. if ev is None:
  189. raise Exception("No global WPS-FAIL event")
  190. def test_autogo_2cli(dev):
  191. """P2P autonomous GO and two clients joining group"""
  192. autogo(dev[0], freq=2412)
  193. connect_cli(dev[0], dev[1], social=True, freq=2412)
  194. connect_cli(dev[0], dev[2], social=True, freq=2412)
  195. hwsim_utils.test_connectivity_p2p(dev[1], dev[2])
  196. dev[0].global_request("P2P_REMOVE_CLIENT " + dev[1].p2p_dev_addr())
  197. dev[1].wait_go_ending_session()
  198. dev[0].global_request("P2P_REMOVE_CLIENT iface=" + dev[2].p2p_interface_addr())
  199. dev[2].wait_go_ending_session()
  200. if "FAIL" not in dev[0].global_request("P2P_REMOVE_CLIENT foo"):
  201. raise Exception("Invalid P2P_REMOVE_CLIENT command accepted")
  202. dev[0].remove_group()
  203. def test_autogo_pbc(dev):
  204. """P2P autonomous GO and PBC"""
  205. dev[1].request("SET p2p_no_group_iface 0")
  206. autogo(dev[0], freq=2412)
  207. if "FAIL" not in dev[0].group_request("WPS_PBC p2p_dev_addr=00:11:22:33:44"):
  208. raise Exception("Invalid WPS_PBC succeeded")
  209. if "OK" not in dev[0].group_request("WPS_PBC p2p_dev_addr=" + dev[1].p2p_dev_addr()):
  210. raise Exception("WPS_PBC failed")
  211. dev[2].p2p_connect_group(dev[0].p2p_dev_addr(), "pbc", timeout=0,
  212. social=True)
  213. ev = dev[2].wait_event(["WPS-M2D"], timeout=15)
  214. if ev is None:
  215. raise Exception("WPS-M2D not reported")
  216. if "config_error=12" not in ev:
  217. raise Exception("Unexpected config_error: " + ev)
  218. dev[1].p2p_connect_group(dev[0].p2p_dev_addr(), "pbc", timeout=15,
  219. social=True)
  220. def test_autogo_tdls(dev):
  221. """P2P autonomous GO and two clients using TDLS"""
  222. wt = Wlantest()
  223. go = dev[0]
  224. logger.info("Start autonomous GO with fixed parameters " + go.ifname)
  225. id = go.add_network()
  226. go.set_network_quoted(id, "ssid", "DIRECT-tdls")
  227. go.set_network_quoted(id, "psk", "12345678")
  228. go.set_network(id, "mode", "3")
  229. go.set_network(id, "disabled", "2")
  230. res = go.p2p_start_go(persistent=id, freq="2462")
  231. logger.debug("res: " + str(res))
  232. wt.flush()
  233. wt.add_passphrase("12345678")
  234. connect_cli(go, dev[1], social=True, freq=2462)
  235. connect_cli(go, dev[2], social=True, freq=2462)
  236. hwsim_utils.test_connectivity_p2p(dev[1], dev[2])
  237. bssid = dev[0].p2p_interface_addr()
  238. addr1 = dev[1].p2p_interface_addr()
  239. addr2 = dev[2].p2p_interface_addr()
  240. dev[1].tdls_setup(addr2)
  241. time.sleep(1)
  242. hwsim_utils.test_connectivity_p2p(dev[1], dev[2])
  243. conf = wt.get_tdls_counter("setup_conf_ok", bssid, addr1, addr2);
  244. if conf == 0:
  245. raise Exception("No TDLS Setup Confirm (success) seen")
  246. dl = wt.get_tdls_counter("valid_direct_link", bssid, addr1, addr2);
  247. if dl == 0:
  248. raise Exception("No valid frames through direct link")
  249. wt.tdls_clear(bssid, addr1, addr2);
  250. dev[1].tdls_teardown(addr2)
  251. time.sleep(1)
  252. teardown = wt.get_tdls_counter("teardown", bssid, addr1, addr2);
  253. if teardown == 0:
  254. raise Exception("No TDLS Setup Teardown seen")
  255. wt.tdls_clear(bssid, addr1, addr2);
  256. hwsim_utils.test_connectivity_p2p(dev[1], dev[2])
  257. ap_path = wt.get_tdls_counter("valid_ap_path", bssid, addr1, addr2);
  258. if ap_path == 0:
  259. raise Exception("No valid frames via AP path")
  260. direct_link = wt.get_tdls_counter("valid_direct_link", bssid, addr1, addr2);
  261. if direct_link > 0:
  262. raise Exception("Unexpected frames through direct link")
  263. idirect_link = wt.get_tdls_counter("invalid_direct_link", bssid, addr1,
  264. addr2);
  265. if idirect_link > 0:
  266. raise Exception("Unexpected frames through direct link (invalid)")
  267. dev[2].remove_group()
  268. dev[1].remove_group()
  269. dev[0].remove_group()
  270. def test_autogo_legacy(dev):
  271. """P2P autonomous GO and legacy clients"""
  272. res = autogo(dev[0], freq=2462)
  273. if dev[0].get_group_status_field("passphrase", extra="WPS") != res['passphrase']:
  274. raise Exception("passphrase mismatch")
  275. if dev[0].group_request("P2P_GET_PASSPHRASE") != res['passphrase']:
  276. raise Exception("passphrase mismatch(2)")
  277. logger.info("Connect P2P client")
  278. connect_cli(dev[0], dev[1], social=True, freq=2462)
  279. if "FAIL" not in dev[1].request("P2P_GET_PASSPHRASE"):
  280. raise Exception("P2P_GET_PASSPHRASE succeeded on P2P Client")
  281. logger.info("Connect legacy WPS client")
  282. pin = dev[2].wps_read_pin()
  283. dev[0].p2p_go_authorize_client(pin)
  284. dev[2].request("P2P_SET disabled 1")
  285. dev[2].dump_monitor()
  286. dev[2].request("WPS_PIN any " + pin)
  287. dev[2].wait_connected(timeout=30)
  288. status = dev[2].get_status()
  289. if status['wpa_state'] != 'COMPLETED':
  290. raise Exception("Not fully connected")
  291. hwsim_utils.test_connectivity_p2p_sta(dev[1], dev[2])
  292. dev[2].request("DISCONNECT")
  293. logger.info("Connect legacy non-WPS client")
  294. dev[2].request("FLUSH")
  295. dev[2].request("P2P_SET disabled 1")
  296. dev[2].connect(ssid=res['ssid'], psk=res['passphrase'], proto='RSN',
  297. key_mgmt='WPA-PSK', pairwise='CCMP', group='CCMP',
  298. scan_freq=res['freq'])
  299. hwsim_utils.test_connectivity_p2p_sta(dev[1], dev[2])
  300. dev[2].request("DISCONNECT")
  301. dev[0].remove_group()
  302. dev[1].wait_go_ending_session()
  303. def test_autogo_chan_switch(dev):
  304. """P2P autonomous GO switching channels"""
  305. autogo(dev[0], freq=2417)
  306. connect_cli(dev[0], dev[1])
  307. res = dev[0].request("CHAN_SWITCH 5 2422")
  308. if "FAIL" in res:
  309. # for now, skip test since mac80211_hwsim support is not yet widely
  310. # deployed
  311. raise HwsimSkip("Assume mac80211_hwsim did not support channel switching")
  312. ev = dev[0].wait_event(["AP-CSA-FINISHED"], timeout=10)
  313. if ev is None:
  314. raise Exception("CSA finished event timed out")
  315. if "freq=2422" not in ev:
  316. raise Exception("Unexpected cahnnel in CSA finished event")
  317. dev[0].dump_monitor()
  318. dev[1].dump_monitor()
  319. time.sleep(0.1)
  320. hwsim_utils.test_connectivity_p2p(dev[0], dev[1])
  321. def test_autogo_extra_cred(dev):
  322. """P2P autonomous GO sending two WPS credentials"""
  323. if "FAIL" in dev[0].request("SET wps_testing_dummy_cred 1"):
  324. raise Exception("Failed to enable test mode")
  325. autogo(dev[0], freq=2412)
  326. connect_cli(dev[0], dev[1], social=True, freq=2412)
  327. dev[0].remove_group()
  328. dev[1].wait_go_ending_session()
  329. def test_autogo_ifdown(dev):
  330. """P2P autonomous GO and external ifdown"""
  331. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  332. wpas.interface_add("wlan5")
  333. res = autogo(wpas)
  334. wpas.dump_monitor()
  335. wpas.interface_remove("wlan5")
  336. wpas.interface_add("wlan5")
  337. res = autogo(wpas)
  338. wpas.dump_monitor()
  339. subprocess.call(['ifconfig', res['ifname'], 'down'])
  340. ev = wpas.wait_global_event(["P2P-GROUP-REMOVED"], timeout=10)
  341. if ev is None:
  342. raise Exception("Group removal not reported")
  343. if res['ifname'] not in ev:
  344. raise Exception("Unexpected group removal event: " + ev)
  345. def test_autogo_start_during_scan(dev):
  346. """P2P autonomous GO started during ongoing manual scan"""
  347. try:
  348. # use autoscan to set scan_req = MANUAL_SCAN_REQ
  349. if "OK" not in dev[0].request("AUTOSCAN periodic:1"):
  350. raise Exception("Failed to set autoscan")
  351. autogo(dev[0], freq=2462)
  352. connect_cli(dev[0], dev[1], social=True, freq=2462)
  353. dev[0].remove_group()
  354. dev[1].wait_go_ending_session()
  355. finally:
  356. dev[0].request("AUTOSCAN ")
  357. def test_autogo_passphrase_len(dev):
  358. """P2P autonomous GO and longer passphrase"""
  359. try:
  360. if "OK" not in dev[0].request("SET p2p_passphrase_len 13"):
  361. raise Exception("Failed to set passphrase length")
  362. res = autogo(dev[0], freq=2412)
  363. if len(res['passphrase']) != 13:
  364. raise Exception("Unexpected passphrase length")
  365. if dev[0].get_group_status_field("passphrase", extra="WPS") != res['passphrase']:
  366. raise Exception("passphrase mismatch")
  367. logger.info("Connect P2P client")
  368. connect_cli(dev[0], dev[1], social=True, freq=2412)
  369. logger.info("Connect legacy WPS client")
  370. pin = dev[2].wps_read_pin()
  371. dev[0].p2p_go_authorize_client(pin)
  372. dev[2].request("P2P_SET disabled 1")
  373. dev[2].dump_monitor()
  374. dev[2].request("WPS_PIN any " + pin)
  375. dev[2].wait_connected(timeout=30)
  376. status = dev[2].get_status()
  377. if status['wpa_state'] != 'COMPLETED':
  378. raise Exception("Not fully connected")
  379. dev[2].request("DISCONNECT")
  380. logger.info("Connect legacy non-WPS client")
  381. dev[2].request("FLUSH")
  382. dev[2].request("P2P_SET disabled 1")
  383. dev[2].connect(ssid=res['ssid'], psk=res['passphrase'], proto='RSN',
  384. key_mgmt='WPA-PSK', pairwise='CCMP', group='CCMP',
  385. scan_freq=res['freq'])
  386. hwsim_utils.test_connectivity_p2p_sta(dev[1], dev[2])
  387. dev[2].request("DISCONNECT")
  388. dev[0].remove_group()
  389. dev[1].wait_go_ending_session()
  390. finally:
  391. dev[0].request("SET p2p_passphrase_len 8")
  392. def test_autogo_bridge(dev):
  393. """P2P autonomous GO in a bridge"""
  394. try:
  395. # use autoscan to set scan_req = MANUAL_SCAN_REQ
  396. if "OK" not in dev[0].request("AUTOSCAN periodic:1"):
  397. raise Exception("Failed to set autoscan")
  398. autogo(dev[0])
  399. subprocess.call(['brctl', 'addbr', 'p2p-br0'])
  400. subprocess.call(['brctl', 'setfd', 'p2p-br0', '0'])
  401. subprocess.call(['brctl', 'addif', 'p2p-br0', dev[0].ifname])
  402. subprocess.call(['ip', 'link', 'set', 'dev', 'p2p-br0', 'up'])
  403. time.sleep(0.1)
  404. subprocess.call(['brctl', 'delif', 'p2p-br0', dev[0].ifname])
  405. time.sleep(0.1)
  406. subprocess.call(['ip', 'link', 'set', 'dev', 'p2p-br0', 'down'])
  407. time.sleep(0.1)
  408. subprocess.call(['brctl', 'delbr', 'p2p-br0'])
  409. ev = dev[0].wait_global_event(["P2P-GROUP-REMOVED"], timeout=1)
  410. if ev is not None:
  411. raise Exception("P2P group removed unexpectedly")
  412. if dev[0].get_status_field('wpa_state') != "COMPLETED":
  413. raise Exception("Unexpected wpa_state")
  414. dev[0].remove_group()
  415. finally:
  416. dev[0].request("AUTOSCAN ")
  417. subprocess.Popen(['brctl', 'delif', 'p2p-br0', dev[0].ifname],
  418. stderr=open('/dev/null', 'w'))
  419. subprocess.Popen(['ip', 'link', 'set', 'dev', 'p2p-br0', 'down'],
  420. stderr=open('/dev/null', 'w'))
  421. subprocess.Popen(['brctl', 'delbr', 'p2p-br0'],
  422. stderr=open('/dev/null', 'w'))
  423. def test_presence_req_on_group_interface(dev):
  424. """P2P_PRESENCE_REQ on group interface"""
  425. dev[1].request("SET p2p_no_group_iface 0")
  426. res = autogo(dev[0], freq=2437)
  427. res = connect_cli(dev[0], dev[1], social=True, freq=2437)
  428. if "FAIL" in dev[1].group_request("P2P_PRESENCE_REQ 30000 102400"):
  429. raise Exception("Could not send presence request")
  430. ev = dev[1].wait_group_event(["P2P-PRESENCE-RESPONSE"])
  431. if ev is None:
  432. raise Exception("Timeout while waiting for Presence Response")
  433. dev[0].remove_group()
  434. dev[1].wait_go_ending_session()