test_p2p_channel.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. # P2P channel selection test cases
  2. # Copyright (c) 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 logging
  7. logger = logging.getLogger()
  8. import os
  9. import subprocess
  10. import time
  11. import hostapd
  12. import hwsim_utils
  13. from wpasupplicant import WpaSupplicant
  14. from hwsim import HWSimRadio
  15. from test_p2p_grpform import go_neg_pin_authorized
  16. from test_p2p_grpform import check_grpform_results
  17. from test_p2p_grpform import remove_group
  18. from test_p2p_grpform import go_neg_pbc
  19. from test_p2p_autogo import autogo
  20. def set_country(country):
  21. subprocess.call(['sudo', 'iw', 'reg', 'set', country])
  22. time.sleep(0.1)
  23. def test_p2p_channel_5ghz(dev):
  24. """P2P group formation with 5 GHz preference"""
  25. try:
  26. set_country("US")
  27. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  28. r_dev=dev[1], r_intent=0,
  29. test_data=False)
  30. check_grpform_results(i_res, r_res)
  31. freq = int(i_res['freq'])
  32. if freq < 5000:
  33. raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq)
  34. remove_group(dev[0], dev[1])
  35. finally:
  36. set_country("00")
  37. def test_p2p_channel_5ghz_no_vht(dev):
  38. """P2P group formation with 5 GHz preference when VHT channels are disallowed"""
  39. try:
  40. set_country("US")
  41. dev[0].request("P2P_SET disallow_freq 5180-5240")
  42. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  43. r_dev=dev[1], r_intent=0,
  44. test_data=False)
  45. check_grpform_results(i_res, r_res)
  46. freq = int(i_res['freq'])
  47. if freq < 5000:
  48. raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq)
  49. remove_group(dev[0], dev[1])
  50. finally:
  51. set_country("00")
  52. dev[0].request("P2P_SET disallow_freq ")
  53. def test_p2p_channel_random_social(dev):
  54. """P2P group formation with 5 GHz preference but all 5 GHz channels disabled"""
  55. try:
  56. set_country("US")
  57. dev[0].request("SET p2p_oper_channel 11")
  58. dev[0].request("P2P_SET disallow_freq 5000-6000,2462")
  59. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  60. r_dev=dev[1], r_intent=0,
  61. test_data=False)
  62. check_grpform_results(i_res, r_res)
  63. freq = int(i_res['freq'])
  64. if freq not in [ 2412, 2437, 2462 ]:
  65. raise Exception("Unexpected channel %d MHz - did not pick random social channel" % freq)
  66. remove_group(dev[0], dev[1])
  67. finally:
  68. set_country("00")
  69. dev[0].request("P2P_SET disallow_freq ")
  70. def test_p2p_channel_random(dev):
  71. """P2P group formation with 5 GHz preference but all 5 GHz channels and all social channels disabled"""
  72. try:
  73. set_country("US")
  74. dev[0].request("SET p2p_oper_channel 11")
  75. dev[0].request("P2P_SET disallow_freq 5000-6000,2412,2437,2462")
  76. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  77. r_dev=dev[1], r_intent=0,
  78. test_data=False)
  79. check_grpform_results(i_res, r_res)
  80. freq = int(i_res['freq'])
  81. if freq > 2500 or freq in [ 2412, 2437, 2462 ]:
  82. raise Exception("Unexpected channel %d MHz" % freq)
  83. remove_group(dev[0], dev[1])
  84. finally:
  85. set_country("00")
  86. dev[0].request("P2P_SET disallow_freq ")
  87. def test_p2p_channel_random_social_with_op_class_change(dev, apdev, params):
  88. """P2P group formation using random social channel with oper class change needed"""
  89. try:
  90. set_country("US")
  91. logger.info("Start group on 5 GHz")
  92. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  93. r_dev=dev[1], r_intent=0,
  94. test_data=False)
  95. check_grpform_results(i_res, r_res)
  96. freq = int(i_res['freq'])
  97. if freq < 5000:
  98. raise Exception("Unexpected channel %d MHz - did not pick 5 GHz preference" % freq)
  99. remove_group(dev[0], dev[1])
  100. logger.info("Disable 5 GHz and try to re-start group based on 5 GHz preference")
  101. dev[0].request("SET p2p_oper_reg_class 115")
  102. dev[0].request("SET p2p_oper_channel 36")
  103. dev[0].request("P2P_SET disallow_freq 5000-6000")
  104. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  105. r_dev=dev[1], r_intent=0,
  106. test_data=False)
  107. check_grpform_results(i_res, r_res)
  108. freq = int(i_res['freq'])
  109. if freq not in [ 2412, 2437, 2462 ]:
  110. raise Exception("Unexpected channel %d MHz - did not pick random social channel" % freq)
  111. remove_group(dev[0], dev[1])
  112. try:
  113. arg = [ "tshark",
  114. "-r", os.path.join(params['logdir'], "hwsim0.pcapng"),
  115. "-Y", "wifi_p2p.public_action.subtype == 0",
  116. "-V" ]
  117. cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
  118. stderr=open('/dev/null', 'w'))
  119. except Exception, e:
  120. logger.info("Could run run tshark check: " + str(e))
  121. cmd = None
  122. pass
  123. if cmd:
  124. last = None
  125. for l in cmd.stdout.read().splitlines():
  126. if "Operating Channel:" not in l:
  127. continue
  128. last = l
  129. if last is None:
  130. raise Exception("Could not find GO Negotiation Request")
  131. if "Operating Class 81" not in last:
  132. raise Exception("Unexpected operating class: " + last.strip())
  133. finally:
  134. set_country("00")
  135. dev[0].request("P2P_SET disallow_freq ")
  136. dev[0].request("SET p2p_oper_reg_class 81")
  137. dev[0].request("SET p2p_oper_channel 11")
  138. def test_p2p_channel_avoid(dev):
  139. """P2P and avoid frequencies driver event"""
  140. try:
  141. set_country("US")
  142. if "OK" not in dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES 5000-6000,2412,2437,2462"):
  143. raise Exception("Could not simulate driver event")
  144. ev = dev[0].wait_event(["CTRL-EVENT-AVOID-FREQ"], timeout=10)
  145. if ev is None:
  146. raise Exception("No CTRL-EVENT-AVOID-FREQ event")
  147. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  148. r_dev=dev[1], r_intent=0,
  149. test_data=False)
  150. check_grpform_results(i_res, r_res)
  151. freq = int(i_res['freq'])
  152. if freq > 2500 or freq in [ 2412, 2437, 2462 ]:
  153. raise Exception("Unexpected channel %d MHz" % freq)
  154. if "OK" not in dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES"):
  155. raise Exception("Could not simulate driver event(2)")
  156. ev = dev[0].wait_event(["CTRL-EVENT-AVOID-FREQ"], timeout=10)
  157. if ev is None:
  158. raise Exception("No CTRL-EVENT-AVOID-FREQ event")
  159. ev = dev[0].wait_event(["P2P-REMOVE-AND-REFORM-GROUP"], timeout=1)
  160. if ev is not None:
  161. raise Exception("Unexpected P2P-REMOVE-AND-REFORM-GROUP event")
  162. if "OK" not in dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES " + str(freq)):
  163. raise Exception("Could not simulate driver event(3)")
  164. ev = dev[0].wait_event(["CTRL-EVENT-AVOID-FREQ"], timeout=10)
  165. if ev is None:
  166. raise Exception("No CTRL-EVENT-AVOID-FREQ event")
  167. ev = dev[0].wait_event(["P2P-REMOVE-AND-REFORM-GROUP"], timeout=10)
  168. if ev is None:
  169. raise Exception("No P2P-REMOVE-AND-REFORM-GROUP event")
  170. finally:
  171. set_country("00")
  172. dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES")
  173. def test_autogo_following_bss(dev, apdev):
  174. """P2P autonomous GO operate on the same channel as station interface"""
  175. if dev[0].get_mcc() > 1:
  176. logger.info("test mode: MCC")
  177. dev[0].request("SET p2p_no_group_iface 0")
  178. channels = { 3 : "2422", 5 : "2432", 9 : "2452" }
  179. for key in channels:
  180. hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test',
  181. "channel" : str(key) })
  182. dev[0].connect("ap-test", key_mgmt="NONE",
  183. scan_freq=str(channels[key]))
  184. res_go = autogo(dev[0])
  185. if res_go['freq'] != channels[key]:
  186. raise Exception("Group operation channel is not the same as on connected station interface")
  187. hwsim_utils.test_connectivity(dev[0], hapd)
  188. dev[0].remove_group(res_go['ifname'])
  189. def test_go_neg_with_bss_connected(dev, apdev):
  190. """P2P channel selection: GO negotiation when station interface is connected"""
  191. dev[0].request("SET p2p_no_group_iface 0")
  192. hapd = hostapd.add_ap(apdev[0]['ifname'],
  193. { "ssid": 'bss-2.4ghz', "channel": '5' })
  194. dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2432")
  195. #dev[0] as GO
  196. [i_res, r_res] = go_neg_pbc(i_dev=dev[0], i_intent=10, r_dev=dev[1],
  197. r_intent=1)
  198. check_grpform_results(i_res, r_res)
  199. if i_res['role'] != "GO":
  200. raise Exception("GO not selected according to go_intent")
  201. if i_res['freq'] != "2432":
  202. raise Exception("Group formed on a different frequency than BSS")
  203. hwsim_utils.test_connectivity(dev[0], hapd)
  204. dev[0].remove_group(i_res['ifname'])
  205. if dev[0].get_mcc() > 1:
  206. logger.info("Skip as-client case due to MCC being enabled")
  207. return;
  208. #dev[0] as client
  209. [i_res2, r_res2] = go_neg_pbc(i_dev=dev[0], i_intent=1, r_dev=dev[1],
  210. r_intent=10)
  211. check_grpform_results(i_res2, r_res2)
  212. if i_res2['role'] != "client":
  213. raise Exception("GO not selected according to go_intent")
  214. if i_res2['freq'] != "2432":
  215. raise Exception("Group formed on a different frequency than BSS")
  216. hwsim_utils.test_connectivity(dev[0], hapd)
  217. def test_autogo_with_bss_on_disallowed_chan(dev, apdev):
  218. """P2P channel selection: Autonomous GO with BSS on a disallowed channel"""
  219. with HWSimRadio(n_channels=2) as (radio, iface):
  220. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  221. wpas.interface_add(iface)
  222. wpas.request("SET p2p_no_group_iface 0")
  223. if wpas.get_mcc() < 2:
  224. raise Exception("New radio does not support MCC")
  225. try:
  226. hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
  227. "channel": '1' })
  228. wpas.request("P2P_SET disallow_freq 2412")
  229. wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
  230. res = autogo(wpas)
  231. if res['freq'] == "2412":
  232. raise Exception("GO set on a disallowed channel")
  233. hwsim_utils.test_connectivity(wpas, hapd)
  234. finally:
  235. wpas.request("P2P_SET disallow_freq ")
  236. def test_go_neg_with_bss_on_disallowed_chan(dev, apdev):
  237. """P2P channel selection: GO negotiation with station interface on a disallowed channel"""
  238. with HWSimRadio(n_channels=2) as (radio, iface):
  239. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  240. wpas.interface_add(iface)
  241. wpas.request("SET p2p_no_group_iface 0")
  242. if wpas.get_mcc() < 2:
  243. raise Exception("New radio does not support MCC")
  244. try:
  245. hapd = hostapd.add_ap(apdev[0]['ifname'],
  246. { "ssid": 'bss-2.4ghz', "channel": '1' })
  247. wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
  248. wpas.request("P2P_SET disallow_freq 2412")
  249. #wpas as GO
  250. [i_res, r_res] = go_neg_pbc(i_dev=wpas, i_intent=10, r_dev=dev[1],
  251. r_intent=1)
  252. check_grpform_results(i_res, r_res)
  253. if i_res['role'] != "GO":
  254. raise Exception("GO not selected according to go_intent")
  255. if i_res['freq'] == "2412":
  256. raise Exception("Group formed on a disallowed channel")
  257. hwsim_utils.test_connectivity(wpas, hapd)
  258. wpas.remove_group(i_res['ifname'])
  259. #wpas as client
  260. [i_res2, r_res2] = go_neg_pbc(i_dev=wpas, i_intent=1, r_dev=dev[1],
  261. r_intent=10)
  262. check_grpform_results(i_res2, r_res2)
  263. if i_res2['role'] != "client":
  264. raise Exception("GO not selected according to go_intent")
  265. if i_res2['freq'] == "2412":
  266. raise Exception("Group formed on a disallowed channel")
  267. hwsim_utils.test_connectivity(wpas, hapd)
  268. finally:
  269. wpas.request("P2P_SET disallow_freq ")
  270. def test_autogo_force_diff_channel(dev, apdev):
  271. """P2P autonomous GO and station interface operate on different channels"""
  272. with HWSimRadio(n_channels=2) as (radio, iface):
  273. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  274. wpas.interface_add(iface)
  275. if wpas.get_mcc() < 2:
  276. raise Exception("New radio does not support MCC")
  277. wpas.request("SET p2p_no_group_iface 0")
  278. hapd = hostapd.add_ap(apdev[0]['ifname'],
  279. {"ssid" : 'ap-test', "channel" : '1'})
  280. wpas.connect("ap-test", key_mgmt = "NONE", scan_freq = "2412")
  281. channels = { 2 : 2417, 5 : 2432, 9 : 2452 }
  282. for key in channels:
  283. res_go = autogo(wpas, channels[key])
  284. hwsim_utils.test_connectivity(wpas, hapd)
  285. if int(res_go['freq']) == 2412:
  286. raise Exception("Group operation channel is: 2412 excepted: " + res_go['freq'])
  287. wpas.remove_group(res_go['ifname'])
  288. def test_go_neg_forced_freq_diff_than_bss_freq(dev, apdev):
  289. """P2P channel selection: GO negotiation with forced freq different than station interface"""
  290. with HWSimRadio(n_channels=2) as (radio, iface):
  291. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  292. wpas.interface_add(iface)
  293. if wpas.get_mcc() < 2:
  294. raise Exception("New radio does not support MCC")
  295. wpas.request("SET p2p_no_group_iface 0")
  296. hapd = hostapd.add_ap(apdev[0]['ifname'],
  297. { "country_code": 'US',
  298. "ssid": 'bss-5ghz', "hw_mode": 'a',
  299. "channel": '40' })
  300. wpas.connect("bss-5ghz", key_mgmt="NONE", scan_freq="5200")
  301. # GO and peer force the same freq, different than BSS freq,
  302. # wpas to become GO
  303. [i_res, r_res] = go_neg_pbc(i_dev=dev[1], i_intent=1, i_freq=5180,
  304. r_dev=wpas, r_intent=14, r_freq=5180)
  305. check_grpform_results(i_res, r_res)
  306. if i_res['freq'] != "5180":
  307. raise Exception("P2P group formed on unexpected frequency: " + i_res['freq'])
  308. if r_res['role'] != "GO":
  309. raise Exception("GO not selected according to go_intent")
  310. hwsim_utils.test_connectivity(wpas, hapd)
  311. wpas.remove_group(r_res['ifname'])
  312. # GO and peer force the same freq, different than BSS freq, wpas to
  313. # become client
  314. [i_res2, r_res2] = go_neg_pbc(i_dev=dev[1], i_intent=14, i_freq=2422,
  315. r_dev=wpas, r_intent=1, r_freq=2422)
  316. check_grpform_results(i_res2, r_res2)
  317. if i_res2['freq'] != "2422":
  318. raise Exception("P2P group formed on unexpected frequency: " + i_res2['freq'])
  319. if r_res2['role'] != "client":
  320. raise Exception("GO not selected according to go_intent")
  321. hwsim_utils.test_connectivity(wpas, hapd)
  322. def test_go_pref_chan_bss_on_diff_chan(dev, apdev):
  323. """P2P channel selection: Station on different channel than GO configured pref channel"""
  324. dev[0].request("SET p2p_no_group_iface 0")
  325. try:
  326. hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
  327. "channel": '1' })
  328. dev[0].request("SET p2p_pref_chan 81:2")
  329. dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
  330. res = autogo(dev[0])
  331. if res['freq'] != "2412":
  332. raise Exception("GO channel did not follow BSS")
  333. hwsim_utils.test_connectivity(dev[0], hapd)
  334. finally:
  335. dev[0].request("SET p2p_pref_chan ")
  336. def test_go_pref_chan_bss_on_disallowed_chan(dev, apdev):
  337. """P2P channel selection: Station interface on different channel than GO configured pref channel, and station channel is disallowed"""
  338. with HWSimRadio(n_channels=2) as (radio, iface):
  339. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  340. wpas.interface_add(iface)
  341. if wpas.get_mcc() < 2:
  342. raise Exception("New radio does not support MCC")
  343. wpas.request("SET p2p_no_group_iface 0")
  344. try:
  345. hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
  346. "channel": '1' })
  347. wpas.request("P2P_SET disallow_freq 2412")
  348. wpas.request("SET p2p_pref_chan 81:2")
  349. wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
  350. res2 = autogo(wpas)
  351. if res2['freq'] != "2417":
  352. raise Exception("GO channel did not follow pref_chan configuration")
  353. hwsim_utils.test_connectivity(wpas, hapd)
  354. finally:
  355. wpas.request("P2P_SET disallow_freq ")
  356. wpas.request("SET p2p_pref_chan ")
  357. def test_no_go_freq(dev, apdev):
  358. """P2P channel selection: no GO freq"""
  359. try:
  360. dev[0].request("SET p2p_no_go_freq 2412")
  361. # dev[0] as client, channel 1 is ok
  362. [i_res, r_res] = go_neg_pbc(i_dev=dev[0], i_intent=1,
  363. r_dev=dev[1], r_intent=14, r_freq=2412)
  364. check_grpform_results(i_res, r_res)
  365. if i_res['freq'] != "2412":
  366. raise Exception("P2P group not formed on forced freq")
  367. dev[1].remove_group(r_res['ifname'])
  368. fail = False
  369. # dev[0] as GO, channel 1 is not allowed
  370. try:
  371. dev[0].request("SET p2p_no_go_freq 2412")
  372. [i_res2, r_res2] = go_neg_pbc(i_dev=dev[0], i_intent=14,
  373. r_dev=dev[1], r_intent=1, r_freq=2412)
  374. check_grpform_results(i_res2, r_res2)
  375. fail = True
  376. except:
  377. pass
  378. if fail:
  379. raise Exception("GO set on a disallowed freq")
  380. finally:
  381. dev[0].request("SET p2p_no_go_freq ")
  382. def test_go_neg_peers_force_diff_freq(dev, apdev):
  383. try:
  384. [i_res2, r_res2] = go_neg_pbc(i_dev=dev[0], i_intent=14, i_freq=5180,
  385. r_dev=dev[1], r_intent=0, r_freq=5200)
  386. except Exception, e:
  387. return
  388. raise Exception("Unexpected group formation success")
  389. def test_autogo_random_channel(dev, apdev):
  390. """P2P channel selection: GO instantiated on random channel 1, 6, 11"""
  391. freqs = []
  392. go_freqs = ["2412", "2437", "2462"]
  393. for i in range(0, 20):
  394. result = autogo(dev[0])
  395. if result['freq'] not in go_freqs:
  396. raise Exception("Unexpected frequency selected: " + result['freq'])
  397. if result['freq'] not in freqs:
  398. freqs.append(result['freq'])
  399. if len(freqs) == 3:
  400. break
  401. dev[0].remove_group(result['ifname'])
  402. if i == 20:
  403. raise Exception("GO created 20 times and not all social channels were selected. freqs not selected: " + str(list(set(go_freqs) - set(freqs))))
  404. def test_p2p_autogo_pref_chan_disallowed(dev, apdev):
  405. """P2P channel selection: GO preferred channels are disallowed"""
  406. try:
  407. dev[0].request("SET p2p_pref_chan 81:1,81:3,81:6,81:9,81:11")
  408. dev[0].request("P2P_SET disallow_freq 2412,2422,2437,2452,2462")
  409. for i in range(0, 5):
  410. res = autogo(dev[0])
  411. if res['freq'] in [ "2412", "2422", "2437", "2452", "2462" ]:
  412. raise Exception("GO channel is disallowed")
  413. dev[0].remove_group(res['ifname'])
  414. finally:
  415. dev[0].request("P2P_SET disallow_freq ")
  416. dev[0].request("SET p2p_pref_chan ")
  417. def test_p2p_autogo_pref_chan_not_in_regulatory(dev, apdev):
  418. """P2P channel selection: GO preferred channel not allowed in the regulatory rules"""
  419. try:
  420. set_country("US")
  421. dev[0].request("SET p2p_pref_chan 124:149")
  422. res = autogo(dev[0], persistent=True)
  423. if res['freq'] != "5745":
  424. raise Exception("Unexpected channel selected: " + res['freq'])
  425. dev[0].remove_group(res['ifname'])
  426. netw = dev[0].list_networks()
  427. if len(netw) != 1:
  428. raise Exception("Unexpected number of network blocks: " + str(netw))
  429. id = netw[0]['id']
  430. set_country("DE")
  431. res = autogo(dev[0], persistent=id)
  432. if res['freq'] == "5745":
  433. raise Exception("Unexpected channel selected(2): " + res['freq'])
  434. dev[0].remove_group(res['ifname'])
  435. finally:
  436. dev[0].request("SET p2p_pref_chan ")
  437. set_country("00")