test_hapd_ctrl.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. # hostapd control interface
  2. # Copyright (c) 2014, Qualcomm Atheros, Inc.
  3. #
  4. # This software may be distributed under the terms of the BSD license.
  5. # See README for more details.
  6. import hostapd
  7. def test_hapd_ctrl_status(dev, apdev):
  8. """hostapd ctrl_iface STATUS commands"""
  9. ssid = "hapd-ctrl"
  10. bssid = apdev[0]['bssid']
  11. params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
  12. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  13. status = hapd.get_status()
  14. driver = hapd.get_driver_status()
  15. if status['bss[0]'] != apdev[0]['ifname']:
  16. raise Exception("Unexpected bss[0]")
  17. if status['ssid[0]'] != ssid:
  18. raise Exception("Unexpected ssid[0]")
  19. if status['bssid[0]'] != bssid:
  20. raise Exception("Unexpected bssid[0]")
  21. if status['freq'] != "2412":
  22. raise Exception("Unexpected freq")
  23. if driver['beacon_set'] != "1":
  24. raise Exception("Unexpected beacon_set")
  25. if driver['addr'] != bssid:
  26. raise Exception("Unexpected addr")
  27. def test_hapd_ctrl_p2p_manager(dev, apdev):
  28. """hostapd as P2P Device manager"""
  29. ssid = "hapd-p2p-mgr"
  30. passphrase = "12345678"
  31. params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
  32. params['manage_p2p'] = '1'
  33. params['allow_cross_connection'] = '0'
  34. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  35. dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
  36. addr = dev[0].own_addr()
  37. if "OK" not in hapd.request("DEAUTHENTICATE " + addr + " p2p=2"):
  38. raise Exception("DEAUTHENTICATE command failed")
  39. dev[0].wait_disconnected(timeout=5)
  40. dev[0].wait_connected(timeout=10, error="Re-connection timed out")
  41. if "OK" not in hapd.request("DISASSOCIATE " + addr + " p2p=2"):
  42. raise Exception("DISASSOCIATE command failed")
  43. dev[0].wait_disconnected(timeout=5)
  44. dev[0].wait_connected(timeout=10, error="Re-connection timed out")
  45. def test_hapd_ctrl_sta(dev, apdev):
  46. """hostapd and STA ctrl_iface commands"""
  47. ssid = "hapd-ctrl-sta"
  48. passphrase = "12345678"
  49. params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
  50. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  51. dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
  52. addr = dev[0].own_addr()
  53. if "FAIL" in hapd.request("STA " + addr):
  54. raise Exception("Unexpected STA failure")
  55. if "FAIL" not in hapd.request("STA " + addr + " eapol"):
  56. raise Exception("Unexpected STA-eapol success")
  57. if "FAIL" not in hapd.request("STA 00:11:22:33:44"):
  58. raise Exception("Unexpected STA success")
  59. if "FAIL" not in hapd.request("STA 00:11:22:33:44:55"):
  60. raise Exception("Unexpected STA success")
  61. if len(hapd.request("STA-NEXT " + addr).splitlines()) > 0:
  62. raise Exception("Unexpected STA-NEXT result")
  63. if "FAIL" not in hapd.request("STA-NEXT 00:11:22:33:44"):
  64. raise Exception("Unexpected STA-NEXT success")
  65. def test_hapd_ctrl_disconnect(dev, apdev):
  66. """hostapd and disconnection ctrl_iface commands"""
  67. ssid = "hapd-ctrl"
  68. passphrase = "12345678"
  69. params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
  70. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  71. dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
  72. addr = dev[0].p2p_dev_addr()
  73. if "FAIL" not in hapd.request("DEAUTHENTICATE 00:11:22:33:44"):
  74. raise Exception("Unexpected DEAUTHENTICATE success")
  75. if "OK" not in hapd.request("DEAUTHENTICATE ff:ff:ff:ff:ff:ff"):
  76. raise Exception("Unexpected DEAUTHENTICATE failure")
  77. dev[0].wait_disconnected(timeout=5)
  78. dev[0].wait_connected(timeout=10, error="Re-connection timed out")
  79. if "FAIL" not in hapd.request("DISASSOCIATE 00:11:22:33:44"):
  80. raise Exception("Unexpected DISASSOCIATE success")
  81. if "OK" not in hapd.request("DISASSOCIATE ff:ff:ff:ff:ff:ff"):
  82. raise Exception("Unexpected DISASSOCIATE failure")
  83. dev[0].wait_disconnected(timeout=5)
  84. dev[0].wait_connected(timeout=10, error="Re-connection timed out")
  85. def test_hapd_ctrl_chan_switch(dev, apdev):
  86. """hostapd and CHAN_SWITCH ctrl_iface command"""
  87. ssid = "hapd-ctrl"
  88. params = { "ssid": ssid }
  89. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  90. if "FAIL" not in hapd.request("CHAN_SWITCH "):
  91. raise Exception("Unexpected CHAN_SWITCH success")
  92. if "FAIL" not in hapd.request("CHAN_SWITCH qwerty 2422"):
  93. raise Exception("Unexpected CHAN_SWITCH success")
  94. if "FAIL" not in hapd.request("CHAN_SWITCH 5 qwerty"):
  95. raise Exception("Unexpected CHAN_SWITCH success")
  96. if "FAIL" not in hapd.request("CHAN_SWITCH 0 2432 center_freq1=123 center_freq2=234 bandwidth=1000 sec_channel_offset=20 ht vht"):
  97. raise Exception("Unexpected CHAN_SWITCH success")
  98. def test_hapd_ctrl_level(dev, apdev):
  99. """hostapd and LEVEL ctrl_iface command"""
  100. ssid = "hapd-ctrl"
  101. params = { "ssid": ssid }
  102. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  103. if "FAIL" not in hapd.request("LEVEL 0"):
  104. raise Exception("Unexpected LEVEL success on non-monitor interface")
  105. def test_hapd_ctrl_new_sta(dev, apdev):
  106. """hostapd and NEW_STA ctrl_iface command"""
  107. ssid = "hapd-ctrl"
  108. params = { "ssid": ssid }
  109. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  110. if "FAIL" not in hapd.request("NEW_STA 00:11:22:33:44"):
  111. raise Exception("Unexpected NEW_STA success")
  112. if "OK" not in hapd.request("NEW_STA 00:11:22:33:44:55"):
  113. raise Exception("Unexpected NEW_STA failure")
  114. if "AUTHORIZED" not in hapd.request("STA 00:11:22:33:44:55"):
  115. raise Exception("Unexpected NEW_STA STA status")
  116. def test_hapd_ctrl_get(dev, apdev):
  117. """hostapd and GET ctrl_iface command"""
  118. ssid = "hapd-ctrl"
  119. params = { "ssid": ssid }
  120. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  121. if "FAIL" not in hapd.request("GET foo"):
  122. raise Exception("Unexpected GET success")
  123. if "FAIL" in hapd.request("GET version"):
  124. raise Exception("Unexpected GET version failure")
  125. def test_hapd_ctrl_unknown(dev, apdev):
  126. """hostapd and unknown ctrl_iface command"""
  127. ssid = "hapd-ctrl"
  128. params = { "ssid": ssid }
  129. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  130. if "UNKNOWN COMMAND" not in hapd.request("FOO"):
  131. raise Exception("Unexpected response")
  132. def test_hapd_ctrl_hs20_wnm_notif(dev, apdev):
  133. """hostapd and HS20_WNM_NOTIF ctrl_iface command"""
  134. ssid = "hapd-ctrl"
  135. params = { "ssid": ssid }
  136. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  137. if "FAIL" not in hapd.request("HS20_WNM_NOTIF 00:11:22:33:44 http://example.com/"):
  138. raise Exception("Unexpected HS20_WNM_NOTIF success")
  139. if "FAIL" not in hapd.request("HS20_WNM_NOTIF 00:11:22:33:44:55http://example.com/"):
  140. raise Exception("Unexpected HS20_WNM_NOTIF success")
  141. def test_hapd_ctrl_hs20_deauth_req(dev, apdev):
  142. """hostapd and HS20_DEAUTH_REQ ctrl_iface command"""
  143. ssid = "hapd-ctrl"
  144. params = { "ssid": ssid }
  145. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  146. if "FAIL" not in hapd.request("HS20_DEAUTH_REQ 00:11:22:33:44 1 120 http://example.com/"):
  147. raise Exception("Unexpected HS20_DEAUTH_REQ success")
  148. if "FAIL" not in hapd.request("HS20_DEAUTH_REQ 00:11:22:33:44:55"):
  149. raise Exception("Unexpected HS20_DEAUTH_REQ success")
  150. if "FAIL" not in hapd.request("HS20_DEAUTH_REQ 00:11:22:33:44:55 1"):
  151. raise Exception("Unexpected HS20_DEAUTH_REQ success")
  152. def test_hapd_ctrl_disassoc_imminent(dev, apdev):
  153. """hostapd and DISASSOC_IMMINENT ctrl_iface command"""
  154. ssid = "hapd-ctrl"
  155. params = { "ssid": ssid }
  156. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  157. if "FAIL" not in hapd.request("DISASSOC_IMMINENT 00:11:22:33:44"):
  158. raise Exception("Unexpected DISASSOC_IMMINENT success")
  159. if "FAIL" not in hapd.request("DISASSOC_IMMINENT 00:11:22:33:44:55"):
  160. raise Exception("Unexpected DISASSOC_IMMINENT success")
  161. if "FAIL" not in hapd.request("DISASSOC_IMMINENT 00:11:22:33:44:55 2"):
  162. raise Exception("Unexpected DISASSOC_IMMINENT success")
  163. dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
  164. addr = dev[0].p2p_interface_addr()
  165. if "OK" not in hapd.request("DISASSOC_IMMINENT " + addr + " 2"):
  166. raise Exception("Unexpected DISASSOC_IMMINENT failure")
  167. ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 15)
  168. if ev is None:
  169. raise Exception("Scan timed out")
  170. def test_hapd_ctrl_ess_disassoc(dev, apdev):
  171. """hostapd and ESS_DISASSOC ctrl_iface command"""
  172. ssid = "hapd-ctrl"
  173. params = { "ssid": ssid }
  174. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  175. if "FAIL" not in hapd.request("ESS_DISASSOC 00:11:22:33:44"):
  176. raise Exception("Unexpected ESS_DISASSOCT success")
  177. if "FAIL" not in hapd.request("ESS_DISASSOC 00:11:22:33:44:55"):
  178. raise Exception("Unexpected ESS_DISASSOC success")
  179. dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
  180. addr = dev[0].p2p_interface_addr()
  181. if "FAIL" not in hapd.request("ESS_DISASSOC " + addr):
  182. raise Exception("Unexpected ESS_DISASSOC success")
  183. if "FAIL" not in hapd.request("ESS_DISASSOC " + addr + " -1"):
  184. raise Exception("Unexpected ESS_DISASSOC success")
  185. if "FAIL" not in hapd.request("ESS_DISASSOC " + addr + " 1"):
  186. raise Exception("Unexpected ESS_DISASSOC success")
  187. if "OK" not in hapd.request("ESS_DISASSOC " + addr + " 20 http://example.com/"):
  188. raise Exception("Unexpected ESS_DISASSOC failure")
  189. ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 15)
  190. if ev is None:
  191. raise Exception("Scan timed out")
  192. def test_hapd_ctrl_set_deny_mac_file(dev, apdev):
  193. """hostapd and SET deny_mac_file ctrl_iface command"""
  194. ssid = "hapd-ctrl"
  195. params = { "ssid": ssid }
  196. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  197. dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
  198. dev[1].connect(ssid, key_mgmt="NONE", scan_freq="2412")
  199. if "OK" not in hapd.request("SET deny_mac_file hostapd.macaddr"):
  200. raise Exception("Unexpected SET failure")
  201. dev[0].wait_disconnected(timeout=15)
  202. ev = dev[1].wait_event(["CTRL-EVENT-DISCONNECTED"], 1)
  203. if ev is not None:
  204. raise Exception("Unexpected disconnection")
  205. def test_hapd_ctrl_set_accept_mac_file(dev, apdev):
  206. """hostapd and SET accept_mac_file ctrl_iface command"""
  207. ssid = "hapd-ctrl"
  208. params = { "ssid": ssid }
  209. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  210. dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
  211. dev[1].connect(ssid, key_mgmt="NONE", scan_freq="2412")
  212. hapd.request("SET macaddr_acl 1")
  213. if "OK" not in hapd.request("SET accept_mac_file hostapd.macaddr"):
  214. raise Exception("Unexpected SET failure")
  215. dev[1].wait_disconnected(timeout=15)
  216. ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], 1)
  217. if ev is not None:
  218. raise Exception("Unexpected disconnection")
  219. def test_hapd_ctrl_set_error_cases(dev, apdev):
  220. """hostapd and SET error cases"""
  221. ssid = "hapd-ctrl"
  222. params = { "ssid": ssid }
  223. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  224. errors = [ "wpa_key_mgmt FOO",
  225. "wpa_key_mgmt WPA-PSK \t FOO",
  226. "wpa_key_mgmt \t ",
  227. "wpa_pairwise FOO",
  228. "wpa_pairwise \t ",
  229. 'wep_key0 "',
  230. 'wep_key0 "abcde',
  231. "wep_key0 1",
  232. "wep_key0 12q3456789",
  233. "wep_key_len_broadcast 20",
  234. "wep_rekey_period -1",
  235. "wep_default_key 4",
  236. "r0kh 02:00:00:00:03:0q nas1.w1.fi 100102030405060708090a0b0c0d0e0f",
  237. "r0kh 02:00:00:00:03:00 12345678901234567890123456789012345678901234567890.nas1.w1.fi 100102030405060708090a0b0c0d0e0f",
  238. "r0kh 02:00:00:00:03:00 nas1.w1.fi 100q02030405060708090a0b0c0d0e0f",
  239. "r1kh 02:00:00:00:04:q0 00:01:02:03:04:06 200102030405060708090a0b0c0d0e0f",
  240. "r1kh 02:00:00:00:04:00 00:01:02:03:04:q6 200102030405060708090a0b0c0d0e0f",
  241. "r1kh 02:00:00:00:04:00 00:01:02:03:04:06 2q0102030405060708090a0b0c0d0e0f",
  242. "roaming_consortium 1",
  243. "roaming_consortium 12",
  244. "roaming_consortium 112233445566778899aabbccddeeff00",
  245. 'venue_name P"engExample venue"',
  246. 'venue_name P"engExample venue',
  247. "venue_name engExample venue",
  248. "venue_name e:Example venue",
  249. "venue_name eng1:Example venue",
  250. "venue_name eng:Example venue 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
  251. "anqp_3gpp_cell_net abc",
  252. "anqp_3gpp_cell_net ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
  253. "anqp_3gpp_cell_net 244",
  254. "anqp_3gpp_cell_net 24,123",
  255. "anqp_3gpp_cell_net 244,1",
  256. "anqp_3gpp_cell_net 244,1234",
  257. "nai_realm 0",
  258. "nai_realm 0,1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.nas1.w1.fi",
  259. "nai_realm 0,example.org,1,2,3,4,5,6,7,8",
  260. "nai_realm 0,example.org,1[1:1][2:2][3:3][4:4][5:5]",
  261. "nai_realm 0,example.org,1[1]",
  262. "nai_realm 0,example.org,1[1:1",
  263. "nai_realm 0,a.example.org;b.example.org;c.example.org;d.example.org;e.example.org;f.example.org;g.example.org;h.example.org;i.example.org;j.example.org;k.example.org",
  264. "qos_map_set 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60",
  265. "qos_map_set 53,2,22,6,8,15,0,7,255,255,16,31,32,39,255,255,40,47,255,300",
  266. "qos_map_set 53,2,22,6,8,15,0,7,255,255,16,31,32,39,255,255,40,47,255,-1",
  267. "qos_map_set 53,2,22,6,8,15,0,7,255,255,16,31,32,39,255,255,40,47,255,255,1",
  268. "qos_map_set 1",
  269. "qos_map_set 1,2",
  270. "hs20_conn_capab 1",
  271. "hs20_conn_capab 6:22",
  272. "hs20_wan_metrics 0q:8000:1000:80:240:3000",
  273. "hs20_wan_metrics 01",
  274. "hs20_wan_metrics 01:8000",
  275. "hs20_wan_metrics 01:8000:1000",
  276. "hs20_wan_metrics 01:8000:1000:80",
  277. "hs20_wan_metrics 01:8000:1000:80:240",
  278. "hs20_oper_friendly_name eng1:Example",
  279. "hs20_icon 32",
  280. "hs20_icon 32:32",
  281. "hs20_icon 32:32:eng",
  282. "hs20_icon 32:32:eng:image/png",
  283. "hs20_icon 32:32:eng:image/png:icon32",
  284. "hs20_icon 32:32:eng:image/png:123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890:/tmp/icon32.png",
  285. "hs20_icon 32:32:eng:image/png:name:/tmp/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.png",
  286. "osu_ssid ",
  287. "osu_ssid P",
  288. 'osu_ssid P"abc',
  289. 'osu_ssid "1234567890123456789012345678901234567890"',
  290. "osu_friendly_name eng:Example",
  291. "osu_nai anonymous@example.com",
  292. "osu_method_list 1 0",
  293. "osu_icon foo",
  294. "osu_service_desc eng:Example services",
  295. "ssid 1234567890123456789012345678901234567890",
  296. "pac_opaque_encr_key 123456",
  297. "eap_fast_a_id 12345",
  298. "eap_fast_a_id 12345q",
  299. "own_ip_addr foo",
  300. "auth_server_addr foo2",
  301. "auth_server_shared_secret ",
  302. "acct_server_addr foo3",
  303. "acct_server_shared_secret ",
  304. "radius_auth_req_attr 123::",
  305. "radius_acct_req_attr 123::",
  306. "radius_das_client 192.168.1.123",
  307. "radius_das_client 192.168.1.1a foo",
  308. "auth_algs 0",
  309. "max_num_sta -1",
  310. "max_num_sta 1000000",
  311. "wpa_passphrase 1234567",
  312. "wpa_passphrase 1234567890123456789012345678901234567890123456789012345678901234",
  313. "wpa_psk 1234567890123456789012345678901234567890123456789012345678901234a",
  314. "wpa_psk 12345678901234567890123456789012345678901234567890123456789012",
  315. "wpa_psk_radius 123",
  316. "wpa_pairwise NONE",
  317. "wpa_pairwise WEP40",
  318. "wpa_pairwise WEP104",
  319. "rsn_pairwise NONE",
  320. "rsn_pairwise WEP40",
  321. "rsn_pairwise WEP104",
  322. "mobility_domain 01",
  323. "r1_key_holder 0011223344",
  324. "ctrl_interface_group nosuchgrouphere",
  325. "hw_mode foo",
  326. "wps_rf_bands foo",
  327. "beacon_int 0",
  328. "beacon_int 65536",
  329. "acs_num_scans 0",
  330. "acs_num_scans 101",
  331. "rts_threshold -1",
  332. "rts_threshold 2348",
  333. "fragm_threshold -1",
  334. "fragm_threshold 2347",
  335. "send_probe_response -1",
  336. "send_probe_response 2",
  337. "vlan_naming -1",
  338. "vlan_naming 10000000",
  339. "group_mgmt_cipher FOO",
  340. "assoc_sa_query_max_timeout 0",
  341. "assoc_sa_query_retry_timeout 0",
  342. "wps_state -1",
  343. "wps_state 3",
  344. "uuid FOO",
  345. "device_name 1234567890123456789012345678901234567890",
  346. "manufacturer 1234567890123456789012345678901234567890123456789012345678901234567890",
  347. "model_name 1234567890123456789012345678901234567890",
  348. "model_number 1234567890123456789012345678901234567890",
  349. "serial_number 1234567890123456789012345678901234567890",
  350. "device_type FOO",
  351. "os_version 1",
  352. "ap_settings /tmp/does/not/exist/ap-settings.foo",
  353. "wps_nfc_dev_pw_id 4",
  354. "wps_nfc_dev_pw_id 100000",
  355. "time_zone A",
  356. "access_network_type -1",
  357. "access_network_type 16",
  358. "hessid 00:11:22:33:44",
  359. "network_auth_type 0q",
  360. "ipaddr_type_availability 1q",
  361. "hs20_operating_class 0",
  362. "hs20_operating_class 0q",
  363. "bss_load_test ",
  364. "bss_load_test 12",
  365. "bss_load_test 12:80",
  366. "vendor_elements 0",
  367. "vendor_elements 0q",
  368. "local_pwr_constraint -1",
  369. "local_pwr_constraint 256",
  370. "wmm_ac_bk_cwmin -1",
  371. "wmm_ac_be_cwmin 16",
  372. "wmm_ac_vi_cwmax -1",
  373. "wmm_ac_vo_cwmax 16",
  374. "wmm_ac_foo_cwmax 6",
  375. "wmm_ac_bk_aifs 0",
  376. "wmm_ac_bk_aifs 256",
  377. "wmm_ac_bk_txop_limit -1",
  378. "wmm_ac_bk_txop_limit 65536",
  379. "wmm_ac_bk_acm -1",
  380. "wmm_ac_bk_acm 2",
  381. "wmm_ac_bk_foo 2",
  382. "tx_queue_foo_aifs 3",
  383. "tx_queue_data3_cwmin 4",
  384. "tx_queue_data3_cwmax 4",
  385. "tx_queue_data3_aifs -4",
  386. "tx_queue_data3_foo 1" ]
  387. for e in errors:
  388. if "FAIL" not in hapd.request("SET " + e):
  389. raise Exception("Unexpected SET success: '%s'" % e)
  390. if "OK" not in hapd.request("SET osu_server_uri https://example.com/"):
  391. raise Exception("Unexpected SET osu_server_uri failure")
  392. if "OK" not in hapd.request("SET osu_friendly_name eng:Example"):
  393. raise Exception("Unexpected SET osu_friendly_name failure")
  394. errors = [ "osu_friendly_name eng1:Example",
  395. "osu_service_desc eng1:Example services" ]
  396. for e in errors:
  397. if "FAIL" not in hapd.request("SET " + e):
  398. raise Exception("Unexpected SET success: '%s'" % e)
  399. no_err = [ "wps_nfc_dh_pubkey 0",
  400. "wps_nfc_dh_privkey 0q",
  401. "wps_nfc_dev_pw 012",
  402. "manage_p2p 0",
  403. "disassoc_low_ack 0",
  404. "network_auth_type 01",
  405. "tdls_prohibit 0",
  406. "tdls_prohibit_chan_switch 0" ]
  407. for e in no_err:
  408. if "OK" not in hapd.request("SET " + e):
  409. raise Exception("Unexpected SET failure: '%s'" % e)
  410. def test_hapd_ctrl_global(dev, apdev):
  411. """hostapd and GET ctrl_iface command"""
  412. ssid = "hapd-ctrl"
  413. params = { "ssid": ssid }
  414. ifname = apdev[0]['ifname']
  415. hapd = hostapd.add_ap(ifname, params)
  416. hapd_global = hostapd.HostapdGlobal()
  417. res = hapd_global.request("IFNAME=" + ifname + " PING")
  418. if "PONG" not in res:
  419. raise Exception("Could not ping hostapd interface " + ifname + " via global control interface")
  420. res = hapd_global.request("IFNAME=" + ifname + " GET version")
  421. if "FAIL" in res:
  422. raise Exception("Could not get hostapd version for " + ifname + " via global control interface")