test_hapd_ctrl.py 22 KB

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