From 6acecce1fe86520afba8560adcf492be45ff11c6 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 30 Mar 2014 12:42:16 +0300 Subject: [PATCH] tests: hostapd configuration parameters Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_hs20.py | 1 + tests/hwsim/test_ap_ht.py | 9 ++ tests/hwsim/test_ap_params.py | 17 +++ tests/hwsim/test_ap_vht.py | 24 +++++ tests/hwsim/test_hapd_ctrl.py | 195 ++++++++++++++++++++++++++++++++++ 5 files changed, 246 insertions(+) diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index f8f5b8734..d2d1af2b3 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/tests/hwsim/test_ap_hs20.py @@ -1793,6 +1793,7 @@ def test_ap_hs20_fetch_osu(dev, apdev): params['hs20_icon'] = "128:80:zxx:image/png:w1fi_logo:w1fi_logo.png" params['osu_ssid'] = '"HS 2.0 OSU OSEN"' params['osu_method_list'] = "0" + params['osu_nai'] = "osen@example.com" params['osu_friendly_name'] = [ "eng:Test2 OSU", "fin:Testi2-OSU" ] params['osu_icon'] = "w1fi_logo" params['osu_service_desc'] = [ "eng:Example services2", "fin:Esimerkkipalveluja2" ] diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py index 8f022d7db..1577b200d 100644 --- a/tests/hwsim/test_ap_ht.py +++ b/tests/hwsim/test_ap_ht.py @@ -448,3 +448,12 @@ def test_ap_require_ht_limited_rates(dev, apdev): raise Exception("Association rejection timed out") if "status_code=27" not in ev: raise Exception("Unexpected rejection status code") + +def test_ap_ht_capab_not_supported(dev, apdev): + """HT configuration with driver not supporting all ht_capab entries""" + params = { "ssid": "test-ht40", + "channel": "5", + "ht_capab": "[HT40-][LDPC][SMPS-STATIC][SMPS-DYNAMIC][GF][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][RX-STBC12][RX-STBC123][DELAYED-BA][MAX-AMSDU-7935][PSMP][DSSS_CCK-40][LSIG-TXOP-PROT]"} + hapd = hostapd.add_ap(apdev[0]['ifname'], params, no_enable=True) + if "FAIL" not in hapd.request("ENABLE"): + raise Exception("Unexpected ENABLE success") diff --git a/tests/hwsim/test_ap_params.py b/tests/hwsim/test_ap_params.py index aacf063e9..e9900bd4a 100644 --- a/tests/hwsim/test_ap_params.py +++ b/tests/hwsim/test_ap_params.py @@ -223,3 +223,20 @@ def test_ap_max_num_sta(dev, apdev): ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1) if ev is not None: raise Exception("Unexpected association") + +def test_ap_tx_queue_params(dev, apdev): + """Open AP with TX queue params set""" + ssid = "tx" + params = {} + params['ssid'] = ssid + params['tx_queue_data2_aifs'] = "4" + params['tx_queue_data2_cwmin'] = "7" + params['tx_queue_data2_cwmax'] = "1023" + params['tx_queue_data2_burst'] = "4.2" + params['tx_queue_data1_aifs'] = "4" + params['tx_queue_data1_cwmin'] = "7" + params['tx_queue_data1_cwmax'] = "1023" + params['tx_queue_data1_burst'] = "2" + hostapd.add_ap(apdev[0]['ifname'], params) + dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412") + hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) diff --git a/tests/hwsim/test_ap_vht.py b/tests/hwsim/test_ap_vht.py index be23458d4..71768a115 100644 --- a/tests/hwsim/test_ap_vht.py +++ b/tests/hwsim/test_ap_vht.py @@ -101,3 +101,27 @@ def test_ap_vht_20(devs, apdevs): hwsim_utils.test_connectivity(dev.ifname, ap['ifname']) finally: subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) + +def test_ap_vht_capab_not_supported(dev, apdev): + """VHT configuration with driver not supporting all vht_capab entries""" + try: + params = { "ssid": "vht", + "country_code": "FI", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+][SHORT-GI-40][DSS_CCK-40]", + "ieee80211n": "1", + "ieee80211ac": "1", + "vht_oper_chwidth": "1", + "vht_capab": "[MAX-MPDU-7991][MAX-MPDU-11454][VHT160][VHT160-80PLUS80][RXLDPC][SHORT-GI-80][SHORT-GI-160][TX-STBC-2BY1][RX-STBC-1][RX-STBC-12][RX-STBC-123][RX-STBC-1234][SU-BEAMFORMER][SU-BEAMFORMEE][BF-ANTENNA-2][SOUNDING-DIMENSION-2][MU-BEAMFORMER][MU-BEAMFORMEE][VHT-TXOP-PS][HTC-VHT][MAX-A-MPDU-LEN-EXP0][MAX-A-MPDU-LEN-EXP7][VHT-LINK-ADAPT2][VHT-LINK-ADAPT3][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN]", + "vht_oper_centr_freq_seg0_idx": "42", + "require_vht": "1" } + hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False) + ev = hapd.wait_event(["AP-DISABLED"], timeout=5) + if ev is None: + raise Exception("Startup failure not reported") + for i in range(1, 7): + if "OK" not in hapd.request("SET vht_capab [MAX-A-MPDU-LEN-EXP%d]" % i): + raise Exception("Unexpected SET failure") + finally: + subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) diff --git a/tests/hwsim/test_hapd_ctrl.py b/tests/hwsim/test_hapd_ctrl.py index 176cbe2bf..6ed827072 100644 --- a/tests/hwsim/test_hapd_ctrl.py +++ b/tests/hwsim/test_hapd_ctrl.py @@ -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)