]>
Commit | Line | Data |
---|---|---|
a85bde82 JM |
1 | # hostapd configuration tests |
2 | # Copyright (c) 2014, Jouni Malinen <j@w1.fi> | |
3 | # | |
4 | # This software may be distributed under the terms of the BSD license. | |
5 | # See README for more details. | |
6 | ||
9fd6804d | 7 | from remotehost import remote_compatible |
a85bde82 JM |
8 | import hostapd |
9 | ||
9fd6804d | 10 | @remote_compatible |
a85bde82 JM |
11 | def test_ap_config_errors(dev, apdev): |
12 | """Various hostapd configuration errors""" | |
a85bde82 JM |
13 | |
14 | # IEEE 802.11d without country code | |
15 | params = { "ssid": "foo", "ieee80211d": "1" } | |
41ba40e7 | 16 | hapd = hostapd.add_ap(apdev[0], params, no_enable=True) |
a85bde82 JM |
17 | if "FAIL" not in hapd.request("ENABLE"): |
18 | raise Exception("Unexpected ENABLE success (ieee80211d without country_code)") | |
1728a2e7 | 19 | hostapd.remove_bss(apdev[0]) |
a85bde82 JM |
20 | |
21 | # IEEE 802.11h without IEEE 802.11d | |
22 | params = { "ssid": "foo", "ieee80211h": "1" } | |
41ba40e7 | 23 | hapd = hostapd.add_ap(apdev[0], params, no_enable=True) |
a85bde82 JM |
24 | if "FAIL" not in hapd.request("ENABLE"): |
25 | raise Exception("Unexpected ENABLE success (ieee80211h without ieee80211d") | |
1728a2e7 | 26 | hostapd.remove_bss(apdev[0]) |
a85bde82 JM |
27 | |
28 | # Power Constraint without IEEE 802.11d | |
29 | params = { "ssid": "foo", "local_pwr_constraint": "1" } | |
41ba40e7 | 30 | hapd = hostapd.add_ap(apdev[0], params, no_enable=True) |
a85bde82 JM |
31 | if "FAIL" not in hapd.request("ENABLE"): |
32 | raise Exception("Unexpected ENABLE success (local_pwr_constraint without ieee80211d)") | |
1728a2e7 | 33 | hostapd.remove_bss(apdev[0]) |
a85bde82 JM |
34 | |
35 | # Spectrum management without Power Constraint | |
36 | params = { "ssid": "foo", "spectrum_mgmt_required": "1" } | |
41ba40e7 | 37 | hapd = hostapd.add_ap(apdev[0], params, no_enable=True) |
a85bde82 JM |
38 | if "FAIL" not in hapd.request("ENABLE"): |
39 | raise Exception("Unexpected ENABLE success (spectrum_mgmt_required without local_pwr_constraint)") | |
1728a2e7 | 40 | hostapd.remove_bss(apdev[0]) |
a85bde82 JM |
41 | |
42 | # IEEE 802.1X without authentication server | |
43 | params = { "ssid": "foo", "ieee8021x": "1" } | |
41ba40e7 | 44 | hapd = hostapd.add_ap(apdev[0], params, no_enable=True) |
a85bde82 JM |
45 | if "FAIL" not in hapd.request("ENABLE"): |
46 | raise Exception("Unexpected ENABLE success (ieee8021x)") | |
1728a2e7 | 47 | hostapd.remove_bss(apdev[0]) |
a85bde82 JM |
48 | |
49 | # RADIUS-PSK without macaddr_acl=2 | |
50 | params = hostapd.wpa2_params(ssid="foo", passphrase="12345678") | |
51 | params["wpa_psk_radius"] = "1" | |
41ba40e7 | 52 | hapd = hostapd.add_ap(apdev[0], params, no_enable=True) |
a85bde82 JM |
53 | if "FAIL" not in hapd.request("ENABLE"): |
54 | raise Exception("Unexpected ENABLE success (wpa_psk_radius)") | |
1728a2e7 | 55 | hostapd.remove_bss(apdev[0]) |
a85bde82 JM |
56 | |
57 | # FT without NAS-Identifier | |
58 | params = { "wpa": "2", | |
59 | "wpa_key_mgmt": "FT-PSK", | |
60 | "rsn_pairwise": "CCMP", | |
61 | "wpa_passphrase": "12345678" } | |
41ba40e7 | 62 | hapd = hostapd.add_ap(apdev[0], params, no_enable=True) |
a85bde82 JM |
63 | if "FAIL" not in hapd.request("ENABLE"): |
64 | raise Exception("Unexpected ENABLE success (FT without nas_identifier)") | |
1728a2e7 | 65 | hostapd.remove_bss(apdev[0]) |
a85bde82 JM |
66 | |
67 | # Hotspot 2.0 without WPA2/CCMP | |
68 | params = hostapd.wpa2_params(ssid="foo") | |
69 | params['wpa_key_mgmt'] = "WPA-EAP" | |
70 | params['ieee8021x'] = "1" | |
71 | params['auth_server_addr'] = "127.0.0.1" | |
72 | params['auth_server_port'] = "1812" | |
73 | params['auth_server_shared_secret'] = "radius" | |
74 | params['interworking'] = "1" | |
75 | params['hs20'] = "1" | |
76 | params['wpa'] = "1" | |
41ba40e7 | 77 | hapd = hostapd.add_ap(apdev[0], params, no_enable=True) |
a85bde82 JM |
78 | if "FAIL" not in hapd.request("ENABLE"): |
79 | raise Exception("Unexpected ENABLE success (HS 2.0 without WPA2/CCMP)") | |
1728a2e7 | 80 | hostapd.remove_bss(apdev[0]) |