test_p2p_autogo.py 19 KB

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