Lines Matching refs:dev

24 def test_wpas_ctrl_network(dev):  argument
26 skip_without_tkip(dev[0])
27 id = dev[0].add_network()
29 if "FAIL" not in dev[0].request("SET_NETWORK " + str(id)):
31 if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + " name"):
33 if "FAIL" not in dev[0].request("SET_NETWORK " + str(id + 1) + " proto OPEN"):
35 if "FAIL" not in dev[0].request("GET_NETWORK " + str(id)):
37 if "FAIL" not in dev[0].request("GET_NETWORK " + str(id + 1) + " proto"):
40 if "OK" not in dev[0].request("SET_NETWORK " + str(id) + " proto \t WPA2 "):
42 res = dev[0].request("GET_NETWORK " + str(id) + " proto")
46 if "OK" not in dev[0].request("SET_NETWORK " + str(id) + " key_mgmt \t WPA-PSK "):
48 res = dev[0].request("GET_NETWORK " + str(id) + " key_mgmt")
52 if "OK" not in dev[0].request("SET_NETWORK " + str(id) + " auth_alg \t OPEN "):
54 res = dev[0].request("GET_NETWORK " + str(id) + " auth_alg")
58 if "OK" not in dev[0].request("SET_NETWORK " + str(id) + " eap \t TLS "):
60 res = dev[0].request("GET_NETWORK " + str(id) + " eap")
66 if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + " " + t):
81 if "SAE" not in dev[0].get_capability("auth_alg"):
86 dev[0].set_network_quoted(id, "ssid", "test")
88 dev[0].set_network(id, field, value)
89 res = dev[0].get_network(id, field)
95 dev[0].set_network(id, "key_mgmt", value)
96 res = dev[0].get_network(id, "key_mgmt")
108 dev[0].set_network_quoted(id, field, value)
109 res = dev[0].get_network(id, field)
115 res = dev[0].get_network(id, field)
119 if dev[0].get_network(id, "password"):
121 dev[0].set_network_quoted(id, "password", "foo")
122 if dev[0].get_network(id, "password") != '*':
124 dev[0].set_network(id, "password", "hash:12345678901234567890123456789012")
125 if dev[0].get_network(id, "password") != '*':
127 dev[0].set_network(id, "password", "NULL")
128 if dev[0].get_network(id, "password"):
130 if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + " password hash:12"):
132 …if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + " password hash:123456789012345678x0123…
135 dev[0].set_network(id, "identity", "414243")
136 if dev[0].get_network(id, "identity") != '"ABC"':
139 dev[0].set_network(id, "identity", 'P"abc\ndef"')
140 if dev[0].get_network(id, "identity") != "6162630a646566":
143 if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + ' identity P"foo'):
146 if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + ' identity 12x3'):
149 if "WEP40" in dev[0].get_capability("group"):
151 … if "FAIL" in dev[0].request("SET_NETWORK " + str(id) + ' wep_key' + str(i) + ' aabbccddee'):
153 if dev[0].get_network(id, "wep_key" + str(i)) != '*':
156 …if "FAIL" in dev[0].request("SET_NETWORK " + str(id) + ' psk_list P2P-00:11:22:33:44:55-0123456789…
159 …if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + ' psk_list 00:11:x2:33:44:55-0123456789…
162 …if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + ' psk_list P2P-00:11:x2:33:44:55-012345…
165 …if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + ' psk_list P2P-00:11:22:33:44:55+012345…
168 …if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + ' psk_list P2P-00:11:22:33:44:55-012345…
171 …if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + ' psk_list P2P-00:11:22:33:44:55-012345…
174 if dev[0].get_network(id, "psk_list"):
177 if dev[0].list_networks()[0]['ssid'] != "test":
179 dev[0].set_network(id, "ssid", "NULL")
180 if dev[0].list_networks()[0]['ssid'] != "":
183 …if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' ssid "0123456789abcdef0123456789abcde…
185 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' scan_ssid qwerty'):
187 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' scan_ssid 2'):
189 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' psk 12345678'):
191 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' psk "1234567"'):
193 …if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' psk "12345678901234567890123456789012…
195 dev[0].set_network_quoted(id, "psk", "123456768")
196dev[0].set_network_quoted(id, "psk", "123456789012345678901234567890123456789012345678901234567890…
197 if dev[0].get_network(id, "psk") != '*':
200 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' eap UNKNOWN'):
203 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' password "foo'):
206 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' wep_key0 "foo'):
208 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' wep_key0 "12345678901234567"'):
210 if "WEP40" in dev[0].get_capability("group"):
212 dev[0].set_network_quoted(id, "wep_key0", "1234")
213 dev[0].set_network_quoted(id, "wep_key1", "12345")
214 dev[0].set_network_quoted(id, "wep_key2", "1234567890123")
215 dev[0].set_network_quoted(id, "wep_key3", "1234567890123456")
217 dev[0].set_network(id, "go_p2p_dev_addr", "any")
218 if dev[0].get_network(id, "go_p2p_dev_addr") is not None:
220 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' go_p2p_dev_addr 00:11:22:33:44'):
222 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' p2p_client_list 00:11:22:33:44'):
224 … if "FAIL" in dev[0].request('SET_NETWORK ' + str(id) + ' p2p_client_list 00:11:22:33:44:55 00:1'):
226 if dev[0].get_network(id, "p2p_client_list") != "00:11:22:33:44:55":
229 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' auth_alg '):
231 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' auth_alg FOO'):
234 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' proto '):
236 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' proto FOO'):
239 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' pairwise '):
241 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' pairwise FOO'):
243 if "FAIL" not in dev[0].request('SET_NETWORK ' + str(id) + ' pairwise WEP40'):
246 if "OK" not in dev[0].request('BSSID ' + str(id) + ' 00:11:22:33:44:55'):
248 if dev[0].request("GET_NETWORK 0 bssid") != '00:11:22:33:44:55':
250 if "OK" not in dev[0].request('BSSID ' + str(id) + ' 00:00:00:00:00:00'):
252 if "FAIL" not in dev[0].request("GET_NETWORK 0 bssid"):
254 if "FAIL" not in dev[0].request('BSSID 123 00:11:22:33:44:55'):
256 if "FAIL" not in dev[0].request('BSSID ' + str(id) + ' 00:11:22:33:44'):
258 if "FAIL" not in dev[0].request('BSSID ' + str(id)):
269 dev[0].set_network(id, "bssid_ignore", val)
270 res = dev[0].get_network(id, "bssid_ignore")
273 dev[0].set_network(id, "bssid_accept", val)
274 res = dev[0].get_network(id, "bssid_accept")
284 if "FAIL" not in dev[0].request("SET_NETWORK %d bssid_ignore %s" % (id, val)):
288 def test_wpas_ctrl_network_oom(dev): argument
290 id = dev[0].add_network()
297 with alloc_fail(dev[0], count, func):
298 if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + ' ssid ' + val):
302 def test_wpas_ctrl_many_networks(dev, apdev): argument
305 dev[0].add_network()
306 dev[0].dump_monitor()
307 id = dev[0].add_network()
308 ev = dev[0].wait_event(["CTRL-EVENT-NETWORK-ADDED %d" % id])
311 ev = dev[0].wait_global_event(["CTRL-EVENT-NETWORK-ADDED %d" % id], timeout=10)
314 dev[0].dump_monitor()
315 res = dev[0].request("LIST_NETWORKS")
318 res = dev[0].request("LIST_NETWORKS LAST_ID=%d" % (id - 2))
324 dev[0].request("REMOVE_NETWORK all", timeout=60)
328 ev = dev[0].wait_event(["CTRL-EVENT-NETWORK-REMOVED"])
333 ev = dev[0].wait_global_event(["CTRL-EVENT-NETWORK-REMOVED"],
343 dev[0].dump_monitor()
346 def test_wpas_ctrl_dup_network(dev, apdev): argument
353 src = dev[0].connect("another", psk=passphrase, scan_freq="2412",
355 id = dev[0].add_network()
356 dev[0].set_network_quoted(id, "ssid", ssid)
358 res = dev[0].request("DUP_NETWORK {} {} {}".format(src, id, f))
361 dev[0].connect_network(id)
363 if "FAIL" not in dev[0].request("DUP_NETWORK "):
365 if "FAIL" not in dev[0].request("DUP_NETWORK %d " % id):
367 if "FAIL" not in dev[0].request("DUP_NETWORK %d %d" % (id, id)):
369 if "FAIL" not in dev[0].request("DUP_NETWORK 123456 1234567 "):
371 if "FAIL" not in dev[0].request("DUP_NETWORK %d 123456 " % id):
373 if "FAIL" not in dev[0].request("DUP_NETWORK %d %d foo" % (id, id)):
375 dev[0].request("DISCONNECT")
376 if "OK" not in dev[0].request("DUP_NETWORK %d %d ssid" % (id, id)):
380 def test_wpas_ctrl_dup_network_global(dev, apdev): argument
387 src = dev[0].connect("another", psk=passphrase, scan_freq="2412",
389 id = dev[0].add_network()
390 dev[0].set_network_quoted(id, "ssid", ssid)
392 …res = dev[0].global_request("DUP_NETWORK {} {} {} {} {}".format(dev[0].ifname, dev[0].ifname, src,…
395 dev[0].connect_network(id)
397 if "FAIL" not in dev[0].global_request("DUP_NETWORK "):
399 if "FAIL" not in dev[0].global_request("DUP_NETWORK %s" % dev[0].ifname):
401 if "FAIL" not in dev[0].global_request("DUP_NETWORK %s %s" % (dev[0].ifname, dev[0].ifname)):
403 …if "FAIL" not in dev[0].global_request("DUP_NETWORK %s %s %d" % (dev[0].ifname, dev[0].ifname, id)…
405 …if "FAIL" not in dev[0].global_request("DUP_NETWORK %s %s %d %d" % (dev[0].ifname, dev[0].ifname, …
407 dev[0].request("DISCONNECT")
408 …if "OK" not in dev[0].global_request("DUP_NETWORK %s %s %d %d ssid" % (dev[0].ifname, dev[0].ifnam…
411 def add_cred(dev): argument
412 id = dev.add_cred()
413 ev = dev.wait_event(["CRED-ADDED"])
420 def set_cred(dev, id, field, value): argument
421 dev.set_cred(id, field, value)
422 ev = dev.wait_event(["CRED-MODIFIED"])
430 def set_cred_quoted(dev, id, field, value): argument
431 dev.set_cred_quoted(id, field, value)
432 ev = dev.wait_event(["CRED-MODIFIED"])
440 def remove_cred(dev, id): argument
441 dev.remove_cred(id)
442 ev = dev.wait_event(["CRED-REMOVED"])
449 def test_wpas_ctrl_cred(dev): argument
451 id1 = add_cred(dev[0])
452 if "FAIL" not in dev[0].request("SET_CRED " + str(id1 + 1) + " temporary 1"):
454 if "FAIL" not in dev[0].request("SET_CRED " + str(id1)):
456 if "FAIL" not in dev[0].request("SET_CRED " + str(id1) + " temporary"):
458 if "FAIL" not in dev[0].request("GET_CRED " + str(id1 + 1) + " temporary"):
460 if "FAIL" not in dev[0].request("GET_CRED " + str(id1)):
462 if "FAIL" not in dev[0].request("GET_CRED " + str(id1) + " foo"):
464 id = add_cred(dev[0])
465 id2 = add_cred(dev[0])
466 set_cred(dev[0], id, "temporary", "1")
467 set_cred(dev[0], id, "priority", "1")
468 set_cred(dev[0], id, "pcsc", "1")
469 set_cred(dev[0], id, "sim_num", "0")
470 set_cred_quoted(dev[0], id, "private_key_passwd", "test")
471 set_cred_quoted(dev[0], id, "domain_suffix_match", "test")
472 set_cred_quoted(dev[0], id, "phase1", "test")
473 set_cred_quoted(dev[0], id, "phase2", "test")
475 if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " eap FOO"):
478 if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " username 12xa"):
482 if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " roaming_consortium " + i):
484 if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " home_ois " + '"' + i + '"'):
486 … if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " required_home_ois " + '"' + i + '"'):
488 …if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " home_ois " + '"112233' + 36*",112233" + …
490 …if "FAIL" in dev[0].request("SET_CRED " + str(id) + " home_ois " + '"112233' + 35*",112233" + '"'):
493dev[0].set_cred(id, "excluded_ssid", "00112233445566778899aabbccddeeff00112233445566778899aabbccdd…
494 …if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " excluded_ssid 00112233445566778899aabbcc…
497 if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " foo 4142"):
507 if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " " + t):
510 id3 = add_cred(dev[0])
511 id4 = add_cred(dev[0])
512 if len(dev[0].request("LIST_CREDS").splitlines()) != 6:
515 remove_cred(dev[0], id1)
516 remove_cred(dev[0], id3)
517 remove_cred(dev[0], id4)
518 remove_cred(dev[0], id2)
519 remove_cred(dev[0], id)
520 if "FAIL" not in dev[0].request("REMOVE_CRED 1"):
522 if len(dev[0].request("LIST_CREDS").splitlines()) != 1:
525 id = add_cred(dev[0])
565 set_cred_quoted(dev[0], id, v[0], v[1])
567 set_cred(dev[0], id, v[0], v[1])
568 val = dev[0].get_cred(id, v[0])
575 creds = dev[0].request("LIST_CREDS").splitlines()
580 remove_cred(dev[0], id)
581 if len(dev[0].request("LIST_CREDS").splitlines()) != 1:
584 id = add_cred(dev[0])
585 set_cred_quoted(dev[0], id, "domain", "foo.example.com")
586 id = add_cred(dev[0])
587 set_cred_quoted(dev[0], id, "domain", "bar.example.com")
588 id = add_cred(dev[0])
589 set_cred_quoted(dev[0], id, "domain", "foo.example.com")
590 if "OK" not in dev[0].request("REMOVE_CRED sp_fqdn=foo.example.com"):
592 creds = dev[0].request("LIST_CREDS")
597 dev[0].request("REMOVE_CRED all")
599 id = add_cred(dev[0])
600 set_cred_quoted(dev[0], id, "domain", "foo.example.com")
601 set_cred_quoted(dev[0], id, "provisioning_sp", "sp.foo.example.com")
602 id = add_cred(dev[0])
603 set_cred_quoted(dev[0], id, "domain", "bar.example.com")
604 set_cred_quoted(dev[0], id, "provisioning_sp", "sp.bar.example.com")
605 id = add_cred(dev[0])
606 set_cred_quoted(dev[0], id, "domain", "foo.example.com")
607 set_cred_quoted(dev[0], id, "provisioning_sp", "sp.foo.example.com")
608 if "OK" not in dev[0].request("REMOVE_CRED provisioning_sp=sp.foo.example.com"):
610 creds = dev[0].request("LIST_CREDS")
615 dev[0].request("REMOVE_CRED all")
618 dev[0].dump_monitor()
620 id = add_cred(dev[0])
621 set_cred_quoted(dev[0], id, "realm", "relatively.long.realm.test%d.example.com" % i)
622 dev[0].dump_monitor()
623 creds = dev[0].request("LIST_CREDS")
625 dev[0].remove_cred(i)
626 dev[0].dump_monitor()
634 def test_wpas_ctrl_pno(dev): argument
636 if "FAIL" not in dev[0].request("SET pno 1"):
638 id = dev[0].add_network()
639 dev[0].set_network_quoted(id, "ssid", "test")
640 dev[0].set_network(id, "key_mgmt", "NONE")
641 dev[0].request("ENABLE_NETWORK " + str(id) + " no-connect")
643 if "FAIL" not in dev[0].request("SET pno 1"):
645 if "FAIL" not in dev[0].request("SET pno 1 freq=2000-3000,5180"):
647 if "FAIL" not in dev[0].request("SET pno 1 freq=0-6000"):
649 if "FAIL" in dev[0].request("SET pno 0"):
653 def test_wpas_ctrl_get(dev): argument
655 if "FAIL" in dev[0].request("GET version"):
657 if "FAIL" in dev[0].request("GET wifi_display"):
659 if "FAIL" not in dev[0].request("GET foo"):
662 dev[0].set("wifi_display", "0")
663 if dev[0].request("GET wifi_display") != '0':
665 dev[0].set("wifi_display", "1")
666 if dev[0].request("GET wifi_display") != '1':
668 dev[0].request("P2P_SET disabled 1")
669 if dev[0].request("GET wifi_display") != '0':
671 dev[0].request("P2P_SET disabled 0")
672 if dev[0].request("GET wifi_display") != '1':
674 dev[0].set("wifi_display", "0")
675 if dev[0].request("GET wifi_display") != '0':
679 def test_wpas_ctrl_preauth(dev): argument
681 if "FAIL" not in dev[0].request("PREAUTH "):
683 if "FAIL" in dev[0].request("PREAUTH 00:11:22:33:44:55"):
687 def test_wpas_ctrl_tdls_discover(dev): argument
689 if "FAIL" not in dev[0].request("TDLS_DISCOVER "):
691 if "FAIL" not in dev[0].request("TDLS_DISCOVER 00:11:22:33:44:55"):
695 def test_wpas_ctrl_tdls_chan_switch(dev): argument
698 if "FAIL" not in dev[0].request("TDLS_CANCEL_CHAN_SWITCH " + args):
704 if "FAIL" not in dev[0].request("TDLS_CHAN_SWITCH " + args):
708 def test_wpas_ctrl_addr(dev): argument
710 if "FAIL" not in dev[0].request("TDLS_SETUP "):
712 if "FAIL" not in dev[0].request("TDLS_TEARDOWN "):
714 if "FAIL" not in dev[0].request("FT_DS "):
716 if "FAIL" not in dev[0].request("WPS_PBC 00:11:22:33:44"):
718 if "FAIL" not in dev[0].request("WPS_PIN 00:11:22:33:44"):
720 if "FAIL" not in dev[0].request("WPS_NFC 00:11:22:33:44"):
722 if "FAIL" not in dev[0].request("WPS_REG 00:11:22:33:44 12345670"):
724 if "FAIL" not in dev[0].request("IBSS_RSN 00:11:22:33:44"):
726 if "FAIL" not in dev[0].request("BSSID_IGNORE 00:11:22:33:44"):
730 def test_wpas_ctrl_wps_errors(dev): argument
732 if "FAIL" not in dev[0].request("WPS_REG 00:11:22:33:44:55"):
734 if "FAIL" not in dev[0].request("WPS_REG 00:11:22:33:44:55 12345670 2233"):
736 if "FAIL" not in dev[0].request("WPS_REG 00:11:22:33:44:55 12345670 2233 OPEN"):
738 if "FAIL" not in dev[0].request("WPS_REG 00:11:22:33:44:55 12345670 2233 OPEN NONE"):
741 if "FAIL" not in dev[0].request("WPS_AP_PIN random"):
744 if "FAIL" not in dev[0].request("WPS_ER_PIN any"):
747 if "FAIL" not in dev[0].request("WPS_ER_LEARN 00:11:22:33:44:55"):
750 if "FAIL" not in dev[0].request("WPS_ER_SET_CONFIG 00:11:22:33:44:55"):
753 if "FAIL" not in dev[0].request("WPS_ER_CONFIG 00:11:22:33:44:55"):
755 if "FAIL" not in dev[0].request("WPS_ER_CONFIG 00:11:22:33:44:55 12345670"):
757 if "FAIL" not in dev[0].request("WPS_ER_CONFIG 00:11:22:33:44:55 12345670 2233"):
759 if "FAIL" not in dev[0].request("WPS_ER_CONFIG 00:11:22:33:44:55 12345670 2233 OPEN"):
761 if "FAIL" not in dev[0].request("WPS_ER_CONFIG 00:11:22:33:44:55 12345670 2233 OPEN NONE"):
764 if "FAIL" not in dev[0].request("WPS_ER_NFC_CONFIG_TOKEN WPS"):
766 if "FAIL" not in dev[0].request("WPS_ER_NFC_CONFIG_TOKEN FOO 00:11:22:33:44:55"):
768 if "FAIL" not in dev[0].request("WPS_ER_NFC_CONFIG_TOKEN NDEF 00:11:22:33:44:55"):
771 if "FAIL" not in dev[0].request("WPS_NFC_CONFIG_TOKEN FOO"):
773 if "FAIL" not in dev[0].request("WPS_NFC_CONFIG_TOKEN WPS FOO"):
775 if "FAIL" not in dev[0].request("WPS_NFC_TOKEN FOO"):
779 def test_wpas_ctrl_config_parser(dev): argument
781 if "FAIL" not in dev[0].request("SET pbc_in_m1 qwerty"):
783 if "FAIL" not in dev[0].request("SET eapol_version 0"):
785 if "FAIL" not in dev[0].request("SET eapol_version 10"):
788 if "FAIL" not in dev[0].request("SET serial_number 0123456789abcdef0123456789abcdef0"):
792 def test_wpas_ctrl_mib(dev): argument
794 mib = dev[0].get_mib()
800 def test_wpas_ctrl_set_wps_params(dev): argument
803 _test_wpas_ctrl_set_wps_params(dev)
805 dev[2].request("SET config_methods ")
807 def _test_wpas_ctrl_set_wps_params(dev): argument
813 if "OK" not in dev[2].request("SET " + t):
826 if "FAIL" not in dev[2].request("SET " + t):
829 def test_wpas_ctrl_level(dev): argument
832 if "FAIL" not in dev[2].request("LEVEL 3"):
834 if "OK" not in dev[2].mon.request("LEVEL 2"):
836 dev[2].request("SCAN freq=2412")
837 ev = dev[2].wait_event(["State:"], timeout=5)
840 dev[2].wait_event(["CTRL-EVENT-SCAN-RESULTS"], timeout=5)
842 dev[2].mon.request("LEVEL 3")
845 def test_wpas_ctrl_bssid_filter(dev, apdev): argument
848 if "OK" not in dev[2].request("SET bssid_filter " + apdev[0]['bssid']):
853 dev[2].scan_for_bss(apdev[0]['bssid'], freq="2412")
854 dev[2].scan(freq="2412")
855 bss = dev[2].get_bss(apdev[0]['bssid'])
858 bss = dev[2].get_bss(apdev[1]['bssid'])
861 dev[2].request("SET bssid_filter " + apdev[0]['bssid'] + " " + \
863 dev[2].scan(freq="2412")
864 bss = dev[2].get_bss(apdev[0]['bssid'])
867 bss = dev[2].get_bss(apdev[1]['bssid'])
870 res = dev[2].request("SCAN_RESULTS").splitlines()
878 if "FAIL" not in dev[2].request("SET bssid_filter 00:11:22:33:44:55 00:11:22:33:44"):
881 dev[2].request("SET bssid_filter ")
884 def test_wpas_ctrl_disallow_aps(dev, apdev): argument
889 if "FAIL" not in dev[0].request("SET disallow_aps bssid "):
891 if "FAIL" not in dev[0].request("SET disallow_aps bssid 00:11:22:33:44"):
893 if "FAIL" not in dev[0].request("SET disallow_aps ssid 0"):
895 if "FAIL" not in dev[0].request("SET disallow_aps ssid 4q"):
897 … if "FAIL" not in dev[0].request("SET disallow_aps bssid 00:11:22:33:44:55 ssid 112233 ssid 123"):
899 …if "FAIL" not in dev[0].request("SET disallow_aps ssid 000102030405060708090a0b0c0d0e0f00010203040…
901 if "FAIL" not in dev[0].request("SET disallow_aps foo 112233445566"):
904 dev[0].connect("test", key_mgmt="NONE", scan_freq="2412")
906 dev[0].scan_for_bss(apdev[1]['bssid'], freq="2412")
907 dev[0].dump_monitor()
908 … if "OK" not in dev[0].request("SET disallow_aps bssid 00:11:22:33:44:55 bssid 00:22:33:44:55:66"):
910 if "OK" not in dev[0].request("SET disallow_aps bssid " + apdev[0]['bssid']):
912 ev = dev[0].wait_connected(timeout=30, error="Reassociation timed out")
916 dev[0].dump_monitor()
917 if "OK" not in dev[0].request("SET disallow_aps ssid " + binascii.hexlify(b"test").decode()):
919 dev[0].wait_disconnected(timeout=5, error="Disconnection not seen")
920 ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
924 dev[0].request("DISCONNECT")
925 dev[0].p2p_start_go(freq=2412)
926 if "OK" not in dev[0].request("SET disallow_aps "):
930 def test_wpas_ctrl_blob(dev): argument
932 if "FAIL" not in dev[0].request("SET blob foo"):
934 if "FAIL" not in dev[0].request("SET blob foo 0"):
936 if "FAIL" not in dev[0].request("SET blob foo 0q"):
938 if "OK" not in dev[0].request("SET blob foo 00"):
940 if "OK" not in dev[0].request("SET blob foo 0011"):
944 def test_wpas_ctrl_set_uapsd(dev): argument
946 if "FAIL" not in dev[0].request("SET uapsd foo"):
948 if "FAIL" not in dev[0].request("SET uapsd 0,0,0"):
950 if "FAIL" not in dev[0].request("SET uapsd 0,0"):
952 if "FAIL" not in dev[0].request("SET uapsd 0"):
954 if "OK" not in dev[0].request("SET uapsd 1,1,1,1;1"):
956 if "OK" not in dev[0].request("SET uapsd 0,0,0,0;0"):
958 if "OK" not in dev[0].request("SET uapsd disable"):
961 def test_wpas_ctrl_set(dev): argument
975 if "FAIL" not in dev[0].request("SET " + val):
980 dev[0].request("SET " + val)
993 if "OK" not in dev[0].request("SET " + val):
999 dev[0].request("SET load_dynamic_eap /tmp/hwsim-eap-not-found.so")
1002 def test_wpas_ctrl_get_capability(dev): argument
1004 …if "FAIL" not in dev[0].request("GET_CAPABILITY 12345678901234567890123456789012345678901234567890…
1006 if "FAIL" not in dev[0].request("GET_CAPABILITY eap foo"):
1008 if "AP" not in dev[0].request("GET_CAPABILITY modes strict"):
1010 res = dev[0].get_capability("eap")
1014 res = dev[0].get_capability("pairwise")
1018 res = dev[0].get_capability("group")
1022 res = dev[0].get_capability("key_mgmt")
1026 res = dev[0].get_capability("key_mgmt iftype=STATION")
1033 res = dev[0].get_capability("key_mgmt iftype=" + i)
1036 res = dev[0].get_capability("proto")
1040 res = dev[0].get_capability("auth_alg")
1044 res = dev[0].get_capability("modes")
1048 res = dev[0].get_capability("channels")
1052 res = dev[0].get_capability("freq")
1056 res = dev[0].get_capability("tdls")
1060 res = dev[0].get_capability("erp")
1064 if dev[0].get_capability("foo") is not None:
1068 def test_wpas_ctrl_nfc_report_handover(dev): argument
1080 if "FAIL" not in dev[0].request("NFC_REPORT_HANDOVER " + v):
1084 def test_wpas_ctrl_nfc_tag_read(dev): argument
1089 if "FAIL" not in dev[0].request("WPS_NFC_TAG_READ " + v):
1093 def test_wpas_ctrl_nfc_get_handover(dev): argument
1097 if "FAIL" not in dev[0].request("NFC_GET_HANDOVER_REQ " + v):
1102 if "FAIL" in dev[0].request("NFC_GET_HANDOVER_REQ " + v):
1108 if "FAIL" not in dev[0].request("NFC_GET_HANDOVER_SEL " + v):
1114 if "FAIL" in dev[0].request("NFC_GET_HANDOVER_SEL " + v):
1117 def get_bssid_ignore_list(dev): argument
1118 return dev.request("BSSID_IGNORE").splitlines()
1121 def test_wpas_ctrl_bssid_ignore(dev): argument
1123 if "OK" not in dev[0].request("BSSID_IGNORE clear"):
1125 b = get_bssid_ignore_list(dev[0])
1128 if "OK" not in dev[0].request("BSSID_IGNORE 00:11:22:33:44:55"):
1130 b = get_bssid_ignore_list(dev[0])
1133 if "OK" not in dev[0].request("BSSID_IGNORE 00:11:22:33:44:56"):
1135 b = get_bssid_ignore_list(dev[0])
1138 if "OK" not in dev[0].request("BSSID_IGNORE 00:11:22:33:44:56"):
1140 b = get_bssid_ignore_list(dev[0])
1144 if "OK" not in dev[0].request("BSSID_IGNORE clear"):
1146 if dev[0].request("BSSID_IGNORE") != "":
1150 def test_wpas_ctrl_bssid_ignore_oom(dev): argument
1152 with alloc_fail(dev[0], 1, "wpa_bssid_ignore_add"):
1153 if "FAIL" not in dev[0].request("BSSID_IGNORE aa:bb:cc:dd:ee:ff"):
1156 def test_wpas_ctrl_log_level(dev): argument
1158 level = dev[2].request("LOG_LEVEL")
1164 if "OK" not in dev[2].request("LOG_LEVEL MSGDUMP 0"):
1166 level = dev[2].request("LOG_LEVEL")
1172 if "OK" not in dev[2].request("LOG_LEVEL MSGDUMP 1"):
1174 level = dev[2].request("LOG_LEVEL")
1180 if "FAIL" not in dev[2].request("LOG_LEVEL FOO"):
1184 if "OK" not in dev[2].request("LOG_LEVEL " + lev):
1186 level = dev[2].request("LOG_LEVEL")
1190 if "OK" not in dev[2].request("LOG_LEVEL MSGDUMP 1"):
1192 level = dev[2].request("LOG_LEVEL")
1199 def test_wpas_ctrl_enable_disable_network(dev, apdev): argument
1204 id = dev[0].connect("test", key_mgmt="NONE", scan_freq="2412",
1206 if "OK" not in dev[0].request("DISABLE_NETWORK " + str(id)):
1208 if "OK" not in dev[0].request("ENABLE_NETWORK " + str(id) + " no-connect"):
1210 if "OK" not in dev[0].request("DISABLE_NETWORK all"):
1212 if "OK" not in dev[0].request("ENABLE_NETWORK " + str(id)):
1214 dev[0].wait_connected(timeout=10)
1215 if "OK" not in dev[0].request("DISABLE_NETWORK " + str(id)):
1217 dev[0].wait_disconnected(timeout=10)
1220 if "OK" not in dev[0].request("ENABLE_NETWORK all"):
1222 dev[0].wait_connected(timeout=10)
1223 if "OK" not in dev[0].request("DISABLE_NETWORK all"):
1225 dev[0].wait_disconnected(timeout=10)
1227 def test_wpas_ctrl_country(dev, apdev): argument
1233 dev[0].dump_monitor()
1235 if "OK" not in dev[0].request("SET country FI"):
1237 if dev[0].request("GET country") != "FI":
1239 ev = dev[0].wait_global_event(["CTRL-EVENT-REGDOM-CHANGE"], 10)
1244 dev[0].request("SET country 00")
1245 if dev[0].request("GET country") != "00":
1247 ev = dev[0].wait_global_event(["CTRL-EVENT-REGDOM-CHANGE"], 10)
1257 def test_wpas_ctrl_suspend_resume(dev): argument
1274 def test_wpas_ctrl_global(dev): argument
1337 def test_wpas_ctrl_roam(dev, apdev): argument
1339 if "FAIL" not in dev[0].request("ROAM 00:11:22:33:44"):
1341 if "FAIL" not in dev[0].request("ROAM 00:11:22:33:44:55"):
1345 id = dev[0].connect("test", key_mgmt="NONE", scan_freq="2412")
1346 if "FAIL" not in dev[0].request("ROAM 00:11:22:33:44:55"):
1350 def test_wpas_ctrl_ipaddr(dev, apdev): argument
1353 dev[0].cmd_execute(['ip', 'addr', 'add', '10.174.65.207/32', 'dev',
1354 dev[0].ifname])
1355 ipaddr = dev[0].get_status_field('ip_address')
1359 dev[0].cmd_execute(['ip', 'addr', 'del', '10.174.65.207/32', 'dev',
1360 dev[0].ifname])
1363 def test_wpas_ctrl_rsp(dev, apdev): argument
1365 if "FAIL" not in dev[0].request("CTRL-RSP-"):
1367 if "FAIL" not in dev[0].request("CTRL-RSP-foo-"):
1369 if "FAIL" not in dev[0].request("CTRL-RSP-foo-1234567"):
1371 if "FAIL" not in dev[0].request("CTRL-RSP-foo-1234567:"):
1373 id = dev[0].add_network()
1374 if "FAIL" not in dev[0].request("CTRL-RSP-foo-%d:" % id):
1378 if "OK" not in dev[0].request("CTRL-RSP-%s-%d:" % (req, id)):
1380 if "OK" not in dev[0].request("CTRL-RSP-%s-%d:" % (req, id)):
1383 def test_wpas_ctrl_vendor_test(dev, apdev): argument
1391 res = dev[0].request(cmd)
1398 res = dev[0].request(cmd + " nested=1")
1405 res = dev[0].request(cmd + " nested=0")
1410 def test_wpas_ctrl_vendor(dev, apdev): argument
1418 if "FAIL" not in dev[0].request("VENDOR " + cmd):
1422 def test_wpas_ctrl_mgmt_tx(dev, apdev): argument
1430 if "FAIL" not in dev[0].request("MGMT_TX " + cmd):
1433 if "OK" not in dev[0].request("MGMT_TX_DONE"):
1437 def test_wpas_ctrl_driver_event(dev, apdev): argument
1439 if "FAIL" not in dev[0].request("DRIVER_EVENT foo"):
1441 …if "OK" not in dev[0].request("DRIVER_EVENT ASSOC reassoc=1 req_ies=0000 resp_ies=0000 resp_frame=…
1445 def test_wpas_ctrl_eapol_rx(dev, apdev): argument
1451 if "FAIL" not in dev[0].request("EAPOL_RX " + cmd):
1455 def test_wpas_ctrl_data_test(dev, apdev): argument
1457 dev[0].request("DATA_TEST_CONFIG 0")
1458 if "FAIL" not in dev[0].request("DATA_TEST_TX 00:11:22:33:44:55 00:11:22:33:44:55 0"):
1462 if "OK" not in dev[0].request("DATA_TEST_CONFIG 1"):
1464 if "OK" not in dev[0].request("DATA_TEST_CONFIG 1"):
1471 if "FAIL" not in dev[0].request("DATA_TEST_TX " + cmd):
1473 if "OK" not in dev[0].request("DATA_TEST_TX 00:11:22:33:44:55 00:11:22:33:44:55 0"):
1476 dev[0].request("DATA_TEST_CONFIG 0")
1483 if "FAIL" not in dev[0].request("DATA_TEST_FRAME " + cmd):
1486 if "OK" not in dev[0].request("DATA_TEST_FRAME 00112233445566778899aabbccddee"):
1490 def test_wpas_ctrl_vendor_elem(dev, apdev): argument
1492 if "OK" not in dev[0].request("VENDOR_ELEM_ADD 1 "):
1500 if "FAIL" not in dev[0].request("VENDOR_ELEM_ADD " + cmd):
1506 if "FAIL" not in dev[0].request("VENDOR_ELEM_GET " + cmd):
1509 dev[0].request("VENDOR_ELEM_REMOVE 1 *")
1519 if "FAIL" not in dev[0].request("VENDOR_ELEM_REMOVE " + cmd):
1522 dev[0].request("VENDOR_ELEM_ADD 1 000100")
1523 if "OK" not in dev[0].request("VENDOR_ELEM_REMOVE 1 "):
1533 if "FAIL" not in dev[0].request("VENDOR_ELEM_REMOVE " + cmd):
1535 if "OK" not in dev[0].request("VENDOR_ELEM_REMOVE 1 000100"):
1538 def test_wpas_ctrl_misc(dev, apdev): argument
1540 if "OK" not in dev[0].request("RELOG"):
1542 if dev[0].request("IFNAME") != dev[0].ifname:
1544 if "FAIL" not in dev[0].request("REATTACH"):
1546 if "OK" not in dev[2].request("RECONFIGURE"):
1548 if "FAIL" in dev[0].request("INTERFACE_LIST"):
1550 if "UNKNOWN COMMAND" not in dev[0].request("FOO"):
1553 if "FAIL" not in dev[0].global_request("INTERFACE_REMOVE foo"):
1555 if "FAIL" not in dev[0].global_request("SET foo"):
1559 def test_wpas_ctrl_dump(dev, apdev): argument
1561 vals = dev[0].get_config()
1564 res = dev[0].request("GET " + field)
1573 def test_wpas_ctrl_interface_add(dev, apdev): argument
1576 dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
1577 hwsim_utils.test_connectivity(dev[0], hapd)
1579 ifname = "test-" + dev[0].ifname
1580 dev[0].interface_add(ifname, create=True)
1584 hwsim_utils.test_connectivity(dev[0], hapd)
1585 dev[0].global_request("INTERFACE_REMOVE " + ifname)
1586 hwsim_utils.test_connectivity(dev[0], hapd)
1588 def test_wpas_ctrl_interface_add_sta(dev, apdev): argument
1591 ifname = "test-" + dev[0].ifname
1592 dev[0].interface_add(ifname, create=True, if_type='sta')
1597 dev[0].global_request("INTERFACE_REMOVE " + ifname)
1599 def test_wpas_ctrl_interface_add_ap(dev, apdev): argument
1618 dev[1].connect("wpas-ap-open", key_mgmt="NONE", scan_freq="2412")
1619 dev[2].connect("wpas-ap-open", key_mgmt="NONE", scan_freq="2412")
1621 hwsim_utils.test_connectivity(wpas, dev[1])
1622 hwsim_utils.test_connectivity(dev[1], dev[2])
1624 dev[1].request("DISCONNECT")
1625 dev[2].request("DISCONNECT")
1626 dev[1].wait_disconnected()
1627 dev[2].wait_disconnected()
1630 def test_wpas_ctrl_interface_add_many(dev, apdev): argument
1633 _test_wpas_ctrl_interface_add_many(dev, apdev)
1636 ifname = "test%d-" % i + dev[0].ifname
1637 dev[0].global_request("INTERFACE_REMOVE " + ifname)
1639 def _test_wpas_ctrl_interface_add_many(dev, apdev): argument
1641 dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
1642 hwsim_utils.test_connectivity(dev[0], hapd)
1643 dev[0].dump_monitor()
1647 ifname = "test%d-" % i + dev[0].ifname
1648 dev[0].interface_add(ifname, create=True)
1653 dev[0].dump_monitor()
1658 dev[0].dump_monitor()
1660 def test_wpas_ctrl_interface_add2(dev, apdev): argument
1662 ifname = "test-ext-" + dev[0].ifname
1664 _test_wpas_ctrl_interface_add2(dev, apdev, ifname)
1668 def _test_wpas_ctrl_interface_add2(dev, apdev, ifname): argument
1670 dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
1671 hwsim_utils.test_connectivity(dev[0], hapd)
1673 subprocess.call(['iw', 'dev', dev[0].ifname, 'interface', 'add', ifname,
1677 dev[0].interface_add(ifname, set_ifname=False, all_params=True)
1681 hwsim_utils.test_connectivity(dev[0], hapd)
1683 dev[0].global_request("INTERFACE_REMOVE " + ifname)
1684 hwsim_utils.test_connectivity(dev[0], hapd)
1686 def test_wpas_ctrl_wait(dev, apdev, test_params): argument
1729 def test_wpas_ctrl_oom(dev): argument
1732 _test_wpas_ctrl_oom(dev)
1734 dev[0].request("VENDOR_ELEM_REMOVE 1 *")
1735 dev[0].request("VENDOR_ELEM_REMOVE 2 *")
1736 dev[0].request("SET bssid_filter ")
1738 def _test_wpas_ctrl_oom(dev): argument
1739 dev[0].request('VENDOR_ELEM_ADD 2 000100')
1856 tls = dev[0].request("GET tls_library")
1861 with alloc_fail(dev[0], count, func):
1862 res = dev[0].request(cmd)
1871 with alloc_fail(dev[0], count, func):
1872 res = dev[0].global_request(cmd)
1877 def test_wpas_ctrl_error(dev): argument
1886 with fail_test(dev[0], count, func):
1887 res = dev[0].request(cmd)
1891 def test_wpas_ctrl_socket_full(dev, apdev, test_params): argument
1893 if not dev[0].ping():
1895 dev[0].get_status()
1914 if not dev[0].ping():
1916 dev[0].get_status()
1949 if not dev[0].ping():
1951 dev[0].get_status()
1964 dev[0].scan(freq=2412)
1970 dev[0].scan(freq=2412)
1972 if not dev[0].ping():
1974 dev[0].get_status()
1976 def test_wpas_ctrl_event_burst(dev, apdev): argument
1978 if "OK" not in dev[0].request("EVENT_TEST 1000"):
1984 (i, g) = dev[0].dump_monitor()
1997 if not dev[0].ping():
2001 def test_wpas_ctrl_sched_scan_plans(dev, apdev): argument
2003 dev[0].request("SET sched_scan_plans foo")
2004 dev[0].request("SET sched_scan_plans 10:100 20:200 30")
2005 dev[0].request("SET sched_scan_plans 4294967295:0")
2006 dev[0].request("SET sched_scan_plans 1 1")
2007 dev[0].request("SET sched_scan_plans ")
2009 with alloc_fail(dev[0], 1, "wpas_sched_scan_plans_set"):
2010 dev[0].request("SET sched_scan_plans 10:100")
2012 dev[0].request("SET sched_scan_plans ")
2014 def test_wpas_ctrl_signal_monitor(dev, apdev): argument
2017 dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
2018 dev[1].connect("open", key_mgmt="NONE", scan_freq="2412",
2020 dev[2].connect("open", key_mgmt="NONE", scan_freq="2412")
2024 if "FAIL" in dev[2].request("SIGNAL_MONITOR THRESHOLD=-1 HYSTERESIS=5"):
2027 if "OK" not in dev[0].request("SIGNAL_MONITOR" + t):
2029 if "FAIL" not in dev[1].request("SIGNAL_MONITOR THRESHOLD=-44 HYSTERESIS=5"):
2031 ev = dev[2].wait_event(["CTRL-EVENT-SIGNAL-CHANGE"], timeout=10)
2037 dev[0].request("SIGNAL_MONITOR")
2038 dev[1].request("SIGNAL_MONITOR")
2039 dev[2].request("SIGNAL_MONITOR")
2041 dev[0].request("REMOVE_NETWORK all")
2042 dev[1].request("REMOVE_NETWORK all")
2043 dev[1].wait_disconnected()
2045 def test_wpas_ctrl_p2p_listen_offload(dev, apdev): argument
2047 dev[0].request("P2P_LO_STOP")
2048 dev[0].request("P2P_LO_START ")
2049 dev[0].request("P2P_LO_START 2412")
2050 dev[0].request("P2P_LO_START 2412 100 200 3")
2051 dev[0].request("P2P_LO_STOP")
2053 def test_wpas_ctrl_driver_flags(dev, apdev): argument
2058 wpas_flags = dev[0].request("DRIVER_FLAGS")
2068 def test_wpas_ctrl_bss_current(dev, apdev): argument
2072 res = dev[0].request("BSS CURRENT")
2075 dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
2076 res = dev[0].request("BSS CURRENT")
2080 def test_wpas_ctrl_set_lci_errors(dev): argument
2082 if "FAIL" not in dev[0].request("SET lci q"):
2085 with fail_test(dev[0], 1, "os_get_reltime;wpas_ctrl_iface_set_lci"):
2086 if "FAIL" not in dev[0].request("SET lci 00"):
2089 def test_wpas_ctrl_set_radio_disabled(dev): argument
2093 dev[0].request("SET radio_disabled 1")
2094 dev[0].request("SET radio_disabled 0")
2096 def test_wpas_ctrl_set_tdls_trigger_control(dev): argument
2100 dev[0].request("SET tdls_trigger_control 1")
2101 dev[0].request("SET tdls_trigger_control 0")
2103 def test_wpas_ctrl_set_sched_scan_relative_rssi(dev): argument
2112 if "FAIL" not in dev[0].request("SET " + t):
2125 if "OK" not in dev[0].request("SET " + t):
2128 def test_wpas_ctrl_get_pref_freq_list_override(dev): argument
2130 if dev[0].request("GET_PREF_FREQ_LIST ").strip() != "FAIL":
2133 dev[0].set("get_pref_freq_list_override", "foo")
2134 res = dev[0].request("GET_PREF_FREQ_LIST STATION").strip()
2138 dev[0].set("get_pref_freq_list_override", "1234:1,2,3 0")
2139 res = dev[0].request("GET_PREF_FREQ_LIST STATION").strip()
2143 dev[0].set("get_pref_freq_list_override", "1234:1,2,3 0:")
2144 res = dev[0].request("GET_PREF_FREQ_LIST STATION").strip()
2148 dev[0].set("get_pref_freq_list_override", "0:1,2")
2149 res = dev[0].request("GET_PREF_FREQ_LIST STATION").strip()
2153 dev[0].set("get_pref_freq_list_override", "1:3,4 0:1,2 2:5,6")
2154 res = dev[0].request("GET_PREF_FREQ_LIST STATION").strip()
2158 dev[0].set("get_pref_freq_list_override", "1:3,4 0:1 2:5,6")
2159 res = dev[0].request("GET_PREF_FREQ_LIST STATION").strip()
2163dev[0].set("get_pref_freq_list_override", "0:1000,1001 2:1002,1003 3:1004,1005 4:1006,1007 8:1010,…
2164 res = dev[0].request("GET_PREF_FREQ_LIST STATION").strip()
2167 res = dev[0].request("GET_PREF_FREQ_LIST AP").strip()
2170 res = dev[0].request("GET_PREF_FREQ_LIST P2P_GO").strip()
2173 res = dev[0].request("GET_PREF_FREQ_LIST P2P_CLIENT").strip()
2176 res = dev[0].request("GET_PREF_FREQ_LIST IBSS").strip()
2179 res = dev[0].request("GET_PREF_FREQ_LIST TDLS").strip()
2183 dev[0].set("get_pref_freq_list_override", "")
2184 res = dev[0].request("GET_PREF_FREQ_LIST STATION").strip()
2187 def test_wpas_ctrl_interface_add_driver_init_failure(dev, apdev): argument
2190 res = dev[0].global_request("INTERFACE_ADD FOO")
2193 dev[0].dump_monitor()