|
@@ -260,3 +260,198 @@ def test_hapd_ctrl_set_accept_mac_file(dev, apdev):
|
|
|
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], 1)
|
|
|
if ev is not None:
|
|
|
raise Exception("Unexpected disconnection")
|
|
|
+
|
|
|
+def test_hapd_ctrl_set_error_cases(dev, apdev):
|
|
|
+ """hostapd and SET error cases"""
|
|
|
+ ssid = "hapd-ctrl"
|
|
|
+ params = { "ssid": ssid }
|
|
|
+ hapd = hostapd.add_ap(apdev[0]['ifname'], params)
|
|
|
+ errors = [ "wpa_key_mgmt FOO",
|
|
|
+ "wpa_key_mgmt WPA-PSK \t FOO",
|
|
|
+ "wpa_key_mgmt \t ",
|
|
|
+ "wpa_pairwise FOO",
|
|
|
+ "wpa_pairwise \t ",
|
|
|
+ 'wep_key0 "',
|
|
|
+ 'wep_key0 "abcde',
|
|
|
+ "wep_key0 1",
|
|
|
+ "wep_key0 12q3456789",
|
|
|
+ "wep_key_len_broadcast 20",
|
|
|
+ "wep_rekey_period -1",
|
|
|
+ "wep_default_key 4",
|
|
|
+ "r0kh 02:00:00:00:03:0q nas1.w1.fi 100102030405060708090a0b0c0d0e0f",
|
|
|
+ "r0kh 02:00:00:00:03:00 12345678901234567890123456789012345678901234567890.nas1.w1.fi 100102030405060708090a0b0c0d0e0f",
|
|
|
+ "r0kh 02:00:00:00:03:00 nas1.w1.fi 100q02030405060708090a0b0c0d0e0f",
|
|
|
+ "r1kh 02:00:00:00:04:q0 00:01:02:03:04:06 200102030405060708090a0b0c0d0e0f",
|
|
|
+ "r1kh 02:00:00:00:04:00 00:01:02:03:04:q6 200102030405060708090a0b0c0d0e0f",
|
|
|
+ "r1kh 02:00:00:00:04:00 00:01:02:03:04:06 2q0102030405060708090a0b0c0d0e0f",
|
|
|
+ "roaming_consortium 1",
|
|
|
+ "roaming_consortium 12",
|
|
|
+ "roaming_consortium 112233445566778899aabbccddeeff00",
|
|
|
+ 'venue_name P"engExample venue"',
|
|
|
+ 'venue_name P"engExample venue',
|
|
|
+ "venue_name engExample venue",
|
|
|
+ "venue_name e:Example venue",
|
|
|
+ "venue_name eng1:Example venue",
|
|
|
+ "venue_name eng:Example venue 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
|
|
+ "anqp_3gpp_cell_net abc",
|
|
|
+ "anqp_3gpp_cell_net ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
|
|
|
+ "anqp_3gpp_cell_net 244",
|
|
|
+ "anqp_3gpp_cell_net 24,123",
|
|
|
+ "anqp_3gpp_cell_net 244,1",
|
|
|
+ "anqp_3gpp_cell_net 244,1234",
|
|
|
+ "nai_realm 0",
|
|
|
+ "nai_realm 0,1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.nas1.w1.fi",
|
|
|
+ "nai_realm 0,example.org,1,2,3,4,5,6,7,8",
|
|
|
+ "nai_realm 0,example.org,1[1:1][2:2][3:3][4:4][5:5]",
|
|
|
+ "nai_realm 0,example.org,1[1]",
|
|
|
+ "nai_realm 0,example.org,1[1:1",
|
|
|
+ "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",
|
|
|
+ "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",
|
|
|
+ "qos_map_set 53,2,22,6,8,15,0,7,255,255,16,31,32,39,255,255,40,47,255,300",
|
|
|
+ "qos_map_set 53,2,22,6,8,15,0,7,255,255,16,31,32,39,255,255,40,47,255,-1",
|
|
|
+ "qos_map_set 53,2,22,6,8,15,0,7,255,255,16,31,32,39,255,255,40,47,255,255,1",
|
|
|
+ "qos_map_set 1",
|
|
|
+ "qos_map_set 1,2",
|
|
|
+ "hs20_conn_capab 1",
|
|
|
+ "hs20_conn_capab 6:22",
|
|
|
+ "hs20_wan_metrics 0q:8000:1000:80:240:3000",
|
|
|
+ "hs20_wan_metrics 01",
|
|
|
+ "hs20_wan_metrics 01:8000",
|
|
|
+ "hs20_wan_metrics 01:8000:1000",
|
|
|
+ "hs20_wan_metrics 01:8000:1000:80",
|
|
|
+ "hs20_wan_metrics 01:8000:1000:80:240",
|
|
|
+ "hs20_oper_friendly_name eng1:Example",
|
|
|
+ "hs20_icon 32",
|
|
|
+ "hs20_icon 32:32",
|
|
|
+ "hs20_icon 32:32:eng",
|
|
|
+ "hs20_icon 32:32:eng:image/png",
|
|
|
+ "hs20_icon 32:32:eng:image/png:icon32",
|
|
|
+ "hs20_icon 32:32:eng:image/png:123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890:/tmp/icon32.png",
|
|
|
+ "hs20_icon 32:32:eng:image/png:name:/tmp/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.png",
|
|
|
+ "osu_ssid ",
|
|
|
+ "osu_ssid P",
|
|
|
+ 'osu_ssid P"abc',
|
|
|
+ 'osu_ssid "1234567890123456789012345678901234567890"',
|
|
|
+ "osu_friendly_name eng:Example",
|
|
|
+ "osu_nai anonymous@example.com",
|
|
|
+ "osu_method_list 1 0",
|
|
|
+ "osu_icon foo",
|
|
|
+ "osu_service_desc eng:Example services",
|
|
|
+ "ssid 1234567890123456789012345678901234567890",
|
|
|
+ "pac_opaque_encr_key 123456",
|
|
|
+ "eap_fast_a_id 12345",
|
|
|
+ "eap_fast_a_id 12345q",
|
|
|
+ "own_ip_addr foo",
|
|
|
+ "auth_server_addr foo2",
|
|
|
+ "auth_server_shared_secret ",
|
|
|
+ "acct_server_addr foo3",
|
|
|
+ "acct_server_shared_secret ",
|
|
|
+ "radius_auth_req_attr 123::",
|
|
|
+ "radius_acct_req_attr 123::",
|
|
|
+ "radius_das_client 192.168.1.123",
|
|
|
+ "radius_das_client 192.168.1.1a foo",
|
|
|
+ "auth_algs 0",
|
|
|
+ "max_num_sta -1",
|
|
|
+ "max_num_sta 1000000",
|
|
|
+ "wpa_passphrase 1234567",
|
|
|
+ "wpa_passphrase 1234567890123456789012345678901234567890123456789012345678901234",
|
|
|
+ "wpa_psk 1234567890123456789012345678901234567890123456789012345678901234a",
|
|
|
+ "wpa_psk 12345678901234567890123456789012345678901234567890123456789012",
|
|
|
+ "wpa_psk_radius 123",
|
|
|
+ "wpa_pairwise NONE",
|
|
|
+ "wpa_pairwise WEP40",
|
|
|
+ "wpa_pairwise WEP104",
|
|
|
+ "rsn_pairwise NONE",
|
|
|
+ "rsn_pairwise WEP40",
|
|
|
+ "rsn_pairwise WEP104",
|
|
|
+ "mobility_domain 01",
|
|
|
+ "r1_key_holder 0011223344",
|
|
|
+ "ctrl_interface_group nosuchgrouphere",
|
|
|
+ "hw_mode foo",
|
|
|
+ "wps_rf_bands foo",
|
|
|
+ "beacon_int 0",
|
|
|
+ "beacon_int 65536",
|
|
|
+ "acs_num_scans 0",
|
|
|
+ "acs_num_scans 101",
|
|
|
+ "rts_threshold -1",
|
|
|
+ "rts_threshold 2348",
|
|
|
+ "fragm_threshold -1",
|
|
|
+ "fragm_threshold 2347",
|
|
|
+ "send_probe_response -1",
|
|
|
+ "send_probe_response 2",
|
|
|
+ "vlan_naming -1",
|
|
|
+ "vlan_naming 10000000",
|
|
|
+ "group_mgmt_cipher FOO",
|
|
|
+ "assoc_sa_query_max_timeout 0",
|
|
|
+ "assoc_sa_query_retry_timeout 0",
|
|
|
+ "wps_state -1",
|
|
|
+ "wps_state 3",
|
|
|
+ "uuid FOO",
|
|
|
+ "device_name 1234567890123456789012345678901234567890",
|
|
|
+ "manufacturer 1234567890123456789012345678901234567890123456789012345678901234567890",
|
|
|
+ "model_name 1234567890123456789012345678901234567890",
|
|
|
+ "model_number 1234567890123456789012345678901234567890",
|
|
|
+ "serial_number 1234567890123456789012345678901234567890",
|
|
|
+ "device_type FOO",
|
|
|
+ "os_version 1",
|
|
|
+ "ap_settings /tmp/does/not/exist/ap-settings.foo",
|
|
|
+ "wps_nfc_dev_pw_id 4",
|
|
|
+ "wps_nfc_dev_pw_id 100000",
|
|
|
+ "time_zone A",
|
|
|
+ "access_network_type -1",
|
|
|
+ "access_network_type 16",
|
|
|
+ "hessid 00:11:22:33:44",
|
|
|
+ "network_auth_type 0q",
|
|
|
+ "ipaddr_type_availability 1q",
|
|
|
+ "hs20_operating_class 0",
|
|
|
+ "hs20_operating_class 0q",
|
|
|
+ "bss_load_test ",
|
|
|
+ "bss_load_test 12",
|
|
|
+ "bss_load_test 12:80",
|
|
|
+ "vendor_elements 0",
|
|
|
+ "vendor_elements 0q",
|
|
|
+ "local_pwr_constraint -1",
|
|
|
+ "local_pwr_constraint 256",
|
|
|
+ "wmm_ac_bk_cwmin -1",
|
|
|
+ "wmm_ac_be_cwmin 13",
|
|
|
+ "wmm_ac_vi_cwmax -1",
|
|
|
+ "wmm_ac_vo_cwmax 13",
|
|
|
+ "wmm_ac_foo_cwmax 6",
|
|
|
+ "wmm_ac_bk_aifs 0",
|
|
|
+ "wmm_ac_bk_aifs 256",
|
|
|
+ "wmm_ac_bk_txop_limit -1",
|
|
|
+ "wmm_ac_bk_txop_limit 65536",
|
|
|
+ "wmm_ac_bk_acm -1",
|
|
|
+ "wmm_ac_bk_acm 2",
|
|
|
+ "wmm_ac_bk_foo 2",
|
|
|
+ "tx_queue_foo_aifs 3",
|
|
|
+ "tx_queue_data3_cwmin 4",
|
|
|
+ "tx_queue_data3_cwmax 4",
|
|
|
+ "tx_queue_data3_aifs -4",
|
|
|
+ "tx_queue_data3_foo 1" ]
|
|
|
+ for e in errors:
|
|
|
+ if "FAIL" not in hapd.request("SET " + e):
|
|
|
+ raise Exception("Unexpected SET success: '%s'" % e)
|
|
|
+
|
|
|
+ if "OK" not in hapd.request("SET osu_server_uri https://example.com/"):
|
|
|
+ raise Exception("Unexpected SET osu_server_uri failure")
|
|
|
+ if "OK" not in hapd.request("SET osu_friendly_name eng:Example"):
|
|
|
+ raise Exception("Unexpected SET osu_friendly_name failure")
|
|
|
+
|
|
|
+ errors = [ "osu_friendly_name eng1:Example",
|
|
|
+ "osu_service_desc eng1:Example services" ]
|
|
|
+ for e in errors:
|
|
|
+ if "FAIL" not in hapd.request("SET " + e):
|
|
|
+ raise Exception("Unexpected SET success: '%s'" % e)
|
|
|
+
|
|
|
+ no_err = [ "wps_nfc_dh_pubkey 0",
|
|
|
+ "wps_nfc_dh_privkey 0q",
|
|
|
+ "wps_nfc_dev_pw 012",
|
|
|
+ "manage_p2p 0",
|
|
|
+ "disassoc_low_ack 0",
|
|
|
+ "network_auth_type 01",
|
|
|
+ "tdls_prohibit 0",
|
|
|
+ "tdls_prohibit_chan_switch 0" ]
|
|
|
+ for e in no_err:
|
|
|
+ if "OK" not in hapd.request("SET " + e):
|
|
|
+ raise Exception("Unexpected SET failure: '%s'" % e)
|