aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2019-03-15 10:10:37 (GMT)
committerJouni Malinen <j@w1.fi>2019-03-16 16:52:09 (GMT)
commitfab49f6145f44760e888b3844a9fff9440a85b27 (patch)
tree3bffb2ff46b1386ceafdc527b4d81047a71a2896
parent009b54bedd27cdfa0fe6f5532f927a7edc371041 (diff)
downloadhostap-fab49f6145f44760e888b3844a9fff9440a85b27.zip
hostap-fab49f6145f44760e888b3844a9fff9440a85b27.tar.gz
hostap-fab49f6145f44760e888b3844a9fff9440a85b27.tar.bz2
tests: Python coding style cleanup (pylint3 bad-whitespace)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
-rw-r--r--tests/hwsim/fst_module_aux.py28
-rw-r--r--tests/hwsim/fst_test_common.py20
-rw-r--r--tests/hwsim/hostapd.py68
-rw-r--r--tests/hwsim/hwsim.py24
-rw-r--r--tests/hwsim/hwsim_utils.py4
-rw-r--r--tests/hwsim/netlink.py70
-rw-r--r--tests/hwsim/nl80211.py4
-rw-r--r--tests/hwsim/radius_das.py2
-rw-r--r--tests/hwsim/remotehost.py4
-rwxr-xr-xtests/hwsim/run-tests.py12
-rw-r--r--tests/hwsim/test_ap_acs.py10
-rw-r--r--tests/hwsim/test_ap_ciphers.py152
-rw-r--r--tests/hwsim/test_ap_config.py302
-rw-r--r--tests/hwsim/test_ap_csa.py6
-rw-r--r--tests/hwsim/test_ap_dynamic.py76
-rw-r--r--tests/hwsim/test_ap_eap.py572
-rw-r--r--tests/hwsim/test_ap_ft.py370
-rw-r--r--tests/hwsim/test_ap_hs20.py1468
-rw-r--r--tests/hwsim/test_ap_ht.py442
-rw-r--r--tests/hwsim/test_ap_open.py136
-rw-r--r--tests/hwsim/test_ap_params.py38
-rw-r--r--tests/hwsim/test_ap_psk.py222
-rw-r--r--tests/hwsim/test_ap_qosmap.py58
-rw-r--r--tests/hwsim/test_ap_roam.py14
-rw-r--r--tests/hwsim/test_ap_tdls.py102
-rw-r--r--tests/hwsim/test_ap_track.py152
-rw-r--r--tests/hwsim/test_ap_vht.py577
-rw-r--r--tests/hwsim/test_ap_vlan.py106
-rw-r--r--tests/hwsim/test_ap_wps.py1743
-rw-r--r--tests/hwsim/test_authsrv.py50
-rw-r--r--tests/hwsim/test_autoscan.py4
-rw-r--r--tests/hwsim/test_bgscan.py30
-rw-r--r--tests/hwsim/test_cfg80211.py17
-rw-r--r--tests/hwsim/test_connect_cmd.py30
-rw-r--r--tests/hwsim/test_dbus.py1047
-rw-r--r--tests/hwsim/test_dfs.py8
-rw-r--r--tests/hwsim/test_dpp.py500
-rw-r--r--tests/hwsim/test_eap_proto.py870
-rw-r--r--tests/hwsim/test_erp.py32
-rw-r--r--tests/hwsim/test_ext_password.py4
-rw-r--r--tests/hwsim/test_fils.py168
-rw-r--r--tests/hwsim/test_fst_config.py68
-rw-r--r--tests/hwsim/test_fst_module.py138
-rw-r--r--tests/hwsim/test_gas.py266
-rw-r--r--tests/hwsim/test_hapd_ctrl.py582
-rw-r--r--tests/hwsim/test_hostapd_oom.py8
-rw-r--r--tests/hwsim/test_hs20_filter.py16
-rw-r--r--tests/hwsim/test_hs20_pps_mo.py4
-rw-r--r--tests/hwsim/test_ibss.py30
-rw-r--r--tests/hwsim/test_ieee8021x.py72
-rw-r--r--tests/hwsim/test_kernel.py4
-rw-r--r--tests/hwsim/test_macsec.py73
-rw-r--r--tests/hwsim/test_mbo.py76
-rw-r--r--tests/hwsim/test_monitor_interface.py2
-rw-r--r--tests/hwsim/test_multi_ap.py70
-rw-r--r--tests/hwsim/test_nfc_wps.py72
-rw-r--r--tests/hwsim/test_oce.py20
-rw-r--r--tests/hwsim/test_ocv.py298
-rw-r--r--tests/hwsim/test_owe.py150
-rw-r--r--tests/hwsim/test_p2p_autogo.py2
-rw-r--r--tests/hwsim/test_p2p_channel.py84
-rw-r--r--tests/hwsim/test_p2p_concurrency.py38
-rw-r--r--tests/hwsim/test_p2p_device.py6
-rw-r--r--tests/hwsim/test_p2p_discovery.py8
-rw-r--r--tests/hwsim/test_p2p_grpform.py22
-rw-r--r--tests/hwsim/test_p2p_invitation.py14
-rw-r--r--tests/hwsim/test_p2p_messages.py38
-rw-r--r--tests/hwsim/test_p2p_persistent.py23
-rw-r--r--tests/hwsim/test_p2p_service.py72
-rw-r--r--tests/hwsim/test_p2p_set.py50
-rw-r--r--tests/hwsim/test_p2ps.py50
-rw-r--r--tests/hwsim/test_pmksa_cache.py56
-rw-r--r--tests/hwsim/test_radio_work.py2
-rw-r--r--tests/hwsim/test_radius.py96
-rw-r--r--tests/hwsim/test_rfkill.py6
-rw-r--r--tests/hwsim/test_rrm.py334
-rw-r--r--tests/hwsim/test_sae.py226
-rw-r--r--tests/hwsim/test_scan.py296
-rw-r--r--tests/hwsim/test_sigma_dut.py278
-rw-r--r--tests/hwsim/test_ssid.py24
-rw-r--r--tests/hwsim/test_sta_dynamic.py6
-rw-r--r--tests/hwsim/test_suite_b.py194
-rw-r--r--tests/hwsim/test_tnc.py66
-rw-r--r--tests/hwsim/test_wep.py50
-rw-r--r--tests/hwsim/test_wext.py22
-rw-r--r--tests/hwsim/test_wmediumd.py14
-rw-r--r--tests/hwsim/test_wnm.py390
-rw-r--r--tests/hwsim/test_wpas_ap.py12
-rw-r--r--tests/hwsim/test_wpas_config.py278
-rw-r--r--tests/hwsim/test_wpas_ctrl.py640
-rw-r--r--tests/hwsim/test_wpas_mesh.py66
-rw-r--r--tests/hwsim/test_wpas_wmm_ac.py36
-rw-r--r--tests/hwsim/tshark.py8
-rw-r--r--tests/hwsim/utils.py2
-rwxr-xr-xtests/hwsim/vm/parallel-vm.py131
-rw-r--r--tests/hwsim/wlantest.py2
-rw-r--r--tests/hwsim/wpasupplicant.py96
-rw-r--r--tests/remote/config.py26
-rw-r--r--tests/remote/monitor.py20
-rwxr-xr-xtests/remote/run-tests.py4
-rw-r--r--tests/remote/rutils.py28
-rw-r--r--tests/remote/test_example.py4
102 files changed, 7663 insertions, 7648 deletions
diff --git a/tests/hwsim/fst_module_aux.py b/tests/hwsim/fst_module_aux.py
index 58aabc5..03a0bd7 100644
--- a/tests/hwsim/fst_module_aux.py
+++ b/tests/hwsim/fst_module_aux.py
@@ -141,7 +141,7 @@ def disconnect_external_sta(sta, ap, check_disconnect=True):
sta.request("DISCONNECT")
if check_disconnect:
hap = ap.get_instance()
- ev = hap.wait_event([ "AP-STA-DISCONNECTED" ], timeout=10)
+ ev = hap.wait_event(["AP-STA-DISCONNECTED"], timeout=10)
if ev is None:
raise Exception("No disconnection event received from %s" % ap.get_ssid())
@@ -313,7 +313,7 @@ class FstDevice:
return None
return res.splitlines()
- def configure_session(self, sid, new_iface, old_iface = None):
+ def configure_session(self, sid, new_iface, old_iface=None):
"""Calls session_set for a number of parameters some of which are stored
in "self" while others are passed to this function explicitly. If
old_iface is None, current iface is used; if old_iface is an empty
@@ -370,7 +370,7 @@ class FstDevice:
return s
def send_test_session_setup_request(self, fsts_id,
- additional_parameter = None):
+ additional_parameter=None):
request = "FST-MANAGER TEST_REQUEST SEND_SETUP_REQUEST " + fsts_id
if additional_parameter is not None:
request += " " + additional_parameter
@@ -380,7 +380,7 @@ class FstDevice:
return s
def send_test_session_setup_response(self, fsts_id,
- response, additional_parameter = None):
+ response, additional_parameter=None):
request = "FST-MANAGER TEST_REQUEST SEND_SETUP_RESPONSE " + fsts_id + " " + response
if additional_parameter is not None:
request += " " + additional_parameter
@@ -453,7 +453,7 @@ class FstDevice:
s = self.grequest("FST-MANAGER SESSION_INITIATE"+ strsid)
if not s.startswith('OK'):
raise Exception("Cannot initiate fst session: %s" % s)
- ev = self.peer_obj.wait_gevent([ "FST-EVENT-SESSION" ], timeout=5)
+ ev = self.peer_obj.wait_gevent(["FST-EVENT-SESSION"], timeout=5)
if ev is None:
raise Exception("No FST-EVENT-SESSION received")
# We got FST event
@@ -520,7 +520,7 @@ class FstDevice:
raise Exception("Cannot transfer fst session: %s" % s)
result = ''
while result == '':
- ev = self.peer_obj.wait_gevent([ "FST-EVENT-SESSION" ], timeout=5)
+ ev = self.peer_obj.wait_gevent(["FST-EVENT-SESSION"], timeout=5)
if ev is None:
raise Exception("Missing session transfer event")
# We got FST event. We expect TRANSITION_CONFIRMED state and then
@@ -536,7 +536,7 @@ class FstDevice:
return result
def wait_for_tear_down(self):
- ev = self.wait_gevent([ "FST-EVENT-SESSION" ], timeout=5)
+ ev = self.wait_gevent(["FST-EVENT-SESSION"], timeout=5)
if ev is None:
raise Exception("No FST-EVENT-SESSION received")
# We got FST event
@@ -582,7 +582,7 @@ class FstDevice:
#
# FstAP class
#
-class FstAP (FstDevice):
+class FstAP(FstDevice):
def __init__(self, iface, ssid, mode, chan, fst_group, fst_pri,
fst_llt=None, rsn=False):
"""If fst_group is empty, then FST parameters will not be set
@@ -610,7 +610,7 @@ class FstAP (FstDevice):
params['wpa_key_mgmt'] = 'WPA-PSK'
params['rsn_pairwise'] = 'CCMP'
params['wpa_passphrase'] = '12345678'
- self.hapd=hostapd.add_ap(self.iface, params)
+ self.hapd = hostapd.add_ap(self.iface, params)
if not self.hapd.ping():
raise Exception("Could not ping FST hostapd")
self.reg_ctrl.start()
@@ -660,7 +660,7 @@ class FstAP (FstDevice):
# Maybe station is not connected?
addr = None
else:
- addr=sta['addr']
+ addr = sta['addr']
return addr
def grequest(self, req):
@@ -688,7 +688,7 @@ class FstAP (FstDevice):
#
# FstSTA class
#
-class FstSTA (FstDevice):
+class FstSTA(FstDevice):
def __init__(self, iface, fst_group, fst_pri, fst_llt=None, rsn=False):
"""If fst_group is empty, then FST parameters will not be set
If fst_llt is empty, the parameter will not be set and the default value
@@ -790,7 +790,7 @@ class FstSTA (FstDevice):
h.connect(ssid, **kwargs)
self.connected = ap
if check_connection:
- ev = ap.wait_event([ "AP-STA-CONNECTED" ], timeout=10)
+ ev = ap.wait_event(["AP-STA-CONNECTED"], timeout=10)
if ev is None:
self.connected = None
raise Exception("No connection event received from %s" % ssid)
@@ -804,7 +804,7 @@ class FstSTA (FstDevice):
h.request("DISCONNECT")
if check_disconnect:
hap = self.connected.get_instance()
- ev = hap.wait_event([ "AP-STA-DISCONNECTED" ], timeout=10)
+ ev = hap.wait_event(["AP-STA-DISCONNECTED"], timeout=10)
if ev is None:
raise Exception("No disconnection event received from %s" % self.connected.get_ssid())
h.dump_monitor()
@@ -820,7 +820,7 @@ class FstSTA (FstDevice):
h.request("DISCONNECT")
if check_disconnect:
hap = self.connected
- ev = hap.wait_event([ "AP-STA-DISCONNECTED" ], timeout=10)
+ ev = hap.wait_event(["AP-STA-DISCONNECTED"], timeout=10)
if ev is None:
raise Exception("No disconnection event received from AP")
h.dump_monitor()
diff --git a/tests/hwsim/fst_test_common.py b/tests/hwsim/fst_test_common.py
index 8fbd71f..4b6bab0 100644
--- a/tests/hwsim/fst_test_common.py
+++ b/tests/hwsim/fst_test_common.py
@@ -12,15 +12,15 @@ import hostapd
logger = logging.getLogger()
-fst_test_def_group='fstg0'
-fst_test_def_freq_g='2412' # Channel 1
-fst_test_def_freq_a='5180' # Channel 36
-fst_test_def_chan_g='1'
-fst_test_def_chan_a='36'
-fst_test_def_prio_low='100'
-fst_test_def_prio_high='110'
-fst_test_def_llt='100'
-fst_test_def_reg_domain='00'
+fst_test_def_group = 'fstg0'
+fst_test_def_freq_g = '2412' # Channel 1
+fst_test_def_freq_a = '5180' # Channel 36
+fst_test_def_chan_g = '1'
+fst_test_def_chan_a = '36'
+fst_test_def_prio_low = '100'
+fst_test_def_prio_high = '110'
+fst_test_def_llt = '100'
+fst_test_def_reg_domain = '00'
class HapdRegCtrl:
def __init__(self):
@@ -89,7 +89,7 @@ class HapdRegCtrl:
logger.debug("fst hostapd: regulatory domain ready")
def fst_clear_regdom():
- cmd = subprocess.Popen([ "iw", "reg", "get" ], stdout=subprocess.PIPE)
+ cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE)
res = cmd.stdout.read().decode()
cmd.stdout.close()
if "country 00:" not in res:
diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index 7578159..2ca1e3d 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -19,7 +19,7 @@ hapd_ctrl = '/var/run/hostapd'
hapd_global = '/var/run/hostapd-global'
def mac2tuple(mac):
- return struct.unpack('6B', binascii.unhexlify(mac.replace(':','')))
+ return struct.unpack('6B', binascii.unhexlify(mac.replace(':', '')))
class HostapdGlobal:
def __init__(self, apdev=None, global_ctrl_override=None):
@@ -267,7 +267,7 @@ class Hostapd:
lines = res.splitlines()
vals = dict()
for l in lines:
- [name,value] = l.split('=', 1)
+ [name, value] = l.split('=', 1)
vals[name] = value
return vals
@@ -282,7 +282,7 @@ class Hostapd:
lines = res.splitlines()
vals = dict()
for l in lines:
- [name,value] = l.split('=', 1)
+ [name, value] = l.split('=', 1)
vals[name] = value
return vals
@@ -297,7 +297,7 @@ class Hostapd:
lines = res.splitlines()
vals = dict()
for l in lines:
- [name,value] = l.split('=', 1)
+ [name, value] = l.split('=', 1)
vals[name] = value
return vals
@@ -349,7 +349,7 @@ class Hostapd:
vals['addr'] = l
first = False
else:
- [name,value] = l.split('=', 1)
+ [name, value] = l.split('=', 1)
vals[name] = value
return vals
@@ -373,7 +373,7 @@ class Hostapd:
if addr not in l:
continue
vals = dict()
- [index,aa,pmkid,expiration,opportunistic] = l.split(' ')
+ [index, aa, pmkid, expiration, opportunistic] = l.split(' ')
vals['index'] = index
vals['pmkid'] = pmkid
vals['expiration'] = expiration
@@ -433,14 +433,14 @@ def add_ap(apdev, params, wait_enabled=True, no_enable=False, timeout=30,
if not hapd.ping():
raise Exception("Could not ping hostapd")
hapd.set_defaults()
- fields = [ "ssid", "wpa_passphrase", "nas_identifier", "wpa_key_mgmt",
- "wpa",
- "wpa_pairwise", "rsn_pairwise", "auth_server_addr",
- "acct_server_addr", "osu_server_uri" ]
+ fields = ["ssid", "wpa_passphrase", "nas_identifier", "wpa_key_mgmt",
+ "wpa",
+ "wpa_pairwise", "rsn_pairwise", "auth_server_addr",
+ "acct_server_addr", "osu_server_uri"]
for field in fields:
if field in params:
hapd.set(field, params[field])
- for f,v in list(params.items()):
+ for f, v in list(params.items()):
if f in fields:
continue
if isinstance(v, list):
@@ -518,9 +518,9 @@ def terminate(apdev):
hapd_global.terminate()
def wpa2_params(ssid=None, passphrase=None):
- params = { "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK",
- "rsn_pairwise": "CCMP" }
+ params = {"wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK",
+ "rsn_pairwise": "CCMP"}
if ssid:
params["ssid"] = ssid
if passphrase:
@@ -528,9 +528,9 @@ def wpa2_params(ssid=None, passphrase=None):
return params
def wpa_params(ssid=None, passphrase=None):
- params = { "wpa": "1",
- "wpa_key_mgmt": "WPA-PSK",
- "wpa_pairwise": "TKIP" }
+ params = {"wpa": "1",
+ "wpa_key_mgmt": "WPA-PSK",
+ "wpa_pairwise": "TKIP"}
if ssid:
params["ssid"] = ssid
if passphrase:
@@ -538,10 +538,10 @@ def wpa_params(ssid=None, passphrase=None):
return params
def wpa_mixed_params(ssid=None, passphrase=None):
- params = { "wpa": "3",
- "wpa_key_mgmt": "WPA-PSK",
- "wpa_pairwise": "TKIP",
- "rsn_pairwise": "CCMP" }
+ params = {"wpa": "3",
+ "wpa_key_mgmt": "WPA-PSK",
+ "wpa_pairwise": "TKIP",
+ "rsn_pairwise": "CCMP"}
if ssid:
params["ssid"] = ssid
if passphrase:
@@ -549,10 +549,10 @@ def wpa_mixed_params(ssid=None, passphrase=None):
return params
def radius_params():
- params = { "auth_server_addr": "127.0.0.1",
- "auth_server_port": "1812",
- "auth_server_shared_secret": "radius",
- "nas_identifier": "nas.w1.fi" }
+ params = {"auth_server_addr": "127.0.0.1",
+ "auth_server_port": "1812",
+ "auth_server_shared_secret": "radius",
+ "nas_identifier": "nas.w1.fi"}
return params
def wpa_eap_params(ssid=None):
@@ -576,8 +576,8 @@ def wpa2_eap_params(ssid=None):
return params
def b_only_params(channel="1", ssid=None, country=None):
- params = { "hw_mode" : "b",
- "channel" : channel }
+ params = {"hw_mode": "b",
+ "channel": channel}
if ssid:
params["ssid"] = ssid
if country:
@@ -585,8 +585,8 @@ def b_only_params(channel="1", ssid=None, country=None):
return params
def g_only_params(channel="1", ssid=None, country=None):
- params = { "hw_mode" : "g",
- "channel" : channel }
+ params = {"hw_mode": "g",
+ "channel": channel}
if ssid:
params["ssid"] = ssid
if country:
@@ -594,8 +594,8 @@ def g_only_params(channel="1", ssid=None, country=None):
return params
def a_only_params(channel="36", ssid=None, country=None):
- params = { "hw_mode" : "a",
- "channel" : channel }
+ params = {"hw_mode": "a",
+ "channel": channel}
if ssid:
params["ssid"] = ssid
if country:
@@ -603,9 +603,9 @@ def a_only_params(channel="36", ssid=None, country=None):
return params
def ht20_params(channel="1", ssid=None, country=None):
- params = { "ieee80211n" : "1",
- "channel" : channel,
- "hw_mode" : "g" }
+ params = {"ieee80211n": "1",
+ "channel": channel,
+ "hw_mode": "g"}
if int(channel) > 14:
params["hw_mode"] = "a"
if ssid:
diff --git a/tests/hwsim/hwsim.py b/tests/hwsim/hwsim.py
index bc1be85..bc8aabd 100644
--- a/tests/hwsim/hwsim.py
+++ b/tests/hwsim/hwsim.py
@@ -10,13 +10,13 @@
import netlink, os
# constants
-HWSIM_CMD_CREATE_RADIO = 4
-HWSIM_CMD_DESTROY_RADIO = 5
+HWSIM_CMD_CREATE_RADIO = 4
+HWSIM_CMD_DESTROY_RADIO = 5
-HWSIM_ATTR_CHANNELS = 9
-HWSIM_ATTR_RADIO_ID = 10
-HWSIM_ATTR_SUPPORT_P2P_DEVICE = 14
-HWSIM_ATTR_USE_CHANCTX = 15
+HWSIM_ATTR_CHANNELS = 9
+HWSIM_ATTR_RADIO_ID = 10
+HWSIM_ATTR_SUPPORT_P2P_DEVICE = 14
+HWSIM_ATTR_USE_CHANCTX = 15
# the controller class
class HWSimController(object):
@@ -35,17 +35,17 @@ class HWSimController(object):
attrs.append(netlink.FlagAttr(HWSIM_ATTR_SUPPORT_P2P_DEVICE))
msg = netlink.GenlMessage(self._fid, HWSIM_CMD_CREATE_RADIO,
- flags = netlink.NLM_F_REQUEST |
- netlink.NLM_F_ACK,
- attrs = attrs)
+ flags=netlink.NLM_F_REQUEST |
+ netlink.NLM_F_ACK,
+ attrs=attrs)
return msg.send_and_recv(self._conn).ret
def destroy_radio(self, radio_id):
attrs = [netlink.U32Attr(HWSIM_ATTR_RADIO_ID, radio_id)]
msg = netlink.GenlMessage(self._fid, HWSIM_CMD_DESTROY_RADIO,
- flags = netlink.NLM_F_REQUEST |
- netlink.NLM_F_ACK,
- attrs = attrs)
+ flags=netlink.NLM_F_REQUEST |
+ netlink.NLM_F_ACK,
+ attrs=attrs)
msg.send_and_recv(self._conn)
class HWSimRadio(object):
diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py
index cf49b13..dccdefc 100644
--- a/tests/hwsim/hwsim_utils.py
+++ b/tests/hwsim/hwsim_utils.py
@@ -248,8 +248,8 @@ def set_rx_rssi(dev, val):
"""
tx_power = (val + 50) * 100
ifname = dev.get_driver_status_field("ifname")
- (res, data) = dev.cmd_execute([ 'iw', ifname, 'set', 'txpower',
- 'fixed', str(tx_power)] )
+ (res, data) = dev.cmd_execute(['iw', ifname, 'set', 'txpower',
+ 'fixed', str(tx_power)])
if res != 0:
raise Exception("Failed to set RSSI to %d" % val)
diff --git a/tests/hwsim/netlink.py b/tests/hwsim/netlink.py
index eba6102..7e6327a 100644
--- a/tests/hwsim/netlink.py
+++ b/tests/hwsim/netlink.py
@@ -32,7 +32,7 @@ class Attr(object):
def _dump(self):
hdr = struct.pack("HH", len(self._data) + 4, self._type)
length = len(self._data)
- pad = ((length + 4 - 1) & ~3 ) - length
+ pad = ((length + 4 - 1) & ~3) - length
return hdr + self._data + b'\x00' * pad
def __repr__(self):
@@ -87,23 +87,23 @@ class Nested(Attr):
hdr = struct.pack("HH", length+4, self.type)
return hdr + contents
-NETLINK_ROUTE = 0
-NETLINK_UNUSED = 1
-NETLINK_USERSOCK = 2
-NETLINK_FIREWALL = 3
-NETLINK_INET_DIAG = 4
-NETLINK_NFLOG = 5
-NETLINK_XFRM = 6
-NETLINK_SELINUX = 7
-NETLINK_ISCSI = 8
-NETLINK_AUDIT = 9
-NETLINK_FIB_LOOKUP = 10
-NETLINK_CONNECTOR = 11
-NETLINK_NETFILTER = 12
-NETLINK_IP6_FW = 13
-NETLINK_DNRTMSG = 14
-NETLINK_KOBJECT_UEVENT = 15
-NETLINK_GENERIC = 16
+NETLINK_ROUTE = 0
+NETLINK_UNUSED = 1
+NETLINK_USERSOCK = 2
+NETLINK_FIREWALL = 3
+NETLINK_INET_DIAG = 4
+NETLINK_NFLOG = 5
+NETLINK_XFRM = 6
+NETLINK_SELINUX = 7
+NETLINK_ISCSI = 8
+NETLINK_AUDIT = 9
+NETLINK_FIB_LOOKUP = 10
+NETLINK_CONNECTOR = 11
+NETLINK_NETFILTER = 12
+NETLINK_IP6_FW = 13
+NETLINK_DNRTMSG = 14
+NETLINK_KOBJECT_UEVENT = 15
+NETLINK_GENERIC = 16
class Message(object):
def __init__(self, msg_type, flags=0, seq=-1, payload=None):
@@ -184,30 +184,30 @@ def parse_attributes(data):
while len(data):
attr_len, attr_type = struct.unpack("HH", data[:4])
attrs[attr_type] = Attr(attr_type, data[4:attr_len])
- attr_len = ((attr_len + 4 - 1) & ~3 )
+ attr_len = ((attr_len + 4 - 1) & ~3)
data = data[attr_len:]
return attrs
-CTRL_CMD_UNSPEC = 0
-CTRL_CMD_NEWFAMILY = 1
-CTRL_CMD_DELFAMILY = 2
-CTRL_CMD_GETFAMILY = 3
-CTRL_CMD_NEWOPS = 4
-CTRL_CMD_DELOPS = 5
-CTRL_CMD_GETOPS = 6
+CTRL_CMD_UNSPEC = 0
+CTRL_CMD_NEWFAMILY = 1
+CTRL_CMD_DELFAMILY = 2
+CTRL_CMD_GETFAMILY = 3
+CTRL_CMD_NEWOPS = 4
+CTRL_CMD_DELOPS = 5
+CTRL_CMD_GETOPS = 6
-CTRL_ATTR_UNSPEC = 0
-CTRL_ATTR_FAMILY_ID = 1
-CTRL_ATTR_FAMILY_NAME = 2
-CTRL_ATTR_VERSION = 3
-CTRL_ATTR_HDRSIZE = 4
-CTRL_ATTR_MAXATTR = 5
-CTRL_ATTR_OPS = 6
+CTRL_ATTR_UNSPEC = 0
+CTRL_ATTR_FAMILY_ID = 1
+CTRL_ATTR_FAMILY_NAME = 2
+CTRL_ATTR_VERSION = 3
+CTRL_ATTR_HDRSIZE = 4
+CTRL_ATTR_MAXATTR = 5
+CTRL_ATTR_OPS = 6
class GenlHdr(object):
- def __init__(self, cmd, version = 0):
+ def __init__(self, cmd, version=0):
self.cmd = cmd
self.version = version
def _dump(self):
@@ -216,7 +216,7 @@ class GenlHdr(object):
def _genl_hdr_parse(data):
return GenlHdr(*struct.unpack("BBxx", data))
-GENL_ID_CTRL = NLMSG_MIN_TYPE
+GENL_ID_CTRL = NLMSG_MIN_TYPE
class GenlMessage(Message):
def __init__(self, family, cmd, attrs=[], flags=0):
diff --git a/tests/hwsim/nl80211.py b/tests/hwsim/nl80211.py
index 08fae83..55642c0 100644
--- a/tests/hwsim/nl80211.py
+++ b/tests/hwsim/nl80211.py
@@ -338,14 +338,14 @@ def build_nl80211_attr_flag(id):
return build_nl80211_attr(id, b'')
def build_nl80211_attr_mac(id, val):
- addr = struct.unpack('6B', binascii.unhexlify(val.replace(':','')))
+ addr = struct.unpack('6B', binascii.unhexlify(val.replace(':', '')))
aval = struct.pack('<6B', *addr)
return build_nl80211_attr(id, aval)
def parse_nl80211_attrs(msg):
attrs = {}
while len(msg) >= 4:
- alen,attr = struct.unpack("@HH", msg[0:4])
+ alen, attr = struct.unpack("@HH", msg[0:4])
if alen < 4:
raise Exception("Too short nl80211 attribute")
alen -= 4
diff --git a/tests/hwsim/radius_das.py b/tests/hwsim/radius_das.py
index 58dc9d6..4a43da4 100644
--- a/tests/hwsim/radius_das.py
+++ b/tests/hwsim/radius_das.py
@@ -17,7 +17,7 @@ class DisconnectPacket(pyrad.packet.Packet):
def RequestPacket(self):
attr = b''
- for code,datalst in sorted(self.items()):
+ for code, datalst in sorted(self.items()):
for data in datalst:
attr += self._PktEncodeAttribute(code, data)
diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py
index aa83c1d..50f46c3 100644
--- a/tests/hwsim/remotehost.py
+++ b/tests/hwsim/remotehost.py
@@ -80,10 +80,10 @@ class Host():
if self.host is None:
cmd = command
else:
- cmd = ["ssh", self.user + "@" + self.host, ' '.join(command)]
+ cmd = ["ssh", self.user + "@" + self.host, ' '.join(command)]
_cmd = self.name + " execute_run: " + ' '.join(cmd)
logger.debug(_cmd)
- t = threading.Thread(target = execute_thread, args=(cmd, res))
+ t = threading.Thread(target=execute_thread, args=(cmd, res))
t.start()
return t
diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index dbc0292..2627c57 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -117,8 +117,8 @@ def report(conn, prefill, build, commit, run, test, result, duration, logdir,
print("sql: %r" % (params, ))
if result == "FAIL":
- for log in [ "log", "log0", "log1", "log2", "log3", "log5",
- "hostapd", "dmesg", "hwsim0", "hwsim0.pcapng" ]:
+ for log in ["log", "log0", "log1", "log2", "log3", "log5",
+ "hostapd", "dmesg", "hwsim0", "hwsim0.pcapng"]:
add_log_file(conn, test, run, log,
logdir + "/" + test + "." + log)
@@ -194,7 +194,7 @@ def main():
logger.debug("Import test cases from " + t)
mod = __import__(m.group(1))
test_modules.append(mod.__name__.replace('test_', '', 1))
- for key,val in mod.__dict__.items():
+ for key, val in mod.__dict__.items():
if key.startswith("test_"):
tests.append(val)
test_names = list(set([t.__name__.replace('test_', '', 1) for t in tests]))
@@ -343,8 +343,8 @@ def main():
dev0 = WpaSupplicant('wlan0', '/tmp/wpas-wlan0')
dev1 = WpaSupplicant('wlan1', '/tmp/wpas-wlan1')
dev2 = WpaSupplicant('wlan2', '/tmp/wpas-wlan2')
- dev = [ dev0, dev1, dev2 ]
- apdev = [ ]
+ dev = [dev0, dev1, dev2]
+ apdev = []
apdev.append({"ifname": 'wlan3', "bssid": "02:00:00:00:03:00"})
apdev.append({"ifname": 'wlan4', "bssid": "02:00:00:00:04:00"})
@@ -385,7 +385,7 @@ def main():
logger.info("Parallel execution - %d/%d" % (split_server, split_total))
split_server -= 1
tests_to_run.sort(key=lambda t: t.__name__)
- tests_to_run = [x for i,x in enumerate(tests_to_run) if i % split_total == split_server]
+ tests_to_run = [x for i, x in enumerate(tests_to_run) if i % split_total == split_server]
if args.shuffle_tests:
from random import shuffle
diff --git a/tests/hwsim/test_ap_acs.py b/tests/hwsim/test_ap_acs.py
index ec126e6..0046000 100644
--- a/tests/hwsim/test_ap_acs.py
+++ b/tests/hwsim/test_ap_acs.py
@@ -16,15 +16,15 @@ from test_dfs import wait_dfs_event
def force_prev_ap_on_24g(ap):
# For now, make sure the last operating channel was on 2.4 GHz band to get
# sufficient survey data from mac80211_hwsim.
- hostapd.add_ap(ap, { "ssid": "open" })
+ hostapd.add_ap(ap, {"ssid": "open"})
time.sleep(0.1)
hostapd.remove_bss(ap)
def force_prev_ap_on_5g(ap):
# For now, make sure the last operating channel was on 5 GHz band to get
# sufficient survey data from mac80211_hwsim.
- hostapd.add_ap(ap, { "ssid": "open", "hw_mode": "a",
- "channel": "36", "country_code": "US" })
+ hostapd.add_ap(ap, {"ssid": "open", "hw_mode": "a",
+ "channel": "36", "country_code": "US"})
time.sleep(0.1)
hostapd.remove_bss(ap)
@@ -424,7 +424,7 @@ def test_ap_acs_dfs(dev, apdev, params):
raise Exception("Unexpected interface state")
freq = int(hapd.get_status_field("freq"))
- if freq not in [ 5260, 5280, 5300, 5320 ]:
+ if freq not in [5260, 5280, 5300, 5320]:
raise Exception("Unexpected frequency: %d" % freq)
dev[0].connect("test-acs", psk="12345678", scan_freq=str(freq))
@@ -473,7 +473,7 @@ def test_ap_acs_vht160_dfs(dev, apdev, params):
raise Exception("Unexpected interface state")
freq = int(hapd.get_status_field("freq"))
- if freq not in [ 5180, 5500 ]:
+ if freq not in [5180, 5500]:
raise Exception("Unexpected frequency: %d" % freq)
dev[0].connect("test-acs", psk="12345678", scan_freq=str(freq))
diff --git a/tests/hwsim/test_ap_ciphers.py b/tests/hwsim/test_ap_ciphers.py
index 8e5b2d6..59fb651 100644
--- a/tests/hwsim/test_ap_ciphers.py
+++ b/tests/hwsim/test_ap_ciphers.py
@@ -22,11 +22,11 @@ def check_cipher(dev, ap, cipher, group_cipher=None):
raise HwsimSkip("Cipher %s not supported" % cipher)
if group_cipher and group_cipher not in dev.get_capability("group"):
raise HwsimSkip("Cipher %s not supported" % group_cipher)
- params = { "ssid": "test-wpa2-psk",
- "wpa_passphrase": "12345678",
- "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK",
- "rsn_pairwise": cipher }
+ params = {"ssid": "test-wpa2-psk",
+ "wpa_passphrase": "12345678",
+ "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK",
+ "rsn_pairwise": cipher}
if group_cipher:
params["group_cipher"] = group_cipher
else:
@@ -39,13 +39,13 @@ def check_cipher(dev, ap, cipher, group_cipher=None):
def check_group_mgmt_cipher(dev, ap, cipher, sta_req_cipher=None):
if cipher not in dev.get_capability("group_mgmt"):
raise HwsimSkip("Cipher %s not supported" % cipher)
- params = { "ssid": "test-wpa2-psk-pmf",
- "wpa_passphrase": "12345678",
- "wpa": "2",
- "ieee80211w": "2",
- "wpa_key_mgmt": "WPA-PSK-SHA256",
- "rsn_pairwise": "CCMP",
- "group_mgmt_cipher": cipher }
+ params = {"ssid": "test-wpa2-psk-pmf",
+ "wpa_passphrase": "12345678",
+ "wpa": "2",
+ "ieee80211w": "2",
+ "wpa_key_mgmt": "WPA-PSK-SHA256",
+ "rsn_pairwise": "CCMP",
+ "group_mgmt_cipher": cipher}
hapd = hostapd.add_ap(ap, params)
Wlantest.setup(hapd)
@@ -68,7 +68,7 @@ def check_group_mgmt_cipher(dev, ap, cipher, sta_req_cipher=None):
group_mgmt = "BIP"
else:
group_mgmt = cipher
- res = wt.info_bss('group_mgmt', ap['bssid']).strip()
+ res = wt.info_bss('group_mgmt', ap['bssid']).strip()
if res != group_mgmt:
raise Exception("Unexpected group mgmt cipher: " + res)
@@ -83,27 +83,27 @@ def test_ap_cipher_tkip_countermeasures_ap(dev, apdev):
"""WPA-PSK/TKIP countermeasures (detected by AP)"""
skip_with_fips(dev[0])
testfile = "/sys/kernel/debug/ieee80211/%s/netdev:%s/tkip_mic_test" % (dev[0].get_driver_status_field("phyname"), dev[0].ifname)
- if dev[0].cmd_execute([ "ls", testfile ])[0] != 0:
+ if dev[0].cmd_execute(["ls", testfile])[0] != 0:
raise HwsimSkip("tkip_mic_test not supported in mac80211")
- params = { "ssid": "tkip-countermeasures",
- "wpa_passphrase": "12345678",
- "wpa": "1",
- "wpa_key_mgmt": "WPA-PSK",
- "wpa_pairwise": "TKIP" }
+ params = {"ssid": "tkip-countermeasures",
+ "wpa_passphrase": "12345678",
+ "wpa": "1",
+ "wpa_key_mgmt": "WPA-PSK",
+ "wpa_pairwise": "TKIP"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("tkip-countermeasures", psk="12345678",
pairwise="TKIP", group="TKIP", scan_freq="2412")
dev[0].dump_monitor()
- dev[0].cmd_execute([ "echo", "-n", apdev[0]['bssid'], ">", testfile ],
+ dev[0].cmd_execute(["echo", "-n", apdev[0]['bssid'], ">", testfile],
shell=True)
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1)
if ev is not None:
raise Exception("Unexpected disconnection on first Michael MIC failure")
- dev[0].cmd_execute([ "echo", "-n", "ff:ff:ff:ff:ff:ff", ">", testfile ],
+ dev[0].cmd_execute(["echo", "-n", "ff:ff:ff:ff:ff:ff", ">", testfile],
shell=True)
ev = dev[0].wait_disconnected(timeout=10,
error="No disconnection after two Michael MIC failures")
@@ -117,15 +117,15 @@ def test_ap_cipher_tkip_countermeasures_ap_mixed_mode(dev, apdev):
"""WPA+WPA2-PSK/TKIP countermeasures (detected by mixed mode AP)"""
skip_with_fips(dev[0])
testfile = "/sys/kernel/debug/ieee80211/%s/netdev:%s/tkip_mic_test" % (dev[0].get_driver_status_field("phyname"), dev[0].ifname)
- if dev[0].cmd_execute([ "ls", testfile ])[0] != 0:
+ if dev[0].cmd_execute(["ls", testfile])[0] != 0:
raise HwsimSkip("tkip_mic_test not supported in mac80211")
- params = { "ssid": "tkip-countermeasures",
- "wpa_passphrase": "12345678",
- "wpa": "3",
- "wpa_key_mgmt": "WPA-PSK",
- "wpa_pairwise": "TKIP",
- "rsn_pairwise": "CCMP" }
+ params = {"ssid": "tkip-countermeasures",
+ "wpa_passphrase": "12345678",
+ "wpa": "3",
+ "wpa_key_mgmt": "WPA-PSK",
+ "wpa_pairwise": "TKIP",
+ "rsn_pairwise": "CCMP"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("tkip-countermeasures", psk="12345678",
@@ -134,13 +134,13 @@ def test_ap_cipher_tkip_countermeasures_ap_mixed_mode(dev, apdev):
pairwise="CCMP", scan_freq="2412")
dev[0].dump_monitor()
- dev[0].cmd_execute([ "echo", "-n", apdev[0]['bssid'], ">", testfile ],
+ dev[0].cmd_execute(["echo", "-n", apdev[0]['bssid'], ">", testfile],
shell=True)
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1)
if ev is not None:
raise Exception("Unexpected disconnection on first Michael MIC failure")
- dev[0].cmd_execute([ "echo", "-n", "ff:ff:ff:ff:ff:ff", ">", testfile ],
+ dev[0].cmd_execute(["echo", "-n", "ff:ff:ff:ff:ff:ff", ">", testfile],
shell=True)
ev = dev[0].wait_disconnected(timeout=10,
@@ -164,28 +164,28 @@ def test_ap_cipher_tkip_countermeasures_ap_mixed_mode(dev, apdev):
def test_ap_cipher_tkip_countermeasures_sta(dev, apdev):
"""WPA-PSK/TKIP countermeasures (detected by STA)"""
skip_with_fips(dev[0])
- params = { "ssid": "tkip-countermeasures",
- "wpa_passphrase": "12345678",
- "wpa": "1",
- "wpa_key_mgmt": "WPA-PSK",
- "wpa_pairwise": "TKIP" }
+ params = {"ssid": "tkip-countermeasures",
+ "wpa_passphrase": "12345678",
+ "wpa": "1",
+ "wpa_key_mgmt": "WPA-PSK",
+ "wpa_pairwise": "TKIP"}
hapd = hostapd.add_ap(apdev[0], params)
testfile = "/sys/kernel/debug/ieee80211/%s/netdev:%s/tkip_mic_test" % (hapd.get_driver_status_field("phyname"), apdev[0]['ifname'])
- if hapd.cmd_execute([ "ls", testfile ])[0] != 0:
+ if hapd.cmd_execute(["ls", testfile])[0] != 0:
raise HwsimSkip("tkip_mic_test not supported in mac80211")
dev[0].connect("tkip-countermeasures", psk="12345678",
pairwise="TKIP", group="TKIP", scan_freq="2412")
dev[0].dump_monitor()
- hapd.cmd_execute([ "echo", "-n", dev[0].own_addr(), ">", testfile ],
+ hapd.cmd_execute(["echo", "-n", dev[0].own_addr(), ">", testfile],
shell=True)
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1)
if ev is not None:
raise Exception("Unexpected disconnection on first Michael MIC failure")
- hapd.cmd_execute([ "echo", "-n", "ff:ff:ff:ff:ff:ff", ">", testfile ],
+ hapd.cmd_execute(["echo", "-n", "ff:ff:ff:ff:ff:ff", ">", testfile],
shell=True)
ev = dev[0].wait_disconnected(timeout=10,
error="No disconnection after two Michael MIC failures")
@@ -200,15 +200,15 @@ def test_ap_cipher_tkip_countermeasures_sta2(dev, apdev, params):
if not params['long']:
raise HwsimSkip("Skip test case with long duration due to --long not specified")
skip_with_fips(dev[0])
- params = { "ssid": "tkip-countermeasures",
- "wpa_passphrase": "12345678",
- "wpa": "1",
- "wpa_key_mgmt": "WPA-PSK",
- "wpa_pairwise": "TKIP" }
+ params = {"ssid": "tkip-countermeasures",
+ "wpa_passphrase": "12345678",
+ "wpa": "1",
+ "wpa_key_mgmt": "WPA-PSK",
+ "wpa_pairwise": "TKIP"}
hapd = hostapd.add_ap(apdev[0], params)
testfile = "/sys/kernel/debug/ieee80211/%s/netdev:%s/tkip_mic_test" % (hapd.get_driver_status_field("phyname"), apdev[0]['ifname'])
- if hapd.cmd_execute([ "ls", testfile ])[0] != 0:
+ if hapd.cmd_execute(["ls", testfile])[0] != 0:
raise HwsimSkip("tkip_mic_test not supported in mac80211")
dev[0].connect("tkip-countermeasures", psk="12345678",
@@ -218,7 +218,7 @@ def test_ap_cipher_tkip_countermeasures_sta2(dev, apdev, params):
pairwise="TKIP", group="TKIP", scan_freq="2412")
dev[1].dump_monitor()
- hapd.cmd_execute([ "echo", "-n", "ff:ff:ff:ff:ff:ff", ">", testfile ],
+ hapd.cmd_execute(["echo", "-n", "ff:ff:ff:ff:ff:ff", ">", testfile],
shell=True)
ev = dev[0].wait_disconnected(timeout=10,
error="No disconnection after two Michael MIC failure")
@@ -305,21 +305,21 @@ def test_ap_cipher_gcmp_ccmp(dev, apdev, params):
"""WPA2-PSK/GCMP/CCMP ciphers"""
config = os.path.join(params['logdir'], 'ap_cipher_gcmp_ccmp.conf')
- for cipher in [ "CCMP", "GCMP", "CCMP-256", "GCMP-256" ]:
+ for cipher in ["CCMP", "GCMP", "CCMP-256", "GCMP-256"]:
if cipher not in dev[0].get_capability("pairwise"):
raise HwsimSkip("Cipher %s not supported" % cipher)
if cipher not in dev[0].get_capability("group"):
raise HwsimSkip("Group cipher %s not supported" % cipher)
- params = { "ssid": "test-wpa2-psk",
- "wpa_passphrase": "12345678",
- "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK",
- "rsn_pairwise": "CCMP GCMP CCMP-256 GCMP-256" }
+ params = {"ssid": "test-wpa2-psk",
+ "wpa_passphrase": "12345678",
+ "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK",
+ "rsn_pairwise": "CCMP GCMP CCMP-256 GCMP-256"}
hapd = hostapd.add_ap(apdev[0], params)
- for cipher in [ "CCMP", "GCMP", "CCMP-256", "GCMP-256" ]:
+ for cipher in ["CCMP", "GCMP", "CCMP-256", "GCMP-256"]:
dev[0].connect("test-wpa2-psk", psk="12345678",
pairwise=cipher, group="CCMP", scan_freq="2412")
if dev[0].get_status_field("group_cipher") != "CCMP":
@@ -365,12 +365,12 @@ def test_ap_cipher_mixed_wpa_wpa2(dev, apdev):
skip_with_fips(dev[0])
ssid = "test-wpa-wpa2-psk"
passphrase = "12345678"
- params = { "ssid": ssid,
- "wpa_passphrase": passphrase,
- "wpa": "3",
- "wpa_key_mgmt": "WPA-PSK",
- "rsn_pairwise": "CCMP",
- "wpa_pairwise": "TKIP" }
+ params = {"ssid": ssid,
+ "wpa_passphrase": passphrase,
+ "wpa": "3",
+ "wpa_key_mgmt": "WPA-PSK",
+ "rsn_pairwise": "CCMP",
+ "wpa_pairwise": "TKIP"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, psk=passphrase, proto="WPA2",
pairwise="CCMP", group="TKIP", scan_freq="2412")
@@ -443,17 +443,17 @@ def test_ap_cipher_bip_cmac_256_req(dev, apdev):
def test_ap_cipher_bip_req_mismatch(dev, apdev):
"""WPA2-PSK with BIP cipher mismatch"""
group_mgmt = dev[0].get_capability("group_mgmt")
- for cipher in [ "AES-128-CMAC", "BIP-GMAC-256" ]:
+ for cipher in ["AES-128-CMAC", "BIP-GMAC-256"]:
if cipher not in group_mgmt:
raise HwsimSkip("Cipher %s not supported" % cipher)
- params = { "ssid": "test-wpa2-psk-pmf",
- "wpa_passphrase": "12345678",
- "wpa": "2",
- "ieee80211w": "2",
- "wpa_key_mgmt": "WPA-PSK-SHA256",
- "rsn_pairwise": "CCMP",
- "group_mgmt_cipher": "AES-128-CMAC" }
+ params = {"ssid": "test-wpa2-psk-pmf",
+ "wpa_passphrase": "12345678",
+ "wpa": "2",
+ "ieee80211w": "2",
+ "wpa_key_mgmt": "WPA-PSK-SHA256",
+ "rsn_pairwise": "CCMP",
+ "group_mgmt_cipher": "AES-128-CMAC"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(hapd.own_addr(), 2412)
@@ -520,11 +520,11 @@ def test_ap_cipher_replay_protection_ap_gcmp(dev, apdev):
run_ap_cipher_replay_protection_ap(dev, apdev, "GCMP")
def run_ap_cipher_replay_protection_ap(dev, apdev, cipher):
- params = { "ssid": "test-wpa2-psk",
- "wpa_passphrase": "12345678",
- "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK",
- "rsn_pairwise": cipher }
+ params = {"ssid": "test-wpa2-psk",
+ "wpa_passphrase": "12345678",
+ "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK",
+ "rsn_pairwise": cipher}
hapd = hostapd.add_ap(apdev[0], params)
phy = hapd.get_driver_status_field("phyname")
@@ -589,11 +589,11 @@ def test_ap_cipher_replay_protection_sta_gtk_gcmp(dev, apdev):
run_ap_cipher_replay_protection_sta(dev, apdev, "GCMP", gtk=True)
def run_ap_cipher_replay_protection_sta(dev, apdev, cipher, gtk=False):
- params = { "ssid": "test-wpa2-psk",
- "wpa_passphrase": "12345678",
- "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK",
- "rsn_pairwise": cipher }
+ params = {"ssid": "test-wpa2-psk",
+ "wpa_passphrase": "12345678",
+ "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK",
+ "rsn_pairwise": cipher}
hapd = hostapd.add_ap(apdev[0], params)
Wlantest.setup(hapd)
diff --git a/tests/hwsim/test_ap_config.py b/tests/hwsim/test_ap_config.py
index cede63c..412a821 100644
--- a/tests/hwsim/test_ap_config.py
+++ b/tests/hwsim/test_ap_config.py
@@ -20,35 +20,35 @@ def test_ap_config_errors(dev, apdev):
"""Various hostapd configuration errors"""
# IEEE 802.11d without country code
- params = { "ssid": "foo", "ieee80211d": "1" }
+ params = {"ssid": "foo", "ieee80211d": "1"}
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
if "FAIL" not in hapd.request("ENABLE"):
raise Exception("Unexpected ENABLE success (ieee80211d without country_code)")
hostapd.remove_bss(apdev[0])
# IEEE 802.11h without IEEE 802.11d
- params = { "ssid": "foo", "ieee80211h": "1" }
+ params = {"ssid": "foo", "ieee80211h": "1"}
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
if "FAIL" not in hapd.request("ENABLE"):
raise Exception("Unexpected ENABLE success (ieee80211h without ieee80211d")
hostapd.remove_bss(apdev[0])
# Power Constraint without IEEE 802.11d
- params = { "ssid": "foo", "local_pwr_constraint": "1" }
+ params = {"ssid": "foo", "local_pwr_constraint": "1"}
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
if "FAIL" not in hapd.request("ENABLE"):
raise Exception("Unexpected ENABLE success (local_pwr_constraint without ieee80211d)")
hostapd.remove_bss(apdev[0])
# Spectrum management without Power Constraint
- params = { "ssid": "foo", "spectrum_mgmt_required": "1" }
+ params = {"ssid": "foo", "spectrum_mgmt_required": "1"}
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
if "FAIL" not in hapd.request("ENABLE"):
raise Exception("Unexpected ENABLE success (spectrum_mgmt_required without local_pwr_constraint)")
hostapd.remove_bss(apdev[0])
# IEEE 802.1X without authentication server
- params = { "ssid": "foo", "ieee8021x": "1" }
+ params = {"ssid": "foo", "ieee8021x": "1"}
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
if "FAIL" not in hapd.request("ENABLE"):
raise Exception("Unexpected ENABLE success (ieee8021x)")
@@ -63,10 +63,10 @@ def test_ap_config_errors(dev, apdev):
hostapd.remove_bss(apdev[0])
# FT without NAS-Identifier
- params = { "wpa": "2",
- "wpa_key_mgmt": "FT-PSK",
- "rsn_pairwise": "CCMP",
- "wpa_passphrase": "12345678" }
+ params = {"wpa": "2",
+ "wpa_key_mgmt": "FT-PSK",
+ "rsn_pairwise": "CCMP",
+ "wpa_passphrase": "12345678"}
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
if "FAIL" not in hapd.request("ENABLE"):
raise Exception("Unexpected ENABLE success (FT without nas_identifier)")
@@ -89,7 +89,7 @@ def test_ap_config_errors(dev, apdev):
def test_ap_config_reload(dev, apdev, params):
"""hostapd configuration reload"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "foo" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "foo"})
hapd.set("ssid", "foobar")
with open(os.path.join(params['logdir'], 'hostapd-test.pid'), "r") as f:
pid = int(f.read())
@@ -169,7 +169,7 @@ def run_ap_config_reload_on_sighup(dev, apdev, params, ht=True):
if not os.path.exists(prg):
prg = '../../hostapd/hostapd'
write_hostapd_config(conffile, apdev[0]['ifname'], "test-1", ht=ht)
- cmd = [ prg, '-B', '-dddt', '-P', pidfile, '-f', logfile, conffile ]
+ cmd = [prg, '-B', '-dddt', '-P', pidfile, '-f', logfile, conffile]
res = subprocess.check_call(cmd)
if res != 0:
raise Exception("Could not start hostapd: %s" % str(res))
@@ -217,7 +217,7 @@ def test_ap_config_reload_on_sighup_bss_changes(dev, apdev, params):
if not os.path.exists(prg):
prg = '../../hostapd/hostapd'
write_hostapd_config(conffile, apdev[0]['ifname'], "test", bss2=True)
- cmd = [ prg, '-B', '-dddt', '-P', pidfile, '-f', logfile, conffile ]
+ cmd = [prg, '-B', '-dddt', '-P', pidfile, '-f', logfile, conffile]
res = subprocess.check_call(cmd)
if res != 0:
raise Exception("Could not start hostapd: %s" % str(res))
@@ -276,7 +276,7 @@ def test_ap_config_reload_before_enable(dev, apdev, params):
def test_ap_config_sigusr1(dev, apdev, params):
"""hostapd SIGUSR1"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "foobar" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "foobar"})
with open(os.path.join(params['logdir'], 'hostapd-test.pid'), "r") as f:
pid = int(f.read())
os.kill(pid, signal.SIGUSR1)
@@ -285,45 +285,45 @@ def test_ap_config_sigusr1(dev, apdev, params):
def test_ap_config_invalid_value(dev, apdev, params):
"""Ignoring invalid hostapd configuration parameter updates"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "test" }, no_enable=True)
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "test"}, no_enable=True)
not_exist = "/tmp/hostapd-test/does-not-exist"
- tests = [ ("driver", "foobar"),
- ("ssid2", "Q"),
- ("macaddr_acl", "255"),
- ("accept_mac_file", not_exist),
- ("deny_mac_file", not_exist),
- ("eapol_version", "255"),
- ("eap_user_file", not_exist),
- ("wep_key_len_broadcast", "-1"),
- ("wep_key_len_unicast", "-1"),
- ("wep_rekey_period", "-1"),
- ("eap_rekey_period", "-1"),
- ("radius_client_addr", "foo"),
- ("acs_chan_bias", "-1:0.8"),
- ("acs_chan_bias", "1"),
- ("acs_chan_bias", "1:p"),
- ("acs_chan_bias", "1:-0.8"),
- ("acs_chan_bias", "1:0.8p"),
- ("dtim_period", "0"),
- ("bss_load_update_period", "-1"),
- ("send_probe_response", "255"),
- ("beacon_rate", "ht:-1"),
- ("beacon_rate", "ht:32"),
- ("beacon_rate", "vht:-1"),
- ("beacon_rate", "vht:10"),
- ("beacon_rate", "9"),
- ("beacon_rate", "10001"),
- ("vlan_file", not_exist),
- ("bss", ""),
- ("bssid", "foo"),
- ("extra_cred", not_exist),
- ("anqp_elem", "265"),
- ("anqp_elem", "265"),
- ("anqp_elem", "265:1"),
- ("anqp_elem", "265:1q"),
- ("fst_priority", ""),
- ("fils_cache_id", "q"),
- ("unknown-item", "foo") ]
+ tests = [("driver", "foobar"),
+ ("ssid2", "Q"),
+ ("macaddr_acl", "255"),
+ ("accept_mac_file", not_exist),
+ ("deny_mac_file", not_exist),
+ ("eapol_version", "255"),
+ ("eap_user_file", not_exist),
+ ("wep_key_len_broadcast", "-1"),
+ ("wep_key_len_unicast", "-1"),
+ ("wep_rekey_period", "-1"),
+ ("eap_rekey_period", "-1"),
+ ("radius_client_addr", "foo"),
+ ("acs_chan_bias", "-1:0.8"),
+ ("acs_chan_bias", "1"),
+ ("acs_chan_bias", "1:p"),
+ ("acs_chan_bias", "1:-0.8"),
+ ("acs_chan_bias", "1:0.8p"),
+ ("dtim_period", "0"),
+ ("bss_load_update_period", "-1"),
+ ("send_probe_response", "255"),
+ ("beacon_rate", "ht:-1"),
+ ("beacon_rate", "ht:32"),
+ ("beacon_rate", "vht:-1"),
+ ("beacon_rate", "vht:10"),
+ ("beacon_rate", "9"),
+ ("beacon_rate", "10001"),
+ ("vlan_file", not_exist),
+ ("bss", ""),
+ ("bssid", "foo"),
+ ("extra_cred", not_exist),
+ ("anqp_elem", "265"),
+ ("anqp_elem", "265"),
+ ("anqp_elem", "265:1"),
+ ("anqp_elem", "265:1q"),
+ ("fst_priority", ""),
+ ("fils_cache_id", "q"),
+ ("unknown-item", "foo")]
for field, val in tests:
if "FAIL" not in hapd.request("SET %s %s" % (field, val)):
raise Exception("Invalid %s accepted" % field)
@@ -333,49 +333,49 @@ def test_ap_config_invalid_value(dev, apdev, params):
def test_ap_config_eap_user_file_parsing(dev, apdev, params):
"""hostapd eap_user_file parsing"""
tmp = os.path.join(params['logdir'], 'ap_vlan_file_parsing.tmp')
- hapd = hostapd.add_ap(apdev[0], { "ssid": "foobar" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "foobar"})
for i in range(2):
if "OK" not in hapd.request("SET eap_user_file auth_serv/eap_user.conf"):
raise Exception("eap_user_file rejected")
- tests = [ "#\n\n*\tTLS\nradius_accept_attr=:",
- "foo\n",
- "\"foo\n",
- "\"foo\"\n",
- "\"foo\" FOOBAR\n",
- "\"foo\" " + 10*"TLS," + "TLS \"\n",
- "\"foo\" TLS \nfoo\n",
- "\"foo\" PEAP hash:foo\n",
- "\"foo\" PEAP hash:8846f7eaee8fb117ad06bdd830b7586q\n",
- "\"foo\" PEAP 01020\n",
- "\"foo\" PEAP 010q\n",
- "\"foo\" TLS\nradius_accept_attr=123:x:012\n",
- "\"foo\" TLS\nradius_accept_attr=123:x:012q\n",
- "\"foo\" TLS\nradius_accept_attr=123:Q:01\n",
- "\"foo\" TLS\nradius_accept_attr=123\nfoo\n" ]
+ tests = ["#\n\n*\tTLS\nradius_accept_attr=:",
+ "foo\n",
+ "\"foo\n",
+ "\"foo\"\n",
+ "\"foo\" FOOBAR\n",
+ "\"foo\" " + 10*"TLS," + "TLS \"\n",
+ "\"foo\" TLS \nfoo\n",
+ "\"foo\" PEAP hash:foo\n",
+ "\"foo\" PEAP hash:8846f7eaee8fb117ad06bdd830b7586q\n",
+ "\"foo\" PEAP 01020\n",
+ "\"foo\" PEAP 010q\n",
+ "\"foo\" TLS\nradius_accept_attr=123:x:012\n",
+ "\"foo\" TLS\nradius_accept_attr=123:x:012q\n",
+ "\"foo\" TLS\nradius_accept_attr=123:Q:01\n",
+ "\"foo\" TLS\nradius_accept_attr=123\nfoo\n"]
for t in tests:
with open(tmp, "w") as f:
f.write(t)
if "FAIL" not in hapd.request("SET eap_user_file " + tmp):
raise Exception("Invalid eap_user_file accepted")
- tests = [ ("\"foo\" TLS\n", 2, "hostapd_config_read_eap_user"),
- ("\"foo\" PEAP \"foo\"\n", 3, "hostapd_config_read_eap_user"),
- ("\"foo\" PEAP hash:8846f7eaee8fb117ad06bdd830b75861\n", 3,
- "hostapd_config_read_eap_user"),
- ("\"foo\" PEAP 0102\n", 3, "hostapd_config_read_eap_user"),
- ("\"foo\" TLS\nradius_accept_attr=123\n", 1,
- "=hostapd_parse_radius_attr"),
- ("\"foo\" TLS\nradius_accept_attr=123\n", 1,
- "wpabuf_alloc;hostapd_parse_radius_attr"),
- ("\"foo\" TLS\nradius_accept_attr=123:s:foo\n", 2,
- "hostapd_parse_radius_attr"),
- ("\"foo\" TLS\nradius_accept_attr=123:x:0102\n", 2,
- "hostapd_parse_radius_attr"),
- ("\"foo\" TLS\nradius_accept_attr=123:d:1\n", 2,
- "hostapd_parse_radius_attr"),
- ("* TLS\n", 1, "hostapd_config_read_eap_user") ]
+ tests = [("\"foo\" TLS\n", 2, "hostapd_config_read_eap_user"),
+ ("\"foo\" PEAP \"foo\"\n", 3, "hostapd_config_read_eap_user"),
+ ("\"foo\" PEAP hash:8846f7eaee8fb117ad06bdd830b75861\n", 3,
+ "hostapd_config_read_eap_user"),
+ ("\"foo\" PEAP 0102\n", 3, "hostapd_config_read_eap_user"),
+ ("\"foo\" TLS\nradius_accept_attr=123\n", 1,
+ "=hostapd_parse_radius_attr"),
+ ("\"foo\" TLS\nradius_accept_attr=123\n", 1,
+ "wpabuf_alloc;hostapd_parse_radius_attr"),
+ ("\"foo\" TLS\nradius_accept_attr=123:s:foo\n", 2,
+ "hostapd_parse_radius_attr"),
+ ("\"foo\" TLS\nradius_accept_attr=123:x:0102\n", 2,
+ "hostapd_parse_radius_attr"),
+ ("\"foo\" TLS\nradius_accept_attr=123:d:1\n", 2,
+ "hostapd_parse_radius_attr"),
+ ("* TLS\n", 1, "hostapd_config_read_eap_user")]
for t, count, func in tests:
with alloc_fail(hapd, count, func):
with open(tmp, "w") as f:
@@ -385,55 +385,55 @@ def test_ap_config_eap_user_file_parsing(dev, apdev, params):
def test_ap_config_set_oom(dev, apdev):
"""hostapd configuration parsing OOM"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "foobar" })
-
- tests = [ (1, "hostapd_parse_das_client",
- "SET radius_das_client 192.168.1.123 pw"),
- (1, "hostapd_config_read_wep", "SET wep_key0 \"hello\""),
- (1, "hostapd_config_read_wep", "SET wep_key0 0102030405"),
- (1, "hostapd_parse_chanlist", "SET chanlist 1 6 11-13"),
- (1, "hostapd_config_bss", "SET bss foo"),
- (2, "hostapd_config_bss", "SET bss foo"),
- (3, "hostapd_config_bss", "SET bss foo"),
- (1, "add_r0kh",
- "SET r0kh 02:01:02:03:04:05 r0kh-1.example.com 000102030405060708090a0b0c0d0e0f"),
- (1, "add_r1kh",
- "SET r1kh 02:01:02:03:04:05 02:11:22:33:44:55 000102030405060708090a0b0c0d0e0f"),
- (1, "parse_roaming_consortium", "SET roaming_consortium 021122"),
- (1, "parse_lang_string", "SET venue_name eng:Example venue"),
- (1, "parse_3gpp_cell_net",
- "SET anqp_3gpp_cell_net 244,91;310,026;234,56"),
- (1, "parse_nai_realm", "SET nai_realm 0,example.com;example.net"),
- (2, "parse_nai_realm", "SET nai_realm 0,example.com;example.net"),
- (1, "parse_anqp_elem", "SET anqp_elem 265:0000"),
- (2, "parse_anqp_elem", "SET anqp_elem 266:000000"),
- (1, "hs20_parse_conn_capab", "SET hs20_conn_capab 1:0:2"),
- (1, "hs20_parse_wan_metrics",
- "SET hs20_wan_metrics 01:8000:1000:80:240:3000"),
- (1, "hs20_parse_icon",
- "SET hs20_icon 32:32:eng:image/png:icon32:/tmp/icon32.png"),
- (1, "hs20_parse_osu_server_uri",
- "SET osu_server_uri https://example.com/osu/"),
- (1, "hostapd_config_parse_acs_chan_bias",
- "SET acs_chan_bias 1:0.8 6:0.8 11:0.8"),
- (2, "hostapd_config_parse_acs_chan_bias",
- "SET acs_chan_bias 1:0.8 6:0.8 11:0.8"),
- (1, "parse_wpabuf_hex", "SET vendor_elements 01020304"),
- (1, "parse_fils_realm", "SET fils_realm example.com"),
- (1, "hostapd_config_fill",
- "SET pac_opaque_encr_key 000102030405060708090a0b0c0d0e0f"),
- (1, "hostapd_config_fill", "SET eap_message hello"),
- (1, "hostapd_config_fill",
- "SET wpa_psk 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"),
- (1, "hostapd_config_fill", "SET time_zone EST5"),
- (1, "hostapd_config_fill",
- "SET network_auth_type 02http://www.example.com/redirect/"),
- (1, "hostapd_config_fill", "SET domain_name example.com"),
- (1, "hostapd_config_fill", "SET hs20_operating_class 5173"),
- (1, "hostapd_config_fill", "SET own_ie_override 11223344"),
- (1, "hostapd_parse_intlist", "SET sae_groups 19 25"),
- (1, "hostapd_parse_intlist", "SET basic_rates 10 20 55 110"),
- (1, "hostapd_parse_intlist", "SET supported_rates 10 20 55 110") ]
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "foobar"})
+
+ tests = [(1, "hostapd_parse_das_client",
+ "SET radius_das_client 192.168.1.123 pw"),
+ (1, "hostapd_config_read_wep", "SET wep_key0 \"hello\""),
+ (1, "hostapd_config_read_wep", "SET wep_key0 0102030405"),
+ (1, "hostapd_parse_chanlist", "SET chanlist 1 6 11-13"),
+ (1, "hostapd_config_bss", "SET bss foo"),
+ (2, "hostapd_config_bss", "SET bss foo"),
+ (3, "hostapd_config_bss", "SET bss foo"),
+ (1, "add_r0kh",
+ "SET r0kh 02:01:02:03:04:05 r0kh-1.example.com 000102030405060708090a0b0c0d0e0f"),
+ (1, "add_r1kh",
+ "SET r1kh 02:01:02:03:04:05 02:11:22:33:44:55 000102030405060708090a0b0c0d0e0f"),
+ (1, "parse_roaming_consortium", "SET roaming_consortium 021122"),
+ (1, "parse_lang_string", "SET venue_name eng:Example venue"),
+ (1, "parse_3gpp_cell_net",
+ "SET anqp_3gpp_cell_net 244,91;310,026;234,56"),
+ (1, "parse_nai_realm", "SET nai_realm 0,example.com;example.net"),
+ (2, "parse_nai_realm", "SET nai_realm 0,example.com;example.net"),
+ (1, "parse_anqp_elem", "SET anqp_elem 265:0000"),
+ (2, "parse_anqp_elem", "SET anqp_elem 266:000000"),
+ (1, "hs20_parse_conn_capab", "SET hs20_conn_capab 1:0:2"),
+ (1, "hs20_parse_wan_metrics",
+ "SET hs20_wan_metrics 01:8000:1000:80:240:3000"),
+ (1, "hs20_parse_icon",
+ "SET hs20_icon 32:32:eng:image/png:icon32:/tmp/icon32.png"),
+ (1, "hs20_parse_osu_server_uri",
+ "SET osu_server_uri https://example.com/osu/"),
+ (1, "hostapd_config_parse_acs_chan_bias",
+ "SET acs_chan_bias 1:0.8 6:0.8 11:0.8"),
+ (2, "hostapd_config_parse_acs_chan_bias",
+ "SET acs_chan_bias 1:0.8 6:0.8 11:0.8"),
+ (1, "parse_wpabuf_hex", "SET vendor_elements 01020304"),
+ (1, "parse_fils_realm", "SET fils_realm example.com"),
+ (1, "hostapd_config_fill",
+ "SET pac_opaque_encr_key 000102030405060708090a0b0c0d0e0f"),
+ (1, "hostapd_config_fill", "SET eap_message hello"),
+ (1, "hostapd_config_fill",
+ "SET wpa_psk 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"),
+ (1, "hostapd_config_fill", "SET time_zone EST5"),
+ (1, "hostapd_config_fill",
+ "SET network_auth_type 02http://www.example.com/redirect/"),
+ (1, "hostapd_config_fill", "SET domain_name example.com"),
+ (1, "hostapd_config_fill", "SET hs20_operating_class 5173"),
+ (1, "hostapd_config_fill", "SET own_ie_override 11223344"),
+ (1, "hostapd_parse_intlist", "SET sae_groups 19 25"),
+ (1, "hostapd_parse_intlist", "SET basic_rates 10 20 55 110"),
+ (1, "hostapd_parse_intlist", "SET supported_rates 10 20 55 110")]
for count, func, cmd in tests:
with alloc_fail(hapd, count, func):
if "FAIL" not in hapd.request(cmd):
@@ -453,25 +453,25 @@ def test_ap_config_set_oom(dev, apdev):
hapd.set("lci", "")
hapd.set("civic", "")
- tests = [ (1, "hs20_parse_icon",
- "SET hs20_icon 32:32:eng:image/png:icon32:/tmp/icon32.png"),
- (1, "parse_roaming_consortium", "SET roaming_consortium 021122"),
- (2, "parse_nai_realm", "SET nai_realm 0,example.com;example.net"),
- (1, "parse_lang_string", "SET venue_name eng:Example venue"),
- (1, "hs20_parse_osu_server_uri",
- "SET osu_server_uri https://example.com/osu/"),
- (1, "hs20_parse_osu_nai", "SET osu_nai anonymous@example.com"),
- (1, "hostapd_parse_intlist", "SET osu_method_list 1 0"),
- (1, "hs20_parse_osu_icon", "SET osu_icon icon32"),
- (2, "hs20_parse_osu_icon", "SET osu_icon icon32"),
- (2, "hs20_parse_osu_icon", "SET osu_icon icon32"),
- (1, "hs20_parse_conn_capab", "SET hs20_conn_capab 1:0:2") ]
+ tests = [(1, "hs20_parse_icon",
+ "SET hs20_icon 32:32:eng:image/png:icon32:/tmp/icon32.png"),
+ (1, "parse_roaming_consortium", "SET roaming_consortium 021122"),
+ (2, "parse_nai_realm", "SET nai_realm 0,example.com;example.net"),
+ (1, "parse_lang_string", "SET venue_name eng:Example venue"),
+ (1, "hs20_parse_osu_server_uri",
+ "SET osu_server_uri https://example.com/osu/"),
+ (1, "hs20_parse_osu_nai", "SET osu_nai anonymous@example.com"),
+ (1, "hostapd_parse_intlist", "SET osu_method_list 1 0"),
+ (1, "hs20_parse_osu_icon", "SET osu_icon icon32"),
+ (2, "hs20_parse_osu_icon", "SET osu_icon icon32"),
+ (2, "hs20_parse_osu_icon", "SET osu_icon icon32"),
+ (1, "hs20_parse_conn_capab", "SET hs20_conn_capab 1:0:2")]
for count, func, cmd in tests:
with alloc_fail(hapd, count, func):
if "FAIL" not in hapd.request(cmd):
raise Exception("Command accepted during OOM (2): " + cmd)
- tests = [ (1, "parse_fils_realm", "SET fils_realm example.com") ]
+ tests = [(1, "parse_fils_realm", "SET fils_realm example.com")]
for count, func, cmd in tests:
with fail_test(hapd, count, func):
if "FAIL" not in hapd.request(cmd):
@@ -479,7 +479,7 @@ def test_ap_config_set_oom(dev, apdev):
def test_ap_config_set_errors(dev, apdev):
"""hostapd configuration parsing errors"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "foobar" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "foobar"})
hapd.set("wep_key0", '"hello"')
hapd.set("wep_key1", '"hello"')
hapd.set("wep_key0", '')
@@ -492,10 +492,10 @@ def test_ap_config_set_errors(dev, apdev):
hapd.set("auth_server_addr", "127.0.0.1")
hapd.set("acct_server_addr", "127.0.0.1")
- tests = [ "SET eap_reauth_period -1",
- "SET fst_llt ",
- "SET auth_server_addr_replace foo",
- "SET acct_server_addr_replace foo" ]
+ tests = ["SET eap_reauth_period -1",
+ "SET fst_llt ",
+ "SET auth_server_addr_replace foo",
+ "SET acct_server_addr_replace foo"]
for t in tests:
if "FAIL" not in hapd.request(t):
raise Exception("Invalid command accepted: " + t)
diff --git a/tests/hwsim/test_ap_csa.py b/tests/hwsim/test_ap_csa.py
index 76c5d78..07ae4a8 100644
--- a/tests/hwsim/test_ap_csa.py
+++ b/tests/hwsim/test_ap_csa.py
@@ -14,8 +14,8 @@ import hostapd
from utils import HwsimSkip
def connect(dev, apdev, **kwargs):
- params = { "ssid": "ap-csa",
- "channel": "1" }
+ params = {"ssid": "ap-csa",
+ "channel": "1"}
params.update(kwargs)
ap = hostapd.add_ap(apdev[0], params)
dev.connect("ap-csa", key_mgmt="NONE", scan_freq="2412")
@@ -146,7 +146,7 @@ def test_ap_csa_invalid(dev, apdev):
csa_supported(dev[0])
ap = connect(dev[0], apdev)
- vals = [ 2461, 4900, 4901, 5181, 5746, 5699, 5895, 5899 ]
+ vals = [2461, 4900, 4901, 5181, 5746, 5699, 5895, 5899]
for val in vals:
if "FAIL" not in ap.request("CHAN_SWITCH 1 %d" % val):
raise Exception("Invalid channel accepted: %d" % val)
diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py
index 9b6ba11..225f3ab 100644
--- a/tests/hwsim/test_ap_dynamic.py
+++ b/tests/hwsim/test_ap_dynamic.py
@@ -59,7 +59,7 @@ def multi_check(dev, check, scan_opt=True):
first = True
for i in range(num_bss):
if not check[i]:
- timeout=0.2 if first else 0.01
+ timeout = 0.2 if first else 0.01
first = False
ev = dev[i].wait_event(["CTRL-EVENT-CONNECTED"], timeout=timeout)
if ev:
@@ -98,59 +98,59 @@ def _test_ap_bss_add_remove(dev, apdev):
ifname3 = apdev[0]['ifname'] + '-3'
logger.info("Set up three BSSes one by one")
hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
- multi_check(dev, [ True, False, False ])
+ multi_check(dev, [True, False, False])
hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
- multi_check(dev, [ True, True, False ])
+ multi_check(dev, [True, True, False])
hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
- multi_check(dev, [ True, True, True ])
+ multi_check(dev, [True, True, True])
logger.info("Remove the last BSS and re-add it")
hostapd.remove_bss(apdev[0], ifname3)
- multi_check(dev, [ True, True, False ])
+ multi_check(dev, [True, True, False])
hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
- multi_check(dev, [ True, True, True ])
+ multi_check(dev, [True, True, True])
logger.info("Remove the middle BSS and re-add it")
hostapd.remove_bss(apdev[0], ifname2)
- multi_check(dev, [ True, False, True ])
+ multi_check(dev, [True, False, True])
hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
- multi_check(dev, [ True, True, True ])
+ multi_check(dev, [True, True, True])
logger.info("Remove the first BSS and re-add it and other BSSs")
hostapd.remove_bss(apdev[0], ifname1)
- multi_check(dev, [ False, False, False ])
+ multi_check(dev, [False, False, False])
hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
- multi_check(dev, [ True, True, True ])
+ multi_check(dev, [True, True, True])
logger.info("Remove two BSSes and re-add them")
hostapd.remove_bss(apdev[0], ifname2)
- multi_check(dev, [ True, False, True ])
+ multi_check(dev, [True, False, True])
hostapd.remove_bss(apdev[0], ifname3)
- multi_check(dev, [ True, False, False ])
+ multi_check(dev, [True, False, False])
hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
- multi_check(dev, [ True, True, False ])
+ multi_check(dev, [True, True, False])
hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
- multi_check(dev, [ True, True, True ])
+ multi_check(dev, [True, True, True])
logger.info("Remove three BSSes in and re-add them")
hostapd.remove_bss(apdev[0], ifname3)
- multi_check(dev, [ True, True, False ])
+ multi_check(dev, [True, True, False])
hostapd.remove_bss(apdev[0], ifname2)
- multi_check(dev, [ True, False, False ])
+ multi_check(dev, [True, False, False])
hostapd.remove_bss(apdev[0], ifname1)
- multi_check(dev, [ False, False, False ])
+ multi_check(dev, [False, False, False])
hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
- multi_check(dev, [ True, False, False ])
+ multi_check(dev, [True, False, False])
hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
- multi_check(dev, [ True, True, False ])
+ multi_check(dev, [True, True, False])
hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
- multi_check(dev, [ True, True, True ])
+ multi_check(dev, [True, True, True])
logger.info("Test error handling if a duplicate ifname is tried")
hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf', ignore_error=True)
- multi_check(dev, [ True, True, True ])
+ multi_check(dev, [True, True, True])
def test_ap_bss_add_remove_during_ht_scan(dev, apdev):
"""Dynamic BSS add during HT40 co-ex scan"""
@@ -160,20 +160,20 @@ def test_ap_bss_add_remove_during_ht_scan(dev, apdev):
ifname2 = apdev[0]['ifname'] + '-2'
hostapd.add_bss(apdev[0], ifname1, 'bss-ht40-1.conf')
hostapd.add_bss(apdev[0], ifname2, 'bss-ht40-2.conf')
- multi_check(dev, [ True, True ], scan_opt=False)
+ multi_check(dev, [True, True], scan_opt=False)
hostapd.remove_bss(apdev[0], ifname2)
hostapd.remove_bss(apdev[0], ifname1)
hostapd.add_bss(apdev[0], ifname1, 'bss-ht40-1.conf')
hostapd.add_bss(apdev[0], ifname2, 'bss-ht40-2.conf')
hostapd.remove_bss(apdev[0], ifname2)
- multi_check(dev, [ True, False ], scan_opt=False)
+ multi_check(dev, [True, False], scan_opt=False)
hostapd.remove_bss(apdev[0], ifname1)
hostapd.add_bss(apdev[0], ifname1, 'bss-ht40-1.conf')
hostapd.add_bss(apdev[0], ifname2, 'bss-ht40-2.conf')
hostapd.remove_bss(apdev[0], ifname1)
- multi_check(dev, [ False, False ])
+ multi_check(dev, [False, False])
def test_ap_multi_bss_config(dev, apdev):
"""hostapd start with a multi-BSS configuration file"""
@@ -185,18 +185,18 @@ def test_ap_multi_bss_config(dev, apdev):
logger.info("Set up three BSSes with one configuration file")
hapd = hostapd.add_iface(apdev[0], 'multi-bss.conf')
hapd.enable()
- multi_check(dev, [ True, True, True ])
+ multi_check(dev, [True, True, True])
hostapd.remove_bss(apdev[0], ifname2)
- multi_check(dev, [ True, False, True ])
+ multi_check(dev, [True, False, True])
hostapd.remove_bss(apdev[0], ifname3)
- multi_check(dev, [ True, False, False ])
+ multi_check(dev, [True, False, False])
hostapd.remove_bss(apdev[0], ifname1)
- multi_check(dev, [ False, False, False ])
+ multi_check(dev, [False, False, False])
hapd = hostapd.add_iface(apdev[0], 'multi-bss.conf')
hapd.enable()
hostapd.remove_bss(apdev[0], ifname1)
- multi_check(dev, [ False, False, False ])
+ multi_check(dev, [False, False, False])
def invalid_ap(ap):
logger.info("Trying to start AP " + ap['ifname'] + " with invalid configuration")
@@ -399,7 +399,7 @@ def hapd_bss_out_of_mem(hapd, phy, confname, count, func):
def test_ap_bss_add_out_of_memory(dev, apdev):
"""Running out of memory while adding a BSS"""
- hapd2 = hostapd.add_ap(apdev[1], { "ssid": "open" })
+ hapd2 = hostapd.add_ap(apdev[1], {"ssid": "open"})
ifname1 = apdev[0]['ifname']
ifname2 = apdev[0]['ifname'] + '-2'
@@ -483,9 +483,9 @@ def _test_ap_iapp(dev, apdev):
subprocess.call(['ip', 'link', 'set', 'dev', br_ifname, 'up'])
subprocess.call(['ip', 'route', 'add', '224.0.0.0/4', 'dev', br_ifname])
- params = { "ssid": "test-1",
- "bridge": br_ifname,
- "iapp_interface": br_ifname }
+ params = {"ssid": "test-1",
+ "bridge": br_ifname,
+ "iapp_interface": br_ifname}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
@@ -507,7 +507,7 @@ def _test_ap_iapp(dev, apdev):
def test_ap_duplicate_bssid(dev, apdev):
"""Duplicate BSSID"""
- params = { "ssid": "test" }
+ params = {"ssid": "test"}
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
hapd.enable()
ifname2 = apdev[0]['ifname'] + '-2'
@@ -542,13 +542,13 @@ def test_ap_bss_config_file(dev, apdev, params):
if not os.path.exists(prg):
prg = '../../hostapd/hostapd'
phy = get_phy(apdev[0])
- cmd = [ prg, '-B', '-dddt', '-P', pidfile, '-f', logfile, '-S', '-T',
- '-b', phy + ':bss-1.conf', '-b', phy + ':bss-2.conf',
- '-b', phy + ':bss-3.conf' ]
+ cmd = [prg, '-B', '-dddt', '-P', pidfile, '-f', logfile, '-S', '-T',
+ '-b', phy + ':bss-1.conf', '-b', phy + ':bss-2.conf',
+ '-b', phy + ':bss-3.conf']
res = subprocess.check_call(cmd)
if res != 0:
raise Exception("Could not start hostapd: %s" % str(res))
- multi_check(dev, [ True, True, True ])
+ multi_check(dev, [True, True, True])
for i in range(0, 3):
dev[i].request("DISCONNECT")
diff --git a/tests/hwsim/test_ap_eap.py b/tests/hwsim/test_ap_eap.py
index 64cb267..32bafdc 100644
--- a/tests/hwsim/test_ap_eap.py
+++ b/tests/hwsim/test_ap_eap.py
@@ -149,7 +149,7 @@ def eap_connect(dev, hapd, method, identity,
expect_cert_error=expect_cert_error)
if expect_failure:
return id
- ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5)
+ ev = hapd.wait_event(["AP-STA-CONNECTED"], timeout=5)
if ev is None:
raise Exception("No connection event received from hostapd")
return id
@@ -843,18 +843,18 @@ def test_ap_wpa2_eap_sim_oom(dev, apdev):
"""EAP-SIM and OOM"""
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hostapd.add_ap(apdev[0], params)
- tests = [ (1, "milenage_f2345"),
- (2, "milenage_f2345"),
- (3, "milenage_f2345"),
- (4, "milenage_f2345"),
- (5, "milenage_f2345"),
- (6, "milenage_f2345"),
- (7, "milenage_f2345"),
- (8, "milenage_f2345"),
- (9, "milenage_f2345"),
- (10, "milenage_f2345"),
- (11, "milenage_f2345"),
- (12, "milenage_f2345") ]
+ tests = [(1, "milenage_f2345"),
+ (2, "milenage_f2345"),
+ (3, "milenage_f2345"),
+ (4, "milenage_f2345"),
+ (5, "milenage_f2345"),
+ (6, "milenage_f2345"),
+ (7, "milenage_f2345"),
+ (8, "milenage_f2345"),
+ (9, "milenage_f2345"),
+ (10, "milenage_f2345"),
+ (11, "milenage_f2345"),
+ (12, "milenage_f2345")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="SIM",
@@ -1056,13 +1056,13 @@ def _test_ap_wpa2_eap_aka_ext(dev, apdev):
time.sleep(0.1)
dev[0].dump_monitor()
- tests = [ ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:0011223344",
- ":UMTS-AUTH:34",
- ":UMTS-AUTH:00112233445566778899aabbccddeeff.00112233445566778899aabbccddeeff:0011223344",
- ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddee:0011223344",
- ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff.0011223344",
- ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff0011223344",
- ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:001122334q" ]
+ tests = [":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:0011223344",
+ ":UMTS-AUTH:34",
+ ":UMTS-AUTH:00112233445566778899aabbccddeeff.00112233445566778899aabbccddeeff:0011223344",
+ ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddee:0011223344",
+ ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff.0011223344",
+ ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff0011223344",
+ ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:001122334q"]
for t in tests:
dev[0].select_network(id, freq="2412")
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
@@ -1266,8 +1266,8 @@ def test_ap_wpa2_eap_ttls_pap(dev, apdev):
ca_cert="auth_serv/ca.pem", phase2="auth=PAP")
hwsim_utils.test_connectivity(dev[0], hapd)
eap_reauth(dev[0], "TTLS")
- check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-1"),
- ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-1") ])
+ check_mib(dev[0], [("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-1"),
+ ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-1")])
def test_ap_wpa2_eap_ttls_pap_subject_match(dev, apdev):
"""WPA2-Enterprise connection using EAP-TTLS/PAP and (alt)subject_match"""
@@ -1287,15 +1287,15 @@ def test_ap_wpa2_eap_ttls_pap_check_cert_subject(dev, apdev):
check_check_cert_subject_support(dev[0])
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hapd = hostapd.add_ap(apdev[0], params)
- tests = [ "C=FI/O=w1.fi/CN=server.w1.fi",
- "C=FI/O=w1.fi",
- "C=FI/CN=server.w1.fi",
- "O=w1.fi/CN=server.w1.fi",
- "C=FI",
- "O=w1.fi",
- "O=w1.*",
- "CN=server.w1.fi",
- "*" ]
+ tests = ["C=FI/O=w1.fi/CN=server.w1.fi",
+ "C=FI/O=w1.fi",
+ "C=FI/CN=server.w1.fi",
+ "O=w1.fi/CN=server.w1.fi",
+ "C=FI",
+ "O=w1.fi",
+ "O=w1.*",
+ "CN=server.w1.fi",
+ "*"]
for test in tests:
eap_connect(dev[0], hapd, "TTLS", "pap user",
anonymous_identity="ttls", password="password",
@@ -1310,14 +1310,14 @@ def test_ap_wpa2_eap_ttls_pap_check_cert_subject_neg(dev, apdev):
check_check_cert_subject_support(dev[0])
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hapd = hostapd.add_ap(apdev[0], params)
- tests = [ "C=US",
- "C",
- "C=FI1*",
- "O=w1.f",
- "O=w1.fi1",
- "O=w1.fi/O=foo",
- "O=foo/O=w1.fi",
- "O=w1.fi/O=w1.fi" ]
+ tests = ["C=US",
+ "C",
+ "C=FI1*",
+ "O=w1.f",
+ "O=w1.fi1",
+ "O=w1.fi/O=foo",
+ "O=foo/O=w1.fi",
+ "O=w1.fi/O=w1.fi"]
for test in tests:
eap_connect(dev[0], hapd, "TTLS", "pap user",
anonymous_identity="ttls", password="password",
@@ -1453,9 +1453,9 @@ def test_ap_wpa2_eap_ttls_invalid_phase2(dev, apdev):
"""EAP-TTLS with invalid phase2 parameter values"""
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hostapd.add_ap(apdev[0], params)
- tests = [ "auth=MSCHAPv2", "auth=MSCHAPV2 autheap=MD5",
- "autheap=MD5 auth=MSCHAPV2", "auth=PAP auth=CHAP",
- "autheap=MD5 autheap=FOO autheap=MSCHAPV2" ]
+ tests = ["auth=MSCHAPv2", "auth=MSCHAPV2 autheap=MD5",
+ "autheap=MD5 auth=MSCHAPV2", "auth=PAP auth=CHAP",
+ "autheap=MD5 autheap=FOO autheap=MSCHAPV2"]
for t in tests:
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="TTLS",
identity="DOMAIN\mschapv2 user",
@@ -1525,7 +1525,7 @@ def test_ap_wpa2_eap_ttls_mschapv2_utf8(dev, apdev):
anonymous_identity="ttls",
password_hex="hash:bd5844fad2489992da7fe8c5a01559cf",
ca_cert="auth_serv/ca.pem", phase2="auth=MSCHAPV2")
- for p in [ "80", "41c041e04141e041", 257*"41" ]:
+ for p in ["80", "41c041e04141e041", 257*"41"]:
dev[2].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
eap="TTLS", identity="utf8-user-hash",
anonymous_identity="ttls", password_hex=p,
@@ -1594,8 +1594,8 @@ def test_ap_wpa2_eap_ttls_eap_gtc_oom(dev, apdev):
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hapd = hostapd.add_ap(apdev[0], params)
- tests = [ "eap_gtc_init",
- "eap_msg_alloc;eap_gtc_process" ]
+ tests = ["eap_gtc_init",
+ "eap_msg_alloc;eap_gtc_process"]
for func in tests:
with alloc_fail(dev[0], 1, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
@@ -2036,11 +2036,11 @@ def test_ap_wpa2_eap_peap_params(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].request("ABORT_SCAN")
- tests = [ ("peap-ver0", ""),
- ("peap-ver1", ""),
- ("peap-ver0", "peapver=0"),
- ("peap-ver1", "peapver=1") ]
- for anon,phase1 in tests:
+ tests = [("peap-ver0", ""),
+ ("peap-ver1", ""),
+ ("peap-ver0", "peapver=0"),
+ ("peap-ver1", "peapver=1")]
+ for anon, phase1 in tests:
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="PEAP",
identity="user", anonymous_identity=anon,
password="password", phase1=phase1,
@@ -2049,9 +2049,9 @@ def test_ap_wpa2_eap_peap_params(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ ("peap-ver0", "peapver=1"),
- ("peap-ver1", "peapver=0") ]
- for anon,phase1 in tests:
+ tests = [("peap-ver0", "peapver=1"),
+ ("peap-ver1", "peapver=0")]
+ for anon, phase1 in tests:
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="PEAP",
identity="user", anonymous_identity=anon,
password="password", phase1=phase1,
@@ -2521,10 +2521,10 @@ def test_ap_wpa2_eap_tls_neg_altsubject_match(dev, apdev):
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hostapd.add_ap(apdev[0], params)
- tests = [ "incorrect.example.com",
- "DNS:incorrect.example.com",
- "DNS:w1.fi",
- "DNS:erver.w1.fi" ]
+ tests = ["incorrect.example.com",
+ "DNS:incorrect.example.com",
+ "DNS:w1.fi",
+ "DNS:erver.w1.fi"]
for match in tests:
_test_ap_wpa2_eap_tls_neg_altsubject_match(dev, apdev, match)
@@ -2733,16 +2733,16 @@ def test_ap_wpa2_eap_pwd_groups(dev, apdev):
"""WPA2-Enterprise connection using various EAP-pwd groups"""
check_eap_capa(dev[0], "PWD")
tls = dev[0].request("GET tls_library")
- params = { "ssid": "test-wpa2-eap", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
- "rsn_pairwise": "CCMP", "ieee8021x": "1",
- "eap_server": "1", "eap_user_file": "auth_serv/eap_user.conf" }
- groups = [ 19, 20, 21, 25, 26 ]
+ params = {"ssid": "test-wpa2-eap", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
+ "rsn_pairwise": "CCMP", "ieee8021x": "1",
+ "eap_server": "1", "eap_user_file": "auth_serv/eap_user.conf"}
+ groups = [19, 20, 21, 25, 26]
if tls.startswith("OpenSSL") and "build=OpenSSL 1.0.2" in tls and "run=OpenSSL 1.0.2" in tls:
logger.info("Add Brainpool EC groups since OpenSSL is new enough")
- groups += [ 27, 28, 29, 30 ]
+ groups += [27, 28, 29, 30]
if tls.startswith("OpenSSL") and "build=OpenSSL 1.1" in tls and "run=OpenSSL 1.1" in tls:
logger.info("Add Brainpool EC groups since OpenSSL is new enough")
- groups += [ 27, 28, 29, 30 ]
+ groups += [27, 28, 29, 30]
for i in groups:
logger.info("Group %d" % i)
params['pwd_group'] = str(i)
@@ -2754,7 +2754,7 @@ def test_ap_wpa2_eap_pwd_groups(dev, apdev):
dev[0].wait_disconnected()
dev[0].dump_monitor()
except:
- if "BoringSSL" in tls and i in [ 25 ]:
+ if "BoringSSL" in tls and i in [25]:
logger.info("Ignore connection failure with group %d with BoringSSL" % i)
dev[0].request("DISCONNECT")
time.sleep(0.1)
@@ -2766,9 +2766,9 @@ def test_ap_wpa2_eap_pwd_groups(dev, apdev):
def test_ap_wpa2_eap_pwd_invalid_group(dev, apdev):
"""WPA2-Enterprise connection using invalid EAP-pwd group"""
check_eap_capa(dev[0], "PWD")
- params = { "ssid": "test-wpa2-eap", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
- "rsn_pairwise": "CCMP", "ieee8021x": "1",
- "eap_server": "1", "eap_user_file": "auth_serv/eap_user.conf" }
+ params = {"ssid": "test-wpa2-eap", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
+ "rsn_pairwise": "CCMP", "ieee8021x": "1",
+ "eap_server": "1", "eap_user_file": "auth_serv/eap_user.conf"}
params['pwd_group'] = "0"
hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="PWD",
@@ -2782,10 +2782,10 @@ def test_ap_wpa2_eap_pwd_as_frag(dev, apdev):
"""WPA2-Enterprise connection using EAP-pwd with server fragmentation"""
check_eap_capa(dev[0], "PWD")
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
- params = { "ssid": "test-wpa2-eap", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
- "rsn_pairwise": "CCMP", "ieee8021x": "1",
- "eap_server": "1", "eap_user_file": "auth_serv/eap_user.conf",
- "pwd_group": "19", "fragment_size": "40" }
+ params = {"ssid": "test-wpa2-eap", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
+ "rsn_pairwise": "CCMP", "ieee8021x": "1",
+ "eap_server": "1", "eap_user_file": "auth_serv/eap_user.conf",
+ "pwd_group": "19", "fragment_size": "40"}
hapd = hostapd.add_ap(apdev[0], params)
eap_connect(dev[0], hapd, "PWD", "pwd user", password="secret password")
@@ -2798,7 +2798,7 @@ def test_ap_wpa2_eap_gpsk(dev, apdev):
eap_reauth(dev[0], "GPSK")
logger.info("Test forced algorithm selection")
- for phase1 in [ "cipher=1", "cipher=2" ]:
+ for phase1 in ["cipher=1", "cipher=2"]:
dev[0].set_network_quoted(id, "phase1", phase1)
ev = dev[0].wait_event(["CTRL-EVENT-EAP-SUCCESS"], timeout=10)
if ev is None:
@@ -2839,10 +2839,10 @@ def test_ap_wpa2_eap_eke(dev, apdev):
eap_reauth(dev[0], "EKE")
logger.info("Test forced algorithm selection")
- for phase1 in [ "dhgroup=5 encr=1 prf=2 mac=2",
- "dhgroup=4 encr=1 prf=2 mac=2",
- "dhgroup=3 encr=1 prf=2 mac=2",
- "dhgroup=3 encr=1 prf=1 mac=1" ]:
+ for phase1 in ["dhgroup=5 encr=1 prf=2 mac=2",
+ "dhgroup=4 encr=1 prf=2 mac=2",
+ "dhgroup=3 encr=1 prf=2 mac=2",
+ "dhgroup=3 encr=1 prf=1 mac=1"]:
dev[0].set_network_quoted(id, "phase1", phase1)
ev = dev[0].wait_event(["CTRL-EVENT-EAP-SUCCESS"], timeout=10)
if ev is None:
@@ -2907,7 +2907,7 @@ def test_ap_wpa2_eap_eke_server_oom(dev, apdev):
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
- for count,func in [ (1, "eap_eke_build_commit"),
+ for count, func in [(1, "eap_eke_build_commit"),
(2, "eap_eke_build_commit"),
(3, "eap_eke_build_commit"),
(1, "eap_eke_build_confirm"),
@@ -2918,19 +2918,19 @@ def test_ap_wpa2_eap_eke_server_oom(dev, apdev):
(1, "eap_eke_process_identity"),
(2, "eap_eke_process_identity"),
(3, "eap_eke_process_identity"),
- (4, "eap_eke_process_identity") ]:
+ (4, "eap_eke_process_identity")]:
with alloc_fail(hapd, count, func):
eap_connect(dev[0], hapd, "EKE", "eke user", password="hello",
expect_failure=True)
dev[0].request("REMOVE_NETWORK all")
- for count,func,pw in [ (1, "eap_eke_init", "hello"),
- (1, "eap_eke_get_session_id", "hello"),
- (1, "eap_eke_getKey", "hello"),
- (1, "eap_eke_build_msg", "hello"),
- (1, "eap_eke_build_failure", "wrong"),
- (1, "eap_eke_build_identity", "hello"),
- (2, "eap_eke_build_identity", "hello") ]:
+ for count, func, pw in [(1, "eap_eke_init", "hello"),
+ (1, "eap_eke_get_session_id", "hello"),
+ (1, "eap_eke_getKey", "hello"),
+ (1, "eap_eke_build_msg", "hello"),
+ (1, "eap_eke_build_failure", "wrong"),
+ (1, "eap_eke_build_identity", "hello"),
+ (2, "eap_eke_build_identity", "hello")]:
with alloc_fail(hapd, count, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP WPA-EAP-SHA256",
eap="EKE", identity="eke user", password=pw,
@@ -2992,10 +2992,10 @@ def test_ap_wpa2_eap_ikev2_as_frag(dev, apdev):
"""WPA2-Enterprise connection using EAP-IKEv2 with server fragmentation"""
check_eap_capa(dev[0], "IKEV2")
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
- params = { "ssid": "test-wpa2-eap", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
- "rsn_pairwise": "CCMP", "ieee8021x": "1",
- "eap_server": "1", "eap_user_file": "auth_serv/eap_user.conf",
- "fragment_size": "50" }
+ params = {"ssid": "test-wpa2-eap", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
+ "rsn_pairwise": "CCMP", "ieee8021x": "1",
+ "eap_server": "1", "eap_user_file": "auth_serv/eap_user.conf",
+ "fragment_size": "50"}
hapd = hostapd.add_ap(apdev[0], params)
eap_connect(dev[0], hapd, "IKEV2", "ikev2 user",
password="ike password")
@@ -3007,9 +3007,9 @@ def test_ap_wpa2_eap_ikev2_oom(dev, apdev):
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hostapd.add_ap(apdev[0], params)
- tests = [ (1, "dh_init"),
- (2, "dh_init"),
- (1, "dh_derive_shared") ]
+ tests = [(1, "dh_init"),
+ (2, "dh_init"),
+ (1, "dh_derive_shared")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="IKEV2",
@@ -3026,9 +3026,9 @@ def test_ap_wpa2_eap_ikev2_oom(dev, apdev):
tls = dev[0].request("GET tls_library")
if not tls.startswith("wolfSSL"):
- tests = [ (1, "os_get_random;dh_init") ]
+ tests = [(1, "os_get_random;dh_init")]
else:
- tests = [ (1, "crypto_dh_init;dh_init") ]
+ tests = [(1, "crypto_dh_init;dh_init")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="IKEV2",
@@ -3066,8 +3066,8 @@ def test_ap_wpa2_eap_psk(dev, apdev):
eap_connect(dev[0], hapd, "PSK", "psk.user@example.com",
password_hex="0123456789abcdef0123456789abcdef", sha256=True)
eap_reauth(dev[0], "PSK", sha256=True)
- check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-5"),
- ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-5") ])
+ check_mib(dev[0], [("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-5"),
+ ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-5")])
bss = dev[0].get_bss(apdev[0]['bssid'])
if 'flags' not in bss:
@@ -3086,8 +3086,8 @@ def test_ap_wpa2_eap_psk_oom(dev, apdev):
skip_with_fips(dev[0])
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hostapd.add_ap(apdev[0], params)
- tests = [ (1, "=aes_128_eax_encrypt"),
- (1, "=aes_128_eax_decrypt") ]
+ tests = [(1, "=aes_128_eax_encrypt"),
+ (1, "=aes_128_eax_decrypt")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="PSK",
@@ -3102,15 +3102,15 @@ def test_ap_wpa2_eap_psk_oom(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ (1, "aes_ctr_encrypt;aes_128_eax_encrypt"),
- (1, "omac1_aes_128;aes_128_eax_encrypt"),
- (2, "omac1_aes_128;aes_128_eax_encrypt"),
- (3, "omac1_aes_128;aes_128_eax_encrypt"),
- (1, "omac1_aes_vector"),
- (1, "omac1_aes_128;aes_128_eax_decrypt"),
- (2, "omac1_aes_128;aes_128_eax_decrypt"),
- (3, "omac1_aes_128;aes_128_eax_decrypt"),
- (1, "aes_ctr_encrypt;aes_128_eax_decrypt") ]
+ tests = [(1, "aes_ctr_encrypt;aes_128_eax_encrypt"),
+ (1, "omac1_aes_128;aes_128_eax_encrypt"),
+ (2, "omac1_aes_128;aes_128_eax_encrypt"),
+ (3, "omac1_aes_128;aes_128_eax_encrypt"),
+ (1, "omac1_aes_vector"),
+ (1, "omac1_aes_128;aes_128_eax_decrypt"),
+ (2, "omac1_aes_128;aes_128_eax_decrypt"),
+ (3, "omac1_aes_128;aes_128_eax_decrypt"),
+ (1, "aes_ctr_encrypt;aes_128_eax_decrypt")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="PSK",
@@ -3148,8 +3148,8 @@ def test_ap_wpa_eap_peap_eap_mschapv2(dev, apdev):
eap_check_auth(dev[0], "PEAP", True, rsn=False)
hwsim_utils.test_connectivity(dev[0], hapd)
eap_reauth(dev[0], "PEAP", rsn=False)
- check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-50-f2-1"),
- ("dot11RSNAAuthenticationSuiteSelected", "00-50-f2-1") ])
+ check_mib(dev[0], [("dot11RSNAAuthenticationSuiteRequested", "00-50-f2-1"),
+ ("dot11RSNAAuthenticationSuiteSelected", "00-50-f2-1")])
status = dev[0].get_status(extra="VERBOSE")
if 'portControl' not in status:
raise Exception("portControl missing from STATUS-VERBOSE")
@@ -3166,21 +3166,21 @@ def test_ap_wpa2_eap_interactive(dev, apdev):
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hapd = hostapd.add_ap(apdev[0], params)
- tests = [ ("Connection with dynamic TTLS/MSCHAPv2 password entry",
- "TTLS", "ttls", "DOMAIN\mschapv2 user", "auth=MSCHAPV2",
- None, "password"),
- ("Connection with dynamic TTLS/MSCHAPv2 identity and password entry",
- "TTLS", "ttls", None, "auth=MSCHAPV2",
- "DOMAIN\mschapv2 user", "password"),
- ("Connection with dynamic TTLS/EAP-MSCHAPv2 password entry",
- "TTLS", "ttls", "user", "autheap=MSCHAPV2", None, "password"),
- ("Connection with dynamic TTLS/EAP-MD5 password entry",
- "TTLS", "ttls", "user", "autheap=MD5", None, "password"),
- ("Connection with dynamic PEAP/EAP-MSCHAPv2 password entry",
- "PEAP", None, "user", "auth=MSCHAPV2", None, "password"),
- ("Connection with dynamic PEAP/EAP-GTC password entry",
- "PEAP", None, "user", "auth=GTC", None, "password") ]
- for [desc,eap,anon,identity,phase2,req_id,req_pw] in tests:
+ tests = [("Connection with dynamic TTLS/MSCHAPv2 password entry",
+ "TTLS", "ttls", "DOMAIN\mschapv2 user", "auth=MSCHAPV2",
+ None, "password"),
+ ("Connection with dynamic TTLS/MSCHAPv2 identity and password entry",
+ "TTLS", "ttls", None, "auth=MSCHAPV2",
+ "DOMAIN\mschapv2 user", "password"),
+ ("Connection with dynamic TTLS/EAP-MSCHAPv2 password entry",
+ "TTLS", "ttls", "user", "autheap=MSCHAPV2", None, "password"),
+ ("Connection with dynamic TTLS/EAP-MD5 password entry",
+ "TTLS", "ttls", "user", "autheap=MD5", None, "password"),
+ ("Connection with dynamic PEAP/EAP-MSCHAPv2 password entry",
+ "PEAP", None, "user", "auth=MSCHAPV2", None, "password"),
+ ("Connection with dynamic PEAP/EAP-GTC password entry",
+ "PEAP", None, "user", "auth=GTC", None, "password")]
+ for [desc, eap, anon, identity, phase2, req_id, req_pw] in tests:
logger.info(desc)
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap=eap,
anonymous_identity=anon, identity=identity,
@@ -3192,7 +3192,7 @@ def test_ap_wpa2_eap_interactive(dev, apdev):
raise Exception("Request for identity timed out")
id = ev.split(':')[0].split('-')[-1]
dev[0].request("CTRL-RSP-IDENTITY-" + id + ":" + req_id)
- ev = dev[0].wait_event(["CTRL-REQ-PASSWORD","CTRL-REQ-OTP"])
+ ev = dev[0].wait_event(["CTRL-REQ-PASSWORD", "CTRL-REQ-OTP"])
if ev is None:
raise Exception("Request for password timed out")
id = ev.split(':')[0].split('-')[-1]
@@ -3244,9 +3244,9 @@ def test_ap_wpa2_eap_vendor_test_oom(dev, apdev):
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hostapd.add_ap(apdev[0], params)
- tests = [ "eap_vendor_test_init",
- "eap_msg_alloc;eap_vendor_test_process",
- "eap_vendor_test_getKey" ]
+ tests = ["eap_vendor_test_init",
+ "eap_msg_alloc;eap_vendor_test_process",
+ "eap_vendor_test_getKey"]
for func in tests:
with alloc_fail(dev[0], 1, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
@@ -3372,9 +3372,9 @@ def test_ap_wpa2_eap_fast_binary_pac_errors(dev, apdev):
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hapd = hostapd.add_ap(apdev[0], params)
- tests = [ (1, "=eap_fast_save_pac_bin"),
- (1, "eap_fast_write_pac"),
- (2, "eap_fast_write_pac"), ]
+ tests = [(1, "=eap_fast_save_pac_bin"),
+ (1, "eap_fast_write_pac"),
+ (2, "eap_fast_write_pac"),]
for count, func in tests:
if "OK" not in dev[0].request("SET blob fast_pac_bin_errors "):
raise Exception("Could not set blob")
@@ -3388,12 +3388,12 @@ def test_ap_wpa2_eap_fast_binary_pac_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ "00", "000000000000", "6ae4920c0001",
- "6ae4920c000000",
- "6ae4920c0000" + "0000" + 32*"00" + "ffff" + "0000",
- "6ae4920c0000" + "0000" + 32*"00" + "0001" + "0000",
- "6ae4920c0000" + "0000" + 32*"00" + "0000" + "0001",
- "6ae4920c0000" + "0000" + 32*"00" + "0000" + "0008" + "00040000" + "0007000100"]
+ tests = ["00", "000000000000", "6ae4920c0001",
+ "6ae4920c000000",
+ "6ae4920c0000" + "0000" + 32*"00" + "ffff" + "0000",
+ "6ae4920c0000" + "0000" + 32*"00" + "0001" + "0000",
+ "6ae4920c0000" + "0000" + 32*"00" + "0000" + "0001",
+ "6ae4920c0000" + "0000" + 32*"00" + "0000" + "0008" + "00040000" + "0007000100"]
for t in tests:
if "OK" not in dev[0].request("SET blob fast_pac_bin_errors " + t):
raise Exception("Could not set blob")
@@ -3413,9 +3413,9 @@ def test_ap_wpa2_eap_fast_binary_pac_errors(dev, apdev):
dev[0].wait_disconnected()
pac = "6ae4920c0000" + "0000" + 32*"00" + "0000" + "0000"
- tests = [ (1, "eap_fast_load_pac_bin"),
- (2, "eap_fast_load_pac_bin"),
- (3, "eap_fast_load_pac_bin") ]
+ tests = [(1, "eap_fast_load_pac_bin"),
+ (2, "eap_fast_load_pac_bin"),
+ (3, "eap_fast_load_pac_bin")]
for count, func in tests:
if "OK" not in dev[0].request("SET blob fast_pac_bin_errors " + pac):
raise Exception("Could not set blob")
@@ -3448,8 +3448,8 @@ def test_ap_wpa2_eap_fast_binary_pac_errors(dev, apdev):
dev[0].wait_disconnected()
pac = "6ae4920c0000" + "0000" + 32*"00" + "0000" + "0009" + "00040000" + "0007000100"
- tests = [ (1, "eap_fast_pac_get_a_id"),
- (2, "eap_fast_pac_get_a_id") ]
+ tests = [(1, "eap_fast_pac_get_a_id"),
+ (2, "eap_fast_pac_get_a_id")]
for count, func in tests:
if "OK" not in dev[0].request("SET blob fast_pac_bin_errors " + pac):
raise Exception("Could not set blob")
@@ -3468,11 +3468,11 @@ def test_ap_wpa2_eap_fast_text_pac_errors(dev, apdev):
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hostapd.add_ap(apdev[0], params)
- tests = [ (1, "eap_fast_parse_hex;eap_fast_parse_pac_key"),
- (1, "eap_fast_parse_hex;eap_fast_parse_pac_opaque"),
- (1, "eap_fast_parse_hex;eap_fast_parse_a_id"),
- (1, "eap_fast_parse_start"),
- (1, "eap_fast_save_pac") ]
+ tests = [(1, "eap_fast_parse_hex;eap_fast_parse_pac_key"),
+ (1, "eap_fast_parse_hex;eap_fast_parse_pac_opaque"),
+ (1, "eap_fast_parse_hex;eap_fast_parse_a_id"),
+ (1, "eap_fast_parse_start"),
+ (1, "eap_fast_save_pac")]
for count, func in tests:
dev[0].request("FLUSH")
if "OK" not in dev[0].request("SET blob fast_pac_text_errors "):
@@ -3760,11 +3760,11 @@ def test_ap_wpa2_eap_fast_cipher_suites(dev, apdev):
if res != "DHE-RSA-AES256-SHA":
raise Exception("Unexpected cipher suite for provisioning: " + res)
- tests = [ "DHE-RSA-AES128-SHA",
- "RC4-SHA",
- "AES128-SHA",
- "AES256-SHA",
- "DHE-RSA-AES256-SHA" ]
+ tests = ["DHE-RSA-AES128-SHA",
+ "RC4-SHA",
+ "AES128-SHA",
+ "AES256-SHA",
+ "DHE-RSA-AES256-SHA"]
for cipher in tests:
dev[0].dump_monitor()
logger.info("Testing " + cipher)
@@ -3938,13 +3938,13 @@ def test_ap_wpa2_eap_tls_ocsp_multi(dev, apdev):
private_key_passwd="whatever", ocsp=2)
def int_eap_server_params():
- params = { "ssid": "test-wpa2-eap", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
- "rsn_pairwise": "CCMP", "ieee8021x": "1",
- "eap_server": "1", "eap_user_file": "auth_serv/eap_user.conf",
- "ca_cert": "auth_serv/ca.pem",
- "server_cert": "auth_serv/server.pem",
- "private_key": "auth_serv/server.key",
- "dh_file": "auth_serv/dh.conf" }
+ params = {"ssid": "test-wpa2-eap", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
+ "rsn_pairwise": "CCMP", "ieee8021x": "1",
+ "eap_server": "1", "eap_user_file": "auth_serv/eap_user.conf",
+ "ca_cert": "auth_serv/ca.pem",
+ "server_cert": "auth_serv/server.pem",
+ "private_key": "auth_serv/server.key",
+ "dh_file": "auth_serv/dh.conf"}
return params
def test_ap_wpa2_eap_tls_ocsp_key_id(dev, apdev, params):
@@ -4253,8 +4253,8 @@ def root_ocsp(cert):
fd2, fn2 = tempfile.mkstemp()
os.close(fd2)
- arg = [ "openssl", "ocsp", "-reqout", fn2, "-issuer", ca, "-sha256",
- "-cert", cert, "-no_nonce", "-text" ]
+ arg = ["openssl", "ocsp", "-reqout", fn2, "-issuer", ca, "-sha256",
+ "-cert", cert, "-no_nonce", "-text"]
logger.info(' '.join(arg))
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
@@ -4268,11 +4268,11 @@ def root_ocsp(cert):
fd, fn = tempfile.mkstemp()
os.close(fd)
- arg = [ "openssl", "ocsp", "-index", "auth_serv/rootCA/index.txt",
- "-rsigner", ca, "-rkey", "auth_serv/ca-key.pem",
- "-CA", ca, "-issuer", ca, "-verify_other", ca, "-trust_other",
- "-ndays", "7", "-reqin", fn2, "-resp_no_certs", "-respout", fn,
- "-text" ]
+ arg = ["openssl", "ocsp", "-index", "auth_serv/rootCA/index.txt",
+ "-rsigner", ca, "-rkey", "auth_serv/ca-key.pem",
+ "-CA", ca, "-issuer", ca, "-verify_other", ca, "-trust_other",
+ "-ndays", "7", "-reqin", fn2, "-resp_no_certs", "-respout", fn,
+ "-text"]
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
res = cmd.stdout.read().decode() + "\n" + cmd.stderr.read().decode()
@@ -4293,8 +4293,8 @@ def ica_ocsp(cert, md="-sha256"):
fd2, fn2 = tempfile.mkstemp()
os.close(fd2)
- arg = [ "openssl", "ocsp", "-reqout", fn2, "-issuer", ca, md,
- "-cert", cert, "-no_nonce", "-text" ]
+ arg = ["openssl", "ocsp", "-reqout", fn2, "-issuer", ca, md,
+ "-cert", cert, "-no_nonce", "-text"]
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
res = cmd.stdout.read().decode() + "\n" + cmd.stderr.read().decode()
@@ -4307,11 +4307,11 @@ def ica_ocsp(cert, md="-sha256"):
fd, fn = tempfile.mkstemp()
os.close(fd)
- arg = [ "openssl", "ocsp", "-index", prefix + "index.txt",
- "-rsigner", ca, "-rkey", prefix + "private/cakey.pem",
- "-CA", ca, "-issuer", ca, "-verify_other", ca, "-trust_other",
- "-ndays", "7", "-reqin", fn2, "-resp_no_certs", "-respout", fn,
- "-text" ]
+ arg = ["openssl", "ocsp", "-index", prefix + "index.txt",
+ "-rsigner", ca, "-rkey", prefix + "private/cakey.pem",
+ "-CA", ca, "-issuer", ca, "-verify_other", ca, "-trust_other",
+ "-ndays", "7", "-reqin", fn2, "-resp_no_certs", "-respout", fn,
+ "-text"]
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
res = cmd.stdout.read().decode() + "\n" + cmd.stderr.read().decode()
@@ -4955,8 +4955,8 @@ def test_ap_wpa2_eap_sim_zero_db_timeout(dev, apdev):
identity="1232010000000000",
password="90dca4eda45b53cf0f12d7c9c3bc6a89:cb9cccc4b9258e6dca4760379fb82581",
wait_connect=False, scan_freq="2412")
- ev = dev[0].wait_event([ "CTRL-EVENT-CONNECTED",
- "CTRL-EVENT-DISCONNECTED" ],
+ ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
+ "CTRL-EVENT-DISCONNECTED"],
timeout=15)
if ev is None:
raise Exception("No connection result")
@@ -5290,8 +5290,8 @@ def test_ap_wpa2_eap_unexpected_wep_eapol_key(dev, apdev):
def test_ap_wpa2_eap_in_bridge(dev, apdev):
"""WPA2-EAP and wpas interface in a bridge"""
- br_ifname='sta-br0'
- ifname='wlan5'
+ br_ifname = 'sta-br0'
+ ifname = 'wlan5'
try:
_test_ap_wpa2_eap_in_bridge(dev, apdev)
finally:
@@ -5304,8 +5304,8 @@ def _test_ap_wpa2_eap_in_bridge(dev, apdev):
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hapd = hostapd.add_ap(apdev[0], params)
- br_ifname='sta-br0'
- ifname='wlan5'
+ br_ifname = 'sta-br0'
+ ifname = 'wlan5'
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
subprocess.call(['brctl', 'addbr', br_ifname])
subprocess.call(['brctl', 'setfd', br_ifname, '0'])
@@ -5454,10 +5454,10 @@ def test_ap_wpa2_eap_tls_oom(dev, apdev):
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
hostapd.add_ap(apdev[0], params)
- tests = [ (1, "tls_connection_set_subject_match"),
- (2, "tls_connection_set_subject_match"),
- (3, "tls_connection_set_subject_match"),
- (4, "tls_connection_set_subject_match") ]
+ tests = [(1, "tls_connection_set_subject_match"),
+ (2, "tls_connection_set_subject_match"),
+ (3, "tls_connection_set_subject_match"),
+ (4, "tls_connection_set_subject_match")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="TLS",
@@ -5573,15 +5573,15 @@ def test_rsn_ie_proto_eap_sta(dev, apdev):
password="abcdefghijklmnop0123456789abcdef",
scan_freq="2412")
- tests = [ ('No RSN Capabilities field',
- '30120100000fac040100000fac040100000fac01'),
- ('No AKM Suite fields',
- '300c0100000fac040100000fac04'),
- ('No Pairwise Cipher Suite fields',
- '30060100000fac04'),
- ('No Group Data Cipher Suite field',
- '30020100') ]
- for txt,ie in tests:
+ tests = [('No RSN Capabilities field',
+ '30120100000fac040100000fac040100000fac01'),
+ ('No AKM Suite fields',
+ '300c0100000fac040100000fac04'),
+ ('No Pairwise Cipher Suite fields',
+ '30060100000fac04'),
+ ('No Group Data Cipher Suite field',
+ '30020100')]
+ for txt, ie in tests:
dev[0].request("DISCONNECT")
dev[0].wait_disconnected()
logger.info(txt)
@@ -5894,15 +5894,15 @@ def test_eap_tls_no_session_resumption(dev, apdev):
def test_eap_tls_session_resumption_radius(dev, apdev):
"""EAP-TLS session resumption (RADIUS)"""
- params = { "ssid": "as", "beacon_int": "2000",
- "radius_server_clients": "auth_serv/radius_clients.conf",
- "radius_server_auth_port": '18128',
- "eap_server": "1",
- "eap_user_file": "auth_serv/eap_user.conf",
- "ca_cert": "auth_serv/ca.pem",
- "server_cert": "auth_serv/server.pem",
- "private_key": "auth_serv/server.key",
- "tls_session_lifetime": "60" }
+ params = {"ssid": "as", "beacon_int": "2000",
+ "radius_server_clients": "auth_serv/radius_clients.conf",
+ "radius_server_auth_port": '18128',
+ "eap_server": "1",
+ "eap_user_file": "auth_serv/eap_user.conf",
+ "ca_cert": "auth_serv/ca.pem",
+ "server_cert": "auth_serv/server.pem",
+ "private_key": "auth_serv/server.key",
+ "tls_session_lifetime": "60"}
authsrv = hostapd.add_ap(apdev[1], params)
check_tls_session_resumption_capa(dev[0], authsrv)
@@ -5927,15 +5927,15 @@ def test_eap_tls_session_resumption_radius(dev, apdev):
def test_eap_tls_no_session_resumption_radius(dev, apdev):
"""EAP-TLS session resumption disabled (RADIUS)"""
- params = { "ssid": "as", "beacon_int": "2000",
- "radius_server_clients": "auth_serv/radius_clients.conf",
- "radius_server_auth_port": '18128',
- "eap_server": "1",
- "eap_user_file": "auth_serv/eap_user.conf",
- "ca_cert": "auth_serv/ca.pem",
- "server_cert": "auth_serv/server.pem",
- "private_key": "auth_serv/server.key",
- "tls_session_lifetime": "0" }
+ params = {"ssid": "as", "beacon_int": "2000",
+ "radius_server_clients": "auth_serv/radius_clients.conf",
+ "radius_server_auth_port": '18128',
+ "eap_server": "1",
+ "eap_user_file": "auth_serv/eap_user.conf",
+ "ca_cert": "auth_serv/ca.pem",
+ "server_cert": "auth_serv/server.pem",
+ "private_key": "auth_serv/server.key",
+ "tls_session_lifetime": "0"}
hostapd.add_ap(apdev[1], params)
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
@@ -5970,14 +5970,14 @@ def test_eap_mschapv2_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ (1, "hash_nt_password_hash;mschapv2_derive_response"),
- (1, "nt_password_hash;mschapv2_derive_response"),
- (1, "nt_password_hash;=mschapv2_derive_response"),
- (1, "generate_nt_response;mschapv2_derive_response"),
- (1, "generate_authenticator_response;mschapv2_derive_response"),
- (1, "nt_password_hash;=mschapv2_derive_response"),
- (1, "get_master_key;mschapv2_derive_response"),
- (1, "os_get_random;eap_mschapv2_challenge_reply") ]
+ tests = [(1, "hash_nt_password_hash;mschapv2_derive_response"),
+ (1, "nt_password_hash;mschapv2_derive_response"),
+ (1, "nt_password_hash;=mschapv2_derive_response"),
+ (1, "generate_nt_response;mschapv2_derive_response"),
+ (1, "generate_authenticator_response;mschapv2_derive_response"),
+ (1, "nt_password_hash;=mschapv2_derive_response"),
+ (1, "get_master_key;mschapv2_derive_response"),
+ (1, "os_get_random;eap_mschapv2_challenge_reply")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("test-wpa-eap", key_mgmt="WPA-EAP", eap="MSCHAPV2",
@@ -5987,10 +5987,10 @@ def test_eap_mschapv2_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ (1, "hash_nt_password_hash;mschapv2_derive_response"),
- (1, "hash_nt_password_hash;=mschapv2_derive_response"),
- (1, "generate_nt_response_pwhash;mschapv2_derive_response"),
- (1, "generate_authenticator_response_pwhash;mschapv2_derive_response") ]
+ tests = [(1, "hash_nt_password_hash;mschapv2_derive_response"),
+ (1, "hash_nt_password_hash;=mschapv2_derive_response"),
+ (1, "generate_nt_response_pwhash;mschapv2_derive_response"),
+ (1, "generate_authenticator_response_pwhash;mschapv2_derive_response")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("test-wpa-eap", key_mgmt="WPA-EAP", eap="MSCHAPV2",
@@ -6001,10 +6001,10 @@ def test_eap_mschapv2_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ (1, "eap_mschapv2_init"),
- (1, "eap_msg_alloc;eap_mschapv2_challenge_reply"),
- (1, "eap_msg_alloc;eap_mschapv2_success"),
- (1, "eap_mschapv2_getKey") ]
+ tests = [(1, "eap_mschapv2_init"),
+ (1, "eap_msg_alloc;eap_mschapv2_challenge_reply"),
+ (1, "eap_msg_alloc;eap_mschapv2_success"),
+ (1, "eap_mschapv2_getKey")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("test-wpa-eap", key_mgmt="WPA-EAP", eap="MSCHAPV2",
@@ -6014,7 +6014,7 @@ def test_eap_mschapv2_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ (1, "eap_msg_alloc;eap_mschapv2_failure") ]
+ tests = [(1, "eap_msg_alloc;eap_mschapv2_failure")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("test-wpa-eap", key_mgmt="WPA-EAP", eap="MSCHAPV2",
@@ -6024,8 +6024,8 @@ def test_eap_mschapv2_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ (2, "eap_mschapv2_init"),
- (3, "eap_mschapv2_init") ]
+ tests = [(2, "eap_mschapv2_init"),
+ (3, "eap_mschapv2_init")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("test-wpa-eap", key_mgmt="WPA-EAP", eap="FAST",
@@ -6050,20 +6050,20 @@ def test_eap_gpsk_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ (1, "os_get_random;eap_gpsk_send_gpsk_2", None),
- (1, "eap_gpsk_derive_session_id;eap_gpsk_send_gpsk_2",
- "cipher=1"),
- (1, "eap_gpsk_derive_session_id;eap_gpsk_send_gpsk_2",
- "cipher=2"),
- (1, "eap_gpsk_derive_keys_helper", None),
- (2, "eap_gpsk_derive_keys_helper", None),
- (1, "eap_gpsk_compute_mic_aes;eap_gpsk_compute_mic;eap_gpsk_send_gpsk_2",
- "cipher=1"),
- (1, "hmac_sha256;eap_gpsk_compute_mic;eap_gpsk_send_gpsk_2",
- "cipher=2"),
- (1, "eap_gpsk_compute_mic;eap_gpsk_validate_gpsk_3_mic", None),
- (1, "eap_gpsk_compute_mic;eap_gpsk_send_gpsk_4", None),
- (1, "eap_gpsk_derive_mid_helper", None) ]
+ tests = [(1, "os_get_random;eap_gpsk_send_gpsk_2", None),
+ (1, "eap_gpsk_derive_session_id;eap_gpsk_send_gpsk_2",
+ "cipher=1"),
+ (1, "eap_gpsk_derive_session_id;eap_gpsk_send_gpsk_2",
+ "cipher=2"),
+ (1, "eap_gpsk_derive_keys_helper", None),
+ (2, "eap_gpsk_derive_keys_helper", None),
+ (1, "eap_gpsk_compute_mic_aes;eap_gpsk_compute_mic;eap_gpsk_send_gpsk_2",
+ "cipher=1"),
+ (1, "hmac_sha256;eap_gpsk_compute_mic;eap_gpsk_send_gpsk_2",
+ "cipher=2"),
+ (1, "eap_gpsk_compute_mic;eap_gpsk_validate_gpsk_3_mic", None),
+ (1, "eap_gpsk_compute_mic;eap_gpsk_send_gpsk_4", None),
+ (1, "eap_gpsk_derive_mid_helper", None)]
for count, func, phase1 in tests:
with fail_test(dev[0], count, func):
dev[0].connect("test-wpa-eap", key_mgmt="WPA-EAP", eap="GPSK",
@@ -6075,19 +6075,19 @@ def test_eap_gpsk_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ (1, "eap_gpsk_init"),
- (2, "eap_gpsk_init"),
- (3, "eap_gpsk_init"),
- (1, "eap_gpsk_process_id_server"),
- (1, "eap_msg_alloc;eap_gpsk_send_gpsk_2"),
- (1, "eap_gpsk_derive_session_id;eap_gpsk_send_gpsk_2"),
- (1, "eap_gpsk_derive_mid_helper;eap_gpsk_derive_session_id;eap_gpsk_send_gpsk_2"),
- (1, "eap_gpsk_derive_keys"),
- (1, "eap_gpsk_derive_keys_helper"),
- (1, "eap_msg_alloc;eap_gpsk_send_gpsk_4"),
- (1, "eap_gpsk_getKey"),
- (1, "eap_gpsk_get_emsk"),
- (1, "eap_gpsk_get_session_id") ]
+ tests = [(1, "eap_gpsk_init"),
+ (2, "eap_gpsk_init"),
+ (3, "eap_gpsk_init"),
+ (1, "eap_gpsk_process_id_server"),
+ (1, "eap_msg_alloc;eap_gpsk_send_gpsk_2"),
+ (1, "eap_gpsk_derive_session_id;eap_gpsk_send_gpsk_2"),
+ (1, "eap_gpsk_derive_mid_helper;eap_gpsk_derive_session_id;eap_gpsk_send_gpsk_2"),
+ (1, "eap_gpsk_derive_keys"),
+ (1, "eap_gpsk_derive_keys_helper"),
+ (1, "eap_msg_alloc;eap_gpsk_send_gpsk_4"),
+ (1, "eap_gpsk_getKey"),
+ (1, "eap_gpsk_get_emsk"),
+ (1, "eap_gpsk_get_session_id")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].request("ERP_FLUSH")
@@ -6229,19 +6229,19 @@ def test_ap_wpa2_eap_assoc_rsn(dev, apdev):
hostapd.add_ap(apdev[1], params)
# Success cases with optional RSN IE fields removed one by one
- tests = [ ("Normal wpa_supplicant assoc req RSN IE",
- "30140100000fac040100000fac040100000fac010000"),
- ("Extra PMKIDCount field in RSN IE",
- "30160100000fac040100000fac040100000fac0100000000"),
- ("Extra Group Management Cipher Suite in RSN IE",
- "301a0100000fac040100000fac040100000fac0100000000000fac06"),
- ("Extra undefined extension field in RSN IE",
- "301c0100000fac040100000fac040100000fac0100000000000fac061122"),
- ("RSN IE without RSN Capabilities",
- "30120100000fac040100000fac040100000fac01"),
- ("RSN IE without AKM", "300c0100000fac040100000fac04"),
- ("RSN IE without pairwise", "30060100000fac04"),
- ("RSN IE without group", "30020100") ]
+ tests = [("Normal wpa_supplicant assoc req RSN IE",
+ "30140100000fac040100000fac040100000fac010000"),
+ ("Extra PMKIDCount field in RSN IE",
+ "30160100000fac040100000fac040100000fac0100000000"),
+ ("Extra Group Management Cipher Suite in RSN IE",
+ "301a0100000fac040100000fac040100000fac0100000000000fac06"),
+ ("Extra undefined extension field in RSN IE",
+ "301c0100000fac040100000fac040100000fac0100000000000fac061122"),
+ ("RSN IE without RSN Capabilities",
+ "30120100000fac040100000fac040100000fac01"),
+ ("RSN IE without AKM", "300c0100000fac040100000fac04"),
+ ("RSN IE without pairwise", "30060100000fac04"),
+ ("RSN IE without group", "30020100")]
for title, ie in tests:
logger.info(title)
set_test_assoc_ie(dev[0], ie)
@@ -6252,10 +6252,10 @@ def test_ap_wpa2_eap_assoc_rsn(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ ("Normal wpa_supplicant assoc req RSN IE",
- "30140100000fac040100000fac040100000fac01cc00"),
- ("Group management cipher included in assoc req RSN IE",
- "301a0100000fac040100000fac040100000fac01cc000000000fac06") ]
+ tests = [("Normal wpa_supplicant assoc req RSN IE",
+ "30140100000fac040100000fac040100000fac01cc00"),
+ ("Group management cipher included in assoc req RSN IE",
+ "301a0100000fac040100000fac040100000fac01cc000000000fac06")]
for title, ie in tests:
logger.info(title)
set_test_assoc_ie(dev[0], ie)
@@ -6266,8 +6266,8 @@ def test_ap_wpa2_eap_assoc_rsn(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ ("Invalid group cipher", "30060100000fac02", 41),
- ("Invalid pairwise cipher", "300c0100000fac040100000fac02", 42) ]
+ tests = [("Invalid group cipher", "30060100000fac02", 41),
+ ("Invalid pairwise cipher", "300c0100000fac040100000fac02", 42)]
for title, ie, status in tests:
logger.info(title)
set_test_assoc_ie(dev[0], ie)
@@ -6283,10 +6283,10 @@ def test_ap_wpa2_eap_assoc_rsn(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
- tests = [ ("Management frame protection not enabled",
- "30140100000fac040100000fac040100000fac010000", 31),
- ("Unsupported management group cipher",
- "301a0100000fac040100000fac040100000fac01cc000000000fac0b", 46) ]
+ tests = [("Management frame protection not enabled",
+ "30140100000fac040100000fac040100000fac010000", 31),
+ ("Unsupported management group cipher",
+ "301a0100000fac040100000fac040100000fac01cc000000000fac0b", 46)]
for title, ie, status in tests:
logger.info(title)
set_test_assoc_ie(dev[0], ie)
@@ -6467,11 +6467,11 @@ def test_eap_tls_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ "eap_peer_tls_derive_key;eap_tls_success",
- "eap_peer_tls_derive_session_id;eap_tls_success",
- "eap_tls_getKey",
- "eap_tls_get_emsk",
- "eap_tls_get_session_id" ]
+ tests = ["eap_peer_tls_derive_key;eap_tls_success",
+ "eap_peer_tls_derive_session_id;eap_tls_success",
+ "eap_tls_getKey",
+ "eap_tls_get_emsk",
+ "eap_tls_get_session_id"]
for func in tests:
with alloc_fail(dev[0], 1, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="TLS",
@@ -6724,8 +6724,8 @@ def run_openssl_systemwide_policy(iface, apdev, test_params):
'alt-wpa_supplicant/wpa_supplicant/wpa_supplicant')
if not os.path.exists(prg):
prg = '../../wpa_supplicant/wpa_supplicant'
- arg = [ prg, '-BddtK', '-P', pidfile, '-f', logfile,
- '-Dnl80211', '-c', conffile, '-i', iface ]
+ arg = [prg, '-BddtK', '-P', pidfile, '-f', logfile,
+ '-Dnl80211', '-c', conffile, '-i', iface]
logger.info("Start wpa_supplicant: " + str(arg))
subprocess.call(arg, env={'OPENSSL_CONF': openssl_cnf})
wpas = WpaSupplicant(ifname=iface)
diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py
index 71ef74f..556ea46 100644
--- a/tests/hwsim/test_ap_ft.py
+++ b/tests/hwsim/test_ap_ft.py
@@ -24,16 +24,16 @@ from test_ap_psk import check_mib, find_wpas_process, read_process_memory, verif
from test_rrm import check_beacon_req
def ft_base_rsn():
- params = { "wpa": "2",
- "wpa_key_mgmt": "FT-PSK",
- "rsn_pairwise": "CCMP" }
+ params = {"wpa": "2",
+ "wpa_key_mgmt": "FT-PSK",
+ "rsn_pairwise": "CCMP"}
return params
def ft_base_mixed():
- params = { "wpa": "3",
- "wpa_key_mgmt": "WPA-PSK FT-PSK",
- "wpa_pairwise": "TKIP",
- "rsn_pairwise": "CCMP" }
+ params = {"wpa": "3",
+ "wpa_key_mgmt": "WPA-PSK FT-PSK",
+ "wpa_pairwise": "TKIP",
+ "rsn_pairwise": "CCMP"}
return params
def ft_params(rsn=True, ssid=None, passphrase=None):
@@ -64,15 +64,15 @@ def ft_params1(rsn=True, ssid=None, passphrase=None, discovery=False):
params['r0kh'] = "ff:ff:ff:ff:ff:ff * 100102030405060708090a0b0c0d0e0f100102030405060708090a0b0c0d0e0f"
params['r1kh'] = "00:00:00:00:00:00 00:00:00:00:00:00 100102030405060708090a0b0c0d0e0f100102030405060708090a0b0c0d0e0f"
else:
- params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 100102030405060708090a0b0c0d0e0f100102030405060708090a0b0c0d0e0f",
- "02:00:00:00:04:00 nas2.w1.fi 300102030405060708090a0b0c0d0e0f300102030405060708090a0b0c0d0e0f" ]
+ params['r0kh'] = ["02:00:00:00:03:00 nas1.w1.fi 100102030405060708090a0b0c0d0e0f100102030405060708090a0b0c0d0e0f",
+ "02:00:00:00:04:00 nas2.w1.fi 300102030405060708090a0b0c0d0e0f300102030405060708090a0b0c0d0e0f"]
params['r1kh'] = "02:00:00:00:04:00 00:01:02:03:04:06 200102030405060708090a0b0c0d0e0f200102030405060708090a0b0c0d0e0f"
return params
def ft_params1_old_key(rsn=True, ssid=None, passphrase=None):
params = ft_params1a(rsn, ssid, passphrase)
- params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 100102030405060708090a0b0c0d0e0f",
- "02:00:00:00:04:00 nas2.w1.fi 300102030405060708090a0b0c0d0e0f" ]
+ params['r0kh'] = ["02:00:00:00:03:00 nas1.w1.fi 100102030405060708090a0b0c0d0e0f",
+ "02:00:00:00:04:00 nas2.w1.fi 300102030405060708090a0b0c0d0e0f"]
params['r1kh'] = "02:00:00:00:04:00 00:01:02:03:04:06 200102030405060708090a0b0c0d0e0f"
return params
@@ -88,15 +88,15 @@ def ft_params2(rsn=True, ssid=None, passphrase=None, discovery=False):
params['r0kh'] = "ff:ff:ff:ff:ff:ff * 100102030405060708090a0b0c0d0e0f100102030405060708090a0b0c0d0e0f"
params['r1kh'] = "00:00:00:00:00:00 00:00:00:00:00:00 100102030405060708090a0b0c0d0e0f100102030405060708090a0b0c0d0e0f"
else:
- params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0e0f200102030405060708090a0b0c0d0e0f",
- "02:00:00:00:04:00 nas2.w1.fi 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f" ]
+ params['r0kh'] = ["02:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0e0f200102030405060708090a0b0c0d0e0f",
+ "02:00:00:00:04:00 nas2.w1.fi 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f"]
params['r1kh'] = "02:00:00:00:03:00 00:01:02:03:04:05 300102030405060708090a0b0c0d0e0f300102030405060708090a0b0c0d0e0f"
return params
def ft_params2_old_key(rsn=True, ssid=None, passphrase=None):
params = ft_params2a(rsn, ssid, passphrase)
- params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0e0f",
- "02:00:00:00:04:00 nas2.w1.fi 000102030405060708090a0b0c0d0e0f" ]
+ params['r0kh'] = ["02:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0e0f",
+ "02:00:00:00:04:00 nas2.w1.fi 000102030405060708090a0b0c0d0e0f"]
params['r1kh'] = "02:00:00:00:03:00 00:01:02:03:04:05 300102030405060708090a0b0c0d0e0f"
return params
@@ -104,8 +104,8 @@ def ft_params1_r0kh_mismatch(rsn=True, ssid=None, passphrase=None):
params = ft_params(rsn, ssid, passphrase)
params['nas_identifier'] = "nas1.w1.fi"
params['r1_key_holder'] = "000102030405"
- params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 100102030405060708090a0b0c0d0e0f100102030405060708090a0b0c0d0e0f",
- "12:00:00:00:04:00 nas2.w1.fi 300102030405060708090a0b0c0d0e0f300102030405060708090a0b0c0d0e0f" ]
+ params['r0kh'] = ["02:00:00:00:03:00 nas1.w1.fi 100102030405060708090a0b0c0d0e0f100102030405060708090a0b0c0d0e0f",
+ "12:00:00:00:04:00 nas2.w1.fi 300102030405060708090a0b0c0d0e0f300102030405060708090a0b0c0d0e0f"]
params['r1kh'] = "12:00:00:00:04:00 10:01:02:03:04:06 200102030405060708090a0b0c0d0e0f200102030405060708090a0b0c0d0e0f"
return params
@@ -113,8 +113,8 @@ def ft_params2_incorrect_rrb_key(rsn=True, ssid=None, passphrase=None):
params = ft_params(rsn, ssid, passphrase)
params['nas_identifier'] = "nas2.w1.fi"
params['r1_key_holder'] = "000102030406"
- params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0ef1200102030405060708090a0b0c0d0ef1",
- "02:00:00:00:04:00 nas2.w1.fi 000102030405060708090a0b0c0d0ef2000102030405060708090a0b0c0d0ef2" ]
+ params['r0kh'] = ["02:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0ef1200102030405060708090a0b0c0d0ef1",
+ "02:00:00:00:04:00 nas2.w1.fi 000102030405060708090a0b0c0d0ef2000102030405060708090a0b0c0d0ef2"]
params['r1kh'] = "02:00:00:00:03:00 00:01:02:03:04:05 300102030405060708090a0b0c0d0ef3300102030405060708090a0b0c0d0ef3"
return params
@@ -122,8 +122,8 @@ def ft_params2_r0kh_mismatch(rsn=True, ssid=None, passphrase=None):
params = ft_params(rsn, ssid, passphrase)
params['nas_identifier'] = "nas2.w1.fi"
params['r1_key_holder'] = "000102030406"
- params['r0kh'] = [ "12:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0e0f200102030405060708090a0b0c0d0e0f",
- "02:00:00:00:04:00 nas2.w1.fi 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f" ]
+ params['r0kh'] = ["12:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0e0f200102030405060708090a0b0c0d0e0f",
+ "02:00:00:00:04:00 nas2.w1.fi 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f"]
params['r1kh'] = "12:00:00:00:03:00 10:01:02:03:04:05 300102030405060708090a0b0c0d0e0f300102030405060708090a0b0c0d0e0f"
return params
@@ -141,7 +141,7 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False,
copts["ieee80211w"] = "1"
copts["scan_freq"] = "2412"
copts["pairwise"] = pairwise_cipher
- copts["group"] = group_cipher
+ copts["group"] = group_cipher
copts["wpa_ptk_rekey"] = ptk_rekey
if group_mgmt:
copts["group_mgmt"] = group_mgmt
@@ -223,7 +223,7 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False,
def test_ap_ft(dev, apdev):
"""WPA2-PSK-FT AP"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -237,7 +237,7 @@ def test_ap_ft(dev, apdev):
def test_ap_ft_old_key(dev, apdev):
"""WPA2-PSK-FT AP (old key)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1_old_key(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -249,7 +249,7 @@ def test_ap_ft_old_key(dev, apdev):
def test_ap_ft_multi_akm(dev, apdev):
"""WPA2-PSK-FT AP with non-FT AKMs enabled"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["wpa_key_mgmt"] = "FT-PSK WPA-PSK WPA-PSK-SHA256"
@@ -273,7 +273,7 @@ def test_ap_ft_multi_akm(dev, apdev):
def test_ap_ft_local_key_gen(dev, apdev):
"""WPA2-PSK-FT AP with local key generation (without pull/push)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1a(ssid=ssid, passphrase=passphrase)
params['ft_psk_generate_local'] = "1"
@@ -291,7 +291,7 @@ def test_ap_ft_local_key_gen(dev, apdev):
def test_ap_ft_vlan(dev, apdev):
"""WPA2-PSK-FT AP with VLAN"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['dynamic_vlan'] = "1"
@@ -310,7 +310,7 @@ def test_ap_ft_vlan(dev, apdev):
def test_ap_ft_vlan_disconnected(dev, apdev):
"""WPA2-PSK-FT AP with VLAN and local key generation"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1a(ssid=ssid, passphrase=passphrase)
params['dynamic_vlan'] = "1"
@@ -331,7 +331,7 @@ def test_ap_ft_vlan_disconnected(dev, apdev):
def test_ap_ft_vlan_2(dev, apdev):
"""WPA2-PSK-FT AP with VLAN and dest-AP does not have VLAN info locally"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['dynamic_vlan'] = "1"
@@ -350,7 +350,7 @@ def test_ap_ft_vlan_2(dev, apdev):
def test_ap_ft_many(dev, apdev):
"""WPA2-PSK-FT AP multiple times"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -362,7 +362,7 @@ def test_ap_ft_many(dev, apdev):
def test_ap_ft_many_vlan(dev, apdev):
"""WPA2-PSK-FT AP with VLAN multiple times"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['dynamic_vlan'] = "1"
@@ -380,7 +380,7 @@ def test_ap_ft_many_vlan(dev, apdev):
def test_ap_ft_mixed(dev, apdev):
"""WPA2-PSK-FT mixed-mode AP"""
ssid = "test-ft-mixed"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(rsn=False, ssid=ssid, passphrase=passphrase)
hapd = hostapd.add_ap(apdev[0], params)
@@ -396,7 +396,7 @@ def test_ap_ft_mixed(dev, apdev):
def test_ap_ft_pmf(dev, apdev):
"""WPA2-PSK-FT AP with PMF"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["ieee80211w"] = "2"
@@ -428,7 +428,7 @@ def run_ap_ft_pmf_bip(dev, apdev, cipher):
raise HwsimSkip("Cipher %s not supported" % cipher)
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["ieee80211w"] = "2"
@@ -445,7 +445,7 @@ def run_ap_ft_pmf_bip(dev, apdev, cipher):
def test_ap_ft_ocv(dev, apdev):
"""WPA2-PSK-FT AP with OCV"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["ieee80211w"] = "2"
@@ -466,7 +466,7 @@ def test_ap_ft_ocv(dev, apdev):
def test_ap_ft_over_ds(dev, apdev):
"""WPA2-PSK-FT AP over DS"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -474,8 +474,8 @@ def test_ap_ft_over_ds(dev, apdev):
hapd1 = hostapd.add_ap(apdev[1], params)
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True)
- check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-4"),
- ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-4") ])
+ check_mib(dev[0], [("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-4"),
+ ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-4")])
def cleanup_ap_ft_separate_hostapd():
subprocess.call(["brctl", "delif", "br0ft", "veth0"],
@@ -486,7 +486,7 @@ def cleanup_ap_ft_separate_hostapd():
stderr=open('/dev/null', 'w'))
subprocess.call(["ip", "link", "del", "veth1"],
stderr=open('/dev/null', 'w'))
- for ifname in [ 'br0ft', 'br1ft', 'br-ft' ]:
+ for ifname in ['br0ft', 'br1ft', 'br-ft']:
subprocess.call(['ip', 'link', 'set', 'dev', ifname, 'down'],
stderr=open('/dev/null', 'w'))
subprocess.call(['brctl', 'delbr', ifname],
@@ -508,7 +508,7 @@ def test_ap_ft_over_ds_separate_hostapd(dev, apdev, params):
def run_ap_ft_separate_hostapd(dev, apdev, params, over_ds):
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
logdir = params['logdir']
pidfile = os.path.join(logdir, 'ap_ft_over_ds_separate_hostapd.pid')
logfile = os.path.join(logdir, 'ap_ft_over_ds_separate_hostapd.hapd')
@@ -520,10 +520,10 @@ def run_ap_ft_separate_hostapd(dev, apdev, params, over_ds):
subprocess.check_call(['brctl', 'setfd', br_ifname, '0'])
subprocess.check_call(['ip', 'link', 'set', 'dev', br_ifname, 'up'])
- subprocess.check_call([ "ip", "link", "add", "veth0", "type", "veth",
- "peer", "name", "veth0br" ])
- subprocess.check_call([ "ip", "link", "add", "veth1", "type", "veth",
- "peer", "name", "veth1br" ])
+ subprocess.check_call(["ip", "link", "add", "veth0", "type", "veth",
+ "peer", "name", "veth0br"])
+ subprocess.check_call(["ip", "link", "add", "veth1", "type", "veth",
+ "peer", "name", "veth1br"])
subprocess.check_call(['ip', 'link', 'set', 'dev', 'veth0br', 'up'])
subprocess.check_call(['ip', 'link', 'set', 'dev', 'veth1br', 'up'])
subprocess.check_call(['brctl', 'addif', br_ifname, 'veth0br'])
@@ -546,13 +546,13 @@ def run_ap_ft_separate_hostapd(dev, apdev, params, over_ds):
prg = os.path.join(logdir, 'alt-hostapd/hostapd/hostapd')
if not os.path.exists(prg):
prg = '../../hostapd/hostapd'
- cmd = [ prg, '-B', '-ddKt',
- '-P', pidfile, '-f', logfile, '-g', global_ctrl ]
+ cmd = [prg, '-B', '-ddKt',
+ '-P', pidfile, '-f', logfile, '-g', global_ctrl]
subprocess.check_call(cmd)
hglobal = hostapd.HostapdGlobal(global_ctrl_override=global_ctrl)
- apdev_ft = { 'ifname': iface }
- apdev2 = [ apdev_ft, apdev[1] ]
+ apdev_ft = {'ifname': iface}
+ apdev2 = [apdev_ft, apdev[1]]
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["r0kh"] = "ff:ff:ff:ff:ff:ff * 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff"
@@ -581,7 +581,7 @@ def run_ap_ft_separate_hostapd(dev, apdev, params, over_ds):
def test_ap_ft_over_ds_ocv(dev, apdev):
"""WPA2-PSK-FT AP over DS"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["ieee80211w"] = "2"
@@ -603,7 +603,7 @@ def test_ap_ft_over_ds_ocv(dev, apdev):
def test_ap_ft_over_ds_disabled(dev, apdev):
"""WPA2-PSK-FT AP over DS disabled"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['ft_over_ds'] = '0'
@@ -618,7 +618,7 @@ def test_ap_ft_over_ds_disabled(dev, apdev):
def test_ap_ft_vlan_over_ds(dev, apdev):
"""WPA2-PSK-FT AP over DS with VLAN"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['dynamic_vlan'] = "1"
@@ -631,13 +631,13 @@ def test_ap_ft_vlan_over_ds(dev, apdev):
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True,
conndev="brvlan1")
- check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-4"),
- ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-4") ])
+ check_mib(dev[0], [("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-4"),
+ ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-4")])
def test_ap_ft_over_ds_many(dev, apdev):
"""WPA2-PSK-FT AP over DS multiple times"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -650,7 +650,7 @@ def test_ap_ft_over_ds_many(dev, apdev):
def test_ap_ft_vlan_over_ds_many(dev, apdev):
"""WPA2-PSK-FT AP over DS with VLAN multiple times"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['dynamic_vlan'] = "1"
@@ -668,7 +668,7 @@ def test_ap_ft_vlan_over_ds_many(dev, apdev):
def test_ap_ft_over_ds_unknown_target(dev, apdev):
"""WPA2-PSK-FT AP"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -681,7 +681,7 @@ def test_ap_ft_over_ds_unknown_target(dev, apdev):
def test_ap_ft_over_ds_unexpected(dev, apdev):
"""WPA2-PSK-FT AP over DS and unexpected response"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -803,7 +803,7 @@ def run_ap_ft_pmf_bip_over_ds(dev, apdev, cipher):
raise HwsimSkip("Cipher %s not supported" % cipher)
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["ieee80211w"] = "2"
@@ -827,7 +827,7 @@ def run_ap_ft_pmf_bip_over_ds(dev, apdev, cipher):
def test_ap_ft_over_ds_pull(dev, apdev):
"""WPA2-PSK-FT AP over DS (pull PMK)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["pmk_r1_push"] = "0"
@@ -841,7 +841,7 @@ def test_ap_ft_over_ds_pull(dev, apdev):
def test_ap_ft_over_ds_pull_old_key(dev, apdev):
"""WPA2-PSK-FT AP over DS (pull PMK; old key)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1_old_key(ssid=ssid, passphrase=passphrase)
params["pmk_r1_push"] = "0"
@@ -855,7 +855,7 @@ def test_ap_ft_over_ds_pull_old_key(dev, apdev):
def test_ap_ft_over_ds_pull_vlan(dev, apdev):
"""WPA2-PSK-FT AP over DS (pull PMK) with VLAN"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["pmk_r1_push"] = "0"
@@ -876,7 +876,7 @@ def test_ap_ft_sae(dev, apdev):
if "SAE" not in dev[0].get_capability("auth_alg"):
raise HwsimSkip("SAE not supported")
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['wpa_key_mgmt'] = "FT-SAE"
@@ -896,7 +896,7 @@ def test_ap_ft_sae_over_ds(dev, apdev):
if "SAE" not in dev[0].get_capability("auth_alg"):
raise HwsimSkip("SAE not supported")
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['wpa_key_mgmt'] = "FT-SAE"
@@ -933,16 +933,16 @@ def test_ap_ft_sae_pw_id(dev, apdev):
def generic_ap_ft_eap(dev, apdev, vlan=False, cui=False, over_ds=False,
discovery=False, roams=1):
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
if vlan:
- identity="gpsk-vlan1"
- conndev="brvlan1"
+ identity = "gpsk-vlan1"
+ conndev = "brvlan1"
elif cui:
- identity="gpsk-cui"
- conndev=False
+ identity = "gpsk-cui"
+ conndev = False
else:
- identity="gpsk user"
- conndev=False
+ identity = "gpsk user"
+ conndev = False
radius = hostapd.radius_params()
params = ft_params1(ssid=ssid, passphrase=passphrase, discovery=discovery)
@@ -968,8 +968,8 @@ def generic_ap_ft_eap(dev, apdev, vlan=False, cui=False, over_ds=False,
conndev=conndev)
if "[WPA2-FT/EAP-CCMP]" not in dev[0].request("SCAN_RESULTS"):
raise Exception("Scan results missing RSN element info")
- check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-3"),
- ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-3") ])
+ check_mib(dev[0], [("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-3"),
+ ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-3")])
# Verify EAPOL reauthentication after FT protocol
if dev[0].get_status_field('bssid') == apdev[0]['bssid']:
@@ -1036,13 +1036,13 @@ def test_ap_ft_eap_vlan_over_ds_multi(dev, apdev):
def generic_ap_ft_eap_pull(dev, apdev, vlan=False):
"""WPA2-EAP-FT AP (pull PMK)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
if vlan:
- identity="gpsk-vlan1"
- conndev="brvlan1"
+ identity = "gpsk-vlan1"
+ conndev = "brvlan1"
else:
- identity="gpsk user"
- conndev=False
+ identity = "gpsk user"
+ conndev = False
radius = hostapd.radius_params()
params = ft_params1(ssid=ssid, passphrase=passphrase)
@@ -1078,7 +1078,7 @@ def test_ap_ft_eap_pull_vlan(dev, apdev):
def test_ap_ft_eap_pull_wildcard(dev, apdev):
"""WPA2-EAP-FT AP (pull PMK) - wildcard R0KH/R1KH"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
radius = hostapd.radius_params()
params = ft_params1(ssid=ssid, passphrase=passphrase, discovery=True)
@@ -1108,7 +1108,7 @@ def test_ap_ft_eap_pull_wildcard(dev, apdev):
def test_ap_ft_mismatching_rrb_key_push(dev, apdev):
"""WPA2-PSK-FT AP over DS with mismatching RRB key (push)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["ieee80211w"] = "2"
@@ -1124,7 +1124,7 @@ def test_ap_ft_mismatching_rrb_key_push(dev, apdev):
def test_ap_ft_mismatching_rrb_key_pull(dev, apdev):
"""WPA2-PSK-FT AP over DS with mismatching RRB key (pull)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["pmk_r1_push"] = "0"
@@ -1140,7 +1140,7 @@ def test_ap_ft_mismatching_rrb_key_pull(dev, apdev):
def test_ap_ft_mismatching_r0kh_id_pull(dev, apdev):
"""WPA2-PSK-FT AP over DS with mismatching R0KH-ID (pull)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["pmk_r1_push"] = "0"
@@ -1160,7 +1160,7 @@ def test_ap_ft_mismatching_r0kh_id_pull(dev, apdev):
def test_ap_ft_mismatching_rrb_r0kh_push(dev, apdev):
"""WPA2-PSK-FT AP over DS with mismatching R0KH key (push)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["ieee80211w"] = "2"
@@ -1176,7 +1176,7 @@ def test_ap_ft_mismatching_rrb_r0kh_push(dev, apdev):
def test_ap_ft_mismatching_rrb_r0kh_pull(dev, apdev):
"""WPA2-PSK-FT AP over DS with mismatching R0KH key (pull)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1_r0kh_mismatch(ssid=ssid, passphrase=passphrase)
params["pmk_r1_push"] = "0"
@@ -1191,7 +1191,7 @@ def test_ap_ft_mismatching_rrb_r0kh_pull(dev, apdev):
def test_ap_ft_mismatching_rrb_key_push_eap(dev, apdev):
"""WPA2-EAP-FT AP over DS with mismatching RRB key (push)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
radius = hostapd.radius_params()
params = ft_params1(ssid=ssid, passphrase=passphrase)
@@ -1213,7 +1213,7 @@ def test_ap_ft_mismatching_rrb_key_push_eap(dev, apdev):
def test_ap_ft_mismatching_rrb_key_pull_eap(dev, apdev):
"""WPA2-EAP-FT AP over DS with mismatching RRB key (pull)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
radius = hostapd.radius_params()
params = ft_params1(ssid=ssid, passphrase=passphrase)
@@ -1235,7 +1235,7 @@ def test_ap_ft_mismatching_rrb_key_pull_eap(dev, apdev):
def test_ap_ft_mismatching_r0kh_id_pull_eap(dev, apdev):
"""WPA2-EAP-FT AP over DS with mismatching R0KH-ID (pull)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
radius = hostapd.radius_params()
params = ft_params1(ssid=ssid, passphrase=passphrase)
@@ -1263,7 +1263,7 @@ def test_ap_ft_mismatching_r0kh_id_pull_eap(dev, apdev):
def test_ap_ft_mismatching_rrb_r0kh_push_eap(dev, apdev):
"""WPA2-EAP-FT AP over DS with mismatching R0KH key (push)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
radius = hostapd.radius_params()
params = ft_params1(ssid=ssid, passphrase=passphrase)
@@ -1285,7 +1285,7 @@ def test_ap_ft_mismatching_rrb_r0kh_push_eap(dev, apdev):
def test_ap_ft_mismatching_rrb_r0kh_pull_eap(dev, apdev):
"""WPA2-EAP-FT AP over DS with mismatching R0KH key (pull)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
radius = hostapd.radius_params()
params = ft_params1_r0kh_mismatch(ssid=ssid, passphrase=passphrase)
@@ -1307,7 +1307,7 @@ def test_ap_ft_mismatching_rrb_r0kh_pull_eap(dev, apdev):
def test_ap_ft_gtk_rekey(dev, apdev):
"""WPA2-PSK-FT AP and GTK rekey"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['wpa_group_rekey'] = '1'
@@ -1339,7 +1339,7 @@ def test_ap_ft_gtk_rekey(dev, apdev):
def test_ft_psk_key_lifetime_in_memory(dev, apdev, params):
"""WPA2-PSK-FT and key lifetime in memory"""
ssid = "test-ft"
- passphrase="04c2726b4b8d5f1b4db9c07aa4d9e9d8f765cb5d25ec817e6cc4fcdd5255db0"
+ passphrase = "04c2726b4b8d5f1b4db9c07aa4d9e9d8f765cb5d25ec817e6cc4fcdd5255db0"
psk = '93c90846ff67af9037ed83fb72b63dbeddaa81d47f926c20909b5886f1d9358d'
pmk = binascii.unhexlify(psk)
p = ft_params1(ssid=ssid, passphrase=passphrase)
@@ -1448,7 +1448,7 @@ def test_ft_psk_key_lifetime_in_memory(dev, apdev, params):
def test_ap_ft_invalid_resp(dev, apdev):
"""WPA2-PSK-FT AP and invalid response IEs"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1473,7 +1473,7 @@ def test_ap_ft_invalid_resp(dev, apdev):
# RIC missing from protected IE count.
"020002000000" + "3603a1b201" + "375200020203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001" + "3900",
# Protected IE missing.
- "020002000000" + "3603a1b201" + "375200ff0203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001" + "3900" + "0000" ]
+ "020002000000" + "3603a1b201" + "375200ff0203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001" + "3900" + "0000"]
for t in tests:
dev[0].scan_for_bss(apdev[1]['bssid'], freq="2412")
hapd1.set("ext_mgmt_frame_handling", "1")
@@ -1507,7 +1507,7 @@ def test_ap_ft_gcmp_256(dev, apdev):
if "GCMP-256" not in dev[0].get_capability("pairwise"):
raise HwsimSkip("Cipher GCMP-256 not supported")
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['rsn_pairwise'] = "GCMP-256"
@@ -1522,7 +1522,7 @@ def test_ap_ft_gcmp_256(dev, apdev):
def setup_ap_ft_oom(dev, apdev):
skip_with_fips(dev[0])
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1561,7 +1561,7 @@ def test_ap_ft_oom3(dev, apdev):
def test_ap_ft_oom4(dev, apdev):
"""WPA2-PSK-FT and OOM (4)"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
dst = setup_ap_ft_oom(dev, apdev)
dev[0].request("REMOVE_NETWORK all")
with alloc_fail(dev[0], 1, "=sme_update_ft_ies"):
@@ -1571,7 +1571,7 @@ def test_ap_ft_oom4(dev, apdev):
def test_ap_ft_ap_oom(dev, apdev):
"""WPA2-PSK-FT and AP OOM"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1592,7 +1592,7 @@ def test_ap_ft_ap_oom(dev, apdev):
def test_ap_ft_ap_oom2(dev, apdev):
"""WPA2-PSK-FT and AP OOM 2"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1616,7 +1616,7 @@ def test_ap_ft_ap_oom2(dev, apdev):
def test_ap_ft_ap_oom3(dev, apdev):
"""WPA2-PSK-FT and AP OOM 3"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1645,7 +1645,7 @@ def test_ap_ft_ap_oom3(dev, apdev):
def test_ap_ft_ap_oom3b(dev, apdev):
"""WPA2-PSK-FT and AP OOM 3b"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1666,7 +1666,7 @@ def test_ap_ft_ap_oom3b(dev, apdev):
def test_ap_ft_ap_oom4(dev, apdev):
"""WPA2-PSK-FT and AP OOM 4"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1698,7 +1698,7 @@ def test_ap_ft_ap_oom4(dev, apdev):
def test_ap_ft_ap_oom5(dev, apdev):
"""WPA2-PSK-FT and AP OOM 5"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1735,7 +1735,7 @@ def test_ap_ft_ap_oom5(dev, apdev):
def test_ap_ft_ap_oom6(dev, apdev):
"""WPA2-PSK-FT and AP OOM 6"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1759,7 +1759,7 @@ def test_ap_ft_ap_oom6(dev, apdev):
def test_ap_ft_ap_oom7a(dev, apdev):
"""WPA2-PSK-FT and AP OOM 7a"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["ieee80211w"] = "2"
@@ -1782,7 +1782,7 @@ def test_ap_ft_ap_oom7a(dev, apdev):
def test_ap_ft_ap_oom7b(dev, apdev):
"""WPA2-PSK-FT and AP OOM 7b"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["ieee80211w"] = "2"
@@ -1805,7 +1805,7 @@ def test_ap_ft_ap_oom7b(dev, apdev):
def test_ap_ft_ap_oom7c(dev, apdev):
"""WPA2-PSK-FT and AP OOM 7c"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["ieee80211w"] = "2"
@@ -1828,7 +1828,7 @@ def test_ap_ft_ap_oom7c(dev, apdev):
def test_ap_ft_ap_oom7d(dev, apdev):
"""WPA2-PSK-FT and AP OOM 7d"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["ieee80211w"] = "2"
@@ -1851,7 +1851,7 @@ def test_ap_ft_ap_oom7d(dev, apdev):
def test_ap_ft_ap_oom8(dev, apdev):
"""WPA2-PSK-FT and AP OOM 8"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['ft_psk_generate_local'] = "1"
@@ -1877,7 +1877,7 @@ def test_ap_ft_ap_oom8(dev, apdev):
def test_ap_ft_ap_oom9(dev, apdev):
"""WPA2-PSK-FT and AP OOM 9"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1913,7 +1913,7 @@ def test_ap_ft_ap_oom9(dev, apdev):
def test_ap_ft_ap_oom10(dev, apdev):
"""WPA2-PSK-FT and AP OOM 10"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1955,7 +1955,7 @@ def test_ap_ft_ap_oom10(dev, apdev):
def test_ap_ft_ap_oom11(dev, apdev):
"""WPA2-PSK-FT and AP OOM 11"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1976,7 +1976,7 @@ def test_ap_ft_ap_oom11(dev, apdev):
def test_ap_ft_over_ds_proto_ap(dev, apdev):
"""WPA2-PSK-FT AP over DS protocol testing for AP processing"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -1995,26 +1995,26 @@ def test_ap_ft_over_ds_proto_ap(dev, apdev):
hapd0.set("ext_mgmt_frame_handling", "1")
hdr = "d0003a01" + _bssid0 + _addr + _bssid0 + "1000"
valid = "0601" + _addr + _bssid1
- tests = [ "0601",
- "0601" + _addr,
- "0601" + _addr + _bssid0,
- "0601" + _addr + "ffffffffffff",
- "0601" + _bssid0 + _bssid0,
- valid,
- valid + "01",
- valid + "3700",
- valid + "3600",
- valid + "3603ffffff",
- valid + "3603a1b2ff",
- valid + "3603a1b2ff" + "3700",
- valid + "3603a1b2ff" + "37520000" + 16*"00" + 32*"00" + 32*"00",
- valid + "3603a1b2ff" + "37520001" + 16*"00" + 32*"00" + 32*"00",
- valid + "3603a1b2ff" + "37550000" + 16*"00" + 32*"00" + 32*"00" + "0301aa",
- valid + "3603a1b2ff" + "37550000" + 16*"00" + 32*"00" + 32*"00" + "0301aa" + "3000",
- valid + "3603a1b2ff" + "37550000" + 16*"00" + 32*"00" + 32*"00" + "0301aa" + "30260100000fac040100000fac040100000facff00000100a225368fe0983b5828a37a0acb37f253",
- valid + "3603a1b2ff" + "37550000" + 16*"00" + 32*"00" + 32*"00" + "0301aa" + "30260100000fac040100000fac030100000fac0400000100a225368fe0983b5828a37a0acb37f253",
- valid + "3603a1b2ff" + "37550000" + 16*"00" + 32*"00" + 32*"00" + "0301aa" + "30260100000fac040100000fac040100000fac0400000100a225368fe0983b5828a37a0acb37f253",
- valid + "0001" ]
+ tests = ["0601",
+ "0601" + _addr,
+ "0601" + _addr + _bssid0,
+ "0601" + _addr + "ffffffffffff",
+ "0601" + _bssid0 + _bssid0,
+ valid,
+ valid + "01",
+ valid + "3700",
+ valid + "3600",
+ valid + "3603ffffff",
+ valid + "3603a1b2ff",
+ valid + "3603a1b2ff" + "3700",
+ valid + "3603a1b2ff" + "37520000" + 16*"00" + 32*"00" + 32*"00",
+ valid + "3603a1b2ff" + "37520001" + 16*"00" + 32*"00" + 32*"00",
+ valid + "3603a1b2ff" + "37550000" + 16*"00" + 32*"00" + 32*"00" + "0301aa",
+ valid + "3603a1b2ff" + "37550000" + 16*"00" + 32*"00" + 32*"00" + "0301aa" + "3000",
+ valid + "3603a1b2ff" + "37550000" + 16*"00" + 32*"00" + 32*"00" + "0301aa" + "30260100000fac040100000fac040100000facff00000100a225368fe0983b5828a37a0acb37f253",
+ valid + "3603a1b2ff" + "37550000" + 16*"00" + 32*"00" + 32*"00" + "0301aa" + "30260100000fac040100000fac030100000fac0400000100a225368fe0983b5828a37a0acb37f253",
+ valid + "3603a1b2ff" + "37550000" + 16*"00" + 32*"00" + 32*"00" + "0301aa" + "30260100000fac040100000fac040100000fac0400000100a225368fe0983b5828a37a0acb37f253",
+ valid + "0001"]
for t in tests:
hapd0.dump_monitor()
if "OK" not in hapd0.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + t):
@@ -2025,7 +2025,7 @@ def test_ap_ft_over_ds_proto_ap(dev, apdev):
def test_ap_ft_over_ds_proto(dev, apdev):
"""WPA2-PSK-FT AP over DS protocol testing"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -2077,7 +2077,7 @@ def test_ap_ft_over_ds_proto(dev, apdev):
def test_ap_ft_rrb(dev, apdev):
"""WPA2-PSK-FT RRB protocol testing"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -2085,8 +2085,8 @@ def test_ap_ft_rrb(dev, apdev):
dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2",
scan_freq="2412")
- _dst_ll = binascii.unhexlify(apdev[0]['bssid'].replace(':',''))
- _src_ll = binascii.unhexlify(dev[0].own_addr().replace(':',''))
+ _dst_ll = binascii.unhexlify(apdev[0]['bssid'].replace(':', ''))
+ _src_ll = binascii.unhexlify(dev[0].own_addr().replace(':', ''))
proto = b'\x89\x0d'
ehdr = _dst_ll + _src_ll + proto
@@ -2170,7 +2170,7 @@ def test_rsn_ie_proto_ft_psk_sta(dev, apdev):
"""RSN element protocol testing for FT-PSK + PMF cases on STA side"""
bssid = apdev[0]['bssid']
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["ieee80211w"] = "1"
@@ -2181,17 +2181,17 @@ def test_rsn_ie_proto_ft_psk_sta(dev, apdev):
ieee80211w="1", scan_freq="2412",
pairwise="CCMP", group="CCMP")
- tests = [ ('PMKIDCount field included',
- '30160100000fac040100000fac040100000fac048c000000' + '3603a1b201'),
- ('Extra IE before RSNE',
- 'dd0400000000' + '30140100000fac040100000fac040100000fac048c00' + '3603a1b201'),
- ('PMKIDCount and Group Management Cipher suite fields included',
- '301a0100000fac040100000fac040100000fac048c000000000fac06' + '3603a1b201'),
- ('Extra octet after defined fields (future extensibility)',
- '301b0100000fac040100000fac040100000fac048c000000000fac0600' + '3603a1b201'),
- ('No RSN Capabilities field (PMF disabled in practice)',
- '30120100000fac040100000fac040100000fac04' + '3603a1b201') ]
- for txt,ie in tests:
+ tests = [('PMKIDCount field included',
+ '30160100000fac040100000fac040100000fac048c000000' + '3603a1b201'),
+ ('Extra IE before RSNE',
+ 'dd0400000000' + '30140100000fac040100000fac040100000fac048c00' + '3603a1b201'),
+ ('PMKIDCount and Group Management Cipher suite fields included',
+ '301a0100000fac040100000fac040100000fac048c000000000fac06' + '3603a1b201'),
+ ('Extra octet after defined fields (future extensibility)',
+ '301b0100000fac040100000fac040100000fac048c000000000fac0600' + '3603a1b201'),
+ ('No RSN Capabilities field (PMF disabled in practice)',
+ '30120100000fac040100000fac040100000fac04' + '3603a1b201')]
+ for txt, ie in tests:
dev[0].request("DISCONNECT")
dev[0].wait_disconnected()
logger.info(txt)
@@ -2237,7 +2237,7 @@ def test_rsn_ie_proto_ft_psk_sta(dev, apdev):
def test_ap_ft_ptk_rekey(dev, apdev):
"""WPA2-PSK-FT PTK rekeying triggered by station after roam"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -2262,7 +2262,7 @@ def test_ap_ft_ptk_rekey(dev, apdev):
def test_ap_ft_ptk_rekey_ap(dev, apdev):
"""WPA2-PSK-FT PTK rekeying triggered by AP after roam"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['wpa_ptk_rekey'] = '2'
@@ -2289,7 +2289,7 @@ def test_ap_ft_ptk_rekey_ap(dev, apdev):
def test_ap_ft_internal_rrb_check(dev, apdev):
"""RRB internal delivery only to WPA enabled BSS"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
radius = hostapd.radius_params()
params = ft_params1(ssid=ssid, passphrase=passphrase)
@@ -2301,7 +2301,7 @@ def test_ap_ft_internal_rrb_check(dev, apdev):
if key_mgmt.split(' ')[0] != "FT-EAP":
raise Exception("Unexpected GET_CONFIG(key_mgmt): " + key_mgmt)
- hapd1 = hostapd.add_ap(apdev[1], { "ssid" : ssid })
+ hapd1 = hostapd.add_ap(apdev[1], {"ssid": ssid})
# Connect to WPA enabled AP
dev[0].connect(ssid, key_mgmt="FT-EAP", proto="WPA2", ieee80211w="1",
@@ -2316,7 +2316,7 @@ def test_ap_ft_internal_rrb_check(dev, apdev):
def test_ap_ft_extra_ie(dev, apdev):
"""WPA2-PSK-FT AP with WPA2-PSK enabled and unexpected MDE"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["wpa_key_mgmt"] = "WPA-PSK FT-PSK"
@@ -2345,7 +2345,7 @@ def test_ap_ft_extra_ie(dev, apdev):
def test_ap_ft_ric(dev, apdev):
"""WPA2-PSK-FT AP and RIC"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -2357,14 +2357,14 @@ def test_ap_ft_ric(dev, apdev):
if "FAIL" not in dev[0].request("SET ric_ies q"):
raise Exception("Invalid ric_ies value accepted")
- tests = [ "3900",
- "3900ff04eeeeeeee",
- "390400000000",
- "390400000000" + "390400000000",
- "390400000000" + "dd050050f20202",
- "390400000000" + "dd3d0050f2020201" + 55*"00",
- "390400000000" + "dd3d0050f2020201aa300010270000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000040420f00ffff0000",
- "390401010000" + "dd3d0050f2020201aa3000dc050000000000000000000000000000000000000000000000000000dc050000000000000000000000000000808d5b0028230000" ]
+ tests = ["3900",
+ "3900ff04eeeeeeee",
+ "390400000000",
+ "390400000000" + "390400000000",
+ "390400000000" + "dd050050f20202",
+ "390400000000" + "dd3d0050f2020201" + 55*"00",
+ "390400000000" + "dd3d0050f2020201aa300010270000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000040420f00ffff0000",
+ "390401010000" + "dd3d0050f2020201aa3000dc050000000000000000000000000000000000000000000000000000dc050000000000000000000000000000808d5b0028230000"]
for t in tests:
dev[0].set("ric_ies", t)
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase,
@@ -2379,7 +2379,7 @@ def ie_hex(ies, id):
def test_ap_ft_reassoc_proto(dev, apdev):
"""WPA2-PSK-FT AP Reassociation Request frame parsing"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -2420,43 +2420,43 @@ def test_ap_ft_reassoc_proto(dev, apdev):
rsne = ie_hex(ies, 48)
mde = ie_hex(ies, 54)
fte = ie_hex(ies, 55)
- tests = [ ]
+ tests = []
# RSN: Trying to use FT, but MDIE not included
- tests += [ rsne ]
+ tests += [rsne]
# RSN: Attempted to use unknown MDIE
- tests += [ rsne + "3603000000" ]
+ tests += [rsne + "3603000000"]
# Invalid RSN pairwise cipher
- tests += [ "30260100000fac040100000fac030100000fac040000010029208a42cd25c85aa571567dce10dae3" ]
+ tests += ["30260100000fac040100000fac030100000fac040000010029208a42cd25c85aa571567dce10dae3"]
# FT: No PMKID in RSNIE
- tests += [ "30160100000fac040100000fac040100000fac0400000000" + ie_hex(ies, 54) ]
+ tests += ["30160100000fac040100000fac040100000fac0400000000" + ie_hex(ies, 54)]
# FT: Invalid FTIE
- tests += [ rsne + mde ]
+ tests += [rsne + mde]
# FT: RIC IE(s) in the frame, but not included in protected IE count
# FT: Failed to parse FT IEs
- tests += [ rsne + mde + fte + "3900" ]
+ tests += [rsne + mde + fte + "3900"]
# FT: SNonce mismatch in FTIE
- tests += [ rsne + mde + "37520000" + 16*"00" + 32*"00" + 32*"00" ]
+ tests += [rsne + mde + "37520000" + 16*"00" + 32*"00" + 32*"00"]
# FT: ANonce mismatch in FTIE
- tests += [ rsne + mde + fte[0:40] + 32*"00" + fte[104:] ]
+ tests += [rsne + mde + fte[0:40] + 32*"00" + fte[104:]]
# FT: No R0KH-ID subelem in FTIE
- tests += [ rsne + mde + "3752" + fte[4:168] ]
+ tests += [rsne + mde + "3752" + fte[4:168]]
# FT: R0KH-ID in FTIE did not match with the current R0KH-ID
- tests += [ rsne + mde + "3755" + fte[4:168] + "0301ff" ]
+ tests += [rsne + mde + "3755" + fte[4:168] + "0301ff"]
# FT: No R1KH-ID subelem in FTIE
- tests += [ rsne + mde + "375e" + fte[4:168] + "030a" + binascii.hexlify(b"nas1.w1.fi").decode() ]
+ tests += [rsne + mde + "375e" + fte[4:168] + "030a" + binascii.hexlify(b"nas1.w1.fi").decode()]
# FT: Unknown R1KH-ID used in ReassocReq
- tests += [ rsne + mde + "3766" + fte[4:168] + "030a" + binascii.hexlify(b"nas1.w1.fi").decode() + "0106000000000000" ]
+ tests += [rsne + mde + "3766" + fte[4:168] + "030a" + binascii.hexlify(b"nas1.w1.fi").decode() + "0106000000000000"]
# FT: PMKID in Reassoc Req did not match with the PMKR1Name derived from auth request
- tests += [ rsne[:-32] + 16*"00" + mde + fte ]
+ tests += [rsne[:-32] + 16*"00" + mde + fte]
# Invalid MIC in FTIE
- tests += [ rsne + mde + fte[0:8] + 16*"00" + fte[40:] ]
+ tests += [rsne + mde + fte[0:8] + 16*"00" + fte[40:]]
for t in tests:
hapd2ap.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + ies1 + t)
def test_ap_ft_reassoc_local_fail(dev, apdev):
"""WPA2-PSK-FT AP Reassociation Request frame and local failure"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -2485,7 +2485,7 @@ def test_ap_ft_reassoc_replay(dev, apdev, params):
"""WPA2-PSK-FT AP and replayed Reassociation Request frame"""
capfile = os.path.join(params['logdir'], "hwsim0.pcapng")
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0], params)
@@ -2555,7 +2555,7 @@ def test_ap_ft_reassoc_replay(dev, apdev, params):
filt = "wlan.fc.type == 2 && " + \
"wlan.da == " + sta + " && " + \
"wlan.sa == " + ap
- fields = [ "wlan.ccmp.extiv" ]
+ fields = ["wlan.ccmp.extiv"]
res = run_tshark(capfile, filt, fields)
vals = res.splitlines()
logger.info("CCMP PN: " + str(vals))
@@ -2570,7 +2570,7 @@ def test_ap_ft_reassoc_replay(dev, apdev, params):
def test_ap_ft_psk_file(dev, apdev):
"""WPA2-PSK-FT AP with PSK from a file"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1a(ssid=ssid, passphrase=passphrase)
params['wpa_psk_file'] = 'hostapd.wpa_psk'
@@ -2601,7 +2601,7 @@ def test_ap_ft_psk_file(dev, apdev):
def test_ap_ft_eap_ap_config_change(dev, apdev):
"""WPA2-EAP-FT AP changing from 802.1X-only to FT-only"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
bssid = apdev[0]['bssid']
radius = hostapd.radius_params()
@@ -2636,7 +2636,7 @@ def test_ap_ft_eap_ap_config_change(dev, apdev):
def test_ap_ft_eap_sha384(dev, apdev):
"""WPA2-EAP-FT with SHA384"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
radius = hostapd.radius_params()
params = ft_params1(ssid=ssid, passphrase=passphrase)
@@ -2658,7 +2658,7 @@ def test_ap_ft_eap_sha384(dev, apdev):
def test_ap_ft_eap_sha384_over_ds(dev, apdev):
"""WPA2-EAP-FT with SHA384 over DS"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
radius = hostapd.radius_params()
params = ft_params1(ssid=ssid, passphrase=passphrase)
@@ -2680,7 +2680,7 @@ def test_ap_ft_eap_sha384_over_ds(dev, apdev):
def test_ap_ft_roam_rrm(dev, apdev):
"""WPA2-PSK-FT AP and radio measurement request"""
ssid = "test-ft"
- passphrase="12345678"
+ passphrase = "12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params["rrm_beacon_report"] = "1"
diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py
index 937d6fa..5a11207 100644
--- a/tests/hwsim/test_ap_hs20.py
+++ b/tests/hwsim/test_ap_hs20.py
@@ -41,15 +41,15 @@ def hs20_ap_params(ssid="test-hs20"):
params['uesa'] = "0"
params['venue_group'] = "7"
params['venue_type'] = "1"
- params['venue_name'] = [ "eng:Example venue", "fin:Esimerkkipaikka" ]
- params['roaming_consortium'] = [ "112233", "1020304050", "010203040506",
- "fedcba" ]
+ params['venue_name'] = ["eng:Example venue", "fin:Esimerkkipaikka"]
+ params['roaming_consortium'] = ["112233", "1020304050", "010203040506",
+ "fedcba"]
params['domain_name'] = "example.com,another.example.com"
- params['nai_realm'] = [ "0,example.com,13[5:6],21[2:4][5:7]",
- "0,another.example.com" ]
+ params['nai_realm'] = ["0,example.com,13[5:6],21[2:4][5:7]",
+ "0,another.example.com"]
params['hs20'] = "1"
params['hs20_wan_metrics'] = "01:8000:1000:80:240:3000"
- params['hs20_conn_capab'] = [ "1:0:2", "6:22:1", "17:5060:0" ]
+ params['hs20_conn_capab'] = ["1:0:2", "6:22:1", "17:5060:0"]
params['hs20_operating_class'] = "5173"
params['anqp_3gpp_cell_net'] = "244,91"
return params
@@ -174,13 +174,13 @@ def test_ap_anqp_sharing(dev, apdev):
bssid2 = apdev[1]['bssid']
params = hs20_ap_params()
params['hessid'] = bssid
- params['nai_realm'] = [ "0,example.com,13[5:6],21[2:4][5:7]" ]
+ params['nai_realm'] = ["0,example.com,13[5:6],21[2:4][5:7]"]
hostapd.add_ap(apdev[1], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com", 'username': "test",
- 'password': "secret",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com", 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com"})
logger.info("Normal network selection with shared ANQP results")
dev[0].scan_for_bss(bssid, freq="2412")
dev[0].scan_for_bss(bssid2, freq="2412")
@@ -234,9 +234,9 @@ def test_ap_anqp_domain_id(dev, apdev):
hostapd.add_ap(apdev[1], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com", 'username': "test",
- 'password': "secret",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com", 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com"})
dev[0].scan_for_bss(bssid, freq="2412")
dev[0].scan_for_bss(bssid2, freq="2412")
interworking_select(dev[0], None, "home", freq="2412")
@@ -254,13 +254,13 @@ def test_ap_anqp_no_sharing_diff_ess(dev, apdev):
bssid2 = apdev[1]['bssid']
params = hs20_ap_params(ssid="test-hs20-another")
params['hessid'] = bssid
- params['nai_realm'] = [ "0,example.com,13[5:6],21[2:4][5:7]" ]
+ params['nai_realm'] = ["0,example.com,13[5:6],21[2:4][5:7]"]
hostapd.add_ap(apdev[1], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com", 'username': "test",
- 'password': "secret",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com", 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com"})
logger.info("Normal network selection with shared ANQP results")
dev[0].scan_for_bss(bssid, freq="2412")
dev[0].scan_for_bss(bssid2, freq="2412")
@@ -283,13 +283,13 @@ def test_ap_anqp_no_sharing_missing_info(dev, apdev):
bssid2 = apdev[1]['bssid']
params = hs20_ap_params()
params['hessid'] = bssid
- params['nai_realm'] = [ "0,example.com,13[5:6],21[2:4][5:7]" ]
+ params['nai_realm'] = ["0,example.com,13[5:6],21[2:4][5:7]"]
hostapd.add_ap(apdev[1], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com", 'username': "test",
- 'password': "secret",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com", 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com"})
logger.info("Normal network selection with shared ANQP results")
dev[0].scan_for_bss(bssid, freq="2412")
dev[0].scan_for_bss(bssid2, freq="2412")
@@ -308,13 +308,13 @@ def test_ap_anqp_sharing_oom(dev, apdev):
bssid2 = apdev[1]['bssid']
params = hs20_ap_params()
params['hessid'] = bssid
- params['nai_realm'] = [ "0,example.com,13[5:6],21[2:4][5:7]" ]
+ params['nai_realm'] = ["0,example.com,13[5:6],21[2:4][5:7]"]
hostapd.add_ap(apdev[1], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com", 'username': "test",
- 'password': "secret",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com", 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com"})
dev[0].scan_for_bss(bssid, freq="2412")
dev[0].scan_for_bss(bssid2, freq="2412")
interworking_select(dev[0], None, "home", freq="2412")
@@ -331,8 +331,8 @@ def test_ap_nai_home_realm_query(dev, apdev):
check_eap_capa(dev[0], "MSCHAPV2")
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.com,13[5:6],21[2:4][5:7]",
- "0,another.example.org" ]
+ params['nai_realm'] = ["0,example.com,13[5:6],21[2:4][5:7]",
+ "0,another.example.org"]
hostapd.add_ap(apdev[0], params)
dev[0].scan(freq="2412")
@@ -360,9 +360,9 @@ def test_ap_nai_home_realm_query(dev, apdev):
if binascii.hexlify(b"example.org").decode() not in nai2:
raise Exception("Non-home realm not reported in wildcard query ")
- cmds = [ "foo",
- "00:11:22:33:44:55 123",
- "00:11:22:33:44:55 qq" ]
+ cmds = ["foo",
+ "00:11:22:33:44:55 123",
+ "00:11:22:33:44:55 qq"]
for cmd in cmds:
if "FAIL" not in dev[0].request("HS20_GET_NAI_HOME_REALM_LIST " + cmd):
raise Exception("Invalid HS20_GET_NAI_HOME_REALM_LIST accepted: " + cmd)
@@ -386,9 +386,9 @@ def test_ap_nai_home_realm_query(dev, apdev):
if "NAI Realm list" not in ev:
raise Exception("Missing NAI Realm list: " + ev)
- dev[0].add_cred_values({ 'realm': "example.com", 'username': "test",
- 'password': "secret",
- 'domain': "example.com" })
+ dev[0].add_cred_values({'realm': "example.com", 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com"})
dev[0].dump_monitor()
if "OK" not in dev[0].request("HS20_GET_NAI_HOME_REALM_LIST " + bssid):
raise Exception("HS20_GET_NAI_HOME_REALM_LIST failed")
@@ -499,15 +499,15 @@ def test_ap_hs20_select(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com", 'username': "test",
- 'password': "secret",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com", 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com"})
interworking_select(dev[0], bssid, "home")
dev[0].remove_cred(id)
- id = dev[0].add_cred_values({ 'realm': "example.com", 'username': "test",
- 'password': "secret",
- 'domain': "no.match.example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com", 'username': "test",
+ 'password': "secret",
+ 'domain': "no.match.example.com"})
interworking_select(dev[0], bssid, "roaming", freq="2412")
dev[0].set_cred_quoted(id, "realm", "no.match.example.com")
@@ -519,14 +519,14 @@ def test_ap_hs20_select(dev, apdev):
bssid2 = apdev[1]['bssid']
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.org,21" ]
+ params['nai_realm'] = ["0,example.org,21"]
params['hessid'] = bssid2
params['domain_name'] = "example.org"
hostapd.add_ap(apdev[1], params)
dev[0].remove_cred(id)
- id = dev[0].add_cred_values({ 'realm': "example.org", 'username': "test",
- 'password': "secret",
- 'domain': "example.org" })
+ id = dev[0].add_cred_values({'realm': "example.org", 'username': "test",
+ 'password': "secret",
+ 'domain': "example.org"})
interworking_select(dev[0], bssid2, "home", freq="2412")
def hs20_simulated_sim(dev, ap, method):
@@ -538,8 +538,8 @@ def hs20_simulated_sim(dev, ap, method):
hostapd.add_ap(ap, params)
dev.hs20_enable()
- dev.add_cred_values({ 'imsi': "555444-333222111", 'eap': method,
- 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"})
+ dev.add_cred_values({'imsi': "555444-333222111", 'eap': method,
+ 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"})
interworking_select(dev, bssid, "home", freq="2412")
interworking_connect(dev, bssid, method)
check_sp_type(dev, "home")
@@ -564,8 +564,8 @@ def test_ap_hs20_sim_invalid(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- dev[0].add_cred_values({ 'imsi': "555444-3332221110", 'eap': "SIM",
- 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"})
+ dev[0].add_cred_values({'imsi': "555444-3332221110", 'eap': "SIM",
+ 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"})
# This hits "No valid IMSI available" in build_root_nai()
interworking_select(dev[0], bssid, freq="2412")
@@ -580,8 +580,8 @@ def test_ap_hs20_sim_oom(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- dev[0].add_cred_values({ 'imsi': "555444-333222111", 'eap': "SIM",
- 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"})
+ dev[0].add_cred_values({'imsi': "555444-333222111", 'eap': "SIM",
+ 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"})
dev[0].scan_for_bss(bssid, freq=2412)
interworking_select(dev[0], bssid, freq="2412")
@@ -616,7 +616,7 @@ def test_ap_hs20_ext_sim(dev, apdev):
dev[0].hs20_enable()
try:
dev[0].request("SET external_sim 1")
- dev[0].add_cred_values({ 'imsi': "23201-0000000000", 'eap': "SIM" })
+ dev[0].add_cred_values({'imsi': "23201-0000000000", 'eap': "SIM"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_ext_sim_connect(dev[0], bssid, "SIM")
check_sp_type(dev[0], "home")
@@ -636,7 +636,7 @@ def test_ap_hs20_ext_sim_roaming(dev, apdev):
dev[0].hs20_enable()
try:
dev[0].request("SET external_sim 1")
- dev[0].add_cred_values({ 'imsi': "23201-0000000000", 'eap': "SIM" })
+ dev[0].add_cred_values({'imsi': "23201-0000000000", 'eap': "SIM"})
interworking_select(dev[0], bssid, "roaming", freq="2412")
interworking_ext_sim_connect(dev[0], bssid, "SIM")
check_sp_type(dev[0], "roaming")
@@ -653,12 +653,12 @@ def test_ap_hs20_username(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com",
- 'update_identifier': "1234" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com",
+ 'update_identifier': "1234"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
check_sp_type(dev[0], "home")
@@ -686,12 +686,12 @@ def test_ap_hs20_connect_api(dev, apdev):
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
wpas.hs20_enable()
wpas.flush_scan_cache()
- id = wpas.add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com",
- 'update_identifier': "1234" })
+ id = wpas.add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com",
+ 'update_identifier': "1234"})
interworking_select(wpas, bssid, "home", freq="2412")
interworking_connect(wpas, bssid, "TTLS")
check_sp_type(wpas, "home")
@@ -711,12 +711,12 @@ def test_ap_hs20_auto_interworking(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable(auto_interworking=True)
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com",
- 'update_identifier': "1234" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com",
+ 'update_identifier': "1234"})
dev[0].request("REASSOCIATE")
dev[0].wait_connected(timeout=15)
check_sp_type(dev[0], "home")
@@ -729,19 +729,19 @@ def test_ap_hs20_auto_interworking(dev, apdev):
@remote_compatible
def test_ap_hs20_auto_interworking_no_match(dev, apdev):
"""Hotspot 2.0 connection with auto_interworking=1 and no matching network"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "mismatch" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "mismatch"})
dev[0].hs20_enable(auto_interworking=True)
id = dev[0].connect("mismatch", psk="12345678", scan_freq="2412",
only_add_network=True)
dev[0].request("ENABLE_NETWORK " + str(id) + " no-connect")
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com",
- 'update_identifier': "1234" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com",
+ 'update_identifier': "1234"})
dev[0].request("INTERWORKING_SELECT auto freq=2412")
time.sleep(0.1)
dev[0].dump_monitor()
@@ -753,8 +753,8 @@ def test_ap_hs20_auto_interworking_no_match(dev, apdev):
fetch = 0
scan = 0
for j in range(15):
- ev = dev[0].wait_event([ "ANQP fetch completed",
- "CTRL-EVENT-SCAN-RESULTS" ], timeout=0.05)
+ ev = dev[0].wait_event(["ANQP fetch completed",
+ "CTRL-EVENT-SCAN-RESULTS"], timeout=0.05)
if ev is None:
break
if "ANQP fetch completed" in ev:
@@ -770,15 +770,15 @@ def test_ap_hs20_auto_interworking_no_match(dev, apdev):
def test_ap_hs20_auto_interworking_no_cred_match(dev, apdev):
"""Hotspot 2.0 connection with auto_interworking=1 but no cred match"""
bssid = apdev[0]['bssid']
- params = { "ssid": "test" }
+ params = {"ssid": "test"}
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable(auto_interworking=True)
- dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com" })
+ dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com"})
id = dev[0].connect("test", psk="12345678", only_add_network=True)
dev[0].request("ENABLE_NETWORK %s" % id)
@@ -792,16 +792,16 @@ def test_ap_hs20_auto_interworking_no_cred_match(dev, apdev):
def eap_test(dev, ap, eap_params, method, user, release=0):
bssid = ap['bssid']
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.com," + eap_params ]
+ params['nai_realm'] = ["0,example.com," + eap_params]
if release > 0:
params['hs20_release'] = str(release)
hostapd.add_ap(ap, params)
dev.hs20_enable()
- dev.add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': user,
- 'password': "password" })
+ dev.add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': user,
+ 'password': "password"})
interworking_select(dev, bssid, freq="2412")
interworking_connect(dev, bssid, method)
@@ -913,15 +913,15 @@ def test_ap_hs20_eap_tls(dev, apdev):
"""Hotspot 2.0 connection with EAP-TLS"""
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.com,13[5:6]" ]
+ params['nai_realm'] = ["0,example.com,13[5:6]"]
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "certificate-user",
- 'ca_cert': "auth_serv/ca.pem",
- 'client_cert': "auth_serv/user.pem",
- 'private_key': "auth_serv/user.key"})
+ dev[0].add_cred_values({'realm': "example.com",
+ 'username': "certificate-user",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'client_cert': "auth_serv/user.pem",
+ 'private_key': "auth_serv/user.key"})
interworking_select(dev[0], bssid, freq="2412")
interworking_connect(dev[0], bssid, "TLS")
@@ -930,15 +930,15 @@ def test_ap_hs20_eap_cert_unknown(dev, apdev):
"""Hotspot 2.0 connection with certificate, but unknown EAP method"""
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.com,99[5:6]" ]
+ params['nai_realm'] = ["0,example.com,99[5:6]"]
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "certificate-user",
- 'ca_cert': "auth_serv/ca.pem",
- 'client_cert': "auth_serv/user.pem",
- 'private_key': "auth_serv/user.key"})
+ dev[0].add_cred_values({'realm': "example.com",
+ 'username': "certificate-user",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'client_cert': "auth_serv/user.pem",
+ 'private_key': "auth_serv/user.key"})
interworking_select(dev[0], None, no_match=True, freq="2412")
@remote_compatible
@@ -946,15 +946,15 @@ def test_ap_hs20_eap_cert_unsupported(dev, apdev):
"""Hotspot 2.0 connection with certificate, but unsupported TTLS"""
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.com,21[5:6]" ]
+ params['nai_realm'] = ["0,example.com,21[5:6]"]
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "certificate-user",
- 'ca_cert': "auth_serv/ca.pem",
- 'client_cert': "auth_serv/user.pem",
- 'private_key': "auth_serv/user.key"})
+ dev[0].add_cred_values({'realm': "example.com",
+ 'username': "certificate-user",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'client_cert': "auth_serv/user.pem",
+ 'private_key': "auth_serv/user.key"})
interworking_select(dev[0], None, no_match=True, freq="2412")
@remote_compatible
@@ -965,9 +965,9 @@ def test_ap_hs20_eap_invalid_cred(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "certificate-user",
- 'client_cert': "auth_serv/user.pem" })
+ dev[0].add_cred_values({'realm': "example.com",
+ 'username': "certificate-user",
+ 'client_cert': "auth_serv/user.pem"})
interworking_select(dev[0], None, no_match=True, freq="2412")
def test_ap_hs20_nai_realms(dev, apdev):
@@ -975,15 +975,15 @@ def test_ap_hs20_nai_realms(dev, apdev):
bssid = apdev[0]['bssid']
params = hs20_ap_params()
params['hessid'] = bssid
- params['nai_realm'] = [ "0,no.match.here;example.com;no.match.here.either,21[2:1][5:7]" ]
+ params['nai_realm'] = ["0,no.match.here;example.com;no.match.here.either,21[2:1][5:7]"]
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "pap user",
- 'password': "password",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "pap user",
+ 'password': "password",
+ 'domain': "example.com"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
check_sp_type(dev[0], "home")
@@ -996,13 +996,13 @@ def test_ap_hs20_roaming_consortium(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- for consortium in [ "112233", "1020304050", "010203040506", "fedcba" ]:
- id = dev[0].add_cred_values({ 'username': "user",
- 'password': "password",
- 'domain': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'roaming_consortium': consortium,
- 'eap': "PEAP" })
+ for consortium in ["112233", "1020304050", "010203040506", "fedcba"]:
+ id = dev[0].add_cred_values({'username': "user",
+ 'password': "password",
+ 'domain': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'roaming_consortium': consortium,
+ 'eap': "PEAP"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "PEAP")
check_sp_type(dev[0], "home")
@@ -1020,15 +1020,15 @@ def test_ap_hs20_roaming_consortiums_match(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- tests = [ ("112233", "112233"),
- ("ffffff,1020304050,eeeeee", "1020304050") ]
- for consortium,selected in tests:
- id = dev[0].add_cred_values({ 'username': "user",
- 'password': "password",
- 'domain': "my.home.example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'roaming_consortiums': consortium,
- 'eap': "PEAP" })
+ tests = [("112233", "112233"),
+ ("ffffff,1020304050,eeeeee", "1020304050")]
+ for consortium, selected in tests:
+ id = dev[0].add_cred_values({'username': "user",
+ 'password': "password",
+ 'domain': "my.home.example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'roaming_consortiums': consortium,
+ 'eap': "PEAP"})
interworking_select(dev[0], bssid, "roaming", freq="2412")
interworking_connect(dev[0], bssid, "PEAP")
check_sp_type(dev[0], "roaming")
@@ -1065,12 +1065,12 @@ def test_ap_hs20_roaming_consortium_invalid(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'username': "user",
- 'password': "password",
- 'domain': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'roaming_consortium': "fedcba",
- 'eap': "PEAP" })
+ id = dev[0].add_cred_values({'username': "user",
+ 'password': "password",
+ 'domain': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'roaming_consortium': "fedcba",
+ 'eap': "PEAP"})
interworking_select(dev[0], bssid, "home", freq="2412", no_match=True)
def test_ap_hs20_roaming_consortium_element(dev, apdev):
@@ -1084,12 +1084,12 @@ def test_ap_hs20_roaming_consortium_element(dev, apdev):
dev[0].hs20_enable()
dev[0].scan_for_bss(bssid, freq="2412")
- id = dev[0].add_cred_values({ 'username': "user",
- 'password': "password",
- 'domain': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'roaming_consortium': "112233",
- 'eap': "PEAP" })
+ id = dev[0].add_cred_values({'username': "user",
+ 'password': "password",
+ 'domain': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'roaming_consortium': "112233",
+ 'eap': "PEAP"})
interworking_select(dev[0], bssid, freq="2412", no_match=True)
hapd.set('vendor_elements', '6f020001')
@@ -1109,12 +1109,12 @@ def test_ap_hs20_roaming_consortium_constraints(dev, apdev):
dev[0].hs20_enable()
- vals = { 'username': "user",
- 'password': "password",
- 'domain': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'roaming_consortium': "fedcba",
- 'eap': "TTLS" }
+ vals = {'username': "user",
+ 'password': "password",
+ 'domain': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'roaming_consortium': "fedcba",
+ 'eap': "TTLS"}
vals2 = vals.copy()
vals2['required_roaming_consortium'] = "223344"
id = dev[0].add_cred_values(vals2)
@@ -1189,9 +1189,9 @@ def test_ap_hs20_3gpp_constraints(dev, apdev):
dev[0].hs20_enable()
- vals = { 'imsi': "555444-333222111",
- 'eap': "SIM",
- 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123" }
+ vals = {'imsi': "555444-333222111",
+ 'eap': "SIM",
+ 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"}
vals2 = vals.copy()
vals2['required_roaming_consortium'] = "223344"
id = dev[0].add_cred_values(vals2)
@@ -1268,13 +1268,13 @@ def test_ap_hs20_connect_no_full_match(dev, apdev):
dev[0].hs20_enable()
- vals = { 'username': "user",
- 'password': "password",
- 'domain': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'roaming_consortium': "fedcba",
- 'eap': "TTLS",
- 'min_dl_bandwidth_home': "65500" }
+ vals = {'username': "user",
+ 'password': "password",
+ 'domain': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'roaming_consortium': "fedcba",
+ 'eap': "TTLS",
+ 'min_dl_bandwidth_home': "65500"}
id = dev[0].add_cred_values(vals)
dev[0].request("INTERWORKING_SELECT freq=2412")
ev = dev[0].wait_event(["INTERWORKING-AP"], timeout=15)
@@ -1286,9 +1286,9 @@ def test_ap_hs20_connect_no_full_match(dev, apdev):
dev[0].remove_cred(id)
dev[0].wait_disconnected()
- vals = { 'imsi': "555444-333222111", 'eap': "SIM",
- 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123",
- 'min_dl_bandwidth_roaming': "65500" }
+ vals = {'imsi': "555444-333222111", 'eap': "SIM",
+ 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123",
+ 'min_dl_bandwidth_roaming': "65500"}
id = dev[0].add_cred_values(vals)
dev[0].request("INTERWORKING_SELECT freq=2412")
ev = dev[0].wait_event(["INTERWORKING-AP"], timeout=15)
@@ -1305,19 +1305,19 @@ def test_ap_hs20_username_roaming(dev, apdev):
check_eap_capa(dev[0], "MSCHAPV2")
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.com,13[5:6],21[2:4][5:7]",
- "0,roaming.example.com,21[2:4][5:7]",
- "0,another.example.com" ]
+ params['nai_realm'] = ["0,example.com,13[5:6],21[2:4][5:7]",
+ "0,roaming.example.com,21[2:4][5:7]",
+ "0,another.example.com"]
params['domain_name'] = "another.example.com"
params['hessid'] = bssid
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "roaming.example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "roaming.example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com"})
interworking_select(dev[0], bssid, "roaming", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
check_sp_type(dev[0], "roaming")
@@ -1331,10 +1331,10 @@ def test_ap_hs20_username_unknown(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password"})
interworking_select(dev[0], bssid, "unknown", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
check_sp_type(dev[0], "unknown")
@@ -1349,11 +1349,11 @@ def test_ap_hs20_username_unknown2(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"})
interworking_select(dev[0], bssid, "unknown", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
check_sp_type(dev[0], "unknown")
@@ -1367,11 +1367,11 @@ def test_ap_hs20_gas_while_associated(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
@@ -1393,15 +1393,15 @@ def test_ap_hs20_gas_with_another_ap_while_associated(dev, apdev):
bssid2 = apdev[1]['bssid']
params = hs20_ap_params()
params['hessid'] = bssid2
- params['nai_realm'] = [ "0,no-match.example.org,13[5:6],21[2:4][5:7]" ]
+ params['nai_realm'] = ["0,no-match.example.org,13[5:6],21[2:4][5:7]"]
hostapd.add_ap(apdev[1], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
dev[0].dump_monitor()
@@ -1437,16 +1437,16 @@ def _test_ap_hs20_gas_while_associated_with_pmf(dev, apdev):
bssid2 = apdev[1]['bssid']
params = hs20_ap_params()
params['hessid'] = bssid2
- params['nai_realm'] = [ "0,no-match.example.org,13[5:6],21[2:4][5:7]" ]
+ params['nai_realm'] = ["0,no-match.example.org,13[5:6],21[2:4][5:7]"]
hostapd.add_ap(apdev[1], params)
dev[0].hs20_enable()
dev[0].request("SET pmf 2")
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
@@ -1474,16 +1474,16 @@ def _test_ap_hs20_gas_with_another_ap_while_using_pmf(dev, apdev):
bssid2 = apdev[1]['bssid']
params = hs20_ap_params()
params['hessid'] = bssid2
- params['nai_realm'] = [ "0,no-match.example.org,13[5:6],21[2:4][5:7]" ]
+ params['nai_realm'] = ["0,no-match.example.org,13[5:6],21[2:4][5:7]"]
hostapd.add_ap(apdev[1], params)
dev[0].hs20_enable()
dev[0].request("SET pmf 2")
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
dev[0].dump_monitor()
@@ -1512,11 +1512,11 @@ def test_ap_hs20_gas_frag_while_associated(dev, apdev):
hapd.set("gas_frag_limit", "50")
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
@@ -1536,11 +1536,11 @@ def test_ap_hs20_multiple_connects(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- values = { 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com" }
+ values = {'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"}
id = dev[0].add_cred_values(values)
dev[0].scan_for_bss(bssid, freq="2412")
@@ -1576,11 +1576,11 @@ def test_ap_hs20_disallow_aps(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- values = { 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com" }
+ values = {'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"}
id = dev[0].add_cred_values(values)
dev[0].scan_for_bss(bssid, freq="2412")
@@ -1657,10 +1657,10 @@ def policy_test(dev, ap, values, only_one=True):
return events
def default_cred(domain=None, user="hs20-test"):
- cred = { 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': user,
- 'password': "password" }
+ cred = {'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': user,
+ 'password': "password"}
if domain:
cred['domain'] = domain
return cred
@@ -1691,7 +1691,7 @@ def test_ap_hs20_req_roaming_consortium(dev, apdev):
params = hs20_ap_params()
params['ssid'] = "test-hs20-other"
- params['roaming_consortium'] = [ "223344" ]
+ params['roaming_consortium'] = ["223344"]
hostapd.add_ap(apdev[1], params)
values = default_cred()
@@ -1704,7 +1704,8 @@ def test_ap_hs20_req_roaming_consortium(dev, apdev):
dev[0].set_cred(id, "required_roaming_consortium", "112233")
dev[0].set_cred(id, "required_roaming_consortium", "112233445566778899aabbccddeeff")
- for val in [ "", "1", "11", "1122", "1122334", "112233445566778899aabbccddeeff00" ]:
+ for val in ["", "1", "11", "1122", "1122334",
+ "112233445566778899aabbccddeeff00"]:
if "FAIL" not in dev[0].request('SET_CRED {} required_roaming_consortium {}'.format(id, val)):
raise Exception("Invalid roaming consortium value accepted: " + val)
@@ -1717,7 +1718,7 @@ def test_ap_hs20_req_roaming_consortium_no_match(dev, apdev):
params = hs20_ap_params()
params['ssid'] = "test-hs20-other"
- params['roaming_consortium'] = [ "223345" ]
+ params['roaming_consortium'] = ["223345"]
hostapd.add_ap(apdev[1], params)
values = default_cred()
@@ -1733,13 +1734,13 @@ def test_ap_hs20_excluded_ssid(dev, apdev):
"""Hotspot 2.0 exclusion based on SSID"""
check_eap_capa(dev[0], "MSCHAPV2")
params = hs20_ap_params()
- params['roaming_consortium'] = [ "223344" ]
+ params['roaming_consortium'] = ["223344"]
params['anqp_3gpp_cell_net'] = "555,444"
hostapd.add_ap(apdev[0], params)
params = hs20_ap_params()
params['ssid'] = "test-hs20-other"
- params['roaming_consortium'] = [ "223344" ]
+ params['roaming_consortium'] = ["223344"]
params['anqp_3gpp_cell_net'] = "555,444"
hostapd.add_ap(apdev[1], params)
@@ -1765,9 +1766,9 @@ def test_ap_hs20_excluded_ssid(dev, apdev):
if len(ev) != 1:
raise Exception("Excluded network not reported")
- values = { 'imsi': "555444-333222111", 'eap': "SIM",
- 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123",
- 'excluded_ssid': "test-hs20" }
+ values = {'imsi': "555444-333222111", 'eap': "SIM",
+ 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123",
+ 'excluded_ssid': "test-hs20"}
events = policy_test(dev[0], apdev[1], values)
ev = [e for e in events if "INTERWORKING-BLACKLISTED " + apdev[0]['bssid'] in e]
if len(ev) != 1:
@@ -1782,11 +1783,11 @@ def test_ap_hs20_roam_to_higher_prio(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"})
logger.info("Connect to the only network option")
interworking_select(dev[0], bssid, "roaming", freq="2412")
dev[0].dump_monitor()
@@ -1821,12 +1822,12 @@ def test_ap_hs20_domain_suffix_match_full(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com",
- 'domain_suffix_match': "server.w1.fi" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com",
+ 'domain_suffix_match': "server.w1.fi"})
interworking_select(dev[0], bssid, "home", freq="2412")
dev[0].dump_monitor()
interworking_connect(dev[0], bssid, "TTLS")
@@ -1852,12 +1853,12 @@ def test_ap_hs20_domain_suffix_match(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com",
- 'domain_suffix_match': "w1.fi" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com",
+ 'domain_suffix_match': "w1.fi"})
interworking_select(dev[0], bssid, "home", freq="2412")
dev[0].dump_monitor()
interworking_connect(dev[0], bssid, "TTLS")
@@ -1984,16 +1985,16 @@ def _test_ap_hs20_multi_cred_sp_prio(dev, apdev):
dev[0].hs20_enable()
dev[0].scan_for_bss(bssid, freq="2412")
dev[0].request("SET external_sim 1")
- id1 = dev[0].add_cred_values({ 'imsi': "23201-0000000000", 'eap': "SIM",
- 'provisioning_sp': "example.com",
- 'sp_priority' :"1" })
- id2 = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com",
- 'provisioning_sp': "example.com",
- 'sp_priority': "2" })
+ id1 = dev[0].add_cred_values({'imsi': "23201-0000000000", 'eap': "SIM",
+ 'provisioning_sp': "example.com",
+ 'sp_priority' :"1"})
+ id2 = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com",
+ 'provisioning_sp': "example.com",
+ 'sp_priority': "2"})
dev[0].dump_monitor()
dev[0].scan_for_bss(bssid, freq="2412")
dev[0].request("INTERWORKING_SELECT auto freq=2412")
@@ -2036,16 +2037,16 @@ def _test_ap_hs20_multi_cred_sp_prio2(dev, apdev):
dev[0].hs20_enable()
dev[0].request("SET external_sim 1")
- id1 = dev[0].add_cred_values({ 'imsi': "23201-0000000000", 'eap': "SIM",
- 'provisioning_sp': "example.com",
- 'sp_priority': "1" })
- id2 = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com",
- 'provisioning_sp': "example.com",
- 'sp_priority': "2" })
+ id1 = dev[0].add_cred_values({'imsi': "23201-0000000000", 'eap': "SIM",
+ 'provisioning_sp': "example.com",
+ 'sp_priority': "1"})
+ id2 = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com",
+ 'provisioning_sp': "example.com",
+ 'sp_priority': "2"})
dev[0].dump_monitor()
dev[0].scan_for_bss(bssid, freq="2412")
dev[0].scan_for_bss(bssid2, freq="2412")
@@ -2080,20 +2081,20 @@ def test_ap_hs20_multi_cred_sp_prio_same(dev, apdev):
dev[0].hs20_enable()
dev[0].scan_for_bss(bssid, freq="2412")
- id1 = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "domain1.example.com",
- 'provisioning_sp': "example.com",
- 'sp_priority': "1" })
- id2 = dev[0].add_cred_values({ 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "domain2.example.com",
- 'provisioning_sp': "example.com",
- 'sp_priority': "1" })
+ id1 = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "domain1.example.com",
+ 'provisioning_sp': "example.com",
+ 'sp_priority': "1"})
+ id2 = dev[0].add_cred_values({'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "domain2.example.com",
+ 'provisioning_sp': "example.com",
+ 'sp_priority': "1"})
dev[0].dump_monitor()
dev[0].scan_for_bss(bssid, freq="2412")
check_auto_select(dev[0], bssid)
@@ -2153,7 +2154,7 @@ def test_ap_hs20_req_conn_capab(dev, apdev):
bssid2 = apdev[1]['bssid']
params = hs20_ap_params(ssid="test-hs20b")
- params['hs20_conn_capab'] = [ "1:0:2", "6:22:1", "17:5060:0", "50:0:1" ]
+ params['hs20_conn_capab'] = ["1:0:2", "6:22:1", "17:5060:0", "50:0:1"]
hostapd.add_ap(apdev[1], params)
dev[0].remove_cred(id)
@@ -2191,7 +2192,7 @@ def test_ap_hs20_req_conn_capab_and_roaming_partner_preference(dev, apdev):
bssid = apdev[0]['bssid']
params = hs20_ap_params()
params['domain_name'] = "roaming.example.org"
- params['hs20_conn_capab'] = [ "1:0:2", "6:22:1", "17:5060:0", "50:0:1" ]
+ params['hs20_conn_capab'] = ["1:0:2", "6:22:1", "17:5060:0", "50:0:1"]
hostapd.add_ap(apdev[0], params)
bssid2 = apdev[1]['bssid']
@@ -2305,8 +2306,8 @@ def test_ap_hs20_min_bandwidth_home_hidden_ssid_in_scan_res(dev, apdev):
check_eap_capa(dev[0], "MSCHAPV2")
bssid = apdev[0]['bssid']
- hapd = hostapd.add_ap(apdev[0], { "ssid": 'secret',
- "ignore_broadcast_ssid": "1" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": 'secret',
+ "ignore_broadcast_ssid": "1"})
dev[0].scan_for_bss(bssid, freq=2412)
hapd.disable()
hapd_global = hostapd.HostapdGlobal(apdev[0])
@@ -2495,15 +2496,15 @@ def test_ap_hs20_deauth_req_from_radius(dev, apdev):
def _test_ap_hs20_deauth_req_from_radius(dev, apdev):
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.com,21[2:4]" ]
+ params['nai_realm'] = ["0,example.com,21[2:4]"]
params['hs20_deauth_req_timeout'] = "2"
hostapd.add_ap(apdev[0], params)
dev[0].request("SET pmf 2")
dev[0].hs20_enable()
- dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-deauth-test",
- 'password': "password" })
+ dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-deauth-test",
+ 'password': "password"})
interworking_select(dev[0], bssid, freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
ev = dev[0].wait_event(["HS20-DEAUTH-IMMINENT-NOTICE"], timeout=5)
@@ -2546,14 +2547,14 @@ def test_ap_hs20_remediation_required(dev, apdev):
def _test_ap_hs20_remediation_required(dev, apdev):
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.com,21[2:4]" ]
+ params['nai_realm'] = ["0,example.com,21[2:4]"]
hostapd.add_ap(apdev[0], params)
dev[0].request("SET pmf 1")
dev[0].hs20_enable()
- dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-subrem-test",
- 'password': "password" })
+ dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-subrem-test",
+ 'password': "password"})
interworking_select(dev[0], bssid, freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
ev = dev[0].wait_event(["HS20-SUBSCRIPTION-REMEDIATION"], timeout=5)
@@ -2574,7 +2575,7 @@ def _test_ap_hs20_remediation_required_ctrl(dev, apdev):
bssid = apdev[0]['bssid']
addr = dev[0].own_addr()
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.com,21[2:4]" ]
+ params['nai_realm'] = ["0,example.com,21[2:4]"]
hapd = hostapd.add_ap(apdev[0], params)
dev[0].request("SET pmf 1")
@@ -2617,14 +2618,14 @@ def test_ap_hs20_session_info(dev, apdev):
def _test_ap_hs20_session_info(dev, apdev):
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.com,21[2:4]" ]
+ params['nai_realm'] = ["0,example.com,21[2:4]"]
hostapd.add_ap(apdev[0], params)
dev[0].request("SET pmf 1")
dev[0].hs20_enable()
- dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-session-info-test",
- 'password': "password" })
+ dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-session-info-test",
+ 'password': "password"})
interworking_select(dev[0], bssid, freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
ev = dev[0].wait_event(["ESS-DISASSOC-IMMINENT"], timeout=10)
@@ -2641,11 +2642,11 @@ def _test_ap_hs20_session_info(dev, apdev):
def test_ap_hs20_osen(dev, apdev):
"""Hotspot 2.0 OSEN connection"""
- params = { 'ssid': "osen",
- 'osen': "1",
- 'auth_server_addr': "127.0.0.1",
- 'auth_server_port': "1812",
- 'auth_server_shared_secret': "radius" }
+ params = {'ssid': "osen",
+ 'osen': "1",
+ 'auth_server_addr': "127.0.0.1",
+ 'auth_server_port': "1812",
+ 'auth_server_shared_secret': "radius"}
hostapd.add_ap(apdev[0], params)
dev[1].connect("osen", key_mgmt="NONE", scan_freq="2412",
@@ -2719,10 +2720,10 @@ def test_ap_hs20_network_preference(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- values = { 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com" }
+ values = {'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"}
dev[0].add_cred_values(values)
id = dev[0].add_network()
@@ -2744,7 +2745,7 @@ def test_ap_hs20_network_preference(dev, apdev):
dev[0].scan_for_bss(bssid2, freq="2412")
dev[0].request("INTERWORKING_SELECT auto freq=2412")
ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
- "INTERWORKING-ALREADY-CONNECTED" ], timeout=15)
+ "INTERWORKING-ALREADY-CONNECTED"], timeout=15)
if ev is None:
raise Exception("Connection timed out")
if "INTERWORKING-ALREADY-CONNECTED" in ev:
@@ -2760,11 +2761,11 @@ def test_ap_hs20_network_preference2(dev, apdev):
hostapd.add_ap(apdev[1], params)
dev[0].hs20_enable()
- values = { 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com",
- 'priority': "1" }
+ values = {'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com",
+ 'priority': "1"}
dev[0].add_cred_values(values)
id = dev[0].add_network()
@@ -2785,7 +2786,7 @@ def test_ap_hs20_network_preference2(dev, apdev):
dev[0].scan_for_bss(bssid, freq="2412")
dev[0].request("INTERWORKING_SELECT auto freq=2412")
ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
- "INTERWORKING-ALREADY-CONNECTED" ], timeout=15)
+ "INTERWORKING-ALREADY-CONNECTED"], timeout=15)
if ev is None:
raise Exception("Connection timed out")
if "INTERWORKING-ALREADY-CONNECTED" in ev:
@@ -2806,14 +2807,14 @@ def test_ap_hs20_network_preference3(dev, apdev):
hostapd.add_ap(apdev[1], params)
dev[0].hs20_enable()
- values = { 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'priority': "1" }
+ values = {'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'priority': "1"}
dev[0].add_cred_values(values)
- values = { 'realm': "example.org",
- 'username': "hs20-test",
- 'password': "password" }
+ values = {'realm': "example.org",
+ 'username': "hs20-test",
+ 'password': "password"}
id = dev[0].add_cred_values(values)
dev[0].scan_for_bss(bssid, freq="2412")
@@ -2826,7 +2827,7 @@ def test_ap_hs20_network_preference3(dev, apdev):
dev[0].set_cred(id, "priority", "2")
dev[0].request("INTERWORKING_SELECT auto freq=2412")
ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
- "INTERWORKING-ALREADY-CONNECTED" ], timeout=15)
+ "INTERWORKING-ALREADY-CONNECTED"], timeout=15)
if ev is None:
raise Exception("Connection timed out")
if "INTERWORKING-ALREADY-CONNECTED" in ev:
@@ -2849,14 +2850,14 @@ def test_ap_hs20_network_preference4(dev, apdev):
hostapd.add_ap(apdev[1], params)
dev[0].hs20_enable()
- values = { 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'priority': "1" }
+ values = {'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'priority': "1"}
dev[0].add_cred_values(values)
- values = { 'imsi': "555444-333222111",
- 'eap': "SIM",
- 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123" }
+ values = {'imsi': "555444-333222111",
+ 'eap': "SIM",
+ 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"}
id = dev[0].add_cred_values(values)
dev[0].scan_for_bss(bssid, freq="2412")
@@ -2869,7 +2870,7 @@ def test_ap_hs20_network_preference4(dev, apdev):
dev[0].set_cred(id, "priority", "2")
dev[0].request("INTERWORKING_SELECT auto freq=2412")
ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
- "INTERWORKING-ALREADY-CONNECTED" ], timeout=15)
+ "INTERWORKING-ALREADY-CONNECTED"], timeout=15)
if ev is None:
raise Exception("Connection timed out")
if "INTERWORKING-ALREADY-CONNECTED" in ev:
@@ -2885,10 +2886,10 @@ def test_ap_hs20_interworking_select_blocking_scan(dev, apdev):
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- values = { 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com" }
+ values = {'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"}
dev[0].add_cred_values(values)
dev[0].scan_for_bss(bssid, freq="2412")
@@ -2904,9 +2905,9 @@ 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 open"'
params['osu_method_list'] = "1"
- params['osu_friendly_name'] = [ "eng:Test OSU", "fin:Testi-OSU" ]
+ params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_icon'] = "w1fi_logo"
- params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
+ params['osu_service_desc'] = ["eng:Example services", "fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)
@@ -2917,9 +2918,9 @@ def test_ap_hs20_fetch_osu(dev, apdev):
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_friendly_name'] = ["eng:Test2 OSU", "fin:Testi2-OSU"]
params['osu_icon'] = "w1fi_logo"
- params['osu_service_desc'] = [ "eng:Example services2", "fin:Esimerkkipalveluja2" ]
+ params['osu_service_desc'] = ["eng:Example services2", "fin:Esimerkkipalveluja2"]
params['osu_server_uri'] = "https://example.org/osu/"
hostapd.add_ap(apdev[1], params)
@@ -2928,7 +2929,7 @@ def test_ap_hs20_fetch_osu(dev, apdev):
dev[0].hs20_enable()
dir = "/tmp/osu-fetch"
if os.path.isdir(dir):
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
else:
@@ -2969,7 +2970,7 @@ def test_ap_hs20_fetch_osu(dev, apdev):
if "OSU-PROVIDER " + bssid2 not in prov:
raise Exception("Missing OSU_PROVIDER(2)")
finally:
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
os.rmdir(dir)
@@ -3060,7 +3061,7 @@ def test_ap_hs20_fetch_osu_no_info(dev, apdev):
dev[0].hs20_enable()
dir = "/tmp/osu-fetch"
if os.path.isdir(dir):
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
else:
@@ -3076,7 +3077,7 @@ def test_ap_hs20_fetch_osu_no_info(dev, apdev):
if ev is None:
raise Exception("Timeout on OSU fetch")
finally:
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
os.rmdir(dir)
@@ -3088,16 +3089,17 @@ def test_ap_hs20_fetch_osu_no_icon(dev, apdev):
params['hs20_icon'] = "128:80:zxx:image/png:w1fi_logo:w1fi_logo-no-file.png"
params['osu_ssid'] = '"HS 2.0 OSU open"'
params['osu_method_list'] = "1"
- params['osu_friendly_name'] = [ "eng:Test OSU", "fin:Testi-OSU" ]
+ params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_icon'] = "w1fi_logo"
- params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
+ params['osu_service_desc'] = ["eng:Example services",
+ "fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
dir = "/tmp/osu-fetch"
if os.path.isdir(dir):
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
else:
@@ -3113,7 +3115,7 @@ def test_ap_hs20_fetch_osu_no_icon(dev, apdev):
if ev is None:
raise Exception("Timeout on OSU fetch")
finally:
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
os.rmdir(dir)
@@ -3125,10 +3127,11 @@ def test_ap_hs20_fetch_osu_single_ssid(dev, apdev):
params['hs20_icon'] = "128:80:zxx:image/png:w1fi_logo:w1fi_logo-no-file.png"
params['osu_ssid'] = '"HS 2.0 OSU open"'
params['osu_method_list'] = "1"
- params['osu_friendly_name'] = [ "eng:Test OSU", "fin:Testi-OSU" ]
+ params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_nai2'] = "osen@example.com"
params['osu_icon'] = "w1fi_logo"
- params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
+ params['osu_service_desc'] = ["eng:Example services",
+ "fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
params['wpa_key_mgmt'] = "WPA-EAP OSEN"
hostapd.add_ap(apdev[0], params)
@@ -3136,7 +3139,7 @@ def test_ap_hs20_fetch_osu_single_ssid(dev, apdev):
dev[0].hs20_enable()
dir = "/tmp/osu-fetch"
if os.path.isdir(dir):
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
else:
@@ -3175,7 +3178,7 @@ def test_ap_hs20_fetch_osu_single_ssid(dev, apdev):
if not osu_nai2:
raise Exception("osu_nai2 not reported")
finally:
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
os.rmdir(dir)
@@ -3187,10 +3190,11 @@ def test_ap_hs20_fetch_osu_single_ssid2(dev, apdev):
params['hs20_icon'] = "128:80:zxx:image/png:w1fi_logo:w1fi_logo-no-file.png"
params['osu_ssid'] = '"HS 2.0 OSU open"'
params['osu_method_list'] = "1"
- params['osu_friendly_name'] = [ "eng:Test OSU", "fin:Testi-OSU" ]
+ params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_nai2'] = "osen@example.com"
params['osu_icon'] = "w1fi_logo"
- params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
+ params['osu_service_desc'] = ["eng:Example services",
+ "fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
params['wpa_key_mgmt'] = "WPA-EAP OSEN"
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
@@ -3203,7 +3207,7 @@ def test_ap_hs20_fetch_osu_single_ssid2(dev, apdev):
dev[0].hs20_enable()
dir = "/tmp/osu-fetch"
if os.path.isdir(dir):
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
else:
@@ -3247,7 +3251,7 @@ def test_ap_hs20_fetch_osu_single_ssid2(dev, apdev):
if not osu_nai2b:
raise Exception("osu_nai2b not reported")
finally:
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
os.rmdir(dir)
@@ -3271,13 +3275,14 @@ def test_ap_hs20_req_hs20_icon(dev, apdev):
"""Hotspot 2.0 OSU provider and multi-icon fetch with REQ_HS20_ICON"""
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['hs20_icon'] = [ "128:80:zxx:image/png:w1fi_logo:w1fi_logo.png",
- "128:80:zxx:image/png:test_logo:auth_serv/sha512-server.pem" ]
+ params['hs20_icon'] = ["128:80:zxx:image/png:w1fi_logo:w1fi_logo.png",
+ "128:80:zxx:image/png:test_logo:auth_serv/sha512-server.pem"]
params['osu_ssid'] = '"HS 2.0 OSU open"'
params['osu_method_list'] = "1"
- params['osu_friendly_name'] = [ "eng:Test OSU", "fin:Testi-OSU" ]
- params['osu_icon'] = [ "w1fi_logo", "w1fi_logo2" ]
- params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
+ params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
+ params['osu_icon'] = ["w1fi_logo", "w1fi_logo2"]
+ params['osu_service_desc'] = ["eng:Example services",
+ "fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)
@@ -3325,9 +3330,9 @@ def test_ap_hs20_req_operator_icon(dev, apdev):
"""Hotspot 2.0 operator icons"""
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['hs20_icon'] = [ "128:80:zxx:image/png:w1fi_logo:w1fi_logo.png",
- "500:300:fi:image/png:test_logo:auth_serv/sha512-server.pem" ]
- params['operator_icon'] = [ "w1fi_logo", "unknown_logo", "test_logo" ]
+ params['hs20_icon'] = ["128:80:zxx:image/png:w1fi_logo:w1fi_logo.png",
+ "500:300:fi:image/png:test_logo:auth_serv/sha512-server.pem"]
+ params['operator_icon'] = ["w1fi_logo", "unknown_logo", "test_logo"]
hostapd.add_ap(apdev[0], params)
value = struct.pack('<HH', 128, 80) + b"zxx"
@@ -3374,13 +3379,14 @@ def test_ap_hs20_req_hs20_icon_oom(dev, apdev):
"""Hotspot 2.0 icon fetch OOM with REQ_HS20_ICON"""
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['hs20_icon'] = [ "128:80:zxx:image/png:w1fi_logo:w1fi_logo.png",
- "128:80:zxx:image/png:test_logo:auth_serv/sha512-server.pem" ]
+ params['hs20_icon'] = ["128:80:zxx:image/png:w1fi_logo:w1fi_logo.png",
+ "128:80:zxx:image/png:test_logo:auth_serv/sha512-server.pem"]
params['osu_ssid'] = '"HS 2.0 OSU open"'
params['osu_method_list'] = "1"
- params['osu_friendly_name'] = [ "eng:Test OSU", "fin:Testi-OSU" ]
- params['osu_icon'] = [ "w1fi_logo", "w1fi_logo2" ]
- params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
+ params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
+ params['osu_icon'] = ["w1fi_logo", "w1fi_logo2"]
+ params['osu_service_desc'] = ["eng:Example services",
+ "fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)
@@ -3426,13 +3432,14 @@ def test_ap_hs20_req_hs20_icon_parallel(dev, apdev):
"""Hotspot 2.0 OSU provider and multi-icon parallel fetch with REQ_HS20_ICON"""
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['hs20_icon'] = [ "128:80:zxx:image/png:w1fi_logo:w1fi_logo.png",
- "128:80:zxx:image/png:test_logo:auth_serv/sha512-server.pem" ]
+ params['hs20_icon'] = ["128:80:zxx:image/png:w1fi_logo:w1fi_logo.png",
+ "128:80:zxx:image/png:test_logo:auth_serv/sha512-server.pem"]
params['osu_ssid'] = '"HS 2.0 OSU open"'
params['osu_method_list'] = "1"
- params['osu_friendly_name'] = [ "eng:Test OSU", "fin:Testi-OSU" ]
- params['osu_icon'] = [ "w1fi_logo", "w1fi_logo2" ]
- params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
+ params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
+ params['osu_icon'] = ["w1fi_logo", "w1fi_logo2"]
+ params['osu_service_desc'] = ["eng:Example services",
+ "fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)
@@ -3481,16 +3488,17 @@ def test_ap_hs20_fetch_osu_stop(dev, apdev):
params['hs20_icon'] = "128:80:zxx:image/png:w1fi_logo:w1fi_logo.png"
params['osu_ssid'] = '"HS 2.0 OSU open"'
params['osu_method_list'] = "1"
- params['osu_friendly_name'] = [ "eng:Test OSU", "fin:Testi-OSU" ]
+ params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_icon'] = "w1fi_logo"
- params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
+ params['osu_service_desc'] = ["eng:Example services",
+ "fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hapd = hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
dir = "/tmp/osu-fetch"
if os.path.isdir(dir):
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
else:
@@ -3554,7 +3562,7 @@ def test_ap_hs20_fetch_osu_stop(dev, apdev):
if ev is None:
raise Exception("GAS event timed out after CANCEL_FETCH_OSU")
finally:
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
os.rmdir(dir)
@@ -3568,7 +3576,7 @@ def test_ap_hs20_fetch_osu_proto(dev, apdev):
dev[0].hs20_enable()
dir = "/tmp/osu-fetch"
if os.path.isdir(dir):
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
else:
@@ -3577,59 +3585,59 @@ def test_ap_hs20_fetch_osu_proto(dev, apdev):
except:
pass
- tests = [ ( "Empty provider list (no OSU SSID field)", b'' ),
- ( "HS 2.0: Not enough room for OSU SSID",
- binascii.unhexlify('01') ),
- ( "HS 2.0: Invalid OSU SSID Length 33",
- binascii.unhexlify('21') + 33*b'A' ),
- ( "HS 2.0: Not enough room for Number of OSU Providers",
- binascii.unhexlify('0130') ),
- ( "Truncated OSU Provider",
- binascii.unhexlify('013001020000') ),
- ( "HS 2.0: Ignored 5 bytes of extra data after OSU Providers",
- binascii.unhexlify('0130001122334455') ),
- ( "HS 2.0: Not enough room for OSU Friendly Name Length",
- binascii.unhexlify('013001000000') ),
- ( "HS 2.0: Not enough room for OSU Friendly Name Duples",
- build_prov('0100') ),
- ( "Invalid OSU Friendly Name", build_prov('040000000000') ),
- ( "Invalid OSU Friendly Name(2)", build_prov('040004000000') ),
- ( "HS 2.0: Not enough room for OSU Server URI length",
- build_prov('0000') ),
- ( "HS 2.0: Not enough room for OSU Server URI",
- build_prov('000001') ),
- ( "HS 2.0: Not enough room for OSU Method list length",
- build_prov('000000') ),
- ( "HS 2.0: Not enough room for OSU Method list",
- build_prov('00000001') ),
- ( "HS 2.0: Not enough room for Icons Available Length",
- build_prov('00000000') ),
- ( "HS 2.0: Not enough room for Icons Available Length(2)",
- build_prov('00000001ff00') ),
- ( "HS 2.0: Not enough room for Icons Available",
- build_prov('000000000100') ),
- ( "HS 2.0: Invalid Icon Metadata",
- build_prov('00000000010000') ),
- ( "HS 2.0: Not room for Icon Type",
- build_prov('000000000900111122223333330200') ),
- ( "HS 2.0: Not room for Icon Filename length",
- build_prov('000000000900111122223333330100') ),
- ( "HS 2.0: Not room for Icon Filename",
- build_prov('000000000900111122223333330001') ),
- ( "HS 2.0: Not enough room for OSU_NAI",
- build_prov('000000000000') ),
- ( "HS 2.0: Not enough room for OSU_NAI(2)",
- build_prov('00000000000001') ),
- ( "HS 2.0: Not enough room for OSU Service Description Length",
- build_prov('00000000000000') ),
- ( "HS 2.0: Not enough room for OSU Service Description Length(2)",
- build_prov('0000000000000000') ),
- ( "HS 2.0: Not enough room for OSU Service Description Duples",
- build_prov('000000000000000100') ),
- ( "Invalid OSU Service Description",
- build_prov('00000000000000040000000000') ),
- ( "Invalid OSU Service Description(2)",
- build_prov('00000000000000040004000000') ) ]
+ tests = [("Empty provider list (no OSU SSID field)", b''),
+ ("HS 2.0: Not enough room for OSU SSID",
+ binascii.unhexlify('01')),
+ ("HS 2.0: Invalid OSU SSID Length 33",
+ binascii.unhexlify('21') + 33*b'A'),
+ ("HS 2.0: Not enough room for Number of OSU Providers",
+ binascii.unhexlify('0130')),
+ ("Truncated OSU Provider",
+ binascii.unhexlify('013001020000')),
+ ("HS 2.0: Ignored 5 bytes of extra data after OSU Providers",
+ binascii.unhexlify('0130001122334455')),
+ ("HS 2.0: Not enough room for OSU Friendly Name Length",
+ binascii.unhexlify('013001000000')),
+ ("HS 2.0: Not enough room for OSU Friendly Name Duples",
+ build_prov('0100')),
+ ("Invalid OSU Friendly Name", build_prov('040000000000')),
+ ("Invalid OSU Friendly Name(2)", build_prov('040004000000')),
+ ("HS 2.0: Not enough room for OSU Server URI length",
+ build_prov('0000')),
+ ("HS 2.0: Not enough room for OSU Server URI",
+ build_prov('000001')),
+ ("HS 2.0: Not enough room for OSU Method list length",
+ build_prov('000000')),
+ ("HS 2.0: Not enough room for OSU Method list",
+ build_prov('00000001')),
+ ("HS 2.0: Not enough room for Icons Available Length",
+ build_prov('00000000')),
+ ("HS 2.0: Not enough room for Icons Available Length(2)",
+ build_prov('00000001ff00')),
+ ("HS 2.0: Not enough room for Icons Available",
+ build_prov('000000000100')),
+ ("HS 2.0: Invalid Icon Metadata",
+ build_prov('00000000010000')),
+ ("HS 2.0: Not room for Icon Type",
+ build_prov('000000000900111122223333330200')),
+ ("HS 2.0: Not room for Icon Filename length",
+ build_prov('000000000900111122223333330100')),
+ ("HS 2.0: Not room for Icon Filename",
+ build_prov('000000000900111122223333330001')),
+ ("HS 2.0: Not enough room for OSU_NAI",
+ build_prov('000000000000')),
+ ("HS 2.0: Not enough room for OSU_NAI(2)",
+ build_prov('00000000000001')),
+ ("HS 2.0: Not enough room for OSU Service Description Length",
+ build_prov('00000000000000')),
+ ("HS 2.0: Not enough room for OSU Service Description Length(2)",
+ build_prov('0000000000000000')),
+ ("HS 2.0: Not enough room for OSU Service Description Duples",
+ build_prov('000000000000000100')),
+ ("Invalid OSU Service Description",
+ build_prov('00000000000000040000000000')),
+ ("Invalid OSU Service Description(2)",
+ build_prov('00000000000000040004000000'))]
try:
dev[0].request("SET osu_dir " + dir)
@@ -3637,7 +3645,7 @@ def test_ap_hs20_fetch_osu_proto(dev, apdev):
for note, prov in tests:
run_fetch_osu(hapd, dev, bssid, note, prov)
finally:
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
os.rmdir(dir)
@@ -3649,9 +3657,10 @@ def test_ap_hs20_fetch_osu_invalid_dir(dev, apdev):
params['hs20_icon'] = "128:80:zxx:image/png:w1fi_logo:w1fi_logo.png"
params['osu_ssid'] = '"HS 2.0 OSU open"'
params['osu_method_list'] = "1"
- params['osu_friendly_name'] = [ "eng:Test OSU", "fin:Testi-OSU" ]
+ params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_icon'] = "w1fi_logo"
- params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
+ params['osu_service_desc'] = ["eng:Example services",
+ "fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)
@@ -3672,16 +3681,17 @@ def test_ap_hs20_fetch_osu_oom(dev, apdev):
params['hs20_icon'] = "128:80:zxx:image/png:w1fi_logo:w1fi_logo.png"
params['osu_ssid'] = '"HS 2.0 OSU open"'
params['osu_method_list'] = "1"
- params['osu_friendly_name'] = [ "eng:Test OSU", "fin:Testi-OSU" ]
+ params['osu_friendly_name'] = ["eng:Test OSU", "fin:Testi-OSU"]
params['osu_icon'] = "w1fi_logo"
- params['osu_service_desc'] = [ "eng:Example services", "fin:Esimerkkipalveluja" ]
+ params['osu_service_desc'] = ["eng:Example services",
+ "fin:Esimerkkipalveluja"]
params['osu_server_uri'] = "https://example.com/osu/"
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
dir = "/tmp/osu-fetch"
if os.path.isdir(dir):
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
else:
@@ -3703,7 +3713,7 @@ def test_ap_hs20_fetch_osu_oom(dev, apdev):
if ev is None:
raise Exception("Timeout on OSU fetch")
finally:
- files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+ files = [f for f in os.listdir(dir) if f.startswith("osu-")]
for f in files:
os.remove(dir + "/" + f)
os.rmdir(dir)
@@ -3791,12 +3801,12 @@ def test_ap_hs20_ft(dev, apdev):
hapd = hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com",
- 'update_identifier': "1234" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com",
+ 'update_identifier': "1234"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
dev[0].dump_monitor()
@@ -3843,16 +3853,16 @@ def test_ap_hs20_remediation_sql(dev, apdev, params):
cur.execute("CREATE TABLE authlog(timestamp TEXT, session TEXT, nas_ip TEXT, username TEXT, note TEXT)")
try:
- params = { "ssid": "as", "beacon_int": "2000",
- "radius_server_clients": "auth_serv/radius_clients.conf",
- "radius_server_auth_port": '18128',
- "eap_server": "1",
- "eap_user_file": "sqlite:" + dbfile,
- "ca_cert": "auth_serv/ca.pem",
- "server_cert": "auth_serv/server.pem",
- "private_key": "auth_serv/server.key",
- "subscr_remediation_url": "https://example.org/",
- "subscr_remediation_method": "1" }
+ params = {"ssid": "as", "beacon_int": "2000",
+ "radius_server_clients": "auth_serv/radius_clients.conf",
+ "radius_server_auth_port": '18128',
+ "eap_server": "1",
+ "eap_user_file": "sqlite:" + dbfile,
+ "ca_cert": "auth_serv/ca.pem",
+ "server_cert": "auth_serv/server.pem",
+ "private_key": "auth_serv/server.key",
+ "subscr_remediation_url": "https://example.org/",
+ "subscr_remediation_method": "1"}
hostapd.add_ap(apdev[1], params)
bssid = apdev[0]['bssid']
@@ -3862,10 +3872,10 @@ def test_ap_hs20_remediation_sql(dev, apdev, params):
dev[0].request("SET pmf 1")
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "user-mschapv2",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "user-mschapv2",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem"})
interworking_select(dev[0], bssid, freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
ev = dev[0].wait_event(["HS20-SUBSCRIPTION-REMEDIATION"], timeout=5)
@@ -3907,18 +3917,18 @@ def test_ap_hs20_sim_provisioning(dev, apdev, params):
cur.execute("CREATE TABLE current_sessions(mac_addr TEXT PRIMARY KEY, identity TEXT, start_time TEXT, nas TEXT, hs20_t_c_filtering BOOLEAN, waiting_coa_ack BOOLEAN, coa_ack_received BOOLEAN)")
try:
- params = { "ssid": "as", "beacon_int": "2000",
- "radius_server_clients": "auth_serv/radius_clients.conf",
- "radius_server_auth_port": '18128',
- "eap_server": "1",
- "eap_user_file": "sqlite:" + dbfile,
- "eap_sim_db": "unix:/tmp/hlr_auc_gw.sock",
- "ca_cert": "auth_serv/ca.pem",
- "server_cert": "auth_serv/server.pem",
- "private_key": "auth_serv/server.key",
- "hs20_sim_provisioning_url":
- "https://example.org/?hotspot2dot0-mobile-identifier-hash=",
- "subscr_remediation_method": "1" }
+ params = {"ssid": "as", "beacon_int": "2000",
+ "radius_server_clients": "auth_serv/radius_clients.conf",
+ "radius_server_auth_port": '18128',
+ "eap_server": "1",
+ "eap_user_file": "sqlite:" + dbfile,
+ "eap_sim_db": "unix:/tmp/hlr_auc_gw.sock",
+ "ca_cert": "auth_serv/ca.pem",
+ "server_cert": "auth_serv/server.pem",
+ "private_key": "auth_serv/server.key",
+ "hs20_sim_provisioning_url":
+ "https://example.org/?hotspot2dot0-mobile-identifier-hash=",
+ "subscr_remediation_method": "1"}
hostapd.add_ap(apdev[1], params)
bssid = apdev[0]['bssid']
@@ -4017,12 +4027,12 @@ def test_ap_hs20_random_mac_addr(dev, apdev):
wpas.request("SET rand_addr_lifetime 60")
wpas.hs20_enable()
wpas.flush_scan_cache()
- id = wpas.add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com",
- 'update_identifier': "1234" })
+ id = wpas.add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com",
+ 'update_identifier': "1234"})
interworking_select(wpas, bssid, "home", freq="2412")
interworking_connect(wpas, bssid, "TTLS")
addr1 = wpas.get_driver_status_field("addr")
@@ -4041,14 +4051,14 @@ def test_ap_hs20_multi_network_and_cred_removal(dev, apdev):
check_eap_capa(dev[0], "MSCHAPV2")
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.com,25[3:26]"]
+ params['nai_realm'] = ["0,example.com,25[3:26]"]
hapd = hostapd.add_ap(apdev[0], params)
dev[0].add_network()
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "user",
- 'password': "password" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "user",
+ 'password': "password"})
interworking_select(dev[0], bssid, freq="2412")
interworking_connect(dev[0], bssid, "PEAP")
dev[0].add_network()
@@ -4077,7 +4087,7 @@ def test_ap_hs20_interworking_add_network(dev, apdev):
check_eap_capa(dev[0], "MSCHAPV2")
bssid = apdev[0]['bssid']
params = hs20_ap_params()
- params['nai_realm'] = [ "0,example.com,21[3:26][6:7][99:99]" ]
+ params['nai_realm'] = ["0,example.com,21[3:26][6:7][99:99]"]
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
@@ -4116,12 +4126,12 @@ def _test_ap_hs20_proxyarp(dev, apdev):
subprocess.call(['brctl', 'setfd', 'ap-br0', '0'])
subprocess.call(['ip', 'link', 'set', 'dev', 'ap-br0', 'up'])
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com",
- 'update_identifier': "1234" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com",
+ 'update_identifier': "1234"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
@@ -4134,8 +4144,8 @@ def _test_ap_hs20_proxyarp(dev, apdev):
addr0 = dev[0].p2p_interface_addr()
addr1 = dev[1].p2p_interface_addr()
- src_ll_opt0 = b"\x01\x01" + binascii.unhexlify(addr0.replace(':',''))
- src_ll_opt1 = b"\x01\x01" + binascii.unhexlify(addr1.replace(':',''))
+ src_ll_opt0 = b"\x01\x01" + binascii.unhexlify(addr0.replace(':', ''))
+ src_ll_opt1 = b"\x01\x01" + binascii.unhexlify(addr1.replace(':', ''))
pkt = build_ns(src_ll=addr0, ip_src="aaaa:bbbb:cccc::2",
ip_dst="ff02::1:ff00:2", target="aaaa:bbbb:cccc::2",
@@ -4178,8 +4188,8 @@ def test_ap_hs20_hidden_ssid_in_scan_res(dev, apdev):
check_eap_capa(dev[0], "MSCHAPV2")
bssid = apdev[0]['bssid']
- hapd = hostapd.add_ap(apdev[0], { "ssid": 'secret',
- "ignore_broadcast_ssid": "1" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": 'secret',
+ "ignore_broadcast_ssid": "1"})
dev[0].scan_for_bss(bssid, freq=2412)
hapd.disable()
hapd_global = hostapd.HostapdGlobal(apdev[0])
@@ -4191,11 +4201,11 @@ def test_ap_hs20_hidden_ssid_in_scan_res(dev, apdev):
hapd = hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
@@ -4240,12 +4250,12 @@ def _test_ap_hs20_proxyarp_dgaf(dev, apdev, disabled):
subprocess.call(['brctl', 'setfd', 'ap-br0', '0'])
subprocess.call(['ip', 'link', 'set', 'dev', 'ap-br0', 'up'])
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com",
- 'update_identifier': "1234" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com",
+ 'update_identifier': "1234"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
@@ -4257,7 +4267,7 @@ def _test_ap_hs20_proxyarp_dgaf(dev, apdev, disabled):
addr0 = dev[0].p2p_interface_addr()
- src_ll_opt0 = b"\x01\x01" + binascii.unhexlify(addr0.replace(':',''))
+ src_ll_opt0 = b"\x01\x01" + binascii.unhexlify(addr0.replace(':', ''))
pkt = build_ns(src_ll=addr0, ip_src="aaaa:bbbb:cccc::2",
ip_dst="ff02::1:ff00:2", target="aaaa:bbbb:cccc::2",
@@ -4360,7 +4370,7 @@ def build_icmpv6(ipv6_addrs, type, code, payload):
def build_ra(src_ll, ip_src, ip_dst, cur_hop_limit=0, router_lifetime=0,
reachable_time=0, retrans_timer=0, opt=None):
link_mc = binascii.unhexlify("3333ff000002")
- _src_ll = binascii.unhexlify(src_ll.replace(':',''))
+ _src_ll = binascii.unhexlify(src_ll.replace(':', ''))
proto = b'\x86\xdd'
ehdr = link_mc + _src_ll + proto
_ip_src = socket.inet_pton(socket.AF_INET6, ip_src)
@@ -4381,7 +4391,7 @@ def build_ra(src_ll, ip_src, ip_dst, cur_hop_limit=0, router_lifetime=0,
def build_ns(src_ll, ip_src, ip_dst, target, opt=None):
link_mc = binascii.unhexlify("3333ff000002")
- _src_ll = binascii.unhexlify(src_ll.replace(':',''))
+ _src_ll = binascii.unhexlify(src_ll.replace(':', ''))
proto = b'\x86\xdd'
ehdr = link_mc + _src_ll + proto
_ip_src = socket.inet_pton(socket.AF_INET6, ip_src)
@@ -4414,7 +4424,7 @@ def send_ns(dev, src_ll=None, target=None, ip_src=None, ip_dst=None, opt=None,
cmd = "DATA_TEST_FRAME "
if opt is None:
- opt = b"\x01\x01" + binascii.unhexlify(src_ll.replace(':',''))
+ opt = b"\x01\x01" + binascii.unhexlify(src_ll.replace(':', ''))
pkt = build_ns(src_ll=src_ll, ip_src=ip_src, ip_dst=ip_dst, target=target,
opt=opt)
@@ -4423,7 +4433,7 @@ def send_ns(dev, src_ll=None, target=None, ip_src=None, ip_dst=None, opt=None,
def build_na(src_ll, ip_src, ip_dst, target, opt=None, flags=0):
link_mc = binascii.unhexlify("3333ff000002")
- _src_ll = binascii.unhexlify(src_ll.replace(':',''))
+ _src_ll = binascii.unhexlify(src_ll.replace(':', ''))
proto = b'\x86\xdd'
ehdr = link_mc + _src_ll + proto
_ip_src = socket.inet_pton(socket.AF_INET6, ip_src)
@@ -4461,8 +4471,8 @@ def build_dhcp_ack(dst_ll, src_ll, ip_src, ip_dst, yiaddr, chaddr,
subnet_mask="255.255.255.0", truncated_opt=False,
wrong_magic=False, force_tot_len=None, no_dhcp=False,
udp_checksum=True):
- _dst_ll = binascii.unhexlify(dst_ll.replace(':',''))
- _src_ll = binascii.unhexlify(src_ll.replace(':',''))
+ _dst_ll = binascii.unhexlify(dst_ll.replace(':', ''))
+ _src_ll = binascii.unhexlify(src_ll.replace(':', ''))
proto = b'\x08\x00'
ehdr = _dst_ll + _src_ll + proto
_ip_src = socket.inet_pton(socket.AF_INET, ip_src)
@@ -4473,7 +4483,7 @@ def build_dhcp_ack(dst_ll, src_ll, ip_src, ip_dst, yiaddr, chaddr,
_yiaddr = socket.inet_pton(socket.AF_INET, yiaddr)
_siaddr = b'\x00\x00\x00\x00'
_giaddr = b'\x00\x00\x00\x00'
- _chaddr = binascii.unhexlify(chaddr.replace(':','') + "00000000000000000000")
+ _chaddr = binascii.unhexlify(chaddr.replace(':', '') + "00000000000000000000")
payload = struct.pack('>BBBBL3BB', 2, 1, 6, 0, 12345, 0, 0, 0, 0)
payload += _ciaddr + _yiaddr + _siaddr + _giaddr + _chaddr + 192*b'\x00'
# magic
@@ -4522,14 +4532,14 @@ def build_dhcp_ack(dst_ll, src_ll, ip_src, ip_dst, yiaddr, chaddr,
def build_arp(dst_ll, src_ll, opcode, sender_mac, sender_ip,
target_mac, target_ip):
- _dst_ll = binascii.unhexlify(dst_ll.replace(':',''))
- _src_ll = binascii.unhexlify(src_ll.replace(':',''))
+ _dst_ll = binascii.unhexlify(dst_ll.replace(':', ''))
+ _src_ll = binascii.unhexlify(src_ll.replace(':', ''))
proto = b'\x08\x06'
ehdr = _dst_ll + _src_ll + proto
- _sender_mac = binascii.unhexlify(sender_mac.replace(':',''))
+ _sender_mac = binascii.unhexlify(sender_mac.replace(':', ''))
_sender_ip = socket.inet_pton(socket.AF_INET, sender_ip)
- _target_mac = binascii.unhexlify(target_mac.replace(':',''))
+ _target_mac = binascii.unhexlify(target_mac.replace(':', ''))
_target_ip = socket.inet_pton(socket.AF_INET, target_ip)
arp = struct.pack('>HHBBH', 1, 0x0800, 6, 4, opcode)
@@ -4565,7 +4575,7 @@ def get_permanent_neighbors(ifname):
cmd = subprocess.Popen(['ip', 'nei'], stdout=subprocess.PIPE)
res = cmd.stdout.read().decode()
cmd.stdout.close()
- return [ line for line in res.splitlines() if "PERMANENT" in line and ifname in line ]
+ return [line for line in res.splitlines() if "PERMANENT" in line and ifname in line]
def get_bridge_macs(ifname):
cmd = subprocess.Popen(['brctl', 'showmacs', ifname],
@@ -4576,9 +4586,9 @@ def get_bridge_macs(ifname):
def tshark_get_arp(cap, filter):
res = run_tshark(cap, filter,
- [ "eth.dst", "eth.src",
- "arp.src.hw_mac", "arp.src.proto_ipv4",
- "arp.dst.hw_mac", "arp.dst.proto_ipv4" ],
+ ["eth.dst", "eth.src",
+ "arp.src.hw_mac", "arp.src.proto_ipv4",
+ "arp.dst.hw_mac", "arp.dst.proto_ipv4"],
wait=False)
frames = []
for l in res.splitlines():
@@ -4587,10 +4597,10 @@ def tshark_get_arp(cap, filter):
def tshark_get_ns(cap):
res = run_tshark(cap, "icmpv6.type == 135",
- [ "eth.dst", "eth.src",
- "ipv6.src", "ipv6.dst",
- "icmpv6.nd.ns.target_address",
- "icmpv6.opt.linkaddr" ],
+ ["eth.dst", "eth.src",
+ "ipv6.src", "ipv6.dst",
+ "icmpv6.nd.ns.target_address",
+ "icmpv6.opt.linkaddr"],
wait=False)
frames = []
for l in res.splitlines():
@@ -4599,10 +4609,10 @@ def tshark_get_ns(cap):
def tshark_get_na(cap):
res = run_tshark(cap, "icmpv6.type == 136",
- [ "eth.dst", "eth.src",
- "ipv6.src", "ipv6.dst",
- "icmpv6.nd.na.target_address",
- "icmpv6.opt.linkaddr" ],
+ ["eth.dst", "eth.src",
+ "ipv6.src", "ipv6.dst",
+ "icmpv6.nd.na.target_address",
+ "icmpv6.opt.linkaddr"],
wait=False)
frames = []
for l in res.splitlines():
@@ -4622,7 +4632,7 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
prefix + ".%s.pcap" % dev[2].ifname)
bssid = apdev[0]['bssid']
- params = { 'ssid': 'open' }
+ params = {'ssid': 'open'}
params['proxy_arp'] = '1'
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
hapd.set("ap_isolate", "1")
@@ -4639,7 +4649,7 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
if "AP-ENABLED" not in ev:
raise Exception("AP startup failed")
- params2 = { 'ssid': 'another' }
+ params2 = {'ssid': 'another'}
hapd2 = hostapd.add_ap(apdev[1], params2, no_enable=True)
hapd2.set('bridge', 'ap-br0')
hapd2.enable()
@@ -4648,7 +4658,7 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
subprocess.call(['ip', 'link', 'set', 'dev', 'ap-br0', 'up'])
if ebtables:
- for chain in [ 'FORWARD', 'OUTPUT' ]:
+ for chain in ['FORWARD', 'OUTPUT']:
try:
subprocess.call(['ebtables', '-A', chain, '-p', 'ARP',
'-d', 'Broadcast', '-o', apdev[0]['ifname'],
@@ -4768,8 +4778,8 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
if '192.168.1.123 dev ap-br0 lladdr 02:00:00:00:00:00 PERMANENT' not in matches:
raise Exception("dev0 IPv4 addr missing")
- targets = [ "192.168.1.123", "192.168.1.124", "192.168.1.125",
- "192.168.1.126" ]
+ targets = ["192.168.1.123", "192.168.1.124", "192.168.1.125",
+ "192.168.1.126"]
for target in targets:
send_arp(dev[1], sender_ip="192.168.1.100", target_ip=target)
@@ -4884,18 +4894,18 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
logger.info("dev0 seen ARP requests:\n" + str(arp_req))
logger.info("dev0 seen ARP replies:\n" + str(arp_reply))
- if [ 'ff:ff:ff:ff:ff:ff', addr1,
- addr1, '192.168.1.100',
- '00:00:00:00:00:00', '192.168.1.123' ] in arp_req:
+ if ['ff:ff:ff:ff:ff:ff', addr1,
+ addr1, '192.168.1.100',
+ '00:00:00:00:00:00', '192.168.1.123'] in arp_req:
raise Exception("dev0 saw ARP request from dev1")
- if [ 'ff:ff:ff:ff:ff:ff', addr2,
- addr2, '192.168.1.103',
- '00:00:00:00:00:00', '192.168.1.123' ] in arp_req:
+ if ['ff:ff:ff:ff:ff:ff', addr2,
+ addr2, '192.168.1.103',
+ '00:00:00:00:00:00', '192.168.1.123'] in arp_req:
raise Exception("dev0 saw ARP request from dev2")
# TODO: Uncomment once fixed in kernel
- #if [ 'ff:ff:ff:ff:ff:ff', bssid,
- # bssid, '192.168.1.101',
- # '00:00:00:00:00:00', '192.168.1.123' ] in arp_req:
+ #if ['ff:ff:ff:ff:ff:ff', bssid,
+ # bssid, '192.168.1.101',
+ # '00:00:00:00:00:00', '192.168.1.123'] in arp_req:
# raise Exception("dev0 saw ARP request from br")
if ebtables:
@@ -4908,9 +4918,9 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
logger.info("dev1 seen ARP requests:\n" + str(arp_req))
logger.info("dev1 seen ARP replies:\n" + str(arp_reply))
- if [ 'ff:ff:ff:ff:ff:ff', addr2,
- addr2, '192.168.1.103',
- '00:00:00:00:00:00', '192.168.1.123' ] in arp_req:
+ if ['ff:ff:ff:ff:ff:ff', addr2,
+ addr2, '192.168.1.103',
+ '00:00:00:00:00:00', '192.168.1.123'] in arp_req:
raise Exception("dev1 saw ARP request from dev2")
if [addr1, addr0, addr0, '192.168.1.123', addr1, '192.168.1.100'] not in arp_reply:
raise Exception("dev1 did not get ARP response for 192.168.1.123")
@@ -4925,9 +4935,9 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
logger.info("dev2 seen ARP requests:\n" + str(arp_req))
logger.info("dev2 seen ARP replies:\n" + str(arp_reply))
- if [ addr2, addr0,
- addr0, '192.168.1.123',
- addr2, '192.168.1.103' ] not in arp_reply:
+ if [addr2, addr0,
+ addr0, '192.168.1.123',
+ addr2, '192.168.1.103'] not in arp_reply:
raise Exception("dev2 did not get ARP response for 192.168.1.123")
arp_req = tshark_get_arp(cap_br, "arp.opcode == 1")
@@ -4936,9 +4946,9 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
logger.info("br seen ARP replies:\n" + str(arp_reply))
# TODO: Uncomment once fixed in kernel
- #if [ bssid, addr0,
- # addr0, '192.168.1.123',
- # bssid, '192.168.1.101' ] not in arp_reply:
+ #if [bssid, addr0,
+ # addr0, '192.168.1.123',
+ # bssid, '192.168.1.101'] not in arp_reply:
# raise Exception("br did not get ARP response for 192.168.1.123")
def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
@@ -4955,7 +4965,7 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
prefix + ".%s.pcap" % dev[2].ifname)
bssid = apdev[0]['bssid']
- params = { 'ssid': 'open' }
+ params = {'ssid': 'open'}
params['proxy_arp'] = '1'
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
hapd.set("ap_isolate", "1")
@@ -4972,7 +4982,7 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
if "AP-ENABLED" not in ev:
raise Exception("AP startup failed")
- params2 = { 'ssid': 'another' }
+ params2 = {'ssid': 'another'}
hapd2 = hostapd.add_ap(apdev[1], params2, no_enable=True)
hapd2.set('bridge', 'ap-br0')
hapd2.enable()
@@ -4981,7 +4991,7 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
subprocess.call(['ip', 'link', 'set', 'dev', 'ap-br0', 'up'])
if ebtables:
- for chain in [ 'FORWARD', 'OUTPUT' ]:
+ for chain in ['FORWARD', 'OUTPUT']:
try:
subprocess.call(['ebtables', '-A', chain, '-d', 'Multicast',
'-p', 'IPv6', '--ip6-protocol', 'ipv6-icmp',
@@ -5038,8 +5048,8 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
addr1 = dev[1].p2p_interface_addr()
addr2 = dev[2].p2p_interface_addr()
- src_ll_opt0 = b"\x01\x01" + binascii.unhexlify(addr0.replace(':',''))
- src_ll_opt1 = b"\x01\x01" + binascii.unhexlify(addr1.replace(':',''))
+ src_ll_opt0 = b"\x01\x01" + binascii.unhexlify(addr0.replace(':', ''))
+ src_ll_opt1 = b"\x01\x01" + binascii.unhexlify(addr1.replace(':', ''))
# DAD NS
send_ns(dev[0], ip_src="::", target="aaaa:bbbb:cccc::2")
@@ -5139,8 +5149,8 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
na = tshark_get_na(cap_dev0)
logger.info("dev0 seen NA: " + str(na))
- if [ addr0, addr1, 'aaaa:bbbb:dddd::2', 'aaaa:bbbb:cccc::2',
- 'aaaa:bbbb:dddd::2', addr1 ] not in na:
+ if [addr0, addr1, 'aaaa:bbbb:dddd::2', 'aaaa:bbbb:cccc::2',
+ 'aaaa:bbbb:dddd::2', addr1] not in na:
# For now, skip the test instead of reporting the error since the IPv6
# proxyarp support is not yet in the upstream kernel tree.
#raise Exception("dev0 did not get NA for aaaa:bbbb:dddd::2")
@@ -5156,8 +5166,8 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
na = tshark_get_na(cap_dev1)
logger.info("dev1 seen NA: " + str(na))
- if [ addr1, addr0, 'aaaa:bbbb:cccc::2', 'aaaa:bbbb:dddd::2',
- 'aaaa:bbbb:cccc::2', addr0 ] not in na:
+ if [addr1, addr0, 'aaaa:bbbb:cccc::2', 'aaaa:bbbb:dddd::2',
+ 'aaaa:bbbb:cccc::2', addr0] not in na:
raise Exception("dev1 did not get NA for aaaa:bbbb:cccc::2")
if ebtables:
@@ -5171,14 +5181,14 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
logger.info("dev2 seen NA: " + str(na))
# FIX: enable once kernel implementation for proxyarp IPv6 is fixed
- #if [ addr2, addr0, 'aaaa:bbbb:cccc::2', 'aaaa:bbbb:ff00::2',
- # 'aaaa:bbbb:cccc::2', addr0 ] not in na:
+ #if [addr2, addr0, 'aaaa:bbbb:cccc::2', 'aaaa:bbbb:ff00::2',
+ # 'aaaa:bbbb:cccc::2', addr0] not in na:
# raise Exception("dev2 did not get NA for aaaa:bbbb:cccc::2")
- #if [ addr2, addr1, 'aaaa:bbbb:dddd::2', 'aaaa:bbbb:ff00::2',
- # 'aaaa:bbbb:dddd::2', addr1 ] not in na:
+ #if [addr2, addr1, 'aaaa:bbbb:dddd::2', 'aaaa:bbbb:ff00::2',
+ # 'aaaa:bbbb:dddd::2', addr1] not in na:
# raise Exception("dev2 did not get NA for aaaa:bbbb:dddd::2")
- #if [ addr2, addr1, 'aaaa:bbbb:eeee::2', 'aaaa:bbbb:ff00::2',
- # 'aaaa:bbbb:eeee::2', addr1 ] not in na:
+ #if [addr2, addr1, 'aaaa:bbbb:eeee::2', 'aaaa:bbbb:ff00::2',
+ # 'aaaa:bbbb:eeee::2', addr1] not in na:
# raise Exception("dev2 did not get NA for aaaa:bbbb:eeee::2")
def test_proxyarp_open(dev, apdev, params):
@@ -5242,11 +5252,11 @@ def test_proxyarp_errors(dev, apdev, params):
stderr=open('/dev/null', 'w'))
def run_proxyarp_errors(dev, apdev, params):
- params = { 'ssid': 'open',
- 'proxy_arp': '1',
- 'ap_isolate': '1',
- 'bridge': 'ap-br0',
- 'disable_dgaf': '1' }
+ params = {'ssid': 'open',
+ 'proxy_arp': '1',
+ 'ap_isolate': '1',
+ 'bridge': 'ap-br0',
+ 'disable_dgaf': '1'}
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
try:
hapd.enable()
@@ -5288,7 +5298,7 @@ def run_proxyarp_errors(dev, apdev, params):
wait_fail_trigger(dev[0], "GET_FAIL")
with alloc_fail(hapd, 1, "sta_ip6addr_add"):
- src_ll_opt0 = b"\x01\x01" + binascii.unhexlify(addr0.replace(':',''))
+ src_ll_opt0 = b"\x01\x01" + binascii.unhexlify(addr0.replace(':', ''))
pkt = build_ns(src_ll=addr0, ip_src="aaaa:bbbb:cccc::2",
ip_dst="ff02::1:ff00:2", target="aaaa:bbbb:cccc::2",
opt=src_ll_opt0)
@@ -5308,11 +5318,11 @@ def test_ap_hs20_connect_deinit(dev, apdev):
wpas.interface_add("wlan5", drv_params="")
wpas.hs20_enable()
wpas.flush_scan_cache()
- wpas.add_cred_values({ 'realm': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem",
- 'domain': "example.com" })
+ wpas.add_cred_values({'realm': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'domain': "example.com"})
wpas.scan_for_bss(bssid, freq=2412)
hapd.disable()
@@ -5339,26 +5349,26 @@ def test_ap_hs20_anqp_format_errors(dev, apdev):
hapd = hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- values = { 'realm': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.com" }
+ values = {'realm': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"}
id = dev[0].add_cred_values(values)
dev[0].scan_for_bss(bssid, freq="2412")
- tests = [ "00", "ffff", "010011223344", "020008000005112233445500",
- "01000400000000", "01000000000000",
- "01000300000200", "0100040000ff0000", "01000300000100",
- "01000300000001",
- "01000600000056112233",
- "01000900000002050001000111",
- "01000600000001000000", "01000600000001ff0000",
- "01000600000001020001",
- "010008000000010400010001", "0100080000000104000100ff",
- "010011000000010d00050200020100030005000600",
- "0000" ]
+ tests = ["00", "ffff", "010011223344", "020008000005112233445500",
+ "01000400000000", "01000000000000",
+ "01000300000200", "0100040000ff0000", "01000300000100",
+ "01000300000001",
+ "01000600000056112233",
+ "01000900000002050001000111",
+ "01000600000001000000", "01000600000001ff0000",
+ "01000600000001020001",
+ "010008000000010400010001", "0100080000000104000100ff",
+ "010011000000010d00050200020100030005000600",
+ "0000"]
for t in tests:
hapd.set("anqp_elem", "263:" + t)
dev[0].request("INTERWORKING_SELECT freq=2412")
@@ -5368,11 +5378,11 @@ def test_ap_hs20_anqp_format_errors(dev, apdev):
dev[0].dump_monitor()
dev[0].remove_cred(id)
- id = dev[0].add_cred_values({ 'imsi': "555444-333222111", 'eap': "AKA",
- 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"})
+ id = dev[0].add_cred_values({'imsi': "555444-333222111", 'eap': "AKA",
+ 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"})
- tests = [ "00", "0100", "0001", "00ff", "000200ff", "0003000101",
- "00020100" ]
+ tests = ["00", "0100", "0001", "00ff", "000200ff", "0003000101",
+ "00020100"]
for t in tests:
hapd.set("anqp_elem", "264:" + t)
dev[0].request("INTERWORKING_SELECT freq=2412")
@@ -5390,20 +5400,20 @@ def test_ap_hs20_cred_with_nai_realm(dev, apdev):
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "test",
- 'password': "secret",
- 'domain': "example.com",
- 'eap': 'TTLS' })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com",
+ 'eap': 'TTLS'})
interworking_select(dev[0], bssid, "home", freq=2412)
dev[0].remove_cred(id)
- id = dev[0].add_cred_values({ 'realm': "foo.com",
- 'username': "test",
- 'password': "secret",
- 'domain': "example.com",
- 'roaming_consortium': "112234",
- 'eap': 'TTLS' })
+ id = dev[0].add_cred_values({'realm': "foo.com",
+ 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com",
+ 'roaming_consortium': "112234",
+ 'eap': 'TTLS'})
interworking_select(dev[0], bssid, "home", freq=2412, no_match=True)
dev[0].remove_cred(id)
@@ -5417,12 +5427,12 @@ def test_ap_hs20_cred_and_no_roaming_consortium(dev, apdev):
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "test",
- 'password': "secret",
- 'domain': "example.com",
- 'roaming_consortium': "112234",
- 'eap': 'TTLS' })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com",
+ 'roaming_consortium': "112234",
+ 'eap': 'TTLS'})
interworking_select(dev[0], bssid, "home", freq=2412, no_match=True)
def test_ap_hs20_interworking_oom(dev, apdev):
@@ -5430,28 +5440,28 @@ def test_ap_hs20_interworking_oom(dev, apdev):
bssid = apdev[0]['bssid']
params = hs20_ap_params()
params['hessid'] = bssid
- params['nai_realm'] = [ "0,no.match.here;example.com;no.match.here.either,21[2:1][5:7]",
- "0,example.com,13[5:6],21[2:4][5:7]",
- "0,another.example.com" ]
+ params['nai_realm'] = ["0,no.match.here;example.com;no.match.here.either,21[2:1][5:7]",
+ "0,example.com,13[5:6],21[2:4][5:7]",
+ "0,another.example.com"]
hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "test",
- 'password': "secret",
- 'domain': "example.com",
- 'eap': 'TTLS' })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com",
+ 'eap': 'TTLS'})
dev[0].scan_for_bss(bssid, freq="2412")
- funcs = [ "wpabuf_alloc;interworking_anqp_send_req",
- "anqp_build_req;interworking_anqp_send_req",
- "gas_query_req;interworking_anqp_send_req",
- "dup_binstr;nai_realm_parse_realm",
- "=nai_realm_parse_realm",
- "=nai_realm_parse",
- "=nai_realm_match" ]
+ funcs = ["wpabuf_alloc;interworking_anqp_send_req",
+ "anqp_build_req;interworking_anqp_send_req",
+ "gas_query_req;interworking_anqp_send_req",
+ "dup_binstr;nai_realm_parse_realm",
+ "=nai_realm_parse_realm",
+ "=nai_realm_parse",
+ "=nai_realm_match"]
for func in funcs:
with alloc_fail(dev[0], 1, func):
dev[0].request("INTERWORKING_SELECT auto freq=2412")
@@ -5483,21 +5493,21 @@ def test_ap_hs20_no_rsn_connect(dev, apdev):
params['auth_server_port'] = "1812"
params['auth_server_shared_secret'] = "radius"
params['interworking'] = "1"
- params['roaming_consortium'] = [ "112233", "1020304050", "010203040506",
- "fedcba" ]
- params['nai_realm'] = [ "0,example.com,13[5:6],21[2:4][5:7]",
- "0,another.example.com" ]
+ params['roaming_consortium'] = ["112233", "1020304050", "010203040506",
+ "fedcba"]
+ params['nai_realm'] = ["0,example.com,13[5:6],21[2:4][5:7]",
+ "0,another.example.com"]
hapd = hostapd.add_ap(apdev[0], params)
dev[0].hs20_enable()
dev[0].scan_for_bss(bssid, freq="2412")
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "test",
- 'password': "secret",
- 'domain': "example.com",
- 'roaming_consortium': "112233",
- 'eap': 'TTLS' })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com",
+ 'roaming_consortium': "112233",
+ 'eap': 'TTLS'})
interworking_select(dev[0], bssid, freq=2412, no_match=True)
if "FAIL" not in dev[0].request("INTERWORKING_CONNECT " + bssid):
@@ -5512,12 +5522,12 @@ def test_ap_hs20_no_match_connect(dev, apdev):
dev[0].hs20_enable()
dev[0].scan_for_bss(bssid, freq="2412")
- id = dev[0].add_cred_values({ 'realm': "example.org",
- 'username': "test",
- 'password': "secret",
- 'domain': "example.org",
- 'roaming_consortium': "112234",
- 'eap': 'TTLS' })
+ id = dev[0].add_cred_values({'realm': "example.org",
+ 'username': "test",
+ 'password': "secret",
+ 'domain': "example.org",
+ 'roaming_consortium': "112234",
+ 'eap': 'TTLS'})
interworking_select(dev[0], bssid, freq=2412, no_match=True)
if "FAIL" not in dev[0].request("INTERWORKING_CONNECT " + bssid):
@@ -5528,30 +5538,30 @@ def test_ap_hs20_multiple_home_cred(dev, apdev):
bssid = apdev[0]['bssid']
params = hs20_ap_params()
params['hessid'] = bssid
- params['nai_realm'] = [ "0,example.com,13[5:6],21[2:4][5:7]" ]
+ params['nai_realm'] = ["0,example.com,13[5:6],21[2:4][5:7]"]
params['domain_name'] = "example.com"
hapd = hostapd.add_ap(apdev[0], params)
bssid2 = apdev[1]['bssid']
params = hs20_ap_params(ssid="test-hs20-other")
params['hessid'] = bssid2
- params['nai_realm'] = [ "0,example.org,13[5:6],21[2:4][5:7]" ]
+ params['nai_realm'] = ["0,example.org,13[5:6],21[2:4][5:7]"]
params['domain_name'] = "example.org"
hapd2 = hostapd.add_ap(apdev[1], params)
dev[0].hs20_enable()
dev[0].scan_for_bss(bssid2, freq="2412")
dev[0].scan_for_bss(bssid, freq="2412")
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'priority': '2',
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'priority': '2',
+ 'username': "hs20-test",
+ 'password': "password",
+ 'domain': "example.com"})
+ id2 = dev[0].add_cred_values({'realm': "example.org",
+ 'priority': '3',
'username': "hs20-test",
'password': "password",
- 'domain': "example.com" })
- id2 = dev[0].add_cred_values({ 'realm': "example.org",
- 'priority': '3',
- 'username': "hs20-test",
- 'password': "password",
- 'domain': "example.org" })
+ 'domain': "example.org"})
dev[0].request("INTERWORKING_SELECT auto freq=2412")
ev = dev[0].wait_connected(timeout=15)
if bssid2 not in ev:
@@ -5569,12 +5579,12 @@ def test_ap_hs20_anqp_invalid_gas_response(dev, apdev):
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "test",
- 'password': "secret",
- 'domain': "example.com",
- 'roaming_consortium': "112234",
- 'eap': 'TTLS' })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "test",
+ 'password': "secret",
+ 'domain': "example.com",
+ 'roaming_consortium': "112234",
+ 'eap': 'TTLS'})
dev[0].request("INTERWORKING_SELECT freq=2412")
query = gas_rx(hapd)
@@ -5656,11 +5666,11 @@ def test_ap_hs20_anqp_invalid_gas_response(dev, apdev):
if "result=SUCCESS" not in ev:
raise Exception("Unexpected result: " + ev)
- tests = [ struct.pack('<HH', 0xdddd, 0),
- struct.pack('<HH3B', 0xdddd, 3, 0x50, 0x6f, 0x9a),
- struct.pack('<HH4B', 0xdddd, 4, 0x50, 0x6f, 0x9a, 0),
- struct.pack('<HH4B', 0xdddd, 4, 0x11, 0x22, 0x33, 0),
- struct.pack('<HHHH', 1, 0, 1, 0) ]
+ tests = [struct.pack('<HH', 0xdddd, 0),
+ struct.pack('<HH3B', 0xdddd, 3, 0x50, 0x6f, 0x9a),
+ struct.pack('<HH4B', 0xdddd, 4, 0x50, 0x6f, 0x9a, 0),
+ struct.pack('<HH4B', 0xdddd, 4, 0x11, 0x22, 0x33, 0),
+ struct.pack('<HHHH', 1, 0, 1, 0)]
for elements in tests:
dev[0].request("INTERWORKING_SELECT freq=2412")
@@ -5691,11 +5701,11 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
dev[0].hs20_enable()
dev[0].scan_for_bss(bssid, freq="2412")
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'domain': "example.com",
- 'username': "test",
- 'password': "secret",
- 'eap': 'TTLS' })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'domain': "example.com",
+ 'username': "test",
+ 'password': "secret",
+ 'eap': 'TTLS'})
interworking_select(dev[0], bssid, "home", freq=2412)
dev[0].dump_monitor()
dev[0].request("NOTE ssid->eap.eap_methods = os_malloc()")
@@ -5704,10 +5714,10 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
dev[0].remove_cred(id)
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'domain': "example.com",
- 'username': "hs20-test-with-domain@example.com",
- 'password': "password" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'domain': "example.com",
+ 'username': "hs20-test-with-domain@example.com",
+ 'password': "password"})
interworking_select(dev[0], bssid, "home", freq=2412)
dev[0].dump_monitor()
dev[0].request("NOTE anon = os_malloc()")
@@ -5720,10 +5730,10 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
dev[0].remove_cred(id)
dev[0].wait_disconnected()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'domain': "example.com",
- 'username': "hs20-test",
- 'password': "password" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'domain': "example.com",
+ 'username': "hs20-test",
+ 'password': "password"})
interworking_select(dev[0], bssid, "home", freq=2412)
dev[0].dump_monitor()
dev[0].request("NOTE anon = os_malloc() (second)")
@@ -5746,12 +5756,12 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
dev[0].remove_cred(id)
- id = dev[0].add_cred_values({ 'roaming_consortium': "112233",
- 'domain': "example.com",
- 'username': "hs20-test",
- 'password': "password",
- 'eap': 'TTLS',
- 'phase2': "auth=MSCHAPV2" })
+ id = dev[0].add_cred_values({'roaming_consortium': "112233",
+ 'domain': "example.com",
+ 'username': "hs20-test",
+ 'password': "password",
+ 'eap': 'TTLS',
+ 'phase2': "auth=MSCHAPV2"})
interworking_select(dev[0], bssid, "home", freq=2412)
dev[0].dump_monitor()
dev[0].request("NOTE anon = os_strdup()")
@@ -5768,12 +5778,12 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
dev[0].remove_cred(id)
dev[0].wait_disconnected()
- id = dev[0].add_cred_values({ 'roaming_consortium': "112233",
- 'domain': "example.com",
- 'realm': "example.com",
- 'username': "user",
- 'password': "password",
- 'eap': 'PEAP' })
+ id = dev[0].add_cred_values({'roaming_consortium': "112233",
+ 'domain': "example.com",
+ 'realm': "example.com",
+ 'username': "user",
+ 'password': "password",
+ 'eap': 'PEAP'})
interworking_select(dev[0], bssid, "home", freq=2412)
dev[0].dump_monitor()
dev[0].request("NOTE id = os_strdup()")
@@ -5786,12 +5796,12 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
dev[0].remove_cred(id)
- id = dev[0].add_cred_values({ 'roaming_consortium': "112233",
- 'domain': "example.com",
- 'realm': "example.com",
- 'username': "user",
- 'password': "password",
- 'eap': "TTLS" })
+ id = dev[0].add_cred_values({'roaming_consortium': "112233",
+ 'domain': "example.com",
+ 'realm': "example.com",
+ 'username': "user",
+ 'password': "password",
+ 'eap': "TTLS"})
interworking_select(dev[0], bssid, "home", freq=2412)
dev[0].dump_monitor()
dev[0].request("NOTE wpa_config_set_quoted(identity) (second)")
@@ -5810,11 +5820,11 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
dev[0].remove_cred(id)
- id = dev[0].add_cred_values({ 'roaming_consortium': "112233",
- 'domain': "example.com",
- 'realm': "example.com",
- 'username': "user",
- 'eap': "PEAP" })
+ id = dev[0].add_cred_values({'roaming_consortium': "112233",
+ 'domain': "example.com",
+ 'realm': "example.com",
+ 'username': "user",
+ 'eap': "PEAP"})
dev[0].set_cred(id, "password", "ext:password")
interworking_select(dev[0], bssid, "home", freq=2412)
dev[0].dump_monitor()
@@ -5827,15 +5837,15 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
dev[0].remove_cred(id)
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'domain': "example.com",
- 'username': "certificate-user",
- 'phase1': "include_tls_length=0",
- 'domain_suffix_match': "example.com",
- 'ca_cert': "auth_serv/ca.pem",
- 'client_cert': "auth_serv/user.pem",
- 'private_key': "auth_serv/user.key",
- 'private_key_passwd': "secret" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'domain': "example.com",
+ 'username': "certificate-user",
+ 'phase1': "include_tls_length=0",
+ 'domain_suffix_match': "example.com",
+ 'ca_cert': "auth_serv/ca.pem",
+ 'client_cert': "auth_serv/user.pem",
+ 'private_key': "auth_serv/user.key",
+ 'private_key_passwd': "secret"})
interworking_select(dev[0], bssid, "home", freq=2412)
dev[0].dump_monitor()
dev[0].request("NOTE wpa_config_set_quoted(client_cert)")
@@ -5863,8 +5873,8 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
dev[0].remove_cred(id)
- id = dev[0].add_cred_values({ 'imsi': "555444-333222111", 'eap': "SIM",
- 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"})
+ id = dev[0].add_cred_values({'imsi': "555444-333222111", 'eap': "SIM",
+ 'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"})
interworking_select(dev[0], bssid, freq=2412)
dev[0].dump_monitor()
with alloc_fail(dev[0], 1, "interworking_set_hs20_params"):
@@ -5884,9 +5894,9 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
dev[0].remove_cred(id)
- id = dev[0].add_cred_values({ 'roaming_consortium': "112233",
- 'username': "user@example.com",
- 'password': "password" })
+ id = dev[0].add_cred_values({'roaming_consortium': "112233",
+ 'username': "user@example.com",
+ 'password': "password"})
interworking_select(dev[0], bssid, freq=2412)
dev[0].dump_monitor()
dev[0].request("NOTE Interworking: No EAP method set for credential using roaming consortium")
@@ -5897,10 +5907,10 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
params = hs20_ap_params()
params['nai_realm'] = "0,example.com,25[3:26]"
hapd = hostapd.add_ap(apdev[0], params)
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'domain': "example.com",
- 'username': "hs20-test",
- 'password': "password" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'domain': "example.com",
+ 'username': "hs20-test",
+ 'password': "password"})
interworking_select(dev[0], bssid, freq=2412)
dev[0].dump_monitor()
dev[0].request("NOTE wpa_config_set(PEAP/FAST-phase1)")
@@ -6170,14 +6180,14 @@ def run_ap_hs20_terms_and_conditions_sql(dev, apdev, params, url_template,
try:
- params = { "ssid": "as", "beacon_int": "2000",
- "radius_server_clients": "auth_serv/radius_clients.conf",
- "radius_server_auth_port": '18128',
- "eap_server": "1",
- "eap_user_file": "sqlite:" + dbfile,
- "ca_cert": "auth_serv/ca.pem",
- "server_cert": "auth_serv/server.pem",
- "private_key": "auth_serv/server.key" }
+ params = {"ssid": "as", "beacon_int": "2000",
+ "radius_server_clients": "auth_serv/radius_clients.conf",
+ "radius_server_auth_port": '18128',
+ "eap_server": "1",
+ "eap_user_file": "sqlite:" + dbfile,
+ "ca_cert": "auth_serv/ca.pem",
+ "server_cert": "auth_serv/server.pem",
+ "private_key": "auth_serv/server.key"}
params['hs20_t_c_server_url'] = url_template
authsrv = hostapd.add_ap(apdev[1], params)
@@ -6195,10 +6205,10 @@ def run_ap_hs20_terms_and_conditions_sql(dev, apdev, params, url_template,
dev[0].request("SET pmf 1")
dev[0].hs20_enable()
- id = dev[0].add_cred_values({ 'realm': "example.com",
- 'username': "user-mschapv2",
- 'password': "password",
- 'ca_cert': "auth_serv/ca.pem" })
+ id = dev[0].add_cred_values({'realm': "example.com",
+ 'username': "user-mschapv2",
+ 'password': "password",
+ 'ca_cert': "auth_serv/ca.pem"})
interworking_select(dev[0], bssid, freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py
index 1df9a9d..9c6f1e4 100644
--- a/tests/hwsim/test_ap_ht.py
+++ b/tests/hwsim/test_ap_ht.py
@@ -36,9 +36,9 @@ def set_world_reg(apdev0=None, apdev1=None, dev0=None):
def test_ap_ht40_scan(dev, apdev):
"""HT40 co-ex scan"""
clear_scan_cache(apdev[0])
- params = { "ssid": "test-ht40",
- "channel": "5",
- "ht_capab": "[HT40-]"}
+ params = {"ssid": "test-ht40",
+ "channel": "5",
+ "ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
state = hapd.get_status_field("state")
@@ -76,8 +76,8 @@ def test_ap_ht40_scan(dev, apdev):
def test_ap_ht_wifi_generation(dev, apdev):
"""HT and wifi_generation"""
clear_scan_cache(apdev[0])
- params = { "ssid": "test-ht",
- "channel": "6" }
+ params = {"ssid": "test-ht",
+ "channel": "6"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-ht", key_mgmt="NONE", scan_freq="2437")
@@ -104,14 +104,14 @@ def test_ap_ht_wifi_generation(dev, apdev):
def test_ap_ht40_scan_conflict(dev, apdev):
"""HT40 co-ex scan conflict"""
clear_scan_cache(apdev[0])
- params = { "ssid": "test-ht40",
- "channel": "6",
- "ht_capab": "[HT40+]"}
+ params = {"ssid": "test-ht40",
+ "channel": "6",
+ "ht_capab": "[HT40+]"}
hostapd.add_ap(apdev[1], params)
- params = { "ssid": "test-ht40",
- "channel": "5",
- "ht_capab": "[HT40-]"}
+ params = {"ssid": "test-ht40",
+ "channel": "5",
+ "ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
state = hapd.get_status_field("state")
@@ -145,14 +145,14 @@ def test_ap_ht40_scan_conflict(dev, apdev):
def test_ap_ht40_scan_conflict2(dev, apdev):
"""HT40 co-ex scan conflict (HT40-)"""
clear_scan_cache(apdev[0])
- params = { "ssid": "test-ht40",
- "channel": "11",
- "ht_capab": "[HT40-]"}
+ params = {"ssid": "test-ht40",
+ "channel": "11",
+ "ht_capab": "[HT40-]"}
hostapd.add_ap(apdev[1], params)
- params = { "ssid": "test-ht40",
- "channel": "1",
- "ht_capab": "[HT40+]"}
+ params = {"ssid": "test-ht40",
+ "channel": "1",
+ "ht_capab": "[HT40+]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
state = hapd.get_status_field("state")
@@ -185,8 +185,8 @@ def test_ap_ht40_scan_conflict2(dev, apdev):
def test_ap_ht40_scan_not_affected(dev, apdev):
"""HT40 co-ex scan and other BSS not affected"""
clear_scan_cache(apdev[0])
- params = { "ssid": "test-ht20",
- "channel": "11" }
+ params = {"ssid": "test-ht20",
+ "channel": "11"}
hostapd.add_ap(apdev[1], params)
hostapd.cmd_execute(apdev[0], ['ifconfig', apdev[0]['ifname'], 'up'])
@@ -197,9 +197,9 @@ def test_ap_ht40_scan_not_affected(dev, apdev):
time.sleep(0.1)
hostapd.cmd_execute(apdev[0], ['ifconfig', apdev[0]['ifname'], 'down'])
- params = { "ssid": "test-ht40",
- "channel": "1",
- "ht_capab": "[HT40+]"}
+ params = {"ssid": "test-ht40",
+ "channel": "1",
+ "ht_capab": "[HT40+]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
state = hapd.get_status_field("state")
@@ -233,13 +233,13 @@ def test_ap_ht40_scan_not_affected(dev, apdev):
def test_ap_ht40_scan_legacy_conflict(dev, apdev):
"""HT40 co-ex scan conflict with legacy 20 MHz AP"""
clear_scan_cache(apdev[0])
- params = { "ssid": "legacy-20",
- "channel": "7", "ieee80211n": "0" }
+ params = {"ssid": "legacy-20",
+ "channel": "7", "ieee80211n": "0"}
hostapd.add_ap(apdev[1], params)
- params = { "ssid": "test-ht40",
- "channel": "5",
- "ht_capab": "[HT40-]"}
+ params = {"ssid": "test-ht40",
+ "channel": "5",
+ "ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
state = hapd.get_status_field("state")
@@ -273,13 +273,13 @@ def test_ap_ht40_scan_legacy_conflict(dev, apdev):
def test_ap_ht40_scan_ht20_conflict(dev, apdev):
"""HT40 co-ex scan conflict with HT 20 MHz AP"""
clear_scan_cache(apdev[0])
- params = { "ssid": "ht-20",
- "channel": "7", "ieee80211n": "1" }
+ params = {"ssid": "ht-20",
+ "channel": "7", "ieee80211n": "1"}
hostapd.add_ap(apdev[1], params)
- params = { "ssid": "test-ht40",
- "channel": "5",
- "ht_capab": "[HT40-]"}
+ params = {"ssid": "test-ht40",
+ "channel": "5",
+ "ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
state = hapd.get_status_field("state")
@@ -312,14 +312,14 @@ def test_ap_ht40_scan_ht20_conflict(dev, apdev):
def test_ap_ht40_scan_intolerant(dev, apdev):
"""HT40 co-ex scan finding an AP advertising 40 MHz intolerant"""
clear_scan_cache(apdev[0])
- params = { "ssid": "another-bss",
- "channel": "1",
- "ht_capab": "[40-INTOLERANT]" }
+ params = {"ssid": "another-bss",
+ "channel": "1",
+ "ht_capab": "[40-INTOLERANT]"}
hostapd.add_ap(apdev[1], params)
- params = { "ssid": "test-ht40",
- "channel": "1",
- "ht_capab": "[HT40+]"}
+ params = {"ssid": "test-ht40",
+ "channel": "1",
+ "ht_capab": "[HT40+]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
state = hapd.get_status_field("state")
@@ -352,14 +352,14 @@ def test_ap_ht40_scan_intolerant(dev, apdev):
def test_ap_ht40_scan_match(dev, apdev):
"""HT40 co-ex scan matching configuration"""
clear_scan_cache(apdev[0])
- params = { "ssid": "test-ht40",
- "channel": "5",
- "ht_capab": "[HT40-]"}
+ params = {"ssid": "test-ht40",
+ "channel": "5",
+ "ht_capab": "[HT40-]"}
hostapd.add_ap(apdev[1], params)
- params = { "ssid": "test-ht40",
- "channel": "5",
- "ht_capab": "[HT40-]"}
+ params = {"ssid": "test-ht40",
+ "channel": "5",
+ "ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
state = hapd.get_status_field("state")
@@ -395,17 +395,17 @@ def test_ap_ht40_5ghz_match(dev, apdev):
try:
hapd = None
hapd2 = None
- params = { "ssid": "test-ht40",
- "hw_mode": "a",
- "channel": "36",
- "country_code": "US",
- "ht_capab": "[HT40+]"}
+ params = {"ssid": "test-ht40",
+ "hw_mode": "a",
+ "channel": "36",
+ "country_code": "US",
+ "ht_capab": "[HT40+]"}
hapd2 = hostapd.add_ap(apdev[1], params)
- params = { "ssid": "test-ht40",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]"}
+ params = {"ssid": "test-ht40",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
state = hapd.get_status_field("state")
@@ -449,17 +449,17 @@ def test_ap_ht40_5ghz_switch(dev, apdev):
try:
hapd = None
hapd2 = None
- params = { "ssid": "test-ht40",
- "hw_mode": "a",
- "channel": "36",
- "country_code": "US",
- "ht_capab": "[HT40+]"}
+ params = {"ssid": "test-ht40",
+ "hw_mode": "a",
+ "channel": "36",
+ "country_code": "US",
+ "ht_capab": "[HT40+]"}
hapd2 = hostapd.add_ap(apdev[1], params)
- params = { "ssid": "test-ht40",
- "hw_mode": "a",
- "channel": "40",
- "ht_capab": "[HT40-]"}
+ params = {"ssid": "test-ht40",
+ "hw_mode": "a",
+ "channel": "40",
+ "ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
state = hapd.get_status_field("state")
@@ -502,11 +502,11 @@ def test_ap_ht40_5ghz_switch2(dev, apdev):
try:
hapd = None
hapd2 = None
- params = { "ssid": "test-ht40",
- "hw_mode": "a",
- "channel": "36",
- "country_code": "US",
- "ht_capab": "[HT40+]"}
+ params = {"ssid": "test-ht40",
+ "hw_mode": "a",
+ "channel": "36",
+ "country_code": "US",
+ "ht_capab": "[HT40+]"}
hapd2 = hostapd.add_ap(apdev[1], params)
id = dev[0].add_network()
@@ -518,10 +518,10 @@ def test_ap_ht40_5ghz_switch2(dev, apdev):
dev[0].select_network(id)
time.sleep(1)
- params = { "ssid": "test-ht40",
- "hw_mode": "a",
- "channel": "40",
- "ht_capab": "[HT40-]"}
+ params = {"ssid": "test-ht40",
+ "hw_mode": "a",
+ "channel": "40",
+ "ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
state = hapd.get_status_field("state")
@@ -561,29 +561,29 @@ def test_ap_ht40_5ghz_switch2(dev, apdev):
def test_obss_scan(dev, apdev):
"""Overlapping BSS scan request"""
- params = { "ssid": "obss-scan",
- "channel": "6",
- "ht_capab": "[HT40-]",
- "obss_interval": "10" }
+ params = {"ssid": "obss-scan",
+ "channel": "6",
+ "ht_capab": "[HT40-]",
+ "obss_interval": "10"}
hapd = hostapd.add_ap(apdev[0], params)
- params = { "ssid": "another-bss",
- "channel": "9",
- "ieee80211n": "0" }
+ params = {"ssid": "another-bss",
+ "channel": "9",
+ "ieee80211n": "0"}
hostapd.add_ap(apdev[1], params)
run_obss_scan(hapd, dev)
def test_obss_scan_ht40_plus(dev, apdev):
"""Overlapping BSS scan request (HT40+)"""
- params = { "ssid": "obss-scan",
- "channel": "6",
- "ht_capab": "[HT40+]",
- "obss_interval": "10" }
+ params = {"ssid": "obss-scan",
+ "channel": "6",
+ "ht_capab": "[HT40+]",
+ "obss_interval": "10"}
hapd = hostapd.add_ap(apdev[0], params)
- params = { "ssid": "another-bss",
- "channel": "9",
- "ieee80211n": "0" }
+ params = {"ssid": "another-bss",
+ "channel": "9",
+ "ieee80211n": "0"}
hostapd.add_ap(apdev[1], params)
run_obss_scan(hapd, dev)
@@ -621,15 +621,15 @@ def run_obss_scan(hapd, dev):
def test_obss_scan_40_intolerant(dev, apdev):
"""Overlapping BSS scan request with 40 MHz intolerant AP"""
- params = { "ssid": "obss-scan",
- "channel": "6",
- "ht_capab": "[HT40-]",
- "obss_interval": "10" }
+ params = {"ssid": "obss-scan",
+ "channel": "6",
+ "ht_capab": "[HT40-]",
+ "obss_interval": "10"}
hapd = hostapd.add_ap(apdev[0], params)
- params = { "ssid": "another-bss",
- "channel": "7",
- "ht_capab": "[40-INTOLERANT]" }
+ params = {"ssid": "another-bss",
+ "channel": "7",
+ "ht_capab": "[40-INTOLERANT]"}
hostapd.add_ap(apdev[1], params)
dev[0].connect("obss-scan", key_mgmt="NONE", scan_freq="2437")
@@ -666,9 +666,9 @@ def test_obss_scan_40_intolerant(dev, apdev):
def test_obss_coex_report_handling(dev, apdev):
"""Overlapping BSS scan report handling with obss_interval=0"""
clear_scan_cache(apdev[0])
- params = { "ssid": "obss-scan",
- "channel": "6",
- "ht_capab": "[HT40-]" }
+ params = {"ssid": "obss-scan",
+ "channel": "6",
+ "ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
dev[0].connect("obss-scan", key_mgmt="NONE", scan_freq="2437")
@@ -679,10 +679,10 @@ def test_obss_coex_report_handling(dev, apdev):
# 20/40 MHz co-ex report tests: number of invalid reports and a valid report
# that forces 20 MHz channel.
- tests = [ '0400', '040048', '04004801', '0400480000', '0400490100',
- '040048ff0000', '04004801ff49ff00', '04004801004900',
- '0400480100490101', '0400480100490201ff',
- '040048010449020005' ]
+ tests = ['0400', '040048', '04004801', '0400480000', '0400490100',
+ '040048ff0000', '04004801ff49ff00', '04004801004900',
+ '0400480100490101', '0400480100490201ff',
+ '040048010449020005']
for msg in tests:
req = "MGMT_TX {} {} freq=2437 action={}".format(bssid, bssid, msg)
if "OK" not in dev[0].request(req):
@@ -695,10 +695,10 @@ def test_obss_coex_report_handling(dev, apdev):
def test_obss_coex_report_handling1(dev, apdev):
"""Overlapping BSS scan report handling with obss_interval=1"""
clear_scan_cache(apdev[0])
- params = { "ssid": "obss-scan",
- "channel": "6",
- "ht_capab": "[HT40+]",
- "obss_interval": "1" }
+ params = {"ssid": "obss-scan",
+ "channel": "6",
+ "ht_capab": "[HT40+]",
+ "obss_interval": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
dev[0].connect("obss-scan", key_mgmt="NONE", scan_freq="2437")
@@ -729,10 +729,10 @@ def test_obss_coex_report_handling1(dev, apdev):
def test_obss_coex_report_handling2(dev, apdev):
"""Overlapping BSS scan report handling with obss_interval=1 and no overlap"""
clear_scan_cache(apdev[0])
- params = { "ssid": "obss-scan",
- "channel": "6",
- "ht_capab": "[HT40+]",
- "obss_interval": "1" }
+ params = {"ssid": "obss-scan",
+ "channel": "6",
+ "ht_capab": "[HT40+]",
+ "obss_interval": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
dev[0].connect("obss-scan", key_mgmt="NONE", scan_freq="2437")
@@ -765,19 +765,19 @@ def test_obss_coex_report_handling2(dev, apdev):
def test_olbc(dev, apdev):
"""OLBC detection"""
- params = { "ssid": "test-olbc",
- "channel": "6",
- "ht_capab": "[HT40-]",
- "ap_table_expiration_time": "2" }
+ params = {"ssid": "test-olbc",
+ "channel": "6",
+ "ht_capab": "[HT40-]",
+ "ap_table_expiration_time": "2"}
hapd = hostapd.add_ap(apdev[0], params)
status = hapd.get_status()
if status['olbc'] != '0' or status['olbc_ht'] != '0':
raise Exception("Unexpected OLBC information")
- params = { "ssid": "olbc-ap",
- "hw_mode": "b",
- "channel": "6",
- "wmm_enabled": "0" }
+ params = {"ssid": "olbc-ap",
+ "hw_mode": "b",
+ "channel": "6",
+ "wmm_enabled": "0"}
hostapd.add_ap(apdev[1], params)
time.sleep(0.5)
status = hapd.get_status()
@@ -806,9 +806,9 @@ def test_olbc_table_limit(dev, apdev):
hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
- params = { "ssid": "test-olbc",
- "channel": "1",
- "ap_table_max_size": "2" }
+ params = {"ssid": "test-olbc",
+ "channel": "1",
+ "ap_table_max_size": "2"}
hapd = hostapd.add_ap(apdev[1], params)
time.sleep(0.3)
@@ -824,22 +824,22 @@ def test_olbc_5ghz(dev, apdev):
try:
hapd = None
hapd2 = None
- params = { "ssid": "test-olbc",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]" }
+ params = {"ssid": "test-olbc",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]"}
hapd = hostapd.add_ap(apdev[0], params)
status = hapd.get_status()
if status['olbc'] != '0' or status['olbc_ht'] != '0':
raise Exception("Unexpected OLBC information")
- params = { "ssid": "olbc-ap",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": "36",
- "ieee80211n": "0",
- "wmm_enabled": "0" }
+ params = {"ssid": "olbc-ap",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": "36",
+ "ieee80211n": "0",
+ "wmm_enabled": "0"}
hapd2 = hostapd.add_ap(apdev[1], params)
found = False
for i in range(20):
@@ -860,8 +860,8 @@ def test_olbc_5ghz(dev, apdev):
def test_ap_require_ht(dev, apdev):
"""Require HT"""
- params = { "ssid": "require-ht",
- "require_ht": "1" }
+ params = {"ssid": "require-ht",
+ "require_ht": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[1].connect("require-ht", key_mgmt="NONE", scan_freq="2412",
@@ -881,7 +881,7 @@ def test_ap_require_ht(dev, apdev):
def test_ap_ht_stbc(dev, apdev):
"""HT STBC overrides"""
- params = { "ssid": "ht" }
+ params = {"ssid": "ht"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("ht", key_mgmt="NONE", scan_freq="2412")
@@ -893,9 +893,9 @@ def test_ap_ht_stbc(dev, apdev):
@remote_compatible
def test_ap_require_ht_limited_rates(dev, apdev):
"""Require HT with limited supported rates"""
- params = { "ssid": "require-ht",
- "supported_rates": "60 120 240 360 480 540",
- "require_ht": "1" }
+ params = {"ssid": "require-ht",
+ "supported_rates": "60 120 240 360 480 540",
+ "require_ht": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[1].connect("require-ht", key_mgmt="NONE", scan_freq="2412",
@@ -911,9 +911,9 @@ def test_ap_require_ht_limited_rates(dev, apdev):
@remote_compatible
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][DSSS_CCK-40][LSIG-TXOP-PROT]"}
+ 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][DSSS_CCK-40][LSIG-TXOP-PROT]"}
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
if "FAIL" not in hapd.request("ENABLE"):
raise Exception("Unexpected ENABLE success")
@@ -921,9 +921,9 @@ def test_ap_ht_capab_not_supported(dev, apdev):
def test_ap_ht_40mhz_intolerant_sta(dev, apdev):
"""Associated STA indicating 40 MHz intolerant"""
clear_scan_cache(apdev[0])
- params = { "ssid": "intolerant",
- "channel": "6",
- "ht_capab": "[HT40-]" }
+ params = {"ssid": "intolerant",
+ "channel": "6",
+ "ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params)
if hapd.get_status_field("num_sta_ht40_intolerant") != "0":
raise Exception("Unexpected num_sta_ht40_intolerant value")
@@ -954,10 +954,10 @@ def test_ap_ht_40mhz_intolerant_sta(dev, apdev):
def test_ap_ht_40mhz_intolerant_sta_deinit(dev, apdev):
"""Associated STA indicating 40 MHz intolerant and hostapd deinit"""
clear_scan_cache(apdev[0])
- params = { "ssid": "intolerant",
- "channel": "6",
- "ht_capab": "[HT40-]",
- "obss_interval": "0" }
+ params = {"ssid": "intolerant",
+ "channel": "6",
+ "ht_capab": "[HT40-]",
+ "obss_interval": "0"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("intolerant", key_mgmt="NONE", scan_freq="2437",
@@ -973,10 +973,10 @@ def test_ap_ht_40mhz_intolerant_sta_deinit(dev, apdev):
def test_ap_ht_40mhz_intolerant_ap(dev, apdev):
"""Associated STA reports 40 MHz intolerant AP after association"""
clear_scan_cache(apdev[0])
- params = { "ssid": "ht",
- "channel": "6",
- "ht_capab": "[HT40-]",
- "obss_interval": "3" }
+ params = {"ssid": "ht",
+ "channel": "6",
+ "ht_capab": "[HT40-]",
+ "obss_interval": "3"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("ht", key_mgmt="NONE", scan_freq="2437")
@@ -985,9 +985,9 @@ def test_ap_ht_40mhz_intolerant_ap(dev, apdev):
raise Exception("Unexpected secondary channel information")
logger.info("Start 40 MHz intolerant AP")
- params = { "ssid": "intolerant",
- "channel": "5",
- "ht_capab": "[40-INTOLERANT]" }
+ params = {"ssid": "intolerant",
+ "channel": "5",
+ "ht_capab": "[40-INTOLERANT]"}
hapd2 = hostapd.add_ap(apdev[1], params)
logger.info("Waiting for co-ex report from STA")
@@ -1025,12 +1025,12 @@ def test_ap_ht40_csa(dev, apdev):
csa_supported(dev[0])
try:
hapd = None
- params = { "ssid": "ht",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1" }
+ params = {"ssid": "ht",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("ht", key_mgmt="NONE", scan_freq="5180")
@@ -1069,12 +1069,12 @@ def test_ap_ht40_csa2(dev, apdev):
csa_supported(dev[0])
try:
hapd = None
- params = { "ssid": "ht",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1" }
+ params = {"ssid": "ht",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("ht", key_mgmt="NONE", scan_freq="5180")
@@ -1113,12 +1113,12 @@ def test_ap_ht40_csa3(dev, apdev):
csa_supported(dev[0])
try:
hapd = None
- params = { "ssid": "ht",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1" }
+ params = {"ssid": "ht",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("ht", key_mgmt="NONE", scan_freq="5180")
@@ -1155,12 +1155,12 @@ def test_ap_ht40_csa3(dev, apdev):
@remote_compatible
def test_ap_ht_smps(dev, apdev):
"""SMPS AP configuration options"""
- params = { "ssid": "ht1", "ht_capab": "[SMPS-STATIC]" }
+ params = {"ssid": "ht1", "ht_capab": "[SMPS-STATIC]"}
try:
hapd = hostapd.add_ap(apdev[0], params)
except:
raise HwsimSkip("Assume mac80211_hwsim was not recent enough to support SMPS")
- params = { "ssid": "ht2", "ht_capab": "[SMPS-DYNAMIC]" }
+ params = {"ssid": "ht2", "ht_capab": "[SMPS-DYNAMIC]"}
hapd2 = hostapd.add_ap(apdev[1], params)
dev[0].connect("ht1", key_mgmt="NONE", scan_freq="2412")
@@ -1171,14 +1171,14 @@ def test_ap_ht_smps(dev, apdev):
@remote_compatible
def test_prefer_ht20(dev, apdev):
"""Preference on HT20 over no-HT"""
- params = { "ssid": "test",
- "channel": "1",
- "ieee80211n": "0" }
+ params = {"ssid": "test",
+ "channel": "1",
+ "ieee80211n": "0"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
- params = { "ssid": "test",
- "channel": "1",
- "ieee80211n": "1" }
+ params = {"ssid": "test",
+ "channel": "1",
+ "ieee80211n": "1"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
@@ -1198,15 +1198,15 @@ def test_prefer_ht20(dev, apdev):
def test_prefer_ht40(dev, apdev):
"""Preference on HT40 over HT20"""
- params = { "ssid": "test",
- "channel": "1",
- "ieee80211n": "1" }
+ params = {"ssid": "test",
+ "channel": "1",
+ "ieee80211n": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
- params = { "ssid": "test",
- "channel": "1",
- "ieee80211n": "1",
- "ht_capab": "[HT40+]" }
+ params = {"ssid": "test",
+ "channel": "1",
+ "ieee80211n": "1",
+ "ht_capab": "[HT40+]"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
@@ -1227,18 +1227,18 @@ def test_prefer_ht40(dev, apdev):
@remote_compatible
def test_prefer_ht20_during_roam(dev, apdev):
"""Preference on HT20 over no-HT in roaming consideration"""
- params = { "ssid": "test",
- "channel": "1",
- "ieee80211n": "0" }
+ params = {"ssid": "test",
+ "channel": "1",
+ "ieee80211n": "0"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
dev[0].scan_for_bss(bssid, freq=2412)
dev[0].connect("test", key_mgmt="NONE", scan_freq="2412")
- params = { "ssid": "test",
- "channel": "1",
- "ieee80211n": "1" }
+ params = {"ssid": "test",
+ "channel": "1",
+ "ieee80211n": "1"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
dev[0].scan_for_bss(bssid2, freq=2412)
@@ -1253,11 +1253,11 @@ def test_ap_ht40_5ghz_invalid_pair(dev, apdev):
"""HT40 on 5 GHz with invalid channel pair"""
clear_scan_cache(apdev[0])
try:
- params = { "ssid": "test-ht40",
- "hw_mode": "a",
- "channel": "40",
- "country_code": "US",
- "ht_capab": "[HT40+]"}
+ params = {"ssid": "test-ht40",
+ "hw_mode": "a",
+ "channel": "40",
+ "country_code": "US",
+ "ht_capab": "[HT40+]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
ev = hapd.wait_event(["AP-DISABLED", "AP-ENABLED"], timeout=10)
if not ev:
@@ -1274,11 +1274,11 @@ def test_ap_ht40_5ghz_disabled_sec(dev, apdev):
"""HT40 on 5 GHz with disabled secondary channel"""
clear_scan_cache(apdev[0])
try:
- params = { "ssid": "test-ht40",
- "hw_mode": "a",
- "channel": "48",
- "country_code": "US",
- "ht_capab": "[HT40+]"}
+ params = {"ssid": "test-ht40",
+ "hw_mode": "a",
+ "channel": "48",
+ "country_code": "US",
+ "ht_capab": "[HT40+]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
ev = hapd.wait_event(["AP-DISABLED", "AP-ENABLED"], timeout=10)
if not ev:
@@ -1295,15 +1295,15 @@ def test_ap_ht40_scan_broken_ap(dev, apdev):
clear_scan_cache(apdev[0])
# Broken AP: Include HT Capabilities element but not HT Operation element
- params = { "ssid": "legacy-20",
- "channel": "7", "ieee80211n": "0",
- "wmm_enabled": "1",
- "vendor_elements": "2d1a0e001bffff000000000000000000000100000000000000000000" }
+ params = {"ssid": "legacy-20",
+ "channel": "7", "ieee80211n": "0",
+ "wmm_enabled": "1",
+ "vendor_elements": "2d1a0e001bffff000000000000000000000100000000000000000000"}
hapd2 = hostapd.add_ap(apdev[1], params)
- params = { "ssid": "test-ht40",
- "channel": "5",
- "ht_capab": "[HT40-]"}
+ params = {"ssid": "test-ht40",
+ "channel": "5",
+ "ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
state = hapd.get_status_field("state")
@@ -1340,10 +1340,10 @@ def run_op_class(dev, apdev, hw_mode, channel, country, ht_capab, sec_chan,
freq, opclass):
clear_scan_cache(apdev[0])
try:
- params = { "ssid": "test-ht40",
- "hw_mode": hw_mode,
- "channel": channel,
- "ht_capab": ht_capab }
+ params = {"ssid": "test-ht40",
+ "hw_mode": hw_mode,
+ "channel": channel,
+ "ht_capab": ht_capab}
if country:
params['country_code'] = country
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
@@ -1439,9 +1439,9 @@ def test_ap_ht_op_class_127(dev, apdev):
def test_ap_ht40_plus_minus1(dev, apdev):
"""HT40 with both plus and minus allowed (1)"""
clear_scan_cache(apdev[0])
- params = { "ssid": "test-ht40",
- "channel": "11",
- "ht_capab": "[HT40+][HT40-]"}
+ params = {"ssid": "test-ht40",
+ "channel": "11",
+ "ht_capab": "[HT40+][HT40-]"}
hapd = hostapd.add_ap(apdev[0], params)
freq = hapd.get_status_field("freq")
@@ -1459,9 +1459,9 @@ def test_ap_ht40_plus_minus1(dev, apdev):
def test_ap_ht40_plus_minus2(dev, apdev):
"""HT40 with both plus and minus allowed (2)"""
clear_scan_cache(apdev[0])
- params = { "ssid": "test-ht40",
- "channel": "1",
- "ht_capab": "[HT40+][HT40-]"}
+ params = {"ssid": "test-ht40",
+ "channel": "1",
+ "ht_capab": "[HT40+][HT40-]"}
hapd = hostapd.add_ap(apdev[0], params)
freq = hapd.get_status_field("freq")
@@ -1479,9 +1479,9 @@ def test_ap_ht40_plus_minus2(dev, apdev):
def test_ap_ht40_disable(dev, apdev):
"""HT40 disabling"""
clear_scan_cache(apdev[0])
- params = { "ssid": "test-ht40",
- "channel": "6",
- "ht_capab": "[HT40-]"}
+ params = {"ssid": "test-ht40",
+ "channel": "6",
+ "ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params)
sec = hapd.get_status_field("secondary_channel")
diff --git a/tests/hwsim/test_ap_open.py b/tests/hwsim/test_ap_open.py
index cca0cb7..4cdb33a 100644
--- a/tests/hwsim/test_ap_open.py
+++ b/tests/hwsim/test_ap_open.py
@@ -25,26 +25,26 @@ def test_ap_open(dev, apdev):
_test_ap_open(dev, apdev)
def _test_ap_open(dev, apdev):
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
bg_scan_period="0")
- ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5)
+ ev = hapd.wait_event(["AP-STA-CONNECTED"], timeout=5)
if ev is None:
raise Exception("No connection event received from hostapd")
hwsim_utils.test_connectivity(dev[0], hapd)
dev[0].request("DISCONNECT")
- ev = hapd.wait_event([ "AP-STA-DISCONNECTED" ], timeout=5)
+ ev = hapd.wait_event(["AP-STA-DISCONNECTED"], timeout=5)
if ev is None:
raise Exception("No disconnection event received from hostapd")
def test_ap_open_packet_loss(dev, apdev):
"""AP with open mode configuration and large packet loss"""
- params = { "ssid": "open",
- "ignore_probe_probability": "0.5",
- "ignore_auth_probability": "0.5",
- "ignore_assoc_probability": "0.5",
- "ignore_reassoc_probability": "0.5" }
+ params = {"ssid": "open",
+ "ignore_probe_probability": "0.5",
+ "ignore_auth_probability": "0.5",
+ "ignore_assoc_probability": "0.5",
+ "ignore_reassoc_probability": "0.5"}
hapd = hostapd.add_ap(apdev[0], params)
for i in range(0, 3):
dev[i].connect("open", key_mgmt="NONE", scan_freq="2412",
@@ -55,7 +55,7 @@ def test_ap_open_packet_loss(dev, apdev):
@remote_compatible
def test_ap_open_unknown_action(dev, apdev):
"""AP with open mode configuration and unknown Action frame"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
bssid = apdev[0]['bssid']
cmd = "MGMT_TX {} {} freq=2412 action=765432".format(bssid, bssid)
@@ -69,7 +69,7 @@ def test_ap_open_unknown_action(dev, apdev):
def test_ap_open_invalid_wmm_action(dev, apdev):
"""AP with open mode configuration and invalid WMM Action frame"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
bssid = apdev[0]['bssid']
cmd = "MGMT_TX {} {} freq=2412 action=1100".format(bssid, bssid)
@@ -82,7 +82,7 @@ def test_ap_open_invalid_wmm_action(dev, apdev):
@remote_compatible
def test_ap_open_reconnect_on_inactivity_disconnect(dev, apdev):
"""Reconnect to open mode AP after inactivity related disconnection"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
hapd.request("DEAUTHENTICATE " + dev[0].p2p_interface_addr() + " reason=4")
dev[0].wait_disconnected(timeout=5)
@@ -92,7 +92,7 @@ def test_ap_open_reconnect_on_inactivity_disconnect(dev, apdev):
def test_ap_open_assoc_timeout(dev, apdev):
"""AP timing out association"""
ssid = "test"
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].scan(freq="2412")
hapd.set("ext_mgmt_frame_handling", "1")
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
@@ -131,7 +131,7 @@ def test_ap_open_assoc_timeout(dev, apdev):
def test_ap_open_auth_drop_sta(dev, apdev):
"""AP dropping station after successful authentication"""
- hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0]['ifname'], {"ssid": "open"})
dev[0].scan(freq="2412")
hapd.set("ext_mgmt_frame_handling", "1")
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
@@ -162,7 +162,7 @@ def test_ap_open_auth_drop_sta(dev, apdev):
@remote_compatible
def test_ap_open_id_str(dev, apdev):
"""AP with open mode and id_str"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412", id_str="foo",
wait_connect=False)
ev = dev[0].wait_connected(timeout=10)
@@ -174,7 +174,7 @@ def test_ap_open_id_str(dev, apdev):
@remote_compatible
def test_ap_open_select_any(dev, apdev):
"""AP with open mode and select any network"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
id = dev[0].connect("unknown", key_mgmt="NONE", scan_freq="2412",
only_add_network=True)
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
@@ -193,7 +193,7 @@ def test_ap_open_select_any(dev, apdev):
@remote_compatible
def test_ap_open_unexpected_assoc_event(dev, apdev):
"""AP with open mode and unexpected association event"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
dev[0].request("DISCONNECT")
dev[0].wait_disconnected(timeout=15)
@@ -214,7 +214,7 @@ def test_ap_open_unexpected_assoc_event(dev, apdev):
def test_ap_open_external_assoc(dev, apdev):
"""AP with open mode and external association"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open-ext-assoc" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open-ext-assoc"})
try:
dev[0].request("STA_AUTOCONNECT 0")
id = dev[0].connect("open-ext-assoc", key_mgmt="NONE", scan_freq="2412",
@@ -224,8 +224,8 @@ def test_ap_open_external_assoc(dev, apdev):
# This will be accepted due to matching network
dev[0].cmd_execute(['iw', 'dev', dev[0].ifname, 'connect',
'open-ext-assoc', "2412", apdev[0]['bssid']])
- ev = dev[0].wait_event([ "CTRL-EVENT-DISCONNECTED",
- "CTRL-EVENT-CONNECTED" ], timeout=10)
+ ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED",
+ "CTRL-EVENT-CONNECTED"], timeout=10)
if ev is None:
raise Exception("Connection timed out")
if "CTRL-EVENT-DISCONNECTED" in ev:
@@ -240,9 +240,9 @@ def test_ap_open_external_assoc(dev, apdev):
def test_ap_bss_load(dev, apdev):
"""AP with open mode (no security) configuration"""
hapd = hostapd.add_ap(apdev[0],
- { "ssid": "open",
- "bss_load_update_period": "10",
- "chan_util_avg_period": "20" })
+ {"ssid": "open",
+ "bss_load_update_period": "10",
+ "chan_util_avg_period": "20"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
# this does not really get much useful output with mac80211_hwsim currently,
# but run through the channel survey update couple of times
@@ -258,8 +258,8 @@ def test_ap_bss_load(dev, apdev):
def test_ap_bss_load_fail(dev, apdev):
"""BSS Load update failing to get survey data"""
hapd = hostapd.add_ap(apdev[0],
- { "ssid": "open",
- "bss_load_update_period": "1" })
+ {"ssid": "open",
+ "bss_load_update_period": "1"})
with fail_test(hapd, 1, "wpa_driver_nl80211_get_survey"):
wait_fail_trigger(hapd, "GET_FAIL")
@@ -267,7 +267,7 @@ def hapd_out_of_mem(hapd, apdev, count, func):
with alloc_fail(hapd, count, func):
started = False
try:
- hostapd.add_ap(apdev, { "ssid": "open" })
+ hostapd.add_ap(apdev, {"ssid": "open"})
started = True
except:
pass
@@ -276,7 +276,7 @@ def hapd_out_of_mem(hapd, apdev, count, func):
def test_ap_open_out_of_memory(dev, apdev):
"""hostapd failing to setup interface due to allocation failure"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
hapd_out_of_mem(hapd, apdev[1], 1, "hostapd_alloc_bss_data")
for i in range(1, 3):
@@ -297,12 +297,12 @@ def test_ap_open_out_of_memory(dev, apdev):
# verify that a new interface can still be added when memory allocation does
# not fail
- hostapd.add_ap(apdev[1], { "ssid": "open" })
+ hostapd.add_ap(apdev[1], {"ssid": "open"})
def test_bssid_black_white_list(dev, apdev):
"""BSSID black/white list"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
- hapd2 = hostapd.add_ap(apdev[1], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
+ hapd2 = hostapd.add_ap(apdev[1], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
bssid_whitelist=apdev[1]['bssid'])
@@ -340,8 +340,8 @@ def test_bssid_black_white_list(dev, apdev):
def test_ap_open_wpas_in_bridge(dev, apdev):
"""Open mode AP and wpas interface in a bridge"""
- br_ifname='sta-br0'
- ifname='wlan5'
+ br_ifname = 'sta-br0'
+ ifname = 'wlan5'
try:
_test_ap_open_wpas_in_bridge(dev, apdev)
finally:
@@ -351,10 +351,10 @@ def test_ap_open_wpas_in_bridge(dev, apdev):
subprocess.call(['iw', ifname, 'set', '4addr', 'off'])
def _test_ap_open_wpas_in_bridge(dev, apdev):
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
- br_ifname='sta-br0'
- ifname='wlan5'
+ br_ifname = 'sta-br0'
+ ifname = 'wlan5'
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
# First, try a failure case of adding an interface
try:
@@ -379,8 +379,8 @@ def _test_ap_open_wpas_in_bridge(dev, apdev):
@remote_compatible
def test_ap_open_start_disabled(dev, apdev):
"""AP with open mode and beaconing disabled"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open",
- "start_disabled": "1" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open",
+ "start_disabled": "1"})
bssid = apdev[0]['bssid']
dev[0].flush_scan_cache()
@@ -395,8 +395,8 @@ def test_ap_open_start_disabled(dev, apdev):
@remote_compatible
def test_ap_open_start_disabled2(dev, apdev):
"""AP with open mode and beaconing disabled (2)"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open",
- "start_disabled": "1" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open",
+ "start_disabled": "1"})
bssid = apdev[0]['bssid']
dev[0].flush_scan_cache()
@@ -417,8 +417,8 @@ def test_ap_open_start_disabled2(dev, apdev):
@remote_compatible
def test_ap_open_ifdown(dev, apdev):
"""AP with open mode and external ifconfig down"""
- params = { "ssid": "open",
- "ap_max_inactivity": "1" }
+ params = {"ssid": "open",
+ "ap_max_inactivity": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@@ -448,10 +448,10 @@ def test_ap_open_ifdown(dev, apdev):
def test_ap_open_disconnect_in_ps(dev, apdev, params):
"""Disconnect with the client in PS to regression-test a kernel bug"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
bg_scan_period="0")
- ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5)
+ ev = hapd.wait_event(["AP-STA-CONNECTED"], timeout=5)
if ev is None:
raise Exception("No connection event received from hostapd")
@@ -493,9 +493,9 @@ def test_ap_open_disconnect_in_ps(dev, apdev, params):
@remote_compatible
def test_ap_open_select_network(dev, apdev):
"""Open mode connection and SELECT_NETWORK to change network"""
- hapd1 = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd1 = hostapd.add_ap(apdev[0], {"ssid": "open"})
bssid1 = apdev[0]['bssid']
- hapd2 = hostapd.add_ap(apdev[1], { "ssid": "open2" })
+ hapd2 = hostapd.add_ap(apdev[1], {"ssid": "open2"})
bssid2 = apdev[1]['bssid']
id1 = dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
@@ -520,7 +520,7 @@ def test_ap_open_select_network(dev, apdev):
@remote_compatible
def test_ap_open_disable_enable(dev, apdev):
"""AP with open mode getting disabled and re-enabled"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
bg_scan_period="0")
@@ -560,7 +560,7 @@ def sta_enable_disable(dev, bssid):
def test_ap_open_sta_enable_disable(dev, apdev):
"""AP with open mode and wpa_supplicant ENABLE/DISABLE_NETWORK"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
bssid = apdev[0]['bssid']
sta_enable_disable(dev[0], bssid)
@@ -578,7 +578,7 @@ def test_ap_open_select_twice(dev, apdev):
ev = dev[0].wait_event(["CTRL-EVENT-NETWORK-NOT-FOUND"], timeout=10)
if ev is None:
raise Exception("No result reported")
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
# Verify that the second SELECT_NETWORK starts a new scan immediately by
# waiting less than the default scan period.
dev[0].select_network(id)
@@ -607,7 +607,7 @@ def test_ap_open_reassoc_not_found(dev, apdev):
@remote_compatible
def test_ap_open_sta_statistics(dev, apdev):
"""AP with open mode and STA statistics"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@@ -627,7 +627,7 @@ def test_ap_open_sta_statistics(dev, apdev):
@remote_compatible
def test_ap_open_poll_sta(dev, apdev):
"""AP with open mode and STA poll"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@@ -641,7 +641,7 @@ def test_ap_open_poll_sta(dev, apdev):
def test_ap_open_pmf_default(dev, apdev):
"""AP with open mode (no security) configuration and pmf=2"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[1].connect("open", key_mgmt="NONE", scan_freq="2412",
ieee80211w="2", wait_connect=False)
dev[2].connect("open", key_mgmt="NONE", scan_freq="2412",
@@ -664,7 +664,7 @@ def test_ap_open_pmf_default(dev, apdev):
def test_ap_open_drv_fail(dev, apdev):
"""AP with open mode and driver operations failing"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
with fail_test(dev[0], 1, "wpa_driver_nl80211_authenticate"):
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
@@ -679,17 +679,17 @@ def test_ap_open_drv_fail(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
def run_multicast_to_unicast(dev, apdev, convert):
- params = { "ssid": "open" }
+ params = {"ssid": "open"}
params["multicast_to_unicast"] = "1" if convert else "0"
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(hapd.own_addr(), freq=2412)
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
- ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5)
+ ev = hapd.wait_event(["AP-STA-CONNECTED"], timeout=5)
if ev is None:
raise Exception("No connection event received from hostapd")
hwsim_utils.test_connectivity(dev[0], hapd, multicast_to_unicast=convert)
dev[0].request("DISCONNECT")
- ev = hapd.wait_event([ "AP-STA-DISCONNECTED" ], timeout=5)
+ ev = hapd.wait_event(["AP-STA-DISCONNECTED"], timeout=5)
if ev is None:
raise Exception("No disconnection event received from hostapd")
@@ -703,8 +703,8 @@ def test_ap_open_multicast_to_unicast_disabled(dev, apdev):
def test_ap_open_drop_duplicate(dev, apdev, params):
"""AP dropping duplicate management frames"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open",
- "interworking": "1" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open",
+ "interworking": "1"})
hapd.set("ext_mgmt_frame_handling", "1")
bssid = hapd.own_addr().replace(':', '')
addr = "020304050607"
@@ -763,7 +763,7 @@ def test_ap_open_drop_duplicate(dev, apdev, params):
def test_ap_open_select_network_freq(dev, apdev):
"""AP with open mode and use for SELECT_NETWORK freq parameter"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
id = dev[0].connect("open", key_mgmt="NONE", only_add_network=True)
dev[0].select_network(id, freq=2412)
start = os.times()[4]
@@ -803,10 +803,10 @@ def _test_ap_open_country(dev, apdev, country_code, country3):
clear_regdom(hapd, dev)
def run_ap_open_country(dev, apdev, country_code, country3):
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open",
- "country_code": country_code,
- "country3": country3,
- "ieee80211d": "1" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open",
+ "country_code": country_code,
+ "country3": country3,
+ "ieee80211d": "1"})
dev[0].scan_for_bss(hapd.own_addr(), freq=2412)
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
dev[0].wait_regdom(country_ie=True)
@@ -814,8 +814,8 @@ def run_ap_open_country(dev, apdev, country_code, country3):
def test_ap_open_disable_select(dev, apdev):
"""DISABLE_NETWORK for connected AP followed by SELECT_NETWORK"""
- hapd1 = hostapd.add_ap(apdev[0], { "ssid": "open" })
- hapd2 = hostapd.add_ap(apdev[1], { "ssid": "open" })
+ hapd1 = hostapd.add_ap(apdev[0], {"ssid": "open"})
+ hapd2 = hostapd.add_ap(apdev[1], {"ssid": "open"})
id = dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
dev[0].request("DISABLE_NETWORK %d" % id)
@@ -828,7 +828,7 @@ def test_ap_open_disable_select(dev, apdev):
def test_ap_open_reassoc_same(dev, apdev):
"""AP with open mode and STA reassociating back to same AP without auth exchange"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
try:
dev[0].request("SET reassoc_same_bss_optim 1")
@@ -840,10 +840,10 @@ def test_ap_open_reassoc_same(dev, apdev):
def test_ap_open_no_reflection(dev, apdev):
"""AP with open mode, STA sending packets to itself"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
- ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5)
+ ev = hapd.wait_event(["AP-STA-CONNECTED"], timeout=5)
if ev is None:
raise Exception("No connection event received from hostapd")
# test normal connectivity is OK
@@ -867,8 +867,8 @@ def test_ap_open_no_reflection(dev, apdev):
def test_ap_no_auth_ack(dev, apdev):
"""AP not receiving Authentication frame ACK"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open",
- "ap_max_inactivity": "1" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open",
+ "ap_max_inactivity": "1"})
hapd.set("ext_mgmt_frame_handling", "1")
bssid = hapd.own_addr()
addr = "02:01:02:03:04:05"
diff --git a/tests/hwsim/test_ap_params.py b/tests/hwsim/test_ap_params.py
index 72e05b9..8a183c4 100644
--- a/tests/hwsim/test_ap_params.py
+++ b/tests/hwsim/test_ap_params.py
@@ -92,8 +92,8 @@ def test_ap_element_parse(dev, apdev):
"""Information element parsing - extra coverage"""
bssid = apdev[0]['bssid']
ssid = "test-wpa2-psk"
- params = { 'ssid': ssid,
- 'vendor_elements': "380501020304059e009e009e009e009e009e00" }
+ params = {'ssid': ssid,
+ 'vendor_elements': "380501020304059e009e009e009e009e009e00"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
bss = dev[0].get_bss(bssid)
@@ -105,8 +105,8 @@ def test_ap_element_parse_oom(dev, apdev):
"""Information element parsing OOM"""
bssid = apdev[0]['bssid']
ssid = "test-wpa2-psk"
- params = { 'ssid': ssid,
- 'vendor_elements': "dd0d506f9a0a00000600411c440028" }
+ params = {'ssid': ssid,
+ 'vendor_elements': "dd0d506f9a0a00000600411c440028"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
with alloc_fail(dev[0], 1, "wpabuf_alloc;ieee802_11_vendor_ie_concat"):
@@ -489,7 +489,7 @@ def test_ap_max_num_sta_no_probe_resp(dev, apdev, params):
dev[1].scan(freq=2412, type="ONLY")
if seen:
out = run_tshark(os.path.join(logdir, "hwsim0.pcapng"),
- "wlan.fc.type_subtype == 5", ["wlan.da" ])
+ "wlan.fc.type_subtype == 5", ["wlan.da"])
if out:
if dev[0].own_addr() not in out:
# Discovery happened through Beacon frame reception. That's not
@@ -547,7 +547,7 @@ def test_ap_tx_queue_params_invalid(dev, apdev):
def test_ap_beacon_rate_legacy(dev, apdev):
"""Open AP with Beacon frame TX rate 5.5 Mbps"""
- hapd = hostapd.add_ap(apdev[0], { 'ssid': 'beacon-rate' })
+ hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if (int(res, 0) & 0x0000080000000000) == 0:
raise HwsimSkip("Setting Beacon frame TX rate not supported")
@@ -558,7 +558,7 @@ def test_ap_beacon_rate_legacy(dev, apdev):
def test_ap_beacon_rate_legacy2(dev, apdev):
"""Open AP with Beacon frame TX rate 12 Mbps in VHT BSS"""
- hapd = hostapd.add_ap(apdev[0], { 'ssid': 'beacon-rate' })
+ hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if (int(res, 0) & 0x0000080000000000) == 0:
raise HwsimSkip("Setting Beacon frame TX rate not supported")
@@ -585,7 +585,7 @@ def test_ap_beacon_rate_legacy2(dev, apdev):
def test_ap_beacon_rate_ht(dev, apdev):
"""Open AP with Beacon frame TX rate HT-MCS 0"""
- hapd = hostapd.add_ap(apdev[0], { 'ssid': 'beacon-rate' })
+ hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if (int(res, 0) & 0x0000100000000000) == 0:
raise HwsimSkip("Setting Beacon frame TX rate not supported")
@@ -596,7 +596,7 @@ def test_ap_beacon_rate_ht(dev, apdev):
def test_ap_beacon_rate_ht2(dev, apdev):
"""Open AP with Beacon frame TX rate HT-MCS 1 in VHT BSS"""
- hapd = hostapd.add_ap(apdev[0], { 'ssid': 'beacon-rate' })
+ hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if (int(res, 0) & 0x0000100000000000) == 0:
raise HwsimSkip("Setting Beacon frame TX rate not supported")
@@ -623,7 +623,7 @@ def test_ap_beacon_rate_ht2(dev, apdev):
def test_ap_beacon_rate_vht(dev, apdev):
"""Open AP with Beacon frame TX rate VHT-MCS 0"""
- hapd = hostapd.add_ap(apdev[0], { 'ssid': 'beacon-rate' })
+ hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if (int(res, 0) & 0x0000200000000000) == 0:
raise HwsimSkip("Setting Beacon frame TX rate not supported")
@@ -651,8 +651,8 @@ def test_ap_beacon_rate_vht(dev, apdev):
def test_ap_wep_to_wpa(dev, apdev):
"""WEP to WPA2-PSK configuration change in hostapd"""
hapd = hostapd.add_ap(apdev[0],
- { "ssid": "wep-to-wpa",
- "wep_key0": '"hello"' })
+ {"ssid": "wep-to-wpa",
+ "wep_key0": '"hello"'})
dev[0].flush_scan_cache()
dev[0].connect("wep-to-wpa", key_mgmt="NONE", wep_key0='"hello"',
scan_freq="2412")
@@ -723,7 +723,7 @@ def test_ap_eapol_version(dev, apdev):
def test_ap_dtim_period(dev, apdev):
"""DTIM period configuration"""
ssid = "dtim-period"
- params = { 'ssid': ssid, 'dtim_period': "10" }
+ params = {'ssid': ssid, 'dtim_period': "10"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
@@ -749,7 +749,7 @@ def test_ap_dtim_period(dev, apdev):
def test_ap_no_probe_resp(dev, apdev):
"""AP with Probe Response frame sending from hostapd disabled"""
ssid = "no-probe-resp"
- params = { 'ssid': ssid, 'send_probe_response': "0" }
+ params = {'ssid': ssid, 'send_probe_response': "0"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq="2412", passive=True)
@@ -763,9 +763,9 @@ def test_ap_no_probe_resp(dev, apdev):
def test_ap_long_preamble(dev, apdev):
"""AP with long preamble"""
ssid = "long-preamble"
- params = { 'ssid': ssid, 'preamble': "0",
- 'hw_mode': 'b', 'ieee80211n': '0',
- 'supported_rates': '10', 'basic_rates': '10' }
+ params = {'ssid': ssid, 'preamble': "0",
+ 'hw_mode': 'b', 'ieee80211n': '0',
+ 'supported_rates': '10', 'basic_rates': '10'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq="2412")
@@ -775,7 +775,7 @@ def test_ap_long_preamble(dev, apdev):
def test_ap_wmm_uapsd(dev, apdev):
"""AP with U-APSD advertisement"""
ssid = "uapsd"
- params = { 'ssid': ssid, 'uapsd_advertisement_enabled': "1" }
+ params = {'ssid': ssid, 'uapsd_advertisement_enabled': "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq="2412")
@@ -785,7 +785,7 @@ def test_ap_wmm_uapsd(dev, apdev):
def test_ap_wowlan_triggers(dev, apdev):
"""AP with wowlan_triggers"""
ssid = "wowlan"
- params = { 'ssid': ssid, 'wowlan_triggers': "any" }
+ params = {'ssid': ssid, 'wowlan_triggers': "any"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq="2412")
diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py
index bcb95ac..e35914c 100644
--- a/tests/hwsim/test_ap_psk.py
+++ b/tests/hwsim/test_ap_psk.py
@@ -135,7 +135,7 @@ def test_ap_wpa2_psk_file_keyid(dev, apdev, params):
if "OK" not in hapd.request("RELOAD_WPA_PSK"):
raise Exception("RELOAD_WPA_PSK failed")
- check_disconnect(dev, [ False, True, False ])
+ check_disconnect(dev, [False, True, False])
with open(psk_file, 'w') as f:
f.write('00:00:00:00:00:00 secret passphrase\n')
@@ -163,7 +163,7 @@ def test_ap_wpa2_psk_file_keyid(dev, apdev, params):
if "OK" not in hapd.request("RELOAD_WPA_PSK"):
raise Exception("RELOAD_WPA_PSK failed")
- check_disconnect(dev, [ True, True, False ])
+ check_disconnect(dev, [True, True, False])
@remote_compatible
def test_ap_wpa2_psk_mem(dev, apdev):
@@ -260,8 +260,8 @@ def test_ap_wpa2_sha256_ptk_rekey(dev, apdev):
if ev is None:
raise Exception("PTK rekey timed out")
hwsim_utils.test_connectivity(dev[0], hapd)
- check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-6"),
- ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-6") ])
+ check_mib(dev[0], [("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-6"),
+ ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-6")])
@remote_compatible
def test_ap_wpa2_sha256_ptk_rekey_ap(dev, apdev):
@@ -278,8 +278,8 @@ def test_ap_wpa2_sha256_ptk_rekey_ap(dev, apdev):
if ev is None:
raise Exception("PTK rekey timed out")
hwsim_utils.test_connectivity(dev[0], hapd)
- check_mib(dev[0], [ ("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-6"),
- ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-6") ])
+ check_mib(dev[0], [("dot11RSNAAuthenticationSuiteRequested", "00-0f-ac-6"),
+ ("dot11RSNAAuthenticationSuiteSelected", "00-0f-ac-6")])
@remote_compatible
def test_ap_wpa_ptk_rekey(dev, apdev):
@@ -322,14 +322,14 @@ def test_ap_wpa_ccmp(dev, apdev):
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
hwsim_utils.test_connectivity(dev[0], hapd)
- check_mib(dev[0], [ ("dot11RSNAConfigGroupCipherSize", "128"),
- ("dot11RSNAGroupCipherRequested", "00-50-f2-4"),
- ("dot11RSNAPairwiseCipherRequested", "00-50-f2-4"),
- ("dot11RSNAAuthenticationSuiteRequested", "00-50-f2-2"),
- ("dot11RSNAGroupCipherSelected", "00-50-f2-4"),
- ("dot11RSNAPairwiseCipherSelected", "00-50-f2-4"),
- ("dot11RSNAAuthenticationSuiteSelected", "00-50-f2-2"),
- ("dot1xSuppSuppControlledPortStatus", "Authorized") ])
+ check_mib(dev[0], [("dot11RSNAConfigGroupCipherSize", "128"),
+ ("dot11RSNAGroupCipherRequested", "00-50-f2-4"),
+ ("dot11RSNAPairwiseCipherRequested", "00-50-f2-4"),
+ ("dot11RSNAAuthenticationSuiteRequested", "00-50-f2-2"),
+ ("dot11RSNAGroupCipherSelected", "00-50-f2-4"),
+ ("dot11RSNAPairwiseCipherSelected", "00-50-f2-4"),
+ ("dot11RSNAAuthenticationSuiteSelected", "00-50-f2-2"),
+ ("dot1xSuppSuppControlledPortStatus", "Authorized")])
def test_ap_wpa2_psk_file_errors(dev, apdev):
"""WPA2-PSK AP with various PSK file error and success cases"""
@@ -343,8 +343,8 @@ def test_ap_wpa2_psk_file_errors(dev, apdev):
except:
pass
- params = { "ssid": ssid, "wpa": "2", "wpa_key_mgmt": "WPA-PSK",
- "rsn_pairwise": "CCMP", "wpa_psk_file": pskfile }
+ params = {"ssid": ssid, "wpa": "2", "wpa_key_mgmt": "WPA-PSK",
+ "rsn_pairwise": "CCMP", "wpa_psk_file": pskfile}
try:
# missing PSK file
@@ -1271,9 +1271,9 @@ def sha1_prf(key, label, data, outlen):
def pmk_to_ptk(pmk, addr1, addr2, nonce1, nonce2):
if addr1 < addr2:
- data = binascii.unhexlify(addr1.replace(':','')) + binascii.unhexlify(addr2.replace(':',''))
+ data = binascii.unhexlify(addr1.replace(':', '')) + binascii.unhexlify(addr2.replace(':', ''))
else:
- data = binascii.unhexlify(addr2.replace(':','')) + binascii.unhexlify(addr1.replace(':',''))
+ data = binascii.unhexlify(addr2.replace(':', '')) + binascii.unhexlify(addr1.replace(':', ''))
if nonce1 < nonce2:
data += nonce1 + nonce2
else:
@@ -1352,12 +1352,12 @@ def eapol_test(apdev, dev, wpa2=True):
else:
rsne = binascii.unhexlify('dd160050f20101000050f20201000050f20201000050f202')
snonce = binascii.unhexlify('1111111111111111111111111111111111111111111111111111111111111111')
- return (bssid,ssid,hapd,snonce,pmk,addr,rsne)
+ return (bssid, ssid, hapd, snonce, pmk, addr, rsne)
@remote_compatible
def test_ap_wpa2_psk_ext_eapol(dev, apdev):
"""WPA2-PSK AP using external EAPOL supplicant"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
msg = recv_eapol(hapd)
anonce = msg['rsn_key_nonce']
@@ -1385,7 +1385,7 @@ def test_ap_wpa2_psk_ext_eapol(dev, apdev):
@remote_compatible
def test_ap_wpa2_psk_ext_eapol_retry1(dev, apdev):
"""WPA2 4-way handshake with EAPOL-Key 1/4 retransmitted"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
msg1 = recv_eapol(hapd)
anonce = msg1['rsn_key_nonce']
@@ -1412,7 +1412,7 @@ def test_ap_wpa2_psk_ext_eapol_retry1(dev, apdev):
@remote_compatible
def test_ap_wpa2_psk_ext_eapol_retry1b(dev, apdev):
"""WPA2 4-way handshake with EAPOL-Key 1/4 and 2/4 retransmitted"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
msg1 = recv_eapol(hapd)
anonce = msg1['rsn_key_nonce']
@@ -1434,7 +1434,7 @@ def test_ap_wpa2_psk_ext_eapol_retry1b(dev, apdev):
@remote_compatible
def test_ap_wpa2_psk_ext_eapol_retry1c(dev, apdev):
"""WPA2 4-way handshake with EAPOL-Key 1/4 and 2/4 retransmitted and SNonce changing"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
msg1 = recv_eapol(hapd)
anonce = msg1['rsn_key_nonce']
@@ -1458,7 +1458,7 @@ def test_ap_wpa2_psk_ext_eapol_retry1c(dev, apdev):
@remote_compatible
def test_ap_wpa2_psk_ext_eapol_retry1d(dev, apdev):
"""WPA2 4-way handshake with EAPOL-Key 1/4 and 2/4 retransmitted and SNonce changing and older used"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
msg1 = recv_eapol(hapd)
anonce = msg1['rsn_key_nonce']
@@ -1482,7 +1482,7 @@ def test_ap_wpa2_psk_ext_eapol_retry1d(dev, apdev):
@remote_compatible
def test_ap_wpa2_psk_ext_eapol_type_diff(dev, apdev):
"""WPA2 4-way handshake using external EAPOL supplicant"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
msg = recv_eapol(hapd)
anonce = msg['rsn_key_nonce']
@@ -1513,8 +1513,8 @@ def test_ap_wpa2_psk_ext_eapol_type_diff(dev, apdev):
@remote_compatible
def test_ap_wpa_psk_ext_eapol(dev, apdev):
"""WPA2-PSK AP using external EAPOL supplicant"""
- (bssid,ssid,hapd,snonce,pmk,addr,wpae) = eapol_test(apdev[0], dev[0],
- wpa2=False)
+ (bssid, ssid, hapd, snonce, pmk, addr, wpae) = eapol_test(apdev[0], dev[0],
+ wpa2=False)
msg = recv_eapol(hapd)
anonce = msg['rsn_key_nonce']
@@ -1541,7 +1541,7 @@ def test_ap_wpa_psk_ext_eapol(dev, apdev):
@remote_compatible
def test_ap_wpa2_psk_ext_eapol_key_info(dev, apdev):
"""WPA2-PSK 4-way handshake with strange key info values"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
msg = recv_eapol(hapd)
anonce = msg['rsn_key_nonce']
@@ -1632,7 +1632,7 @@ def aes_wrap(kek, plain):
for i in range(1, n + 1):
b = enc(struct.pack('>Q', a) + r[i - 1])
a = struct.unpack('>Q', b[:8])[0] ^ (n * j + i)
- r[i - 1] =b[8:]
+ r[i - 1] = b[8:]
return struct.pack('>Q', a) + b''.join(r)
def pad_key_data(plain):
@@ -1646,7 +1646,7 @@ def pad_key_data(plain):
def test_ap_wpa2_psk_supp_proto(dev, apdev):
"""WPA2-PSK 4-way handshake protocol testing for supplicant"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -1843,7 +1843,7 @@ def test_ap_wpa2_psk_supp_proto(dev, apdev):
def test_ap_wpa2_psk_supp_proto_no_ie(dev, apdev):
"""WPA2-PSK supplicant protocol testing: IE not included"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -1870,7 +1870,7 @@ def test_ap_wpa2_psk_supp_proto_no_ie(dev, apdev):
def test_ap_wpa2_psk_supp_proto_ie_mismatch(dev, apdev):
"""WPA2-PSK supplicant protocol testing: IE mismatch"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -1897,7 +1897,7 @@ def test_ap_wpa2_psk_supp_proto_ie_mismatch(dev, apdev):
def test_ap_wpa2_psk_supp_proto_ok(dev, apdev):
"""WPA2-PSK supplicant protocol testing: success"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -1925,7 +1925,7 @@ def test_ap_wpa2_psk_supp_proto_ok(dev, apdev):
def test_ap_wpa2_psk_supp_proto_no_gtk(dev, apdev):
"""WPA2-PSK supplicant protocol testing: no GTK"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -1955,7 +1955,7 @@ def test_ap_wpa2_psk_supp_proto_no_gtk(dev, apdev):
def test_ap_wpa2_psk_supp_proto_anonce_change(dev, apdev):
"""WPA2-PSK supplicant protocol testing: ANonce change"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -1986,7 +1986,7 @@ def test_ap_wpa2_psk_supp_proto_anonce_change(dev, apdev):
def test_ap_wpa2_psk_supp_proto_unexpected_group_msg(dev, apdev):
"""WPA2-PSK supplicant protocol testing: unexpected group message"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -2018,7 +2018,7 @@ def test_ap_wpa2_psk_supp_proto_unexpected_group_msg(dev, apdev):
@remote_compatible
def test_ap_wpa2_psk_supp_proto_msg_1_invalid_kde(dev, apdev):
"""WPA2-PSK supplicant protocol testing: invalid KDE in msg 1/4"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -2035,7 +2035,7 @@ def test_ap_wpa2_psk_supp_proto_msg_1_invalid_kde(dev, apdev):
def test_ap_wpa2_psk_supp_proto_wrong_pairwise_key_len(dev, apdev):
"""WPA2-PSK supplicant protocol testing: wrong pairwise key length"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -2067,7 +2067,7 @@ def test_ap_wpa2_psk_supp_proto_wrong_pairwise_key_len(dev, apdev):
def test_ap_wpa2_psk_supp_proto_wrong_group_key_len(dev, apdev):
"""WPA2-PSK supplicant protocol testing: wrong group key length"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -2098,7 +2098,7 @@ def test_ap_wpa2_psk_supp_proto_wrong_group_key_len(dev, apdev):
def test_ap_wpa2_psk_supp_proto_gtk_tx_bit_workaround(dev, apdev):
"""WPA2-PSK supplicant protocol testing: GTK TX bit workaround"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -2129,7 +2129,7 @@ def test_ap_wpa2_psk_supp_proto_gtk_tx_bit_workaround(dev, apdev):
def test_ap_wpa2_psk_supp_proto_gtk_keyidx_0_and_3(dev, apdev):
"""WPA2-PSK supplicant protocol testing: GTK key index 0 and 3"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -2182,7 +2182,7 @@ def test_ap_wpa2_psk_supp_proto_gtk_keyidx_0_and_3(dev, apdev):
def test_ap_wpa2_psk_supp_proto_no_gtk_in_group_msg(dev, apdev):
"""WPA2-PSK supplicant protocol testing: GTK KDE missing from group msg"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -2223,7 +2223,7 @@ def test_ap_wpa2_psk_supp_proto_no_gtk_in_group_msg(dev, apdev):
def test_ap_wpa2_psk_supp_proto_too_long_gtk_in_group_msg(dev, apdev):
"""WPA2-PSK supplicant protocol testing: too long GTK KDE in group msg"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -2264,7 +2264,7 @@ def test_ap_wpa2_psk_supp_proto_too_long_gtk_in_group_msg(dev, apdev):
def test_ap_wpa2_psk_supp_proto_too_long_gtk_kde(dev, apdev):
"""WPA2-PSK supplicant protocol testing: too long GTK KDE"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -2292,7 +2292,7 @@ def test_ap_wpa2_psk_supp_proto_too_long_gtk_kde(dev, apdev):
def test_ap_wpa2_psk_supp_proto_gtk_not_encrypted(dev, apdev):
"""WPA2-PSK supplicant protocol testing: GTK KDE not encrypted"""
- (bssid,ssid,hapd,snonce,pmk,addr,rsne) = eapol_test(apdev[0], dev[0])
+ (bssid, ssid, hapd, snonce, pmk, addr, rsne) = eapol_test(apdev[0], dev[0])
# Wait for EAPOL-Key msg 1/4 from hostapd to determine when associated
msg = recv_eapol(hapd)
@@ -2350,7 +2350,7 @@ def read_process_memory(pid, key=None):
continue
if not perm.startswith('rw'):
continue
- for name in [ "[heap]", "[stack]" ]:
+ for name in ["[heap]", "[stack]"]:
if name in l:
logger.info("%s 0x%x-0x%x is at %d-%d" % (name, start, end, len(buf), len(buf) + (end - start)))
mem.seek(start)
@@ -2506,8 +2506,8 @@ def test_ap_wpa2_psk_wep(dev, apdev):
def test_ap_wpa2_psk_wpas_in_bridge(dev, apdev):
"""WPA2-PSK AP and wpas interface in a bridge"""
- br_ifname='sta-br0'
- ifname='wlan5'
+ br_ifname = 'sta-br0'
+ ifname = 'wlan5'
try:
_test_ap_wpa2_psk_wpas_in_bridge(dev, apdev)
finally:
@@ -2522,8 +2522,8 @@ def _test_ap_wpa2_psk_wpas_in_bridge(dev, apdev):
params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
hapd = hostapd.add_ap(apdev[0], params)
- br_ifname='sta-br0'
- ifname='wlan5'
+ br_ifname = 'sta-br0'
+ ifname = 'wlan5'
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
subprocess.call(['brctl', 'addbr', br_ifname])
subprocess.call(['brctl', 'setfd', br_ifname, '0'])
@@ -2675,29 +2675,29 @@ def test_ap_wpa_ie_parsing(dev, apdev):
id = dev[0].connect(ssid, psk=passphrase, scan_freq="2412",
only_add_network=True)
- tests = [ "dd040050f201",
- "dd050050f20101",
- "dd060050f2010100",
- "dd060050f2010001",
- "dd070050f201010000",
- "dd080050f20101000050",
- "dd090050f20101000050f2",
- "dd0a0050f20101000050f202",
- "dd0b0050f20101000050f20201",
- "dd0c0050f20101000050f2020100",
- "dd0c0050f20101000050f2020000",
- "dd0c0050f20101000050f202ffff",
- "dd0d0050f20101000050f202010000",
- "dd0e0050f20101000050f20201000050",
- "dd0f0050f20101000050f20201000050f2",
- "dd100050f20101000050f20201000050f202",
- "dd110050f20101000050f20201000050f20201",
- "dd120050f20101000050f20201000050f2020100",
- "dd120050f20101000050f20201000050f2020000",
- "dd120050f20101000050f20201000050f202ffff",
- "dd130050f20101000050f20201000050f202010000",
- "dd140050f20101000050f20201000050f20201000050",
- "dd150050f20101000050f20201000050f20201000050f2" ]
+ tests = ["dd040050f201",
+ "dd050050f20101",
+ "dd060050f2010100",
+ "dd060050f2010001",
+ "dd070050f201010000",
+ "dd080050f20101000050",
+ "dd090050f20101000050f2",
+ "dd0a0050f20101000050f202",
+ "dd0b0050f20101000050f20201",
+ "dd0c0050f20101000050f2020100",
+ "dd0c0050f20101000050f2020000",
+ "dd0c0050f20101000050f202ffff",
+ "dd0d0050f20101000050f202010000",
+ "dd0e0050f20101000050f20201000050",
+ "dd0f0050f20101000050f20201000050f2",
+ "dd100050f20101000050f20201000050f202",
+ "dd110050f20101000050f20201000050f20201",
+ "dd120050f20101000050f20201000050f2020100",
+ "dd120050f20101000050f20201000050f2020000",
+ "dd120050f20101000050f20201000050f202ffff",
+ "dd130050f20101000050f20201000050f202010000",
+ "dd140050f20101000050f20201000050f20201000050",
+ "dd150050f20101000050f20201000050f20201000050f2"]
for t in tests:
try:
if "OK" not in dev[0].request("VENDOR_ELEM_ADD 13 " + t):
@@ -2711,9 +2711,9 @@ def test_ap_wpa_ie_parsing(dev, apdev):
finally:
dev[0].request("VENDOR_ELEM_REMOVE 13 *")
- tests = [ "dd170050f20101000050f20201000050f20201000050f202ff",
- "dd180050f20101000050f20201000050f20201000050f202ffff",
- "dd190050f20101000050f20201000050f20201000050f202ffffff" ]
+ tests = ["dd170050f20101000050f20201000050f20201000050f202ff",
+ "dd180050f20101000050f20201000050f20201000050f202ffff",
+ "dd190050f20101000050f20201000050f20201000050f202ffffff"]
for t in tests:
try:
if "OK" not in dev[0].request("VENDOR_ELEM_ADD 13 " + t):
@@ -2761,25 +2761,25 @@ def test_rsn_ie_proto_psk_sta(dev, apdev):
raise Exception("Invalid own_ie_override value accepted")
id = dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
- tests = [ ('No RSN Capabilities field',
- '30120100000fac040100000fac040100000fac02'),
- ('Reserved RSN Capabilities bits set',
- '30140100000fac040100000fac040100000fac023cff'),
- ('Truncated RSN Capabilities field',
- '30130100000fac040100000fac040100000fac023c'),
- ('Extra pairwise cipher suite (unsupported)',
- '30180100000fac040200ffffffff000fac040100000fac020c00'),
- ('Extra AKM suite (unsupported)',
- '30180100000fac040100000fac040200ffffffff000fac020c00'),
- ('PMKIDCount field included',
- '30160100000fac040100000fac040100000fac020c000000'),
- ('Truncated PMKIDCount field',
- '30150100000fac040100000fac040100000fac020c0000'),
- ('Unexpected Group Management Cipher Suite with PMF disabled',
- '301a0100000fac040100000fac040100000fac020c000000000fac06'),
- ('Extra octet after defined fields (future extensibility)',
- '301b0100000fac040100000fac040100000fac020c000000000fac0600') ]
- for txt,ie in tests:
+ tests = [('No RSN Capabilities field',
+ '30120100000fac040100000fac040100000fac02'),
+ ('Reserved RSN Capabilities bits set',
+ '30140100000fac040100000fac040100000fac023cff'),
+ ('Truncated RSN Capabilities field',
+ '30130100000fac040100000fac040100000fac023c'),
+ ('Extra pairwise cipher suite (unsupported)',
+ '30180100000fac040200ffffffff000fac040100000fac020c00'),
+ ('Extra AKM suite (unsupported)',
+ '30180100000fac040100000fac040200ffffffff000fac020c00'),
+ ('PMKIDCount field included',
+ '30160100000fac040100000fac040100000fac020c000000'),
+ ('Truncated PMKIDCount field',
+ '30150100000fac040100000fac040100000fac020c0000'),
+ ('Unexpected Group Management Cipher Suite with PMF disabled',
+ '301a0100000fac040100000fac040100000fac020c000000000fac06'),
+ ('Extra octet after defined fields (future extensibility)',
+ '301b0100000fac040100000fac040100000fac020c000000000fac0600')]
+ for txt, ie in tests:
dev[0].request("DISCONNECT")
dev[0].wait_disconnected()
dev[0].dump_monitor()
@@ -2831,10 +2831,10 @@ def test_ap_wpa2_psk_assoc_rsn(dev, apdev):
params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
hapd = hostapd.add_ap(apdev[0], params)
- tests = [ ("Normal wpa_supplicant assoc req RSN IE",
- "30140100000fac040100000fac040100000fac020000"),
- ("RSN IE without RSN Capabilities",
- "30120100000fac040100000fac040100000fac02") ]
+ tests = [("Normal wpa_supplicant assoc req RSN IE",
+ "30140100000fac040100000fac040100000fac020000"),
+ ("RSN IE without RSN Capabilities",
+ "30120100000fac040100000fac040100000fac02")]
for title, ie in tests:
logger.info(title)
set_test_assoc_ie(dev[0], ie)
@@ -2842,11 +2842,11 @@ def test_ap_wpa2_psk_assoc_rsn(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
- tests = [ ("WPA IE instead of RSN IE and only RSN enabled on AP",
- "dd160050f20101000050f20201000050f20201000050f202", 40),
- ("Empty RSN IE", "3000", 40),
- ("RSN IE with truncated Version", "300101", 40),
- ("RSN IE with only Version", "30020100", 43) ]
+ tests = [("WPA IE instead of RSN IE and only RSN enabled on AP",
+ "dd160050f20101000050f20201000050f20201000050f202", 40),
+ ("Empty RSN IE", "3000", 40),
+ ("RSN IE with truncated Version", "300101", 40),
+ ("RSN IE with only Version", "30020100", 43)]
for title, ie, status in tests:
logger.info(title)
set_test_assoc_ie(dev[0], ie)
@@ -2865,11 +2865,11 @@ def test_ap_wpa2_psk_ft_workaround(dev, apdev):
ssid = "test-wpa2-psk-ft"
passphrase = 'qwertyuiop'
- params = { "wpa": "2",
- "wpa_key_mgmt": "FT-PSK WPA-PSK",
- "rsn_pairwise": "CCMP",
- "ssid": ssid,
- "wpa_passphrase": passphrase }
+ params = {"wpa": "2",
+ "wpa_key_mgmt": "FT-PSK WPA-PSK",
+ "rsn_pairwise": "CCMP",
+ "ssid": ssid,
+ "wpa_passphrase": passphrase}
params["mobility_domain"] = "a1b2"
params["r0_key_lifetime"] = "10000"
params["pmk_r1_push"] = "1"
@@ -2899,8 +2899,8 @@ def test_ap_wpa2_psk_assoc_rsn_pmkid(dev, apdev):
def test_ap_wpa_psk_rsn_pairwise(dev, apdev):
"""WPA-PSK AP and only rsn_pairwise set"""
- params = { "ssid": "wpapsk", "wpa": "1", "wpa_key_mgmt": "WPA-PSK",
- "rsn_pairwise": "TKIP", "wpa_passphrase": "1234567890" }
+ params = {"ssid": "wpapsk", "wpa": "1", "wpa_key_mgmt": "WPA-PSK",
+ "rsn_pairwise": "TKIP", "wpa_passphrase": "1234567890"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("wpapsk", psk="1234567890", proto="WPA", pairwise="TKIP",
scan_freq="2412")
diff --git a/tests/hwsim/test_ap_qosmap.py b/tests/hwsim/test_ap_qosmap.py
index 1cc202e..e4e940f 100644
--- a/tests/hwsim/test_ap_qosmap.py
+++ b/tests/hwsim/test_ap_qosmap.py
@@ -25,12 +25,12 @@ def check_qos_map(ap, hapd, dev, sta, dscp, tid, ap_tid=None):
time.sleep(sleep_time)
tx = wt.get_tx_tid(bssid, sta, tid)
if tx == 0:
- [ tx, rx ] = wt.get_tid_counters(bssid, sta)
+ [tx, rx] = wt.get_tid_counters(bssid, sta)
logger.info("Expected TX DSCP " + str(dscp) + " with TID " + str(tid) + " but counters: " + str(tx))
raise Exception("No STA->AP data frame using the expected TID")
rx = wt.get_rx_tid(bssid, sta, ap_tid)
if rx == 0:
- [ tx, rx ] = wt.get_tid_counters(bssid, sta)
+ [tx, rx] = wt.get_tid_counters(bssid, sta)
logger.info("Expected RX DSCP " + str(dscp) + " with TID " + str(ap_tid) + " but counters: " + str(rx))
raise Exception("No AP->STA data frame using the expected TID")
@@ -41,7 +41,7 @@ def test_ap_qosmap(dev, apdev):
if int(drv_flags, 0) & 0x40000000 == 0:
raise HwsimSkip("Driver does not support QoS Map")
ssid = "test-qosmap"
- params = { "ssid": ssid }
+ params = {"ssid": ssid}
params['qos_map_set'] = '53,2,22,6,8,15,0,7,255,255,16,31,32,39,255,255,40,47,48,55'
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
@@ -79,14 +79,14 @@ def test_ap_qosmap(dev, apdev):
def test_ap_qosmap_default(dev, apdev):
"""QoS mapping with default values"""
ssid = "test-qosmap-default"
- params = { "ssid": ssid }
+ params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
addr = dev[0].p2p_interface_addr()
dev[0].request("DATA_TEST_CONFIG 1")
hapd.request("DATA_TEST_CONFIG 1")
Wlantest.setup(hapd)
- for dscp in [ 0, 7, 8, 15, 16, 23, 24, 31, 32, 39, 40, 47, 48, 55, 56, 63]:
+ for dscp in [0, 7, 8, 15, 16, 23, 24, 31, 32, 39, 40, 47, 48, 55, 56, 63]:
check_qos_map(apdev[0], hapd, dev[0], addr, dscp, dscp >> 3)
dev[0].request("DATA_TEST_CONFIG 0")
hapd.request("DATA_TEST_CONFIG 0")
@@ -95,38 +95,38 @@ def test_ap_qosmap_default(dev, apdev):
def test_ap_qosmap_default_acm(dev, apdev):
"""QoS mapping with default values and ACM=1 for VO/VI"""
ssid = "test-qosmap-default"
- params = { "ssid": ssid,
- "wmm_ac_bk_aifs": "7",
- "wmm_ac_bk_cwmin": "4",
- "wmm_ac_bk_cwmax": "10",
- "wmm_ac_bk_txop_limit": "0",
- "wmm_ac_bk_acm": "0",
- "wmm_ac_be_aifs": "3",
- "wmm_ac_be_cwmin": "4",
- "wmm_ac_be_cwmax": "10",
- "wmm_ac_be_txop_limit": "0",
- "wmm_ac_be_acm": "0",
- "wmm_ac_vi_aifs": "2",
- "wmm_ac_vi_cwmin": "3",
- "wmm_ac_vi_cwmax": "4",
- "wmm_ac_vi_txop_limit": "94",
- "wmm_ac_vi_acm": "1",
- "wmm_ac_vo_aifs": "2",
- "wmm_ac_vo_cwmin": "2",
- "wmm_ac_vo_cwmax": "2",
- "wmm_ac_vo_txop_limit": "47",
- "wmm_ac_vo_acm": "1" }
+ params = {"ssid": ssid,
+ "wmm_ac_bk_aifs": "7",
+ "wmm_ac_bk_cwmin": "4",
+ "wmm_ac_bk_cwmax": "10",
+ "wmm_ac_bk_txop_limit": "0",
+ "wmm_ac_bk_acm": "0",
+ "wmm_ac_be_aifs": "3",
+ "wmm_ac_be_cwmin": "4",
+ "wmm_ac_be_cwmax": "10",
+ "wmm_ac_be_txop_limit": "0",
+ "wmm_ac_be_acm": "0",
+ "wmm_ac_vi_aifs": "2",
+ "wmm_ac_vi_cwmin": "3",
+ "wmm_ac_vi_cwmax": "4",
+ "wmm_ac_vi_txop_limit": "94",
+ "wmm_ac_vi_acm": "1",
+ "wmm_ac_vo_aifs": "2",
+ "wmm_ac_vo_cwmin": "2",
+ "wmm_ac_vo_cwmax": "2",
+ "wmm_ac_vo_txop_limit": "47",
+ "wmm_ac_vo_acm": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
addr = dev[0].p2p_interface_addr()
dev[0].request("DATA_TEST_CONFIG 1")
hapd.request("DATA_TEST_CONFIG 1")
Wlantest.setup(hapd)
- for dscp in [ 0, 7, 8, 15, 16, 23, 24, 31, 32, 39, 40, 47, 48, 55, 56, 63]:
+ for dscp in [0, 7, 8, 15, 16, 23, 24, 31, 32, 39, 40, 47, 48, 55, 56, 63]:
ap_tid = dscp >> 3
tid = ap_tid
# downgrade VI/VO to BE
- if tid in [ 4, 5, 6, 7 ]:
+ if tid in [4, 5, 6, 7]:
tid = 3
check_qos_map(apdev[0], hapd, dev[0], addr, dscp, tid, ap_tid)
dev[0].request("DATA_TEST_CONFIG 0")
@@ -136,7 +136,7 @@ def test_ap_qosmap_default_acm(dev, apdev):
def test_ap_qosmap_invalid(dev, apdev):
"""QoS mapping ctrl_iface error handling"""
ssid = "test-qosmap"
- params = { "ssid": ssid }
+ params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "FAIL" not in hapd.request("SEND_QOS_MAP_CONF 00:11:22:33:44:55"):
raise Exception("Unexpected SEND_QOS_MAP_CONF success")
diff --git a/tests/hwsim/test_ap_roam.py b/tests/hwsim/test_ap_roam.py
index 575239f..6708f3f 100644
--- a/tests/hwsim/test_ap_roam.py
+++ b/tests/hwsim/test_ap_roam.py
@@ -16,10 +16,10 @@ from wpasupplicant import WpaSupplicant
@remote_compatible
def test_ap_roam_open(dev, apdev):
"""Roam between two open APs"""
- hapd0 = hostapd.add_ap(apdev[0], { "ssid": "test-open" })
+ hapd0 = hostapd.add_ap(apdev[0], {"ssid": "test-open"})
dev[0].connect("test-open", key_mgmt="NONE")
hwsim_utils.test_connectivity(dev[0], hapd0)
- hapd1 = hostapd.add_ap(apdev[1], { "ssid": "test-open" })
+ hapd1 = hostapd.add_ap(apdev[1], {"ssid": "test-open"})
dev[0].scan(type="ONLY")
dev[0].roam(apdev[1]['bssid'])
hwsim_utils.test_connectivity(dev[0], hapd1)
@@ -29,10 +29,10 @@ def test_ap_roam_open(dev, apdev):
@remote_compatible
def test_ap_roam_open_failed(dev, apdev):
"""Roam failure due to rejected authentication"""
- hapd0 = hostapd.add_ap(apdev[0], { "ssid": "test-open" })
+ hapd0 = hostapd.add_ap(apdev[0], {"ssid": "test-open"})
dev[0].connect("test-open", key_mgmt="NONE", scan_freq="2412")
hwsim_utils.test_connectivity(dev[0], hapd0)
- params = { "ssid": "test-open", "max_num_sta" : "0" }
+ params = {"ssid": "test-open", "max_num_sta": "0"}
hapd1 = hostapd.add_ap(apdev[1], params)
bssid = hapd1.own_addr()
@@ -174,7 +174,7 @@ def test_ap_roam_wpa2_psk_failed(dev, apdev, params):
@remote_compatible
def test_ap_reassociation_to_same_bss(dev, apdev):
"""Reassociate to the same BSS"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "test-open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "test-open"})
dev[0].connect("test-open", key_mgmt="NONE")
dev[0].request("REASSOCIATE")
@@ -194,8 +194,8 @@ def test_ap_reassociation_to_same_bss(dev, apdev):
@remote_compatible
def test_ap_roam_set_bssid(dev, apdev):
"""Roam control"""
- hostapd.add_ap(apdev[0], { "ssid": "test-open" })
- hostapd.add_ap(apdev[1], { "ssid": "test-open" })
+ hostapd.add_ap(apdev[0], {"ssid": "test-open"})
+ hostapd.add_ap(apdev[1], {"ssid": "test-open"})
id = dev[0].connect("test-open", key_mgmt="NONE", bssid=apdev[1]['bssid'],
scan_freq="2412")
if dev[0].get_status_field('bssid') != apdev[1]['bssid']:
diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py
index 6f6f65a..fb74065 100644
--- a/tests/hwsim/test_ap_tdls.py
+++ b/tests/hwsim/test_ap_tdls.py
@@ -70,13 +70,13 @@ def wlantest_tdls_packet_counters(bssid, addr0, addr1):
inv_dl = wt.get_tdls_counter("invalid_direct_link", bssid, addr0, addr1)
ap = wt.get_tdls_counter("valid_ap_path", bssid, addr0, addr1)
inv_ap = wt.get_tdls_counter("invalid_ap_path", bssid, addr0, addr1)
- return [dl,inv_dl,ap,inv_ap]
+ return [dl, inv_dl, ap, inv_ap]
def tdls_check_dl(sta0, sta1, bssid, addr0, addr1):
wt = Wlantest()
wt.tdls_clear(bssid, addr0, addr1)
hwsim_utils.test_connectivity_sta(sta0, sta1)
- [dl,inv_dl,ap,inv_ap] = wlantest_tdls_packet_counters(bssid, addr0, addr1)
+ [dl, inv_dl, ap, inv_ap] = wlantest_tdls_packet_counters(bssid, addr0, addr1)
if dl == 0:
raise Exception("No valid frames through direct link")
if inv_dl > 0:
@@ -90,7 +90,7 @@ def tdls_check_ap(sta0, sta1, bssid, addr0, addr1):
wt = Wlantest()
wt.tdls_clear(bssid, addr0, addr1)
hwsim_utils.test_connectivity_sta(sta0, sta1)
- [dl,inv_dl,ap,inv_ap] = wlantest_tdls_packet_counters(bssid, addr0, addr1)
+ [dl, inv_dl, ap, inv_ap] = wlantest_tdls_packet_counters(bssid, addr0, addr1)
if dl > 0:
raise Exception("Unexpected frames through direct link")
if inv_dl > 0:
@@ -306,7 +306,7 @@ def test_ap_wpa_mixed_tdls(dev, apdev):
def test_ap_wep_tdls(dev, apdev):
"""WEP AP and two stations using TDLS"""
hapd = hostapd.add_ap(apdev[0],
- { "ssid": "test-wep", "wep_key0": '"hello"' })
+ {"ssid": "test-wep", "wep_key0": '"hello"'})
wlantest_setup(hapd)
connect_2sta_wep(dev, hapd)
setup_tdls(dev[0], dev[1], hapd)
@@ -315,7 +315,7 @@ def test_ap_wep_tdls(dev, apdev):
def test_ap_open_tdls(dev, apdev):
"""Open AP and two stations using TDLS"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "test-open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "test-open"})
wlantest_setup(hapd)
connect_2sta_open(dev, hapd)
setup_tdls(dev[0], dev[1], hapd)
@@ -381,16 +381,16 @@ def tdls_clear_reg(hapd, dev):
def test_ap_open_tdls_vht(dev, apdev):
"""Open AP and two stations using TDLS"""
- params = { "ssid": "test-open",
- "country_code": "DE",
- "hw_mode": "a",
- "channel": "36",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "ht_capab": "",
- "vht_capab": "",
- "vht_oper_chwidth": "0",
- "vht_oper_centr_freq_seg0_idx": "0" }
+ params = {"ssid": "test-open",
+ "country_code": "DE",
+ "hw_mode": "a",
+ "channel": "36",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "ht_capab": "",
+ "vht_capab": "",
+ "vht_oper_chwidth": "0",
+ "vht_oper_centr_freq_seg0_idx": "0"}
hapd = None
try:
hapd = hostapd.add_ap(apdev[0], params)
@@ -405,16 +405,16 @@ def test_ap_open_tdls_vht(dev, apdev):
def test_ap_open_tdls_vht80(dev, apdev):
"""Open AP and two stations using TDLS with VHT 80"""
- params = { "ssid": "test-open",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_capab": "",
- "vht_oper_chwidth": "1",
- "vht_oper_centr_freq_seg0_idx": "42" }
+ params = {"ssid": "test-open",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_capab": "",
+ "vht_oper_chwidth": "1",
+ "vht_oper_centr_freq_seg0_idx": "42"}
try:
hapd = None
hapd = hostapd.add_ap(apdev[0], params)
@@ -442,17 +442,17 @@ def test_ap_open_tdls_vht80(dev, apdev):
def test_ap_open_tdls_vht80plus80(dev, apdev):
"""Open AP and two stations using TDLS with VHT 80+80"""
- params = { "ssid": "test-open",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_capab": "",
- "vht_oper_chwidth": "3",
- "vht_oper_centr_freq_seg0_idx": "42",
- "vht_oper_centr_freq_seg1_idx": "155" }
+ params = {"ssid": "test-open",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_capab": "",
+ "vht_oper_chwidth": "3",
+ "vht_oper_centr_freq_seg0_idx": "42",
+ "vht_oper_centr_freq_seg1_idx": "155"}
try:
hapd = None
hapd = hostapd.add_ap(apdev[0], params)
@@ -486,15 +486,15 @@ def test_ap_open_tdls_vht80plus80(dev, apdev):
def test_ap_open_tdls_vht160(dev, apdev):
"""Open AP and two stations using TDLS with VHT 160"""
- params = { "ssid": "test-open",
- "country_code": "ZA",
- "hw_mode": "a",
- "channel": "104",
- "ht_capab": "[HT40-]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "2",
- "vht_oper_centr_freq_seg0_idx": "114" }
+ params = {"ssid": "test-open",
+ "country_code": "ZA",
+ "hw_mode": "a",
+ "channel": "104",
+ "ht_capab": "[HT40-]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "2",
+ "vht_oper_centr_freq_seg0_idx": "114"}
try:
hapd = None
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
@@ -534,7 +534,7 @@ def test_tdls_chan_switch(dev, apdev):
if flags & 0x800000000 == 0:
raise HwsimSkip("Driver does not support TDLS channel switching")
- hapd = hostapd.add_ap(apdev[0], { "ssid": "test-open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "test-open"})
wlantest_setup(hapd)
connect_2sta_open(dev, hapd)
setup_tdls(dev[0], dev[1], hapd)
@@ -562,16 +562,16 @@ def test_ap_tdls_link_status(dev, apdev):
def test_ap_tdls_prohibit(dev, apdev):
"""Open AP and TDLS prohibited"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "test-open",
- "tdls_prohibit": "1" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "test-open",
+ "tdls_prohibit": "1"})
connect_2sta_open(dev, hapd)
if "FAIL" not in dev[0].request("TDLS_SETUP " + dev[1].own_addr()):
raise Exception("TDLS_SETUP accepted unexpectedly")
def test_ap_tdls_chan_switch_prohibit(dev, apdev):
"""Open AP and TDLS channel switch prohibited"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "test-open",
- "tdls_prohibit_chan_switch": "1" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "test-open",
+ "tdls_prohibit_chan_switch": "1"})
wlantest_setup(hapd)
connect_2sta_open(dev, hapd)
setup_tdls(dev[0], dev[1], hapd)
@@ -584,7 +584,7 @@ def test_ap_open_tdls_external_control(dev, apdev):
dev[0].set("tdls_external_control", "0")
def _test_ap_open_tdls_external_control(dev, apdev):
- hapd = hostapd.add_ap(apdev[0], { "ssid": "test-open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "test-open"})
dev[0].connect("test-open", key_mgmt="NONE", scan_freq="2412")
dev[1].connect("test-open", key_mgmt="NONE", scan_freq="2412")
addr0 = dev[0].own_addr()
diff --git a/tests/hwsim/test_ap_track.py b/tests/hwsim/test_ap_track.py
index 4444e39..25201e5 100644
--- a/tests/hwsim/test_ap_track.py
+++ b/tests/hwsim/test_ap_track.py
@@ -22,20 +22,20 @@ def test_ap_track_sta(dev, apdev):
time.sleep(0.1)
def _test_ap_track_sta(dev, apdev):
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "g",
- "channel": "6",
- "track_sta_max_num": "2" }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "g",
+ "channel": "6",
+ "track_sta_max_num": "2"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "40",
- "track_sta_max_num": "100",
- "track_sta_max_age": "1" }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "40",
+ "track_sta_max_num": "100",
+ "track_sta_max_age": "1"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
@@ -91,20 +91,20 @@ def test_ap_track_sta_no_probe_resp(dev, apdev):
def _test_ap_track_sta_no_probe_resp(dev, apdev):
dev[0].flush_scan_cache()
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "g",
- "channel": "6",
- "beacon_int": "10000",
- "no_probe_resp_if_seen_on": apdev[1]['ifname'] }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "g",
+ "channel": "6",
+ "beacon_int": "10000",
+ "no_probe_resp_if_seen_on": apdev[1]['ifname']}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "40",
- "track_sta_max_num": "100" }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "40",
+ "track_sta_max_num": "100"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
@@ -132,20 +132,20 @@ def test_ap_track_sta_no_auth(dev, apdev):
time.sleep(0.1)
def _test_ap_track_sta_no_auth(dev, apdev):
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "g",
- "channel": "6",
- "track_sta_max_num": "100",
- "no_auth_if_seen_on": apdev[1]['ifname'] }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "g",
+ "channel": "6",
+ "track_sta_max_num": "100",
+ "no_auth_if_seen_on": apdev[1]['ifname']}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "40",
- "track_sta_max_num": "100" }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "40",
+ "track_sta_max_num": "100"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
@@ -158,8 +158,8 @@ def _test_ap_track_sta_no_auth(dev, apdev):
dev[0].connect("track", key_mgmt="NONE", scan_freq="2437",
freq_list="2437", wait_connect=False)
dev[1].request("DISCONNECT")
- ev = dev[0].wait_event([ "CTRL-EVENT-CONNECTED",
- "CTRL-EVENT-AUTH-REJECT" ], timeout=10)
+ ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
+ "CTRL-EVENT-AUTH-REJECT"], timeout=10)
if ev is None:
raise Exception("Unknown connection result")
if "CTRL-EVENT-CONNECTED" in ev:
@@ -181,21 +181,21 @@ def test_ap_track_sta_no_auth_passive(dev, apdev):
def _test_ap_track_sta_no_auth_passive(dev, apdev):
dev[0].flush_scan_cache()
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "g",
- "channel": "6",
- "no_auth_if_seen_on": apdev[1]['ifname'] }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "g",
+ "channel": "6",
+ "no_auth_if_seen_on": apdev[1]['ifname']}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "40",
- "interworking": "1",
- "venue_name": "eng:Venue",
- "track_sta_max_num": "100" }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "40",
+ "interworking": "1",
+ "venue_name": "eng:Venue",
+ "track_sta_max_num": "100"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
@@ -218,8 +218,8 @@ def _test_ap_track_sta_no_auth_passive(dev, apdev):
dev[0].connect("track", key_mgmt="NONE", scan_freq="2437",
freq_list="2437", wait_connect=False)
- ev = dev[0].wait_event([ "CTRL-EVENT-CONNECTED",
- "CTRL-EVENT-AUTH-REJECT" ], timeout=10)
+ ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
+ "CTRL-EVENT-AUTH-REJECT"], timeout=10)
if ev is None:
raise Exception("Unknown connection result")
if "CTRL-EVENT-CONNECTED" in ev:
@@ -237,20 +237,20 @@ def test_ap_track_sta_force_5ghz(dev, apdev):
time.sleep(0.1)
def _test_ap_track_sta_force_5ghz(dev, apdev):
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "g",
- "channel": "6",
- "no_probe_resp_if_seen_on": apdev[1]['ifname'],
- "no_auth_if_seen_on": apdev[1]['ifname'] }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "g",
+ "channel": "6",
+ "no_probe_resp_if_seen_on": apdev[1]['ifname'],
+ "no_auth_if_seen_on": apdev[1]['ifname']}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "40",
- "track_sta_max_num": "100" }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "40",
+ "track_sta_max_num": "100"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
@@ -272,20 +272,20 @@ def test_ap_track_sta_force_2ghz(dev, apdev):
time.sleep(0.1)
def _test_ap_track_sta_force_2ghz(dev, apdev):
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "g",
- "channel": "6",
- "track_sta_max_num": "100" }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "g",
+ "channel": "6",
+ "track_sta_max_num": "100"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "40",
- "no_probe_resp_if_seen_on": apdev[0]['ifname'],
- "no_auth_if_seen_on": apdev[0]['ifname'] }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "40",
+ "no_probe_resp_if_seen_on": apdev[0]['ifname'],
+ "no_auth_if_seen_on": apdev[0]['ifname']}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
@@ -310,11 +310,11 @@ def test_ap_track_taxonomy(dev, apdev):
dev[2].flush_scan_cache()
def _test_ap_track_taxonomy(dev, apdev):
- params = { "ssid": "track",
- "country_code": "US",
- "hw_mode": "g",
- "channel": "6",
- "track_sta_max_num": "2" }
+ params = {"ssid": "track",
+ "country_code": "US",
+ "hw_mode": "g",
+ "channel": "6",
+ "track_sta_max_num": "2"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
diff --git a/tests/hwsim/test_ap_vht.py b/tests/hwsim/test_ap_vht.py
index df4be9b..e17b397 100644
--- a/tests/hwsim/test_ap_vht.py
+++ b/tests/hwsim/test_ap_vht.py
@@ -29,15 +29,15 @@ def test_ap_vht80(dev, apdev):
"""VHT with 80 MHz channel width"""
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "1",
- "vht_oper_centr_freq_seg0_idx": "42" }
+ params = {"ssid": "vht",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "1",
+ "vht_oper_centr_freq_seg0_idx": "42"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@@ -91,15 +91,15 @@ def test_ap_vht_wifi_generation(dev, apdev):
"""VHT and wifi_generation"""
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "1",
- "vht_oper_centr_freq_seg0_idx": "42" }
+ params = {"ssid": "vht",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "1",
+ "vht_oper_centr_freq_seg0_idx": "42"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@@ -138,15 +138,15 @@ def vht80_test(apdev, dev, channel, ht_capab):
clear_scan_cache(apdev)
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": str(channel),
- "ht_capab": ht_capab,
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "1",
- "vht_oper_centr_freq_seg0_idx": "42" }
+ params = {"ssid": "vht",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": str(channel),
+ "ht_capab": ht_capab,
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "1",
+ "vht_oper_centr_freq_seg0_idx": "42"}
hapd = hostapd.add_ap(apdev, params)
bssid = apdev['bssid']
@@ -180,17 +180,17 @@ def test_ap_vht80_params(dev, apdev):
"""VHT with 80 MHz channel width and number of optional features enabled"""
try:
hapd = None
- 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-11454][RXLDPC][SHORT-GI-80][TX-STBC-2BY1][RX-STBC-1][MAX-A-MPDU-LEN-EXP0]",
- "vht_oper_centr_freq_seg0_idx": "42",
- "require_vht": "1" }
+ 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-11454][RXLDPC][SHORT-GI-80][TX-STBC-2BY1][RX-STBC-1][MAX-A-MPDU-LEN-EXP0]",
+ "vht_oper_centr_freq_seg0_idx": "42",
+ "require_vht": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[1].connect("vht", key_mgmt="NONE", scan_freq="5180",
@@ -225,18 +225,18 @@ def test_ap_vht80_invalid(dev, apdev):
"""VHT with invalid 80 MHz channel configuration (seg1)"""
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "1",
- "vht_oper_centr_freq_seg0_idx": "42",
- "vht_oper_centr_freq_seg1_idx": "155",
- 'ieee80211d': '1',
- 'ieee80211h': '1' }
+ params = {"ssid": "vht",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "1",
+ "vht_oper_centr_freq_seg0_idx": "42",
+ "vht_oper_centr_freq_seg1_idx": "155",
+ 'ieee80211d': '1',
+ 'ieee80211h': '1'}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
# This fails due to unexpected seg1 configuration
ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
@@ -257,17 +257,17 @@ def test_ap_vht80_invalid2(dev, apdev):
"""VHT with invalid 80 MHz channel configuration (seg0)"""
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "1",
- "vht_oper_centr_freq_seg0_idx": "46",
- 'ieee80211d': '1',
- 'ieee80211h': '1' }
+ params = {"ssid": "vht",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "1",
+ "vht_oper_centr_freq_seg0_idx": "46",
+ 'ieee80211d': '1',
+ 'ieee80211h': '1'}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
# This fails due to invalid seg0 configuration
ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
@@ -290,19 +290,18 @@ def test_ap_vht_20(devs, apdevs):
ap = apdevs[0]
try:
hapd = None
- params = { "ssid": "test-vht20",
- "country_code": "DE",
- "hw_mode": "a",
- "channel": "36",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "ht_capab": "",
- "vht_capab": "",
- "vht_oper_chwidth": "0",
- "vht_oper_centr_freq_seg0_idx": "0",
- "supported_rates": "60 120 240 360 480 540",
- "require_vht": "1",
- }
+ params = {"ssid": "test-vht20",
+ "country_code": "DE",
+ "hw_mode": "a",
+ "channel": "36",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "ht_capab": "",
+ "vht_capab": "",
+ "vht_oper_chwidth": "0",
+ "vht_oper_centr_freq_seg0_idx": "0",
+ "supported_rates": "60 120 240 360 480 540",
+ "require_vht": "1"}
hapd = hostapd.add_ap(ap, params)
dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE")
hwsim_utils.test_connectivity(dev, hapd)
@@ -319,17 +318,16 @@ def test_ap_vht_40(devs, apdevs):
ap = apdevs[0]
try:
hapd = None
- params = { "ssid": "test-vht40",
- "country_code": "DE",
- "hw_mode": "a",
- "channel": "36",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "ht_capab": "[HT40+]",
- "vht_capab": "",
- "vht_oper_chwidth": "0",
- "vht_oper_centr_freq_seg0_idx": "0",
- }
+ params = {"ssid": "test-vht40",
+ "country_code": "DE",
+ "hw_mode": "a",
+ "channel": "36",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "ht_capab": "[HT40+]",
+ "vht_capab": "",
+ "vht_oper_chwidth": "0",
+ "vht_oper_centr_freq_seg0_idx": "0"}
hapd = hostapd.add_ap(ap, params)
dev.connect("test-vht40", scan_freq="5180", key_mgmt="NONE")
hwsim_utils.test_connectivity(dev, hapd)
@@ -343,17 +341,17 @@ def test_ap_vht_40(devs, apdevs):
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][BF-ANTENNA-3][BF-ANTENNA-4][SOUNDING-DIMENSION-2][SOUNDING-DIMENSION-3][SOUNDING-DIMENSION-4][MU-BEAMFORMER][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" }
+ 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][BF-ANTENNA-3][BF-ANTENNA-4][SOUNDING-DIMENSION-2][SOUNDING-DIMENSION-3][SOUNDING-DIMENSION-4][MU-BEAMFORMER][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], params, wait_enabled=False)
ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
if ev is None:
@@ -369,17 +367,17 @@ def test_ap_vht160(dev, apdev):
"""VHT with 160 MHz channel width (1)"""
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "2",
- "vht_oper_centr_freq_seg0_idx": "50",
- 'ieee80211d': '1',
- 'ieee80211h': '1' }
+ params = {"ssid": "vht",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "2",
+ "vht_oper_centr_freq_seg0_idx": "50",
+ 'ieee80211d': '1',
+ 'ieee80211h': '1'}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
ev = wait_dfs_event(hapd, "DFS-CAC-START", 5)
@@ -439,17 +437,17 @@ def test_ap_vht160b(dev, apdev):
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": "104",
- "ht_capab": "[HT40-]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "2",
- "vht_oper_centr_freq_seg0_idx": "114",
- 'ieee80211d': '1',
- 'ieee80211h': '1' }
+ params = {"ssid": "vht",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": "104",
+ "ht_capab": "[HT40-]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "2",
+ "vht_oper_centr_freq_seg0_idx": "114",
+ 'ieee80211d': '1',
+ 'ieee80211h': '1'}
hapd = hostapd.add_ap(apdev[1], params, wait_enabled=False)
ev = wait_dfs_event(hapd, "DFS-CAC-START", 5)
@@ -543,17 +541,17 @@ def test_ap_vht160_no_dfs_128_minus(dev, apdev):
def run_ap_vht160_no_dfs(dev, apdev, channel, ht_capab):
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "ZA",
- "hw_mode": "a",
- "channel": channel,
- "ht_capab": ht_capab,
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "2",
- "vht_oper_centr_freq_seg0_idx": "114",
- 'ieee80211d': '1',
- 'ieee80211h': '1' }
+ params = {"ssid": "vht",
+ "country_code": "ZA",
+ "hw_mode": "a",
+ "channel": channel,
+ "ht_capab": ht_capab,
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "2",
+ "vht_oper_centr_freq_seg0_idx": "114",
+ 'ieee80211d': '1',
+ 'ieee80211h': '1'}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
ev = hapd.wait_event(["AP-ENABLED"], timeout=2)
if not ev:
@@ -592,17 +590,17 @@ def test_ap_vht160_no_ht40(dev, apdev):
"""VHT with 160 MHz channel width and HT40 disabled"""
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "ZA",
- "hw_mode": "a",
- "channel": "108",
- "ht_capab": "",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "2",
- "vht_oper_centr_freq_seg0_idx": "114",
- 'ieee80211d': '1',
- 'ieee80211h': '1' }
+ params = {"ssid": "vht",
+ "country_code": "ZA",
+ "hw_mode": "a",
+ "channel": "108",
+ "ht_capab": "",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "2",
+ "vht_oper_centr_freq_seg0_idx": "114",
+ 'ieee80211d': '1',
+ 'ieee80211h': '1'}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
ev = hapd.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=2)
if not ev:
@@ -631,33 +629,33 @@ def test_ap_vht80plus80(dev, apdev):
try:
hapd = None
hapd2 = None
- params = { "ssid": "vht",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "52",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "3",
- "vht_oper_centr_freq_seg0_idx": "58",
- "vht_oper_centr_freq_seg1_idx": "155",
- 'ieee80211d': '1',
- 'ieee80211h': '1' }
+ params = {"ssid": "vht",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "52",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "3",
+ "vht_oper_centr_freq_seg0_idx": "58",
+ "vht_oper_centr_freq_seg1_idx": "155",
+ 'ieee80211d': '1',
+ 'ieee80211h': '1'}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
# This will actually fail since DFS on 80+80 is not yet supported
ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
# ignore result to avoid breaking the test once 80+80 DFS gets enabled
- params = { "ssid": "vht2",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "3",
- "vht_oper_centr_freq_seg0_idx": "42",
- "vht_oper_centr_freq_seg1_idx": "155" }
+ params = {"ssid": "vht2",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "3",
+ "vht_oper_centr_freq_seg0_idx": "42",
+ "vht_oper_centr_freq_seg1_idx": "155"}
hapd2 = hostapd.add_ap(apdev[1], params, wait_enabled=False)
ev = hapd2.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=5)
@@ -702,18 +700,18 @@ def test_ap_vht80plus80_invalid(dev, apdev):
"""VHT with invalid 80+80 MHz channel"""
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "3",
- "vht_oper_centr_freq_seg0_idx": "42",
- "vht_oper_centr_freq_seg1_idx": "0",
- 'ieee80211d': '1',
- 'ieee80211h': '1' }
+ params = {"ssid": "vht",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "3",
+ "vht_oper_centr_freq_seg0_idx": "42",
+ "vht_oper_centr_freq_seg1_idx": "0",
+ 'ieee80211d': '1',
+ 'ieee80211h': '1'}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
# This fails due to missing(invalid) seg1 configuration
ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
@@ -735,15 +733,15 @@ def test_ap_vht80_csa(dev, apdev):
csa_supported(dev[0])
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "149",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "1",
- "vht_oper_centr_freq_seg0_idx": "155" }
+ params = {"ssid": "vht",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "149",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "1",
+ "vht_oper_centr_freq_seg0_idx": "155"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("vht", key_mgmt="NONE", scan_freq="5745")
@@ -788,13 +786,13 @@ def test_ap_vht_csa_vht40(dev, apdev):
csa_supported(dev[0])
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "149",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "0" }
+ params = {"ssid": "vht",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "149",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "0"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@@ -836,13 +834,13 @@ def test_ap_vht_csa_vht20(dev, apdev):
csa_supported(dev[0])
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "149",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "0" }
+ params = {"ssid": "vht",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "149",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "0"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@@ -877,16 +875,16 @@ def test_ap_vht_csa_vht40_disable(dev, apdev):
csa_supported(dev[0])
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "US",
- "hw_mode": "a",
- "channel": "149",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_capab": "",
- "vht_oper_chwidth": "0",
- "vht_oper_centr_freq_seg0_idx": "0" }
+ params = {"ssid": "vht",
+ "country_code": "US",
+ "hw_mode": "a",
+ "channel": "149",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_capab": "",
+ "vht_oper_chwidth": "0",
+ "vht_oper_centr_freq_seg0_idx": "0"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@@ -924,15 +922,14 @@ def test_ap_vht_csa_vht40_disable(dev, apdev):
def test_ap_vht_on_24ghz(dev, apdev):
"""Subset of VHT features on 2.4 GHz"""
hapd = None
- params = { "ssid": "test-vht-2g",
- "hw_mode": "g",
- "channel": "1",
- "ieee80211n": "1",
- "vendor_vht": "1",
- "vht_capab": "[MAX-MPDU-11454]",
- "vht_oper_chwidth": "0",
- "vht_oper_centr_freq_seg0_idx": "1"
- }
+ params = {"ssid": "test-vht-2g",
+ "hw_mode": "g",
+ "channel": "1",
+ "ieee80211n": "1",
+ "vendor_vht": "1",
+ "vht_capab": "[MAX-MPDU-11454]",
+ "vht_oper_chwidth": "0",
+ "vht_oper_centr_freq_seg0_idx": "1"}
hapd = hostapd.add_ap(apdev[0], params)
try:
if "OK" not in dev[0].request("VENDOR_ELEM_ADD 13 dd1300904c0400bf0c3240820feaff0000eaff0000"):
@@ -955,26 +952,25 @@ def test_prefer_vht40(dev, apdev):
try:
hapd2 = None
- params = { "ssid": "test",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": "36",
- "ieee80211n": "1",
- "ht_capab": "[HT40+]" }
+ params = {"ssid": "test",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": "36",
+ "ieee80211n": "1",
+ "ht_capab": "[HT40+]"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
- params = { "ssid": "test",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": "36",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "ht_capab": "[HT40+]",
- "vht_capab": "",
- "vht_oper_chwidth": "0",
- "vht_oper_centr_freq_seg0_idx": "0",
- }
+ params = {"ssid": "test",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": "36",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "ht_capab": "[HT40+]",
+ "vht_capab": "",
+ "vht_oper_chwidth": "0",
+ "vht_oper_centr_freq_seg0_idx": "0"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
@@ -1002,17 +998,17 @@ def test_ap_vht80_pwr_constraint(dev, apdev):
"""VHT with 80 MHz channel width and local power constraint"""
hapd = None
try:
- params = { "ssid": "vht",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211d": "1",
- "local_pwr_constraint": "3",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "1",
- "vht_oper_centr_freq_seg0_idx": "42" }
+ params = {"ssid": "vht",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211d": "1",
+ "local_pwr_constraint": "3",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "1",
+ "vht_oper_centr_freq_seg0_idx": "42"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
@@ -1036,16 +1032,16 @@ def test_ap_vht_use_sta_nsts(dev, apdev):
"""VHT with 80 MHz channel width and use_sta_nsts=1"""
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "1",
- "vht_oper_centr_freq_seg0_idx": "42",
- "use_sta_nsts": "1" }
+ params = {"ssid": "vht",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "1",
+ "vht_oper_centr_freq_seg0_idx": "42",
+ "use_sta_nsts": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@@ -1067,19 +1063,19 @@ def test_ap_vht_tkip(dev, apdev):
"""VHT and TKIP"""
try:
hapd = None
- params = { "ssid": "vht",
- "wpa": "1",
- "wpa_key_mgmt": "WPA-PSK",
- "wpa_pairwise": "TKIP",
- "wpa_passphrase": "12345678",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "1",
- "vht_oper_centr_freq_seg0_idx": "42" }
+ params = {"ssid": "vht",
+ "wpa": "1",
+ "wpa_key_mgmt": "WPA-PSK",
+ "wpa_pairwise": "TKIP",
+ "wpa_passphrase": "12345678",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "1",
+ "vht_oper_centr_freq_seg0_idx": "42"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@@ -1116,20 +1112,19 @@ def test_ap_vht_40_fallback_to_20(devs, apdevs):
ap = apdevs[0]
try:
hapd = None
- params = { "ssid": "test-vht40",
- "country_code": "US",
- "hw_mode": "a",
- "basic_rates": "60 120 240",
- "channel": "161",
- "ieee80211d": "1",
- "ieee80211h": "1",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "ht_capab": "[HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40]",
- "vht_capab": "[RXLDPC][SHORT-GI-80][TX-STBC-2BY1][RX-STBC1][MAX-MPDU-11454][MAX-A-MPDU-LEN-EXP7]",
- "vht_oper_chwidth": "0",
- "vht_oper_centr_freq_seg0_idx": "155",
- }
+ params = {"ssid": "test-vht40",
+ "country_code": "US",
+ "hw_mode": "a",
+ "basic_rates": "60 120 240",
+ "channel": "161",
+ "ieee80211d": "1",
+ "ieee80211h": "1",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "ht_capab": "[HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40]",
+ "vht_capab": "[RXLDPC][SHORT-GI-80][TX-STBC-2BY1][RX-STBC1][MAX-MPDU-11454][MAX-A-MPDU-LEN-EXP7]",
+ "vht_oper_chwidth": "0",
+ "vht_oper_centr_freq_seg0_idx": "155"}
hapd = hostapd.add_ap(ap, params)
dev.connect("test-vht40", scan_freq="5805", key_mgmt="NONE")
dev.wait_regdom(country_ie=True)
@@ -1148,16 +1143,16 @@ def test_ap_vht80_to_24g_ht(dev, apdev):
"""VHT with 80 MHz channel width reconfigured to 2.4 GHz HT"""
try:
hapd = None
- params = { "ssid": "vht",
- "country_code": "FI",
- "hw_mode": "a",
- "channel": "36",
- "ht_capab": "[HT40+]",
- "ieee80211n": "1",
- "ieee80211ac": "1",
- "vht_oper_chwidth": "1",
- "vht_capab": "[MAX-MPDU-11454]",
- "vht_oper_centr_freq_seg0_idx": "42" }
+ params = {"ssid": "vht",
+ "country_code": "FI",
+ "hw_mode": "a",
+ "channel": "36",
+ "ht_capab": "[HT40+]",
+ "ieee80211n": "1",
+ "ieee80211ac": "1",
+ "vht_oper_chwidth": "1",
+ "vht_capab": "[MAX-MPDU-11454]",
+ "vht_oper_centr_freq_seg0_idx": "42"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
diff --git a/tests/hwsim/test_ap_vlan.py b/tests/hwsim/test_ap_vlan.py
index 513273e..04bec3c 100644
--- a/tests/hwsim/test_ap_vlan.py
+++ b/tests/hwsim/test_ap_vlan.py
@@ -26,9 +26,9 @@ from tshark import run_tshark
def test_ap_vlan_open(dev, apdev):
"""AP VLAN with open network"""
- params = { "ssid": "test-vlan-open",
- "dynamic_vlan": "1",
- "accept_mac_file": "hostapd.accept" }
+ params = {"ssid": "test-vlan-open",
+ "dynamic_vlan": "1",
+ "accept_mac_file": "hostapd.accept"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
@@ -40,10 +40,10 @@ def test_ap_vlan_open(dev, apdev):
def test_ap_vlan_file_open(dev, apdev):
"""AP VLAN with open network and vlan_file mapping"""
- params = { "ssid": "test-vlan-open",
- "dynamic_vlan": "1",
- "vlan_file": "hostapd.vlan",
- "accept_mac_file": "hostapd.accept" }
+ params = {"ssid": "test-vlan-open",
+ "dynamic_vlan": "1",
+ "vlan_file": "hostapd.vlan",
+ "accept_mac_file": "hostapd.accept"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
@@ -55,10 +55,10 @@ def test_ap_vlan_file_open(dev, apdev):
def test_ap_vlan_file_open2(dev, apdev):
"""AP VLAN with open network and vlan_file mapping (2)"""
- params = { "ssid": "test-vlan-open",
- "dynamic_vlan": "1",
- "vlan_file": "hostapd.vlan2",
- "accept_mac_file": "hostapd.accept2" }
+ params = {"ssid": "test-vlan-open",
+ "dynamic_vlan": "1",
+ "vlan_file": "hostapd.vlan2",
+ "accept_mac_file": "hostapd.accept2"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
@@ -71,12 +71,12 @@ def test_ap_vlan_file_open2(dev, apdev):
def test_ap_vlan_file_parsing(dev, apdev, params):
"""hostapd vlan_file/mac_file parsing"""
tmp = os.path.join(params['logdir'], 'ap_vlan_file_parsing.tmp')
- params = { "ssid": "test-vlan-open", "dynamic_vlan": "1" }
+ params = {"ssid": "test-vlan-open", "dynamic_vlan": "1"}
hapd = hostapd.add_ap(apdev[0], params)
- tests = [ "#\n\n0\t11\n",
- "* ",
- "1 netdev12345678901234567890" ]
+ tests = ["#\n\n0\t11\n",
+ "* ",
+ "1 netdev12345678901234567890"]
for t in tests:
with open(tmp, "w") as f:
f.write(t)
@@ -89,11 +89,11 @@ def test_ap_vlan_file_parsing(dev, apdev, params):
if "FAIL" not in hapd.request("SET vlan_file " + tmp):
raise Exception("vlan_file accepted during OOM")
- tests = [ "#\n\n0\tvlan\n",
- "4095\tvlan\n",
- "vlan\n",
- "1\t1234567890abcdef1234567890\n",
- "1\n" ]
+ tests = ["#\n\n0\tvlan\n",
+ "4095\tvlan\n",
+ "vlan\n",
+ "1\t1234567890abcdef1234567890\n",
+ "1\n"]
for t in tests:
with open(tmp, "w") as f:
f.write(t)
@@ -207,15 +207,15 @@ def test_ap_vlan_tagged_wpa2_radius_id_change(dev, apdev):
subprocess.call(['ip', 'link', 'del', ifname2])
def generic_ap_vlan_wpa2_radius_id_change(dev, apdev, tagged):
- as_params = { "ssid": "as",
- "beacon_int": "2000",
- "radius_server_clients": "auth_serv/radius_clients.conf",
- "radius_server_auth_port": '18128',
- "eap_server": "1",
- "eap_user_file": "auth_serv/eap_user.conf",
- "ca_cert": "auth_serv/ca.pem",
- "server_cert": "auth_serv/server.pem",
- "private_key": "auth_serv/server.key" }
+ as_params = {"ssid": "as",
+ "beacon_int": "2000",
+ "radius_server_clients": "auth_serv/radius_clients.conf",
+ "radius_server_auth_port": '18128',
+ "eap_server": "1",
+ "eap_user_file": "auth_serv/eap_user.conf",
+ "ca_cert": "auth_serv/ca.pem",
+ "server_cert": "auth_serv/server.pem",
+ "private_key": "auth_serv/server.key"}
authserv = hostapd.add_ap(apdev[1], as_params)
params = hostapd.wpa2_eap_params(ssid="test-vlan")
@@ -328,10 +328,10 @@ def test_ap_vlan_wpa2_radius_required(dev, apdev):
def test_ap_vlan_tagged(dev, apdev):
"""AP VLAN with tagged interface"""
- params = { "ssid": "test-vlan-open",
- "dynamic_vlan": "1",
- "vlan_tagged_interface": "lo",
- "accept_mac_file": "hostapd.accept" }
+ params = {"ssid": "test-vlan-open",
+ "dynamic_vlan": "1",
+ "vlan_tagged_interface": "lo",
+ "accept_mac_file": "hostapd.accept"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
@@ -344,8 +344,8 @@ def test_ap_vlan_tagged(dev, apdev):
def ap_vlan_iface_cleanup_multibss_cleanup():
subprocess.call(['ifconfig', 'dummy0', 'down'],
stderr=open('/dev/null', 'w'))
- ifnames = [ 'wlan3.1', 'wlan3.2', 'wlan3-2.1', 'wlan3-2.2', 'dummy0.2',
- 'dummy0.1', 'dummy0', 'brvlan1', 'brvlan2' ]
+ ifnames = ['wlan3.1', 'wlan3.2', 'wlan3-2.1', 'wlan3-2.2', 'dummy0.2',
+ 'dummy0.1', 'dummy0', 'brvlan1', 'brvlan2']
for ifname in ifnames:
subprocess.call(['ip', 'link', 'del', ifname],
stderr=open('/dev/null', 'w'))
@@ -394,16 +394,16 @@ def ap_vlan_iface_cleanup_multibss(dev, apdev, cfgfile):
ap_vlan_iface_cleanup_multibss_cleanup()
ap_vlan_iface_test_and_prepare_environ()
- as_params = { "ssid": "as",
- "beacon_int": "2000",
- "radius_server_clients": "auth_serv/radius_clients.conf",
- "radius_server_auth_port": '18128',
- "eap_server": "1",
- "eap_user_file": "auth_serv/eap_user.conf",
- "ca_cert": "auth_serv/ca.pem",
- "server_cert": "auth_serv/server.pem",
- "private_key": "auth_serv/server.key",
- "vlan_naming": "1" }
+ as_params = {"ssid": "as",
+ "beacon_int": "2000",
+ "radius_server_clients": "auth_serv/radius_clients.conf",
+ "radius_server_auth_port": '18128',
+ "eap_server": "1",
+ "eap_user_file": "auth_serv/eap_user.conf",
+ "ca_cert": "auth_serv/ca.pem",
+ "server_cert": "auth_serv/server.pem",
+ "private_key": "auth_serv/server.key",
+ "vlan_naming": "1"}
authserv = hostapd.add_ap(apdev[1], as_params)
# start the actual test
@@ -616,8 +616,8 @@ def test_ap_vlan_without_station(dev, apdev, p):
@remote_compatible
def test_ap_open_per_sta_vif(dev, apdev):
"""AP VLAN with open network"""
- params = { "ssid": "test-vlan-open",
- "per_sta_vif": "1" }
+ params = {"ssid": "test-vlan-open",
+ "per_sta_vif": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
@@ -627,9 +627,9 @@ def test_ap_open_per_sta_vif(dev, apdev):
@remote_compatible
def test_ap_vlan_open_per_sta_vif(dev, apdev):
"""AP VLAN (dynamic) with open network"""
- params = { "ssid": "test-vlan-open",
- "per_sta_vif": "1",
- "dynamic_vlan": "1" }
+ params = {"ssid": "test-vlan-open",
+ "per_sta_vif": "1",
+ "dynamic_vlan": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
@@ -738,9 +738,9 @@ def test_ap_vlan_sae(dev, apdev, params):
raise HwsimSkip("SAE not supported")
params = hostapd.wpa2_params(ssid="test-sae-vlan")
params['wpa_key_mgmt'] = 'SAE'
- params['sae_password'] = [ 'pw1|vlanid=1|id=id1',
- 'pw2|mac=ff:ff:ff:ff:ff:ff|vlanid=2|id=id2',
- 'pw3|vlanid=3|id=id3' ]
+ params['sae_password'] = ['pw1|vlanid=1|id=id1',
+ 'pw2|mac=ff:ff:ff:ff:ff:ff|vlanid=2|id=id2',
+ 'pw3|vlanid=3|id=id3']
params['dynamic_vlan'] = "1"
hapd = hostapd.add_ap(apdev[0], params)
diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py
index f0f852b..df408f1 100644
--- a/tests/hwsim/test_ap_wps.py
+++ b/tests/hwsim/test_ap_wps.py
@@ -45,9 +45,9 @@ from utils import wait_fail_trigger
from test_ap_eap import int_eap_server_params
def wps_start_ap(apdev, ssid="test-wps-conf"):
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"}
return hostapd.add_ap(apdev, params)
@remote_compatible
@@ -55,7 +55,7 @@ def test_ap_wps_init(dev, apdev):
"""Initial AP configuration with first WPS Enrollee"""
ssid = "test-wps"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "1" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "1"})
logger.info("WPS provisioning step")
hapd.request("WPS_PBC")
if "PBC Status: Active" not in hapd.request("WPS_GET_STATUS"):
@@ -109,7 +109,7 @@ def test_ap_wps_init(dev, apdev):
def test_ap_wps_init_2ap_pbc(dev, apdev):
"""Initial two-radio AP configuration with first WPS PBC Enrollee"""
ssid = "test-wps"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "1" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hostapd.add_ap(apdev[1], params)
logger.info("WPS provisioning step")
@@ -145,7 +145,7 @@ def test_ap_wps_init_2ap_pbc(dev, apdev):
def test_ap_wps_init_2ap_pin(dev, apdev):
"""Initial two-radio AP configuration with first WPS PIN Enrollee"""
ssid = "test-wps"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "1" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hostapd.add_ap(apdev[1], params)
logger.info("WPS provisioning step")
@@ -177,7 +177,7 @@ def test_ap_wps_init_through_wps_config(dev, apdev):
"""Initial AP configuration using wps_config command"""
ssid = "test-wps-init-config"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "1" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "1"})
if "FAIL" in hapd.request("WPS_CONFIG " + binascii.hexlify(ssid.encode()).decode() + " WPA2PSK CCMP " + binascii.hexlify(b"12345678").decode()):
raise Exception("WPS_CONFIG command failed")
ev = hapd.wait_event(["WPS-NEW-AP-SETTINGS"], timeout=5)
@@ -199,8 +199,8 @@ def test_ap_wps_init_through_wps_config_2(dev, apdev):
"""AP configuration using wps_config and wps_cred_processing=2"""
ssid = "test-wps-init-config"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "1",
- "wps_cred_processing": "2" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "1",
+ "wps_cred_processing": "2"})
if "FAIL" in hapd.request("WPS_CONFIG " + binascii.hexlify(ssid.encode()).decode() + " WPA2PSK CCMP " + binascii.hexlify(b"12345678").decode()):
raise Exception("WPS_CONFIG command failed")
ev = hapd.wait_event(["WPS-NEW-AP-SETTINGS"], timeout=5)
@@ -214,7 +214,7 @@ def test_ap_wps_invalid_wps_config_passphrase(dev, apdev):
"""AP configuration using wps_config command with invalid passphrase"""
ssid = "test-wps-init-config"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "1" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "1"})
if "FAIL" not in hapd.request("WPS_CONFIG " + binascii.hexlify(ssid.encode()).decode() + " WPA2PSK CCMP " + binascii.hexlify(b"1234567").decode()):
raise Exception("Invalid WPS_CONFIG command accepted")
@@ -222,9 +222,9 @@ def test_ap_wps_conf(dev, apdev):
"""WPS PBC provisioning with configured AP"""
ssid = "test-wps-conf"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
logger.info("WPS provisioning step")
hapd.request("WPS_PBC")
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
@@ -252,10 +252,10 @@ def test_ap_wps_conf_5ghz(dev, apdev):
try:
hapd = None
ssid = "test-wps-conf"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "country_code": "FI", "hw_mode": "a", "channel": "36" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "country_code": "FI", "hw_mode": "a", "channel": "36"}
hapd = hostapd.add_ap(apdev[0], params)
logger.info("WPS provisioning step")
hapd.request("WPS_PBC")
@@ -278,10 +278,10 @@ def test_ap_wps_conf_chan14(dev, apdev):
try:
hapd = None
ssid = "test-wps-conf"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "country_code": "JP", "hw_mode": "b", "channel": "14" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "country_code": "JP", "hw_mode": "b", "channel": "14"}
hapd = hostapd.add_ap(apdev[0], params)
logger.info("WPS provisioning step")
hapd.request("WPS_PBC")
@@ -302,9 +302,9 @@ def test_ap_wps_conf_chan14(dev, apdev):
def test_ap_wps_twice(dev, apdev):
"""WPS provisioning with twice to change passphrase"""
ssid = "test-wps-twice"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"}
hapd = hostapd.add_ap(apdev[0], params)
logger.info("WPS provisioning step")
hapd.request("WPS_PBC")
@@ -332,9 +332,9 @@ def test_ap_wps_incorrect_pin(dev, apdev):
"""WPS PIN provisioning with incorrect PIN"""
ssid = "test-wps-incorrect-pin"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
logger.info("WPS provisioning attempt 1")
hapd.request("WPS_PIN any 12345670")
@@ -375,9 +375,9 @@ def test_ap_wps_conf_pin(dev, apdev):
"""WPS PIN provisioning with configured AP"""
ssid = "test-wps-conf-pin"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
logger.info("WPS provisioning step")
pin = dev[0].wps_read_pin()
hapd.request("WPS_PIN any " + pin)
@@ -401,7 +401,7 @@ def test_ap_wps_conf_pin(dev, apdev):
raise Exception("WPS-AUTH flag not cleared")
logger.info("Try to connect from another station using the same PIN")
pin = dev[1].request("WPS_PIN " + apdev[0]['bssid'])
- ev = dev[1].wait_event(["WPS-M2D","CTRL-EVENT-CONNECTED"], timeout=30)
+ ev = dev[1].wait_event(["WPS-M2D", "CTRL-EVENT-CONNECTED"], timeout=30)
if ev is None:
raise Exception("Operation timed out")
if "WPS-M2D" not in ev:
@@ -413,10 +413,10 @@ def test_ap_wps_conf_pin_mixed_mode(dev, apdev):
"""WPS PIN provisioning with configured AP (WPA+WPA2)"""
ssid = "test-wps-conf-pin-mixed"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "3",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "wpa_pairwise": "TKIP" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "3",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "wpa_pairwise": "TKIP"})
logger.info("WPS provisioning step")
pin = dev[0].wps_read_pin()
@@ -471,9 +471,9 @@ def test_ap_wps_conf_pin_v1(dev, apdev):
"""WPS PIN provisioning with configured WPS v1.0 AP"""
ssid = "test-wps-conf-pin-v1"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
logger.info("WPS provisioning step")
pin = dev[0].wps_read_pin()
hapd.request("SET wps_version_number 0x10")
@@ -497,9 +497,9 @@ def test_ap_wps_conf_pin_2sta(dev, apdev):
"""Two stations trying to use WPS PIN at the same time"""
ssid = "test-wps-conf-pin2"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
logger.info("WPS provisioning step")
pin = "12345670"
pin2 = "55554444"
@@ -519,9 +519,9 @@ def test_ap_wps_conf_pin_timeout(dev, apdev):
"""WPS PIN provisioning with configured AP timing out PIN"""
ssid = "test-wps-conf-pin"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
addr = dev[0].p2p_interface_addr()
pin = dev[0].wps_read_pin()
if "FAIL" not in hapd.request("WPS_PIN "):
@@ -547,10 +547,10 @@ def test_ap_wps_reg_connect(dev, apdev):
ssid = "test-wps-reg-ap-pin"
appin = "12345670"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "ap_pin": appin})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "ap_pin": appin})
logger.info("WPS provisioning step")
dev[0].dump_monitor()
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
@@ -570,10 +570,10 @@ def test_ap_wps_reg_connect_zero_len_ap_pin(dev, apdev):
ssid = "test-wps-reg-ap-pin"
appin = ""
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "ap_pin": appin})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "ap_pin": appin})
logger.info("WPS provisioning step")
dev[0].dump_monitor()
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
@@ -589,10 +589,10 @@ def test_ap_wps_reg_connect_mixed_mode(dev, apdev):
ssid = "test-wps-reg-ap-pin"
appin = "12345670"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "3",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "wpa_pairwise": "TKIP", "ap_pin": appin})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "3",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "wpa_pairwise": "TKIP", "ap_pin": appin})
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].wps_reg(apdev[0]['bssid'], appin)
status = dev[0].get_status()
@@ -624,11 +624,11 @@ def test_ap_wps_reg_override_ap_settings(dev, apdev):
ssid = "test-wps-reg-ap-pin"
appin = "12345670"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "ap_pin": appin, "ap_settings": ap_settings })
- hapd2 = hostapd.add_ap(apdev[1], { "ssid": "test" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "ap_pin": appin, "ap_settings": ap_settings})
+ hapd2 = hostapd.add_ap(apdev[1], {"ssid": "test"})
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].scan_for_bss(apdev[1]['bssid'], freq=2412)
dev[0].wps_reg(apdev[0]['bssid'], appin)
@@ -651,15 +651,15 @@ def test_ap_wps_random_ap_pin(dev, apdev):
"""WPS registrar using random AP PIN"""
ssid = "test-wps-reg-random-ap-pin"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "uuid": ap_uuid, "upnp_iface": "lo" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "uuid": ap_uuid, "upnp_iface": "lo"}
hapd = hostapd.add_ap(apdev[0], params)
appin = hapd.request("WPS_AP_PIN random")
if "FAIL" in appin:
@@ -719,8 +719,8 @@ def test_ap_wps_reg_config(dev, apdev):
ssid = "test-wps-init-ap-pin"
appin = "12345670"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "ap_pin": appin})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "ap_pin": appin})
logger.info("WPS configuration step")
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].dump_monitor()
@@ -755,8 +755,8 @@ def test_ap_wps_reg_config_ext_processing(dev, apdev):
"""WPS registrar configuring an AP with external config processing"""
ssid = "test-wps-init-ap-pin"
appin = "12345670"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wps_cred_processing": "1", "ap_pin": appin}
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wps_cred_processing": "1", "ap_pin": appin}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
new_ssid = "wps-new-ssid"
@@ -782,8 +782,8 @@ def test_ap_wps_reg_config_tkip(dev, apdev):
ssid = "test-wps-init-ap"
appin = "12345670"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "1",
- "ap_pin": appin})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "1",
+ "ap_pin": appin})
logger.info("WPS configuration step")
dev[0].request("SET wps_version_number 0x10")
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
@@ -813,15 +813,15 @@ def test_ap_wps_setup_locked(dev, apdev):
ssid = "test-wps-incorrect-ap-pin"
appin = "12345670"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "ap_pin": appin})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "ap_pin": appin})
new_ssid = "wps-new-ssid-test"
new_passphrase = "1234567890"
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
- ap_setup_locked=False
+ ap_setup_locked = False
for pin in ["55554444", "1234", "12345678", "00000000", "11111111"]:
dev[0].dump_monitor()
logger.info("Try incorrect AP PIN - attempt " + pin)
@@ -834,7 +834,7 @@ def test_ap_wps_setup_locked(dev, apdev):
raise Exception("Unexpected connection")
if "config_error=15" in ev:
logger.info("AP Setup Locked")
- ap_setup_locked=True
+ ap_setup_locked = True
elif "config_error=18" not in ev:
raise Exception("config_error=18 not reported")
dev[0].wait_disconnected(timeout=10)
@@ -878,15 +878,15 @@ def test_ap_wps_setup_locked_timeout(dev, apdev):
ssid = "test-wps-incorrect-ap-pin"
appin = "12345670"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "ap_pin": appin})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "ap_pin": appin})
new_ssid = "wps-new-ssid-test"
new_passphrase = "1234567890"
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
- ap_setup_locked=False
+ ap_setup_locked = False
for pin in ["55554444", "1234", "12345678", "00000000", "11111111"]:
dev[0].dump_monitor()
logger.info("Try incorrect AP PIN - attempt " + pin)
@@ -899,7 +899,7 @@ def test_ap_wps_setup_locked_timeout(dev, apdev):
raise Exception("Unexpected connection")
if "config_error=15" in ev:
logger.info("AP Setup Locked")
- ap_setup_locked=True
+ ap_setup_locked = True
break
elif "config_error=18" not in ev:
raise Exception("config_error=18 not reported")
@@ -915,10 +915,10 @@ def test_ap_wps_setup_locked_2(dev, apdev):
"""WPS AP configured for special ap_setup_locked=2 mode"""
ssid = "test-wps-ap-pin"
appin = "12345670"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "ap_pin": appin, "ap_setup_locked": "2" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "ap_pin": appin, "ap_setup_locked": "2"}
hapd = hostapd.add_ap(apdev[0], params)
new_ssid = "wps-new-ssid-test"
new_passphrase = "1234567890"
@@ -952,15 +952,15 @@ def test_ap_wps_setup_locked_2(dev, apdev):
@remote_compatible
def test_ap_wps_pbc_overlap_2ap(dev, apdev):
"""WPS PBC session overlap with two active APs"""
- params = { "ssid": "wps1", "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "wps_independent": "1"}
+ params = {"ssid": "wps1", "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "wps_independent": "1"}
hapd = hostapd.add_ap(apdev[0], params)
- params = { "ssid": "wps2", "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "123456789", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "wps_independent": "1"}
+ params = {"ssid": "wps2", "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "123456789", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "wps_independent": "1"}
hapd2 = hostapd.add_ap(apdev[1], params)
hapd.request("WPS_PBC")
hapd2.request("WPS_PBC")
@@ -980,9 +980,9 @@ def test_ap_wps_pbc_overlap_2sta(dev, apdev):
"""WPS PBC session overlap with two active STAs"""
ssid = "test-wps-pbc-overlap"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
logger.info("WPS provisioning step")
hapd.request("WPS_PBC")
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
@@ -1018,9 +1018,9 @@ def test_ap_wps_cancel(dev, apdev):
"""WPS AP cancelling enabled config method"""
ssid = "test-wps-ap-cancel"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
bssid = apdev[0]['bssid']
logger.info("Verify PBC enable/cancel")
@@ -1065,14 +1065,14 @@ def _test_ap_wps_er_add_enrollee(dev, apdev):
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "1",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- 'friendly_name': "WPS AP - <>&'\" - TEST",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "1",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ 'friendly_name': "WPS AP - <>&'\" - TEST",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
logger.info("WPS configuration step")
new_passphrase = "1234567890"
dev[0].dump_monitor()
@@ -1198,15 +1198,15 @@ def _test_ap_wps_er_add_enrollee_uuid(dev, apdev):
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
logger.info("WPS configuration step")
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].wps_reg(apdev[0]['bssid'], ap_pin)
@@ -1290,16 +1290,16 @@ def _test_ap_wps_er_multi_add_enrollee(dev, apdev):
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- 'friendly_name': "WPS AP",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ 'friendly_name': "WPS AP",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
for i in range(2):
dev[i].scan_for_bss(apdev[0]['bssid'], freq=2412)
@@ -1350,15 +1350,15 @@ def _test_ap_wps_er_add_enrollee_pbc(dev, apdev):
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
logger.info("Learn AP configuration")
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].dump_monitor()
@@ -1421,15 +1421,15 @@ def _test_ap_wps_er_pbc_overlap(dev, apdev):
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].dump_monitor()
dev[0].wps_reg(apdev[0]['bssid'], ap_pin)
@@ -1496,15 +1496,15 @@ def _test_ap_wps_er_v10_add_enrollee_pin(dev, apdev):
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
logger.info("Learn AP configuration")
dev[0].request("SET wps_version_number 0x10")
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
@@ -1551,15 +1551,15 @@ def _test_ap_wps_er_config_ap(dev, apdev):
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
logger.info("Connect ER to the AP")
dev[0].connect(ssid, psk="12345678", scan_freq="2412")
@@ -1605,15 +1605,15 @@ def _test_ap_wps_er_cache_ap_settings(dev, apdev):
ssid = "wps-er-add-enrollee"
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].wps_reg(apdev[0]['bssid'], ap_pin)
@@ -1640,15 +1640,14 @@ def _test_ap_wps_er_cache_ap_settings(dev, apdev):
hapd.disable()
for i in range(2):
- ev = dev[0].wait_event([ "WPS-ER-AP-REMOVE",
- "CTRL-EVENT-DISCONNECTED" ],
+ ev = dev[0].wait_event(["WPS-ER-AP-REMOVE", "CTRL-EVENT-DISCONNECTED"],
timeout=15)
if ev is None:
raise Exception("AP removal or disconnection timed out")
hapd = hostapd.add_ap(apdev[0], params)
for i in range(2):
- ev = dev[0].wait_event([ "WPS-ER-AP-ADD", "CTRL-EVENT-CONNECTED" ],
+ ev = dev[0].wait_event(["WPS-ER-AP-ADD", "CTRL-EVENT-CONNECTED"],
timeout=15)
if ev is None:
raise Exception("AP discovery or connection timed out")
@@ -1684,15 +1683,15 @@ def _test_ap_wps_er_cache_ap_settings_oom(dev, apdev):
ssid = "wps-er-add-enrollee"
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].wps_reg(apdev[0]['bssid'], ap_pin)
@@ -1720,15 +1719,15 @@ def _test_ap_wps_er_cache_ap_settings_oom(dev, apdev):
hapd.disable()
for i in range(2):
- ev = dev[0].wait_event([ "WPS-ER-AP-REMOVE",
- "CTRL-EVENT-DISCONNECTED" ],
+ ev = dev[0].wait_event(["WPS-ER-AP-REMOVE",
+ "CTRL-EVENT-DISCONNECTED"],
timeout=15)
if ev is None:
raise Exception("AP removal or disconnection timed out")
hapd = hostapd.add_ap(apdev[0], params)
for i in range(2):
- ev = dev[0].wait_event([ "WPS-ER-AP-ADD", "CTRL-EVENT-CONNECTED" ],
+ ev = dev[0].wait_event(["WPS-ER-AP-ADD", "CTRL-EVENT-CONNECTED"],
timeout=15)
if ev is None:
raise Exception("AP discovery or connection timed out")
@@ -1746,15 +1745,15 @@ def _test_ap_wps_er_cache_ap_settings_oom2(dev, apdev):
ssid = "wps-er-add-enrollee"
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].wps_reg(apdev[0]['bssid'], ap_pin)
@@ -1782,15 +1781,15 @@ def _test_ap_wps_er_cache_ap_settings_oom2(dev, apdev):
hapd.disable()
for i in range(2):
- ev = dev[0].wait_event([ "WPS-ER-AP-REMOVE",
- "CTRL-EVENT-DISCONNECTED" ],
+ ev = dev[0].wait_event(["WPS-ER-AP-REMOVE",
+ "CTRL-EVENT-DISCONNECTED"],
timeout=15)
if ev is None:
raise Exception("AP removal or disconnection timed out")
hapd = hostapd.add_ap(apdev[0], params)
for i in range(2):
- ev = dev[0].wait_event([ "WPS-ER-AP-ADD", "CTRL-EVENT-CONNECTED" ],
+ ev = dev[0].wait_event(["WPS-ER-AP-ADD", "CTRL-EVENT-CONNECTED"],
timeout=15)
if ev is None:
raise Exception("AP discovery or connection timed out")
@@ -1808,15 +1807,15 @@ def _test_ap_wps_er_subscribe_oom(dev, apdev):
ssid = "wps-er-add-enrollee"
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].wps_reg(apdev[0]['bssid'], ap_pin)
@@ -1847,15 +1846,15 @@ def _test_ap_wps_er_set_sel_reg_oom(dev, apdev):
ssid = "wps-er-add-enrollee"
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].wps_reg(apdev[0]['bssid'], ap_pin)
@@ -1874,10 +1873,10 @@ def _test_ap_wps_er_set_sel_reg_oom(dev, apdev):
raise Exception("WPS-FAIL timed out")
time.sleep(0.1)
- for func in [ "http_client_url_parse;wps_er_send_set_sel_reg",
- "wps_er_soap_hdr;wps_er_send_set_sel_reg",
- "http_client_addr;wps_er_send_set_sel_reg",
- "wpabuf_alloc;wps_er_set_sel_reg" ]:
+ for func in ["http_client_url_parse;wps_er_send_set_sel_reg",
+ "wps_er_soap_hdr;wps_er_send_set_sel_reg",
+ "http_client_addr;wps_er_send_set_sel_reg",
+ "wpabuf_alloc;wps_er_set_sel_reg"]:
with alloc_fail(dev[0], 1, func):
if "OK" not in dev[0].request("WPS_ER_PBC " + ap_uuid):
raise Exception("WPS_ER_PBC failed")
@@ -1899,15 +1898,15 @@ def _test_ap_wps_er_learn_oom(dev, apdev):
ssid = "wps-er-add-enrollee"
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].wps_reg(apdev[0]['bssid'], ap_pin)
@@ -1917,11 +1916,11 @@ def _test_ap_wps_er_learn_oom(dev, apdev):
if ev is None:
raise Exception("AP not discovered")
- for func in [ "wps_er_http_put_message_cb",
- "xml_get_base64_item;wps_er_http_put_message_cb",
- "http_client_url_parse;wps_er_ap_put_message",
- "wps_er_soap_hdr;wps_er_ap_put_message",
- "http_client_addr;wps_er_ap_put_message" ]:
+ for func in ["wps_er_http_put_message_cb",
+ "xml_get_base64_item;wps_er_http_put_message_cb",
+ "http_client_url_parse;wps_er_ap_put_message",
+ "wps_er_soap_hdr;wps_er_ap_put_message",
+ "http_client_addr;wps_er_ap_put_message"]:
with alloc_fail(dev[0], 1, func):
dev[0].request("WPS_ER_LEARN " + ap_uuid + " " + ap_pin)
ev = dev[0].wait_event(["WPS-ER-AP-SETTINGS"], timeout=1)
@@ -1943,11 +1942,11 @@ def test_ap_wps_fragmentation(dev, apdev):
ssid = "test-wps-fragmentation"
appin = "12345670"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "3",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "wpa_pairwise": "TKIP", "ap_pin": appin,
- "fragment_size": "50" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "3",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "wpa_pairwise": "TKIP", "ap_pin": appin,
+ "fragment_size": "50"})
logger.info("WPS provisioning step (PBC)")
hapd.request("WPS_PBC")
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
@@ -1995,9 +1994,9 @@ def test_ap_wps_new_version_sta(dev, apdev):
"""WPS compatibility with new version number on the station"""
ssid = "test-wps-ver"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
logger.info("WPS provisioning step")
hapd.request("WPS_PBC")
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
@@ -2012,9 +2011,9 @@ def test_ap_wps_new_version_ap(dev, apdev):
"""WPS compatibility with new version number on the AP"""
ssid = "test-wps-ver"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
logger.info("WPS provisioning step")
if "FAIL" in hapd.request("SET wps_version_number 0x43"):
raise Exception("Failed to enable test functionality")
@@ -2029,16 +2028,16 @@ def test_ap_wps_new_version_ap(dev, apdev):
def test_ap_wps_check_pin(dev, apdev):
"""Verify PIN checking through control interface"""
hapd = hostapd.add_ap(apdev[0],
- { "ssid": "wps", "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP" })
- for t in [ ("12345670", "12345670"),
- ("12345678", "FAIL-CHECKSUM"),
- ("12345", "FAIL"),
- ("123456789", "FAIL"),
- ("1234-5670", "12345670"),
- ("1234 5670", "12345670"),
- ("1-2.3:4 5670", "12345670") ]:
+ {"ssid": "wps", "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ for t in [("12345670", "12345670"),
+ ("12345678", "FAIL-CHECKSUM"),
+ ("12345", "FAIL"),
+ ("123456789", "FAIL"),
+ ("1234-5670", "12345670"),
+ ("1234 5670", "12345670"),
+ ("1-2.3:4 5670", "12345670")]:
res = hapd.request("WPS_CHECK_PIN " + t[0]).rstrip('\n')
res2 = dev[0].request("WPS_CHECK_PIN " + t[0]).rstrip('\n')
if res != res2:
@@ -2069,8 +2068,8 @@ def test_ap_wps_wep_config(dev, apdev):
ssid = "test-wps-config"
appin = "12345670"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "ap_pin": appin})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "ap_pin": appin})
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
dev[0].wps_reg(apdev[0]['bssid'], appin, "wps-new-ssid-wep", "OPEN", "WEP",
"hello", no_wait=True)
@@ -2090,8 +2089,8 @@ def test_ap_wps_wep_config(dev, apdev):
def test_ap_wps_wep_enroll(dev, apdev):
"""WPS 2.0 STA rejecting WEP configuration"""
ssid = "test-wps-wep"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "skip_cred_build": "1", "extra_cred": "wps-wep-cred" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "skip_cred_build": "1", "extra_cred": "wps-wep-cred"}
hapd = hostapd.add_ap(apdev[0], params)
hapd.request("WPS_PBC")
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
@@ -2106,14 +2105,14 @@ def test_ap_wps_wep_enroll(dev, apdev):
def test_ap_wps_ie_fragmentation(dev, apdev):
"""WPS AP using fragmented WPS IE"""
ssid = "test-wps-ie-fragmentation"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "1234567890abcdef1234567890abcdef",
- "manufacturer": "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
- "model_name": "1234567890abcdef1234567890abcdef",
- "model_number": "1234567890abcdef1234567890abcdef",
- "serial_number": "1234567890abcdef1234567890abcdef" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "1234567890abcdef1234567890abcdef",
+ "manufacturer": "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
+ "model_name": "1234567890abcdef1234567890abcdef",
+ "model_number": "1234567890abcdef1234567890abcdef",
+ "serial_number": "1234567890abcdef1234567890abcdef"}
hapd = hostapd.add_ap(apdev[0], params)
hapd.request("WPS_PBC")
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
@@ -2142,7 +2141,7 @@ def get_psk(pskfile):
for l in lines:
if l == "# WPA PSKs":
continue
- (addr,psk) = l.split(' ')
+ (addr, psk) = l.split(' ')
psks[addr] = psk
return psks
@@ -2164,10 +2163,10 @@ def test_ap_wps_per_station_psk(dev, apdev):
with open(pskfile, "w") as f:
f.write("# WPA PSKs\n")
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa": "2", "wpa_key_mgmt": "WPA-PSK",
- "rsn_pairwise": "CCMP", "ap_pin": appin,
- "wpa_psk_file": pskfile }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa": "2", "wpa_key_mgmt": "WPA-PSK",
+ "rsn_pairwise": "CCMP", "ap_pin": appin,
+ "wpa_psk_file": pskfile}
hapd = hostapd.add_ap(apdev[0], params)
logger.info("First enrollee")
@@ -2239,10 +2238,10 @@ def test_ap_wps_per_station_psk_failure(dev, apdev):
with open(pskfile, "w") as f:
f.write("# WPA PSKs\n")
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa": "2", "wpa_key_mgmt": "WPA-PSK",
- "rsn_pairwise": "CCMP", "ap_pin": appin,
- "wpa_psk_file": pskfile }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa": "2", "wpa_key_mgmt": "WPA-PSK",
+ "rsn_pairwise": "CCMP", "ap_pin": appin,
+ "wpa_psk_file": pskfile}
hapd = hostapd.add_ap(apdev[0], params)
if "FAIL" in hapd.request("SET wpa_psk_file /tmp/does/not/exists/ap_wps_per_enrollee_psk_failure.psk_file"):
raise Exception("Failed to set wpa_psk_file")
@@ -2283,10 +2282,10 @@ def test_ap_wps_pin_request_file(dev, apdev):
if os.path.exists(pinfile):
os.remove(pinfile)
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wps_pin_requests": pinfile,
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wps_pin_requests": pinfile,
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
uuid = dev[0].get_status_field("uuid")
pin = dev[0].wps_read_pin()
try:
@@ -2338,7 +2337,7 @@ def test_ap_wps_auto_setup_with_config_file(dev, apdev):
vals = dict()
for l in lines:
try:
- [name,value] = l.split('=', 1)
+ [name, value] = l.split('=', 1)
vals[name] = value
except ValueError as e:
if "# WPS configuration" in l:
@@ -2377,9 +2376,9 @@ def test_ap_wps_pbc_timeout(dev, apdev, params):
server = MyTCPServer(("127.0.0.1", 12345), WPSERHTTPServer)
server.timeout = 1
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 200:
@@ -2397,7 +2396,7 @@ VFi5hrLk
</u:SetSelectedRegistrar>
</s:Body>
</s:Envelope>'''
- headers = { "Content-type": 'text/xml; charset="utf-8"' }
+ headers = {"Content-type": 'text/xml; charset="utf-8"'}
headers["SOAPAction"] = '"urn:schemas-wifialliance-org:service:WFAWLANConfig:1#%s"' % "SetSelectedRegistrar"
conn.request("POST", ctrlurl.path, msg, headers)
resp = conn.getresponse()
@@ -2465,20 +2464,20 @@ VFi5hrLk
def add_ssdp_ap(ap, ap_uuid):
ssid = "wps-ssdp"
ap_pin = "12345670"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo",
- "friendly_name": "WPS Access Point",
- "manufacturer_url": "http://www.example.com/",
- "model_description": "Wireless Access Point",
- "model_url": "http://www.example.com/model/",
- "upc": "123456789012" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo",
+ "friendly_name": "WPS Access Point",
+ "manufacturer_url": "http://www.example.com/",
+ "model_description": "Wireless Access Point",
+ "model_url": "http://www.example.com/model/",
+ "upc": "123456789012"}
return hostapd.add_ap(ap, params)
def ssdp_send(msg, no_recv=False):
@@ -2807,7 +2806,7 @@ def upnp_soap_action(conn, path, action, include_soap_action=True,
msg = ET.SubElement(act, "NewWLANEventMAC")
msg.text = neweventmac
- headers = { "Content-type": 'text/xml; charset="utf-8"' }
+ headers = {"Content-type": 'text/xml; charset="utf-8"'}
if include_soap_action:
headers["SOAPAction"] = '"urn:schemas-wifialliance-org:service:WFAWLANConfig:1#%s"' % action
elif soap_action_override:
@@ -2845,8 +2844,8 @@ def test_ap_wps_upnp(dev, apdev):
url = urlparse(location)
conn = HTTPConnection(url.netloc)
#conn.set_debuglevel(1)
- headers = { "Content-type": 'text/xml; charset="utf-8"',
- "SOAPAction": '"urn:schemas-wifialliance-org:service:WFAWLANConfig:1#GetDeviceInfo"' }
+ headers = {"Content-type": 'text/xml; charset="utf-8"',
+ "SOAPAction": '"urn:schemas-wifialliance-org:service:WFAWLANConfig:1#GetDeviceInfo"'}
conn.request("POST", "hello", "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 404:
@@ -2857,8 +2856,8 @@ def test_ap_wps_upnp(dev, apdev):
if resp.status != 501:
raise Exception("Unexpected HTTP response: %d" % resp.status)
- headers = { "Content-type": 'text/xml; charset="utf-8"',
- "SOAPAction": '"urn:some-unknown-action#GetDeviceInfo"' }
+ headers = {"Content-type": 'text/xml; charset="utf-8"',
+ "SOAPAction": '"urn:some-unknown-action#GetDeviceInfo"'}
ctrlurl = urlparse(urls['control_url'])
conn.request("POST", ctrlurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
@@ -2872,10 +2871,10 @@ def test_ap_wps_upnp(dev, apdev):
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("GetDeviceInfo with invalid SOAPAction header")
- for act in [ "foo",
- "urn:schemas-wifialliance-org:service:WFAWLANConfig:1#GetDeviceInfo",
- '"urn:schemas-wifialliance-org:service:WFAWLANConfig:1"',
- '"urn:schemas-wifialliance-org:service:WFAWLANConfig:123#GetDevice']:
+ for act in ["foo",
+ "urn:schemas-wifialliance-org:service:WFAWLANConfig:1#GetDeviceInfo",
+ '"urn:schemas-wifialliance-org:service:WFAWLANConfig:1"',
+ '"urn:schemas-wifialliance-org:service:WFAWLANConfig:123#GetDevice']:
resp = upnp_soap_action(conn, ctrlurl.path, "GetDeviceInfo",
include_soap_action=False,
soap_action_override=act)
@@ -2921,8 +2920,8 @@ def test_ap_wps_upnp_subscribe(dev, apdev):
url = urlparse(location)
conn = HTTPConnection(url.netloc)
#conn.set_debuglevel(1)
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", "hello", "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 412:
@@ -2933,25 +2932,25 @@ def test_ap_wps_upnp_subscribe(dev, apdev):
if resp.status != 412:
raise Exception("Unexpected HTTP response: %d" % resp.status)
- headers = { "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 412:
raise Exception("Unexpected HTTP response: %d" % resp.status)
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "NT": "upnp:foobar",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "NT": "upnp:foobar",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 400:
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("Valid subscription")
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 200:
@@ -2960,46 +2959,46 @@ def test_ap_wps_upnp_subscribe(dev, apdev):
logger.debug("Subscription SID " + sid)
logger.debug("Invalid re-subscription")
- headers = { "NT": "upnp:event",
- "sid": "123456734567854",
- "timeout": "Second-1234" }
+ headers = {"NT": "upnp:event",
+ "sid": "123456734567854",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 400:
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("Invalid re-subscription")
- headers = { "NT": "upnp:event",
- "sid": "uuid:123456734567854",
- "timeout": "Second-1234" }
+ headers = {"NT": "upnp:event",
+ "sid": "uuid:123456734567854",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 400:
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("Invalid re-subscription")
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "NT": "upnp:event",
- "sid": sid,
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "NT": "upnp:event",
+ "sid": sid,
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 400:
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("SID mismatch in re-subscription")
- headers = { "NT": "upnp:event",
- "sid": "uuid:4c2bca79-1ff4-4e43-85d4-952a2b8a51fb",
- "timeout": "Second-1234" }
+ headers = {"NT": "upnp:event",
+ "sid": "uuid:4c2bca79-1ff4-4e43-85d4-952a2b8a51fb",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 412:
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("Valid re-subscription")
- headers = { "NT": "upnp:event",
- "sid": sid,
- "timeout": "Second-1234" }
+ headers = {"NT": "upnp:event",
+ "sid": sid,
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 200:
@@ -3011,72 +3010,72 @@ def test_ap_wps_upnp_subscribe(dev, apdev):
raise Exception("Unexpected SID change")
logger.debug("Valid re-subscription")
- headers = { "NT": "upnp:event",
- "sid": "uuid: \t \t" + sid.split(':')[1],
- "timeout": "Second-1234" }
+ headers = {"NT": "upnp:event",
+ "sid": "uuid: \t \t" + sid.split(':')[1],
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 200:
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("Invalid unsubscription")
- headers = { "sid": sid }
+ headers = {"sid": sid}
conn.request("UNSUBSCRIBE", "/hello", "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 412:
raise Exception("Unexpected HTTP response: %d" % resp.status)
- headers = { "foo": "bar" }
+ headers = {"foo": "bar"}
conn.request("UNSUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 412:
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("Valid unsubscription")
- headers = { "sid": sid }
+ headers = {"sid": sid}
conn.request("UNSUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 200:
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("Unsubscription for not existing SID")
- headers = { "sid": sid }
+ headers = {"sid": sid}
conn.request("UNSUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 412:
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("Invalid unsubscription")
- headers = { "sid": " \t \tfoo" }
+ headers = {"sid": " \t \tfoo"}
conn.request("UNSUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 400:
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("Invalid unsubscription")
- headers = { "sid": "uuid:\t \tfoo" }
+ headers = {"sid": "uuid:\t \tfoo"}
conn.request("UNSUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 400:
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("Invalid unsubscription")
- headers = { "NT": "upnp:event",
- "sid": sid }
+ headers = {"NT": "upnp:event",
+ "sid": sid}
conn.request("UNSUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 400:
raise Exception("Unexpected HTTP response: %d" % resp.status)
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "sid": sid }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "sid": sid}
conn.request("UNSUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 400:
raise Exception("Unexpected HTTP response: %d" % resp.status)
logger.debug("Valid subscription with multiple callbacks")
- headers = { "callback": '<http://127.0.0.1:12345/event> <http://127.0.0.1:12345/event>\t<http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event>',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event> <http://127.0.0.1:12345/event>\t<http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event><http://127.0.0.1:12345/event>',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 200:
@@ -3103,15 +3102,15 @@ def test_ap_wps_upnp_subscribe(dev, apdev):
time.sleep(0.1)
time.sleep(0.2)
- headers = { "sid": sid }
+ headers = {"sid": sid}
conn.request("UNSUBSCRIBE", eventurl.path, "", headers)
resp = conn.getresponse()
if resp.status != 200 and resp.status != 412:
raise Exception("Unexpected HTTP response for UNSUBSCRIBE: %d" % resp.status)
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
with alloc_fail(hapd, 1, "http_client_addr;event_send_start"):
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
@@ -3120,15 +3119,15 @@ def test_ap_wps_upnp_subscribe(dev, apdev):
sid = resp.getheader("sid")
logger.debug("Subscription SID " + sid)
- headers = { "sid": sid }
+ headers = {"sid": sid}
conn.request("UNSUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 200:
raise Exception("Unexpected HTTP response for UNSUBSCRIBE: %d" % resp.status)
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 200:
@@ -3179,25 +3178,25 @@ def test_ap_wps_upnp_subscribe(dev, apdev):
if resp.status != 500:
raise Exception("Unexpected HTTP response: %d" % resp.status)
- headers = { "callback": '',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 500:
raise Exception("Unexpected HTTP response: %d" % resp.status)
- headers = { "callback": ' <',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": ' <',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 500:
raise Exception("Unexpected HTTP response: %d" % resp.status)
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
with alloc_fail(hapd, 1, "wpabuf_alloc;subscription_first_event"):
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
@@ -3223,9 +3222,9 @@ def test_ap_wps_upnp_subscribe(dev, apdev):
raise Exception("Unexpected HTTP response: %d" % resp.status)
for i in range(6):
- headers = { "callback": '<http://127.0.0.1:%d/event>' % (12345 + i),
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:%d/event>' % (12345 + i),
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 200:
@@ -3279,9 +3278,9 @@ def test_ap_wps_upnp_subscribe_events(dev, apdev):
url = urlparse(location)
conn = HTTPConnection(url.netloc)
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 200:
@@ -3342,7 +3341,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
raise Exception("Unexpected response to HEAD: " + str(resp.status))
conn.close()
- for cmd in [ "PUT", "DELETE", "TRACE", "CONNECT", "M-SEARCH", "M-POST" ]:
+ for cmd in ["PUT", "DELETE", "TRACE", "CONNECT", "M-SEARCH", "M-POST"]:
try:
conn.request(cmd, "hello")
resp = conn.getresponse()
@@ -3350,7 +3349,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
pass
conn.close()
- headers = { "Content-Length": 'abc' }
+ headers = {"Content-Length": 'abc'}
conn.request("HEAD", "hello", "\r\n\r\n", headers)
try:
resp = conn.getresponse()
@@ -3358,7 +3357,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
pass
conn.close()
- headers = { "Content-Length": '-10' }
+ headers = {"Content-Length": '-10'}
conn.request("HEAD", "hello", "\r\n\r\n", headers)
try:
resp = conn.getresponse()
@@ -3366,7 +3365,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
pass
conn.close()
- headers = { "Content-Length": '10000000000000' }
+ headers = {"Content-Length": '10000000000000'}
conn.request("HEAD", "hello", "\r\n\r\nhello", headers)
try:
resp = conn.getresponse()
@@ -3374,14 +3373,14 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
pass
conn.close()
- headers = { "Transfer-Encoding": 'abc' }
+ headers = {"Transfer-Encoding": 'abc'}
conn.request("HEAD", "hello", "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 501:
raise Exception("Unexpected response to HEAD: " + str(resp.status))
conn.close()
- headers = { "Transfer-Encoding": 'chunked' }
+ headers = {"Transfer-Encoding": 'chunked'}
conn.request("HEAD", "hello", "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 501:
@@ -3403,7 +3402,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
raise Exception("Unexpected response to HEAD: " + str(resp.status))
conn.close()
- headers = { "Content-Length": '20' }
+ headers = {"Content-Length": '20'}
conn.request("POST", "hello", 10 * 'A' + "\r\n\r\n", headers)
try:
resp = conn.getresponse()
@@ -3435,7 +3434,7 @@ def test_ap_wps_upnp_http_proto_chunked(dev, apdev):
conn = HTTPConnection(url.netloc)
#conn.set_debuglevel(1)
- headers = { "Transfer-Encoding": 'chunked' }
+ headers = {"Transfer-Encoding": 'chunked'}
conn.request("POST", "hello",
"a\r\nabcdefghij\r\n" + "2\r\nkl\r\n" + "0\r\n\r\n",
headers)
@@ -3472,7 +3471,7 @@ def test_ap_wps_upnp_http_proto_chunked(dev, apdev):
if completed:
raise Exception("Too long chunked request did not result in connection reset")
- headers = { "Transfer-Encoding": 'chunked' }
+ headers = {"Transfer-Encoding": 'chunked'}
conn.request("POST", "hello", "80000000\r\na", headers)
try:
resp = conn.getresponse()
@@ -3491,7 +3490,7 @@ def test_ap_wps_upnp_http_proto_chunked(dev, apdev):
def test_ap_wps_disabled(dev, apdev):
"""WPS operations while WPS is disabled"""
ssid = "test-wps-disabled"
- hapd = hostapd.add_ap(apdev[0], { "ssid": ssid })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": ssid})
if "FAIL" not in hapd.request("WPS_PBC"):
raise Exception("WPS_PBC succeeded unexpectedly")
if "FAIL" not in hapd.request("WPS_CANCEL"):
@@ -3500,8 +3499,8 @@ def test_ap_wps_disabled(dev, apdev):
def test_ap_wps_mixed_cred(dev, apdev):
"""WPS 2.0 STA merging mixed mode WPA/WPA2 credentials"""
ssid = "test-wps-wep"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "skip_cred_build": "1", "extra_cred": "wps-mixed-cred" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "skip_cred_build": "1", "extra_cred": "wps-mixed-cred"}
hapd = hostapd.add_ap(apdev[0], params)
hapd.request("WPS_PBC")
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
@@ -3526,11 +3525,11 @@ def test_ap_wps_while_connected(dev, apdev):
"""WPS PBC provisioning while connected to another AP"""
ssid = "test-wps-conf"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
- hostapd.add_ap(apdev[1], { "ssid": "open" })
+ hostapd.add_ap(apdev[1], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
logger.info("WPS provisioning step")
@@ -3547,11 +3546,11 @@ def test_ap_wps_while_connected_no_autoconnect(dev, apdev):
"""WPS PBC provisioning while connected to another AP and STA_AUTOCONNECT disabled"""
ssid = "test-wps-conf"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
- hostapd.add_ap(apdev[1], { "ssid": "open" })
+ hostapd.add_ap(apdev[1], {"ssid": "open"})
try:
dev[0].request("STA_AUTOCONNECT 0")
@@ -3573,9 +3572,9 @@ def test_ap_wps_from_event(dev, apdev):
"""WPS PBC event on AP to enable PBC"""
ssid = "test-wps-conf"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
dev[0].dump_monitor()
hapd.dump_monitor()
@@ -3596,9 +3595,9 @@ def test_ap_wps_ap_scan_2(dev, apdev):
"""AP_SCAN 2 for WPS"""
ssid = "test-wps-conf"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
hapd.request("WPS_PBC")
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@@ -3643,7 +3642,7 @@ def test_ap_wps_eapol_workaround(dev, apdev):
"""EAPOL workaround code path for 802.1X header length mismatch"""
ssid = "test-wps"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "1" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "1"})
bssid = apdev[0]['bssid']
hapd.request("SET ext_eapol_frame_io 1")
dev[0].request("SET ext_eapol_frame_io 1")
@@ -3662,15 +3661,15 @@ def test_ap_wps_iteration(dev, apdev):
"""WPS PIN and iterate through APs without selected registrar"""
ssid = "test-wps-conf"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
ssid2 = "test-wps-conf2"
hapd2 = hostapd.add_ap(apdev[1],
- { "ssid": ssid2, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid2, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
dev[0].scan_for_bss(apdev[1]['bssid'], freq="2412")
@@ -3704,10 +3703,10 @@ def test_ap_wps_iteration_error(dev, apdev):
"""WPS AP iteration on no Selected Registrar and error case with an AP"""
ssid = "test-wps-conf-pin"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "wps_independent": "1" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "wps_independent": "1"})
hapd.request("SET ext_eapol_frame_io 1")
bssid = apdev[0]['bssid']
pin = dev[0].wps_read_pin()
@@ -3730,10 +3729,10 @@ def test_ap_wps_iteration_error(dev, apdev):
# Start the real target AP and activate registrar on it.
hapd2 = hostapd.add_ap(apdev[1],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "wps_independent": "1" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "wps_independent": "1"})
hapd2.request("WPS_PIN any " + pin)
dev[0].wait_disconnected(timeout=15)
@@ -3750,9 +3749,9 @@ def test_ap_wps_priority(dev, apdev):
"""WPS PIN provisioning with configured AP and wps_priority"""
ssid = "test-wps-conf-pin"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
logger.info("WPS provisioning step")
pin = dev[0].wps_read_pin()
hapd.request("WPS_PIN any " + pin)
@@ -3772,10 +3771,10 @@ def test_ap_wps_priority(dev, apdev):
@remote_compatible
def test_ap_wps_and_non_wps(dev, apdev):
"""WPS and non-WPS AP in single hostapd process"""
- params = { "ssid": "wps", "eap_server": "1", "wps_state": "1" }
+ params = {"ssid": "wps", "eap_server": "1", "wps_state": "1"}
hapd = hostapd.add_ap(apdev[0], params)
- params = { "ssid": "no wps" }
+ params = {"ssid": "no wps"}
hapd2 = hostapd.add_ap(apdev[1], params)
appin = hapd.request("WPS_AP_PIN random")
@@ -3792,7 +3791,7 @@ def test_ap_wps_and_non_wps(dev, apdev):
def test_ap_wps_init_oom(dev, apdev):
"""Initial AP configuration and OOM during PSK generation"""
ssid = "test-wps"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "1" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "1"}
hapd = hostapd.add_ap(apdev[0], params)
with alloc_fail(hapd, 1, "base64_gen_encode;?base64_encode;wps_build_cred"):
@@ -3820,15 +3819,15 @@ def _test_ap_wps_er_oom(dev, apdev):
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"})
dev[0].connect(ssid, psk="12345678", scan_freq="2412")
@@ -3908,18 +3907,18 @@ def test_ap_wps_wpa_cli_action(dev, apdev, test_params):
ssid = "test-wps-conf"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
prg = os.path.join(test_params['logdir'],
'alt-wpa_supplicant/wpa_supplicant/wpa_cli')
if not os.path.exists(prg):
prg = '../../wpa_supplicant/wpa_cli'
- arg = [ prg, '-P', pidfile, '-B', '-i', dev[0].ifname, '-a', actionfile ]
+ arg = [prg, '-P', pidfile, '-B', '-i', dev[0].ifname, '-a', actionfile]
subprocess.call(arg)
- arg = [ 'ps', 'ax' ]
+ arg = ['ps', 'ax']
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE)
out = cmd.communicate()[0].decode()
cmd.wait()
@@ -3945,7 +3944,7 @@ def test_ap_wps_wpa_cli_action(dev, apdev, test_params):
if "WPS-SUCCESS" not in res:
raise Exception("WPS-SUCCESS event not seen in action file")
- arg = [ 'ps', 'ax' ]
+ arg = ['ps', 'ax']
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE)
out = cmd.communicate()[0].decode()
cmd.wait()
@@ -3972,7 +3971,7 @@ def _test_ap_wps_er_ssdp_proto(dev, apdev):
raise Exception("Invalid filter accepted")
if "OK" not in dev[0].request("WPS_ER_START ifname=lo 1.2.3.4"):
raise Exception("WPS_ER_START with filter failed")
- (msg,addr) = sock.recvfrom(1000)
+ (msg, addr) = sock.recvfrom(1000)
msg = msg.decode()
logger.debug("Received SSDP message from %s: %s" % (str(addr), msg))
if "M-SEARCH" not in msg:
@@ -3982,7 +3981,7 @@ def _test_ap_wps_er_ssdp_proto(dev, apdev):
dev[0].request("WPS_ER_STOP")
dev[0].request("WPS_ER_START ifname=lo")
- (msg,addr) = sock.recvfrom(1000)
+ (msg, addr) = sock.recvfrom(1000)
msg = msg.decode()
logger.debug("Received SSDP message from %s: %s" % (str(addr), msg))
if "M-SEARCH" not in msg:
@@ -4155,7 +4154,7 @@ def wps_er_start(dev, http_server, max_age=1, wait_m_search=False,
sock.bind(("239.255.255.250", 1900))
dev.request("WPS_ER_START ifname=lo")
for i in range(100):
- (msg,addr) = sock.recvfrom(1000)
+ (msg, addr) = sock.recvfrom(1000)
msg = msg.decode()
logger.debug("Received SSDP message from %s: %s" % (str(addr), msg))
if "M-SEARCH" in msg:
@@ -4171,7 +4170,7 @@ def wps_er_start(dev, http_server, max_age=1, wait_m_search=False,
location_url = 'http://127.0.0.1:12345/foo.xml'
sock.sendto(("HTTP/1.1 200 OK\r\nST: urn:schemas-wifialliance-org:device:WFADevice:1\r\nlocation:%s\r\ncache-control:max-age=%d\r\n\r\n" % (location_url, max_age)).encode(), addr)
server.timeout = 1
- return server,sock
+ return server, sock
def wps_er_stop(dev, sock, server, on_alloc_fail=False):
sock.close()
@@ -4196,7 +4195,7 @@ def wps_er_stop(dev, sock, server, on_alloc_fail=False):
def run_wps_er_proto_test(dev, handler, no_event_url=False, location_url=None):
try:
uuid = '27ea801a-9e5c-4e73-bd82-f89cbcd10d7e'
- server,sock = wps_er_start(dev, handler, location_url=location_url)
+ server, sock = wps_er_start(dev, handler, location_url=location_url)
global wps_event_url
wps_event_url = None
server.handle_request()
@@ -4222,13 +4221,13 @@ def send_wlanevent(url, uuid, data, no_response=False):
<e:property><WLANEvent>'''
payload += base64.b64encode(data).decode()
payload += '</WLANEvent></e:property></e:propertyset>'
- headers = { "Content-type": 'text/xml; charset="utf-8"',
- "Server": "Unspecified, UPnP/1.0, Unspecified",
- "HOST": url.netloc,
- "NT": "upnp:event",
- "SID": "uuid:" + uuid,
- "SEQ": "0",
- "Content-Length": str(len(payload)) }
+ headers = {"Content-type": 'text/xml; charset="utf-8"',
+ "Server": "Unspecified, UPnP/1.0, Unspecified",
+ "HOST": url.netloc,
+ "NT": "upnp:event",
+ "SID": "uuid:" + uuid,
+ "SEQ": "0",
+ "Content-Length": str(len(payload))}
conn.request("NOTIFY", url.path, payload, headers)
if no_response:
try:
@@ -4249,7 +4248,7 @@ def test_ap_wps_er_http_proto(dev, apdev):
def _test_ap_wps_er_http_proto(dev, apdev):
uuid = '27ea801a-9e5c-4e73-bd82-f89cbcd10d7e'
- server,sock = wps_er_start(dev[0], WPSAPHTTPServer, max_age=15)
+ server, sock = wps_er_start(dev[0], WPSAPHTTPServer, max_age=15)
global wps_event_url
wps_event_url = None
server.handle_request()
@@ -4281,13 +4280,13 @@ RGV2aWNlIEEQSQAGADcqAAEg
</WLANEvent></e:property>
</e:propertyset>
'''
- headers = { "Content-type": 'text/xml; charset="utf-8"',
- "Server": "Unspecified, UPnP/1.0, Unspecified",
- "HOST": url.netloc,
- "NT": "upnp:event",
- "SID": "uuid:" + uuid,
- "SEQ": "0",
- "Content-Length": str(len(payload)) }
+ headers = {"Content-type": 'text/xml; charset="utf-8"',
+ "Server": "Unspecified, UPnP/1.0, Unspecified",
+ "HOST": url.netloc,
+ "NT": "upnp:event",
+ "SID": "uuid:" + uuid,
+ "SEQ": "0",
+ "Content-Length": str(len(payload))}
conn.request("NOTIFY", url.path, payload, headers)
resp = conn.getresponse()
if resp.status != 200:
@@ -4524,10 +4523,10 @@ RGV2aWNlIEEQSQAGADcqAAEg
raise Exception("Too few concurrent HTTP connections accepted")
logger.info("OOM in HTTP server")
- for func in [ "http_request_init", "httpread_create",
- "eloop_register_timeout;httpread_create",
- "eloop_sock_table_add_sock;?eloop_register_sock;httpread_create",
- "httpread_hdr_analyze" ]:
+ for func in ["http_request_init", "httpread_create",
+ "eloop_register_timeout;httpread_create",
+ "eloop_sock_table_add_sock;?eloop_register_sock;httpread_create",
+ "httpread_hdr_analyze"]:
with alloc_fail(dev[0], 1, func):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM,
socket.IPPROTO_TCP)
@@ -4540,17 +4539,17 @@ RGV2aWNlIEEQSQAGADcqAAEg
sock.close()
logger.info("Invalid HTTP header")
- for req in [ " GET / HTTP/1.1\r\n\r\n",
- "HTTP/1.1 200 OK\r\n\r\n",
- "HTTP/\r\n\r\n",
- "GET %%a%aa% HTTP/1.1\r\n\r\n",
- "GET / HTTP/1.1\r\n FOO\r\n\r\n",
- "NOTIFY / HTTP/1.1\r\n" + 4097*'a' + '\r\n\r\n',
- "NOTIFY / HTTP/1.1\r\n\r\n" + 8193*'a',
- "POST / HTTP/1.1\r\nTransfer-Encoding: CHUNKED\r\n\r\n foo\r\n",
- "POST / HTTP/1.1\r\nTransfer-Encoding: CHUNKED\r\n\r\n1\r\nfoo\r\n",
- "POST / HTTP/1.1\r\nTransfer-Encoding: CHUNKED\r\n\r\n0\r\n",
- "POST / HTTP/1.1\r\nTransfer-Encoding: CHUNKED\r\n\r\n0\r\naa\ra\r\n\ra" ]:
+ for req in [" GET / HTTP/1.1\r\n\r\n",
+ "HTTP/1.1 200 OK\r\n\r\n",
+ "HTTP/\r\n\r\n",
+ "GET %%a%aa% HTTP/1.1\r\n\r\n",
+ "GET / HTTP/1.1\r\n FOO\r\n\r\n",
+ "NOTIFY / HTTP/1.1\r\n" + 4097*'a' + '\r\n\r\n',
+ "NOTIFY / HTTP/1.1\r\n\r\n" + 8193*'a',
+ "POST / HTTP/1.1\r\nTransfer-Encoding: CHUNKED\r\n\r\n foo\r\n",
+ "POST / HTTP/1.1\r\nTransfer-Encoding: CHUNKED\r\n\r\n1\r\nfoo\r\n",
+ "POST / HTTP/1.1\r\nTransfer-Encoding: CHUNKED\r\n\r\n0\r\n",
+ "POST / HTTP/1.1\r\nTransfer-Encoding: CHUNKED\r\n\r\n0\r\naa\ra\r\n\ra"]:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM,
socket.IPPROTO_TCP)
sock.settimeout(0.1)
@@ -4575,13 +4574,13 @@ RGV2aWNlIEEQSQAGADcqAAEg
conn = HTTPConnection(url.netloc)
payload = '<foo'
- headers = { "Content-type": 'text/xml; charset="utf-8"',
- "Server": "Unspecified, UPnP/1.0, Unspecified",
- "HOST": url.netloc,
- "NT": "upnp:event",
- "SID": "uuid:" + uuid,
- "SEQ": "0",
- "Content-Length": str(len(payload)) }
+ headers = {"Content-type": 'text/xml; charset="utf-8"',
+ "Server": "Unspecified, UPnP/1.0, Unspecified",
+ "HOST": url.netloc,
+ "NT": "upnp:event",
+ "SID": "uuid:" + uuid,
+ "SEQ": "0",
+ "Content-Length": str(len(payload))}
conn.request("NOTIFY", url.path, payload, headers)
resp = conn.getresponse()
if resp.status != 200:
@@ -4589,13 +4588,13 @@ RGV2aWNlIEEQSQAGADcqAAEg
conn = HTTPConnection(url.netloc)
payload = '<WLANEvent foo></WLANEvent>'
- headers = { "Content-type": 'text/xml; charset="utf-8"',
- "Server": "Unspecified, UPnP/1.0, Unspecified",
- "HOST": url.netloc,
- "NT": "upnp:event",
- "SID": "uuid:" + uuid,
- "SEQ": "0",
- "Content-Length": str(len(payload)) }
+ headers = {"Content-type": 'text/xml; charset="utf-8"',
+ "Server": "Unspecified, UPnP/1.0, Unspecified",
+ "HOST": url.netloc,
+ "NT": "upnp:event",
+ "SID": "uuid:" + uuid,
+ "SEQ": "0",
+ "Content-Length": str(len(payload))}
conn.request("NOTIFY", url.path, payload, headers)
resp = conn.getresponse()
if resp.status != 200:
@@ -4607,12 +4606,12 @@ RGV2aWNlIEEQSQAGADcqAAEg
with alloc_fail(dev[0], 1, "wpabuf_alloc_ext_data;xml_get_base64_item"):
send_wlanevent(url, uuid, b'foo')
- for func in [ "wps_init",
- "wps_process_manufacturer",
- "wps_process_model_name",
- "wps_process_model_number",
- "wps_process_serial_number",
- "wps_process_dev_name" ]:
+ for func in ["wps_init",
+ "wps_process_manufacturer",
+ "wps_process_model_name",
+ "wps_process_model_number",
+ "wps_process_serial_number",
+ "wps_process_dev_name"]:
with alloc_fail(dev[0], 1, func):
send_wlanevent(url, uuid, m1)
@@ -4694,14 +4693,14 @@ def test_ap_wps_er_http_proto_subscribe_oom(dev, apdev):
dev[0].request("WPS_ER_STOP")
def _test_ap_wps_er_http_proto_subscribe_oom(dev, apdev):
- tests = [ (1, "http_client_url_parse"),
- (1, "wpabuf_alloc;wps_er_subscribe"),
- (1, "http_client_addr"),
- (1, "eloop_sock_table_add_sock;?eloop_register_sock;http_client_addr"),
- (1, "eloop_register_timeout;http_client_addr") ]
- for count,func in tests:
+ tests = [(1, "http_client_url_parse"),
+ (1, "wpabuf_alloc;wps_er_subscribe"),
+ (1, "http_client_addr"),
+ (1, "eloop_sock_table_add_sock;?eloop_register_sock;http_client_addr"),
+ (1, "eloop_register_timeout;http_client_addr")]
+ for count, func in tests:
with alloc_fail(dev[0], count, func):
- server,sock = wps_er_start(dev[0], WPSAPHTTPServer)
+ server, sock = wps_er_start(dev[0], WPSAPHTTPServer)
server.handle_request()
server.handle_request()
wps_er_stop(dev[0], sock, server, on_alloc_fail=True)
@@ -4867,8 +4866,8 @@ def _test_ap_wps_http_timeout(dev, apdev):
logger.debug("DummyServer - wait done")
logger.debug("Start WPS ER")
- server,sock2 = wps_er_start(dev[0], DummyServer, max_age=40,
- wait_m_search=True)
+ server, sock2 = wps_er_start(dev[0], DummyServer, max_age=40,
+ wait_m_search=True)
logger.debug("Start server to accept, but not complete, HTTP connection from WPS ER")
# This will wait for 31 seconds..
@@ -4895,7 +4894,7 @@ def _test_ap_wps_er_url_parse(dev, apdev):
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(("239.255.255.250", 1900))
dev[0].request("WPS_ER_START ifname=lo")
- (msg,addr) = sock.recvfrom(1000)
+ (msg, addr) = sock.recvfrom(1000)
msg = msg.decode()
logger.debug("Received SSDP message from %s: %s" % (str(addr), msg))
if "M-SEARCH" not in msg:
@@ -4944,8 +4943,8 @@ def test_ap_wps_init_oom(dev, apdev):
"""wps_init OOM cases"""
ssid = "test-wps"
appin = "12345670"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "ap_pin": appin }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "ap_pin": appin}
hapd = hostapd.add_ap(apdev[0], params)
pin = dev[0].wps_read_pin()
@@ -4992,7 +4991,7 @@ def test_ap_wps_init_oom(dev, apdev):
def test_ap_wps_invalid_assoc_req_elem(dev, apdev):
"""WPS and invalid IE in Association Request frame"""
ssid = "test-wps"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2"}
hapd = hostapd.add_ap(apdev[0], params)
pin = "12345670"
hapd.request("WPS_PIN any " + pin)
@@ -5013,7 +5012,7 @@ def test_ap_wps_invalid_assoc_req_elem(dev, apdev):
def test_ap_wps_pbc_pin_mismatch(dev, apdev):
"""WPS PBC/PIN mismatch"""
ssid = "test-wps"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2"}
hapd = hostapd.add_ap(apdev[0], params)
hapd.request("SET wps_version_number 0x10")
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
@@ -5032,10 +5031,10 @@ def test_ap_wps_pbc_pin_mismatch(dev, apdev):
def test_ap_wps_ie_invalid(dev, apdev):
"""WPS PIN attempt with AP that has invalid WSC IE"""
ssid = "test-wps"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "vendor_elements": "dd050050f20410" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "vendor_elements": "dd050050f20410"}
hapd = hostapd.add_ap(apdev[0], params)
- params = { 'ssid': "another", "vendor_elements": "dd050050f20410" }
+ params = {'ssid': "another", "vendor_elements": "dd050050f20410"}
hostapd.add_ap(apdev[1], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
pin = dev[0].wps_read_pin()
@@ -5049,9 +5048,9 @@ def test_ap_wps_ie_invalid(dev, apdev):
def test_ap_wps_scan_prio_order(dev, apdev):
"""WPS scan priority ordering"""
ssid = "test-wps"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2"}
hapd = hostapd.add_ap(apdev[0], params)
- params = { 'ssid': "another", "vendor_elements": "dd050050f20410" }
+ params = {'ssid': "another", "vendor_elements": "dd050050f20410"}
hostapd.add_ap(apdev[1], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
dev[0].scan_for_bss(apdev[1]['bssid'], freq="2412")
@@ -5065,7 +5064,7 @@ def test_ap_wps_scan_prio_order(dev, apdev):
def test_ap_wps_probe_req_ie_oom(dev, apdev):
"""WPS ProbeReq IE OOM"""
ssid = "test-wps"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2"}
hapd = hostapd.add_ap(apdev[0], params)
pin = dev[0].wps_read_pin()
hapd.request("WPS_PIN any " + pin)
@@ -5093,7 +5092,7 @@ def test_ap_wps_probe_req_ie_oom(dev, apdev):
def test_ap_wps_assoc_req_ie_oom(dev, apdev):
"""WPS AssocReq IE OOM"""
ssid = "test-wps"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2"}
hapd = hostapd.add_ap(apdev[0], params)
pin = dev[0].wps_read_pin()
hapd.request("WPS_PIN any " + pin)
@@ -5108,7 +5107,7 @@ def test_ap_wps_assoc_req_ie_oom(dev, apdev):
def test_ap_wps_assoc_resp_ie_oom(dev, apdev):
"""WPS AssocResp IE OOM"""
ssid = "test-wps"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2"}
hapd = hostapd.add_ap(apdev[0], params)
pin = dev[0].wps_read_pin()
hapd.request("WPS_PIN any " + pin)
@@ -5123,10 +5122,10 @@ def test_ap_wps_assoc_resp_ie_oom(dev, apdev):
@remote_compatible
def test_ap_wps_bss_info_errors(dev, apdev):
"""WPS BSS info errors"""
- params = { "ssid": "1",
- "vendor_elements": "dd0e0050f20410440001ff101100010a" }
+ params = {"ssid": "1",
+ "vendor_elements": "dd0e0050f20410440001ff101100010a"}
hostapd.add_ap(apdev[0], params)
- params = { 'ssid': "2", "vendor_elements": "dd050050f20410" }
+ params = {'ssid': "2", "vendor_elements": "dd050050f20410"}
hostapd.add_ap(apdev[1], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
dev[0].scan_for_bss(apdev[1]['bssid'], freq="2412")
@@ -5294,10 +5293,10 @@ def test_ap_wps_random_psk_fail(dev, apdev):
with open(pskfile, "w") as f:
f.write("# WPA PSKs\n")
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa": "2", "wpa_key_mgmt": "WPA-PSK",
- "rsn_pairwise": "CCMP", "ap_pin": appin,
- "wpa_psk_file": pskfile }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa": "2", "wpa_key_mgmt": "WPA-PSK",
+ "rsn_pairwise": "CCMP", "ap_pin": appin,
+ "wpa_psk_file": pskfile}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
@@ -5350,9 +5349,9 @@ def wps_start_ext(apdev, dev, pbc=False, pin=None):
addr = dev.own_addr()
bssid = apdev['bssid']
ssid = "test-wps-conf"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"}
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"}
hapd = hostapd.add_ap(apdev, params)
if pbc:
@@ -5369,7 +5368,7 @@ def wps_start_ext(apdev, dev, pbc=False, pin=None):
dev.request("WPS_PBC " + bssid)
else:
dev.request("WPS_PIN " + bssid + " " + pin)
- return addr,bssid,hapd
+ return addr, bssid, hapd
def wps_auth_corrupt(dst, src, addr):
ev = src.wait_event(["EAPOL-TX"], timeout=10)
@@ -5405,7 +5404,7 @@ def wps_auth_corrupt_to_ap(dev, hapd, addr, fail_str):
def test_ap_wps_authenticator_mismatch_m2(dev, apdev):
"""WPS and Authenticator attribute mismatch in M2"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5415,7 +5414,7 @@ def test_ap_wps_authenticator_mismatch_m2(dev, apdev):
def test_ap_wps_authenticator_mismatch_m3(dev, apdev):
"""WPS and Authenticator attribute mismatch in M3"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5426,7 +5425,7 @@ def test_ap_wps_authenticator_mismatch_m3(dev, apdev):
def test_ap_wps_authenticator_mismatch_m4(dev, apdev):
"""WPS and Authenticator attribute mismatch in M4"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5438,7 +5437,7 @@ def test_ap_wps_authenticator_mismatch_m4(dev, apdev):
def test_ap_wps_authenticator_mismatch_m5(dev, apdev):
"""WPS and Authenticator attribute mismatch in M5"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5451,7 +5450,7 @@ def test_ap_wps_authenticator_mismatch_m5(dev, apdev):
def test_ap_wps_authenticator_mismatch_m6(dev, apdev):
"""WPS and Authenticator attribute mismatch in M6"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5465,7 +5464,7 @@ def test_ap_wps_authenticator_mismatch_m6(dev, apdev):
def test_ap_wps_authenticator_mismatch_m7(dev, apdev):
"""WPS and Authenticator attribute mismatch in M7"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5480,7 +5479,7 @@ def test_ap_wps_authenticator_mismatch_m7(dev, apdev):
def test_ap_wps_authenticator_mismatch_m8(dev, apdev):
"""WPS and Authenticator attribute mismatch in M8"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5496,7 +5495,7 @@ def test_ap_wps_authenticator_mismatch_m8(dev, apdev):
def test_ap_wps_authenticator_missing_m2(dev, apdev):
"""WPS and Authenticator attribute missing from M2"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5521,7 +5520,7 @@ def test_ap_wps_authenticator_missing_m2(dev, apdev):
def test_ap_wps_m2_dev_passwd_id_p2p(dev, apdev):
"""WPS and M2 with different Device Password ID (P2P)"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5546,7 +5545,7 @@ def test_ap_wps_m2_dev_passwd_id_p2p(dev, apdev):
def test_ap_wps_m2_dev_passwd_id_change_pin_to_pbc(dev, apdev):
"""WPS and M2 with different Device Password ID (PIN to PBC)"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5569,7 +5568,7 @@ def test_ap_wps_m2_dev_passwd_id_change_pin_to_pbc(dev, apdev):
def test_ap_wps_m2_dev_passwd_id_change_pbc_to_pin(dev, apdev):
"""WPS and M2 with different Device Password ID (PBC to PIN)"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5595,7 +5594,7 @@ def test_ap_wps_m2_dev_passwd_id_change_pbc_to_pin(dev, apdev):
def test_ap_wps_m2_missing_dev_passwd_id(dev, apdev):
"""WPS and M2 without Device Password ID"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5621,7 +5620,7 @@ def test_ap_wps_m2_missing_dev_passwd_id(dev, apdev):
def test_ap_wps_m2_missing_registrar_nonce(dev, apdev):
"""WPS and M2 without Registrar Nonce"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5651,7 +5650,7 @@ def test_ap_wps_m2_missing_registrar_nonce(dev, apdev):
def test_ap_wps_m2_missing_enrollee_nonce(dev, apdev):
"""WPS and M2 without Enrollee Nonce"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5681,7 +5680,7 @@ def test_ap_wps_m2_missing_enrollee_nonce(dev, apdev):
def test_ap_wps_m2_missing_uuid_r(dev, apdev):
"""WPS and M2 without UUID-R"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5710,7 +5709,7 @@ def test_ap_wps_m2_missing_uuid_r(dev, apdev):
def test_ap_wps_m2_invalid(dev, apdev):
"""WPS and M2 parsing failure"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5739,7 +5738,7 @@ def test_ap_wps_m2_invalid(dev, apdev):
def test_ap_wps_m2_missing_msg_type(dev, apdev):
"""WPS and M2 without Message Type"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5768,7 +5767,7 @@ def test_ap_wps_m2_missing_msg_type(dev, apdev):
def test_ap_wps_m2_unknown_msg_type(dev, apdev):
"""WPS and M2 but unknown Message Type"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5795,7 +5794,7 @@ def test_ap_wps_m2_unknown_msg_type(dev, apdev):
def test_ap_wps_m2_unknown_opcode(dev, apdev):
"""WPS and M2 but unknown opcode"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5818,7 +5817,7 @@ def test_ap_wps_m2_unknown_opcode(dev, apdev):
def test_ap_wps_m2_unknown_opcode2(dev, apdev):
"""WPS and M2 but unknown opcode (WSC_Start)"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5841,7 +5840,7 @@ def test_ap_wps_m2_unknown_opcode2(dev, apdev):
def test_ap_wps_m2_unknown_opcode3(dev, apdev):
"""WPS and M2 but unknown opcode (WSC_Done)"""
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -5863,7 +5862,7 @@ def test_ap_wps_m2_unknown_opcode3(dev, apdev):
dev[0].flush_scan_cache()
def wps_m2_but_other(dev, apdev, title, msgtype):
- addr,bssid,hapd = wps_start_ext(apdev, dev)
+ addr, bssid, hapd = wps_start_ext(apdev, dev)
wps_ext_eap_identity_req(dev, hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev, addr)
wps_ext_eap_wsc(dev, hapd, bssid, "EAP-WSC/Start")
@@ -5889,7 +5888,7 @@ def wps_m2_but_other(dev, apdev, title, msgtype):
dev.wait_disconnected()
def wps_m4_but_other(dev, apdev, title, msgtype):
- addr,bssid,hapd = wps_start_ext(apdev, dev)
+ addr, bssid, hapd = wps_start_ext(apdev, dev)
wps_ext_eap_identity_req(dev, hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev, addr)
wps_ext_eap_wsc(dev, hapd, bssid, "EAP-WSC/Start")
@@ -5940,15 +5939,15 @@ def test_ap_wps_m4_msg_type_m2d(dev, apdev):
def test_ap_wps_config_methods(dev, apdev):
"""WPS configuration method parsing"""
ssid = "test-wps-conf"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "config_methods": "ethernet display ext_nfc_token int_nfc_token physical_display physical_push_button" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "config_methods": "ethernet display ext_nfc_token int_nfc_token physical_display physical_push_button"}
hapd = hostapd.add_ap(apdev[0], params)
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "config_methods": "display push_button" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "config_methods": "display push_button"}
hapd2 = hostapd.add_ap(apdev[1], params)
def test_ap_wps_set_selected_registrar_proto(dev, apdev):
@@ -5972,9 +5971,9 @@ def test_ap_wps_set_selected_registrar_proto(dev, apdev):
server = MyTCPServer(("127.0.0.1", 12345), WPSERHTTPServer)
server.timeout = 1
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 200:
@@ -5983,16 +5982,16 @@ def test_ap_wps_set_selected_registrar_proto(dev, apdev):
logger.debug("Subscription SID " + sid)
server.handle_request()
- tests = [ (500, "10"),
- (200, "104a000110" + "1041000101" + "101200020000" +
- "105300023148" +
- "1049002c00372a0001200124111111111111222222222222333333333333444444444444555555555555666666666666" +
- "10480010362db47ba53a519188fb5458b986b2e4"),
- (200, "104a000110" + "1041000100" + "101200020000" +
- "105300020000"),
- (200, "104a000110" + "1041000100"),
- (200, "104a000110") ]
- for status,test in tests:
+ tests = [(500, "10"),
+ (200, "104a000110" + "1041000101" + "101200020000" +
+ "105300023148" +
+ "1049002c00372a0001200124111111111111222222222222333333333333444444444444555555555555666666666666" +
+ "10480010362db47ba53a519188fb5458b986b2e4"),
+ (200, "104a000110" + "1041000100" + "101200020000" +
+ "105300020000"),
+ (200, "104a000110" + "1041000100"),
+ (200, "104a000110")]
+ for status, test in tests:
tlvs = binascii.unhexlify(test)
newmsg = base64.b64encode(tlvs).decode()
msg = '<?xml version="1.0"?>\n'
@@ -6002,7 +6001,7 @@ def test_ap_wps_set_selected_registrar_proto(dev, apdev):
msg += '<NewMessage>'
msg += newmsg
msg += "</NewMessage></u:SetSelectedRegistrar></s:Body></s:Envelope>"
- headers = { "Content-type": 'text/xml; charset="utf-8"' }
+ headers = {"Content-type": 'text/xml; charset="utf-8"'}
headers["SOAPAction"] = '"urn:schemas-wifialliance-org:service:WFAWLANConfig:1#%s"' % "SetSelectedRegistrar"
conn.request("POST", ctrlurl.path, msg, headers)
resp = conn.getresponse()
@@ -6171,7 +6170,7 @@ def get_wsc_msg(dev):
# Parse EAPOL header
if len(data) < 4:
raise Exception("No room for EAPOL header")
- version,type,length = struct.unpack('>BBH', data[0:4])
+ version, type, length = struct.unpack('>BBH', data[0:4])
msg['eapol_version'] = version
msg['eapol_type'] = type
msg['eapol_length'] = length
@@ -6184,7 +6183,7 @@ def get_wsc_msg(dev):
# Parse EAP header
if len(data) < 4:
raise Exception("No room for EAP header")
- code,identifier,length = struct.unpack('>BBH', data[0:4])
+ code, identifier, length = struct.unpack('>BBH', data[0:4])
msg['eap_code'] = code
msg['eap_identifier'] = identifier
msg['eap_length'] = length
@@ -6223,7 +6222,7 @@ def get_wsc_msg(dev):
while len(data) > 0:
if len(data) < 4:
raise Exception("Truncated attribute header")
- attr,length = struct.unpack('>HH', data[0:4])
+ attr, length = struct.unpack('>HH', data[0:4])
data = data[4:]
if length > len(data):
raise Exception("Truncated attribute 0x%04x" % attr)
@@ -6304,7 +6303,7 @@ def wsc_keys(kdk):
authkey = keys[0:32]
keywrapkey = keys[32:48]
emsk = keys[48:80]
- return authkey,keywrapkey,emsk
+ return authkey, keywrapkey, emsk
def wsc_dev_pw_half_psk(authkey, dev_pw):
m = hmac.new(authkey, dev_pw.encode(), hashlib.sha256)
@@ -6315,7 +6314,7 @@ def wsc_dev_pw_psk(authkey, dev_pw):
dev_pw_2 = dev_pw[len(dev_pw) // 2:]
psk1 = wsc_dev_pw_half_psk(authkey, dev_pw_1)
psk2 = wsc_dev_pw_half_psk(authkey, dev_pw_2)
- return psk1,psk2
+ return psk1, psk2
def build_attr_authenticator(authkey, prev_msg, curr_msg):
m = hmac.new(authkey, prev_msg + curr_msg, hashlib.sha256)
@@ -6352,7 +6351,7 @@ def decrypt_attr_encr_settings(authkey, keywrapkey, data):
if len(decrypted) < 12:
raise Exception("Truncated Encrypted Settings plaintext")
kwa = decrypted[-12:]
- attr,length = struct.unpack(">HH", kwa[0:4])
+ attr, length = struct.unpack(">HH", kwa[0:4])
if attr != ATTR_KEY_WRAP_AUTH or length != 8:
raise Exception("Invalid KWA header")
kwa = kwa[4:]
@@ -6395,14 +6394,14 @@ def wsc_dh_kdf(peer_pk, own_private, mac_addr, e_nonce, r_nonce):
m = hmac.new(dhkey, e_nonce + mac_addr + r_nonce, hashlib.sha256)
kdk = m.digest()
logger.debug("KDK: " + binascii.hexlify(kdk).decode())
- authkey,keywrapkey,emsk = wsc_keys(kdk)
+ authkey, keywrapkey, emsk = wsc_keys(kdk)
logger.debug("AuthKey: " + binascii.hexlify(authkey).decode())
logger.debug("KeyWrapKey: " + binascii.hexlify(keywrapkey).decode())
logger.debug("EMSK: " + binascii.hexlify(emsk).decode())
- return authkey,keywrapkey
+ return authkey, keywrapkey
def wsc_dev_pw_hash(authkey, dev_pw, e_pk, r_pk):
- psk1,psk2 = wsc_dev_pw_psk(authkey, dev_pw)
+ psk1, psk2 = wsc_dev_pw_psk(authkey, dev_pw)
logger.debug("PSK1: " + binascii.hexlify(psk1).decode())
logger.debug("PSK2: " + binascii.hexlify(psk2).decode())
@@ -6417,7 +6416,7 @@ def wsc_dev_pw_hash(authkey, dev_pw, e_pk, r_pk):
m = hmac.new(authkey, s2 + psk2 + e_pk + r_pk, hashlib.sha256)
hash2 = m.digest()
logger.debug("Hash2: " + binascii.hexlify(hash2).decode())
- return s1,s2,hash1,hash2
+ return s1, s2, hash1, hash2
def build_m1(eap_id, uuid_e, mac_addr, e_nonce, e_pk,
manufacturer='', model_name='', config_methods='\x00\x00'):
@@ -6529,7 +6528,7 @@ def build_nack(eap_id, e_nonce, r_nonce, config_error='\x00\x00',
def test_wps_ext(dev, apdev):
"""WPS against external implementation"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -6552,11 +6551,11 @@ def test_wps_ext(dev, apdev):
logger.debug("Receive M2 from AP")
msg, m2_attrs, raw_m2_attrs = recv_wsc_msg(hapd, WSC_MSG, WPS_M2)
- authkey,keywrapkey = wsc_dh_kdf(m2_attrs[ATTR_PUBLIC_KEY], own_private,
- mac_addr, e_nonce,
- m2_attrs[ATTR_REGISTRAR_NONCE])
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk,
- m2_attrs[ATTR_PUBLIC_KEY])
+ authkey, keywrapkey = wsc_dh_kdf(m2_attrs[ATTR_PUBLIC_KEY], own_private,
+ mac_addr, e_nonce,
+ m2_attrs[ATTR_REGISTRAR_NONCE])
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk,
+ m2_attrs[ATTR_PUBLIC_KEY])
logger.debug("Send M3 to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -6628,11 +6627,12 @@ def test_wps_ext(dev, apdev):
logger.debug("Receive M1 from STA")
msg, m1_attrs, raw_m1_attrs = recv_wsc_msg(dev[0], WSC_MSG, WPS_M1)
- authkey,keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
- mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
- r_nonce)
- r_s1,r_s2,r_hash1,r_hash2 = wsc_dev_pw_hash(authkey, pin,
- m1_attrs[ATTR_PUBLIC_KEY], e_pk)
+ authkey, keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
+ mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
+ r_nonce)
+ r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
+ m1_attrs[ATTR_PUBLIC_KEY],
+ e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@@ -6711,7 +6711,7 @@ def test_wps_ext(dev, apdev):
def wps_start_kwa(dev, apdev):
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -6725,11 +6725,12 @@ def wps_start_kwa(dev, apdev):
msg, m1_attrs, raw_m1_attrs = recv_wsc_msg(dev[0], WSC_MSG, WPS_M1)
eap_id = (msg['eap_identifier'] + 1) % 256
- authkey,keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
- mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
- r_nonce)
- r_s1,r_s2,r_hash1,r_hash2 = wsc_dev_pw_hash(authkey, pin,
- m1_attrs[ATTR_PUBLIC_KEY], e_pk)
+ authkey, keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
+ mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
+ r_nonce)
+ r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
+ m1_attrs[ATTR_PUBLIC_KEY],
+ e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@@ -6767,7 +6768,7 @@ def wps_stop_kwa(dev, bssid, attrs, authkey, raw_m3_attrs, eap_id):
def test_wps_ext_kwa_proto_no_kwa(dev, apdev):
"""WPS and KWA error: No KWA attribute"""
- r_s1,keywrapkey,authkey,raw_m3_attrs,eap_id,bssid,attrs = wps_start_kwa(dev, apdev)
+ r_s1, keywrapkey, authkey, raw_m3_attrs, eap_id, bssid, attrs = wps_start_kwa(dev, apdev)
data = build_wsc_attr(ATTR_R_SNONCE1, r_s1)
# Encrypted Settings without KWA
iv = 16*b'\x99'
@@ -6781,7 +6782,7 @@ def test_wps_ext_kwa_proto_no_kwa(dev, apdev):
def test_wps_ext_kwa_proto_data_after_kwa(dev, apdev):
"""WPS and KWA error: Data after KWA"""
- r_s1,keywrapkey,authkey,raw_m3_attrs,eap_id,bssid,attrs = wps_start_kwa(dev, apdev)
+ r_s1, keywrapkey, authkey, raw_m3_attrs, eap_id, bssid, attrs = wps_start_kwa(dev, apdev)
data = build_wsc_attr(ATTR_R_SNONCE1, r_s1)
# Encrypted Settings and data after KWA
m = hmac.new(authkey, data, hashlib.sha256)
@@ -6799,7 +6800,7 @@ def test_wps_ext_kwa_proto_data_after_kwa(dev, apdev):
def test_wps_ext_kwa_proto_kwa_mismatch(dev, apdev):
"""WPS and KWA error: KWA mismatch"""
- r_s1,keywrapkey,authkey,raw_m3_attrs,eap_id,bssid,attrs = wps_start_kwa(dev, apdev)
+ r_s1, keywrapkey, authkey, raw_m3_attrs, eap_id, bssid, attrs = wps_start_kwa(dev, apdev)
data = build_wsc_attr(ATTR_R_SNONCE1, r_s1)
# Encrypted Settings and KWA with incorrect value
data += build_wsc_attr(ATTR_KEY_WRAP_AUTH, 8*'\x00')
@@ -6814,7 +6815,7 @@ def test_wps_ext_kwa_proto_kwa_mismatch(dev, apdev):
def wps_run_cred_proto(dev, apdev, m8_cred, connect=False, no_connect=False):
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -6828,11 +6829,12 @@ def wps_run_cred_proto(dev, apdev, m8_cred, connect=False, no_connect=False):
msg, m1_attrs, raw_m1_attrs = recv_wsc_msg(dev[0], WSC_MSG, WPS_M1)
eap_id = (msg['eap_identifier'] + 1) % 256
- authkey,keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
- mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
- r_nonce)
- r_s1,r_s2,r_hash1,r_hash2 = wsc_dev_pw_hash(authkey, pin,
- m1_attrs[ATTR_PUBLIC_KEY], e_pk)
+ authkey, keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
+ mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
+ r_nonce)
+ r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
+ m1_attrs[ATTR_PUBLIC_KEY],
+ e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@@ -7016,7 +7018,7 @@ def test_wps_ext_cred_proto_missing_cred(dev, apdev):
def test_wps_ext_proto_m2_no_public_key(dev, apdev):
"""WPS and no Public Key in M2"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -7030,11 +7032,12 @@ def test_wps_ext_proto_m2_no_public_key(dev, apdev):
msg, m1_attrs, raw_m1_attrs = recv_wsc_msg(dev[0], WSC_MSG, WPS_M1)
eap_id = (msg['eap_identifier'] + 1) % 256
- authkey,keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
- mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
- r_nonce)
- r_s1,r_s2,r_hash1,r_hash2 = wsc_dev_pw_hash(authkey, pin,
- m1_attrs[ATTR_PUBLIC_KEY], e_pk)
+ authkey, keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
+ mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
+ r_nonce)
+ r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
+ m1_attrs[ATTR_PUBLIC_KEY],
+ e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@@ -7054,7 +7057,7 @@ def test_wps_ext_proto_m2_no_public_key(dev, apdev):
def test_wps_ext_proto_m2_invalid_public_key(dev, apdev):
"""WPS and invalid Public Key in M2"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -7068,11 +7071,12 @@ def test_wps_ext_proto_m2_invalid_public_key(dev, apdev):
msg, m1_attrs, raw_m1_attrs = recv_wsc_msg(dev[0], WSC_MSG, WPS_M1)
eap_id = (msg['eap_identifier'] + 1) % 256
- authkey,keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
- mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
- r_nonce)
- r_s1,r_s2,r_hash1,r_hash2 = wsc_dev_pw_hash(authkey, pin,
- m1_attrs[ATTR_PUBLIC_KEY], e_pk)
+ authkey, keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
+ mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
+ r_nonce)
+ r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
+ m1_attrs[ATTR_PUBLIC_KEY],
+ e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@@ -7092,7 +7096,7 @@ def test_wps_ext_proto_m2_invalid_public_key(dev, apdev):
def test_wps_ext_proto_m2_public_key_oom(dev, apdev):
"""WPS and Public Key OOM in M2"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -7106,11 +7110,12 @@ def test_wps_ext_proto_m2_public_key_oom(dev, apdev):
msg, m1_attrs, raw_m1_attrs = recv_wsc_msg(dev[0], WSC_MSG, WPS_M1)
eap_id = (msg['eap_identifier'] + 1) % 256
- authkey,keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
- mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
- r_nonce)
- r_s1,r_s2,r_hash1,r_hash2 = wsc_dev_pw_hash(authkey, pin,
- m1_attrs[ATTR_PUBLIC_KEY], e_pk)
+ authkey, keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
+ mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
+ r_nonce)
+ r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
+ m1_attrs[ATTR_PUBLIC_KEY],
+ e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@@ -7131,7 +7136,7 @@ def test_wps_ext_proto_m2_public_key_oom(dev, apdev):
def test_wps_ext_proto_nack_m3(dev, apdev):
"""WPS and NACK M3"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -7145,11 +7150,12 @@ def test_wps_ext_proto_nack_m3(dev, apdev):
msg, m1_attrs, raw_m1_attrs = recv_wsc_msg(dev[0], WSC_MSG, WPS_M1)
eap_id = (msg['eap_identifier'] + 1) % 256
- authkey,keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
- mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
- r_nonce)
- r_s1,r_s2,r_hash1,r_hash2 = wsc_dev_pw_hash(authkey, pin,
- m1_attrs[ATTR_PUBLIC_KEY], e_pk)
+ authkey, keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
+ mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
+ r_nonce)
+ r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
+ m1_attrs[ATTR_PUBLIC_KEY],
+ e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@@ -7174,7 +7180,7 @@ def test_wps_ext_proto_nack_m3(dev, apdev):
def test_wps_ext_proto_nack_m5(dev, apdev):
"""WPS and NACK M5"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -7188,11 +7194,12 @@ def test_wps_ext_proto_nack_m5(dev, apdev):
msg, m1_attrs, raw_m1_attrs = recv_wsc_msg(dev[0], WSC_MSG, WPS_M1)
eap_id = (msg['eap_identifier'] + 1) % 256
- authkey,keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
- mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
- r_nonce)
- r_s1,r_s2,r_hash1,r_hash2 = wsc_dev_pw_hash(authkey, pin,
- m1_attrs[ATTR_PUBLIC_KEY], e_pk)
+ authkey, keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
+ mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
+ r_nonce)
+ r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
+ m1_attrs[ATTR_PUBLIC_KEY],
+ e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@@ -7233,7 +7240,7 @@ def test_wps_ext_proto_nack_m5(dev, apdev):
def wps_nack_m3(dev, apdev):
pin = "00000000"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pbc=True)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -7247,11 +7254,12 @@ def wps_nack_m3(dev, apdev):
msg, m1_attrs, raw_m1_attrs = recv_wsc_msg(dev[0], WSC_MSG, WPS_M1)
eap_id = (msg['eap_identifier'] + 1) % 256
- authkey,keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
- mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
- r_nonce)
- r_s1,r_s2,r_hash1,r_hash2 = wsc_dev_pw_hash(authkey, pin,
- m1_attrs[ATTR_PUBLIC_KEY], e_pk)
+ authkey, keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
+ mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
+ r_nonce)
+ r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
+ m1_attrs[ATTR_PUBLIC_KEY],
+ e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@@ -7428,7 +7436,7 @@ def test_wps_ext_proto_ack_m3(dev, apdev):
def wps_to_m3_helper(dev, apdev):
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
wps_ext_eap_wsc(dev[0], hapd, bssid, "EAP-WSC/Start")
@@ -7442,11 +7450,12 @@ def wps_to_m3_helper(dev, apdev):
msg, m1_attrs, raw_m1_attrs = recv_wsc_msg(dev[0], WSC_MSG, WPS_M1)
eap_id = (msg['eap_identifier'] + 1) % 256
- authkey,keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
- mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
- r_nonce)
- r_s1,r_s2,r_hash1,r_hash2 = wsc_dev_pw_hash(authkey, pin,
- m1_attrs[ATTR_PUBLIC_KEY], e_pk)
+ authkey, keywrapkey = wsc_dh_kdf(m1_attrs[ATTR_PUBLIC_KEY], own_private,
+ mac_addr, m1_attrs[ATTR_ENROLLEE_NONCE],
+ r_nonce)
+ r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, pin,
+ m1_attrs[ATTR_PUBLIC_KEY],
+ e_pk)
logger.debug("Send M2 to STA")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, eap_id,
@@ -7754,10 +7763,10 @@ def wps_start_ext_reg(apdev, dev):
bssid = apdev['bssid']
ssid = "test-wps-conf"
appin = "12345670"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "ap_pin": appin }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "ap_pin": appin}
hapd = hostapd.add_ap(apdev, params)
dev.scan_for_bss(bssid, freq="2412")
@@ -7766,10 +7775,10 @@ def wps_start_ext_reg(apdev, dev):
dev.request("WPS_REG " + bssid + " " + appin)
- return addr,bssid,hapd
+ return addr, bssid, hapd
def wps_run_ap_settings_proto(dev, apdev, ap_settings, success):
- addr,bssid,hapd = wps_start_ext_reg(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext_reg(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -7783,9 +7792,9 @@ def wps_run_ap_settings_proto(dev, apdev, ap_settings, success):
uuid_r = 16*b'\x33'
r_nonce = 16*b'\x44'
own_private, r_pk = wsc_dh_init()
- authkey,keywrapkey = wsc_dh_kdf(e_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- r_s1,r_s2,r_hash1,r_hash2 = wsc_dev_pw_hash(authkey, appin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(e_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ r_s1, r_s2, r_hash1, r_hash2 = wsc_dev_pw_hash(authkey, appin, e_pk, r_pk)
logger.debug("Send M2 to AP")
m2, raw_m2_attrs = build_m2(authkey, raw_m1_attrs, msg['eap_identifier'],
@@ -7846,8 +7855,8 @@ def wps_run_ap_settings_proto(dev, apdev, ap_settings, success):
raise Exception("Unexpected message - expected WSC_Done")
logger.debug("Send WSC_ACK to AP")
- ack,attrs = build_ack(msg['eap_identifier'], e_nonce, r_nonce,
- eap_code=2)
+ ack, attrs = build_ack(msg['eap_identifier'], e_nonce, r_nonce,
+ eap_code=2)
send_wsc_msg(hapd, addr, ack)
dev[0].wait_disconnected()
else:
@@ -7860,8 +7869,8 @@ def wps_run_ap_settings_proto(dev, apdev, ap_settings, success):
raise Exception("Unexpected message - expected WSC_NACK")
logger.debug("Send WSC_NACK to AP")
- nack,attrs = build_nack(msg['eap_identifier'], e_nonce, r_nonce,
- eap_code=2)
+ nack, attrs = build_nack(msg['eap_identifier'], e_nonce, r_nonce,
+ eap_code=2)
send_wsc_msg(hapd, addr, nack)
dev[0].wait_disconnected()
@@ -7915,7 +7924,7 @@ def test_wps_ext_ap_settings_reject_encr_type(dev, apdev):
@remote_compatible
def test_wps_ext_ap_settings_m2d(dev, apdev):
"""WPS and AP Settings: M2D"""
- addr,bssid,hapd = wps_start_ext_reg(apdev[0], dev[0])
+ addr, bssid, hapd = wps_start_ext_reg(apdev[0], dev[0])
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -7945,8 +7954,8 @@ def wps_wait_ap_nack(hapd, dev, e_nonce, r_nonce):
raise Exception("Unexpected message - expected WSC_NACK")
logger.debug("Send WSC_NACK to AP")
- nack,attrs = build_nack(msg['eap_identifier'], e_nonce, r_nonce,
- eap_code=2)
+ nack, attrs = build_nack(msg['eap_identifier'], e_nonce, r_nonce,
+ eap_code=2)
send_wsc_msg(hapd, dev.own_addr(), nack)
dev.wait_disconnected()
@@ -7954,7 +7963,7 @@ def wps_wait_ap_nack(hapd, dev, e_nonce, r_nonce):
def test_wps_ext_m3_missing_e_hash1(dev, apdev):
"""WPS proto: M3 missing E-Hash1"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -7978,9 +7987,9 @@ def test_wps_ext_m3_missing_e_hash1(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3 to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -7999,7 +8008,7 @@ def test_wps_ext_m3_missing_e_hash1(dev, apdev):
def test_wps_ext_m3_missing_e_hash2(dev, apdev):
"""WPS proto: M3 missing E-Hash2"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8023,9 +8032,9 @@ def test_wps_ext_m3_missing_e_hash2(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3 to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -8044,7 +8053,7 @@ def test_wps_ext_m3_missing_e_hash2(dev, apdev):
def test_wps_ext_m5_missing_e_snonce1(dev, apdev):
"""WPS proto: M5 missing E-SNonce1"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8068,9 +8077,9 @@ def test_wps_ext_m5_missing_e_snonce1(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3 to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -8104,7 +8113,7 @@ def test_wps_ext_m5_missing_e_snonce1(dev, apdev):
def test_wps_ext_m5_e_snonce1_mismatch(dev, apdev):
"""WPS proto: M5 E-SNonce1 mismatch"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8128,9 +8137,9 @@ def test_wps_ext_m5_e_snonce1_mismatch(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3 to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -8162,7 +8171,7 @@ def test_wps_ext_m5_e_snonce1_mismatch(dev, apdev):
def test_wps_ext_m7_missing_e_snonce2(dev, apdev):
"""WPS proto: M7 missing E-SNonce2"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8186,9 +8195,9 @@ def test_wps_ext_m7_missing_e_snonce2(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3 to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -8236,7 +8245,7 @@ def test_wps_ext_m7_missing_e_snonce2(dev, apdev):
def test_wps_ext_m7_e_snonce2_mismatch(dev, apdev):
"""WPS proto: M7 E-SNonce2 mismatch"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8260,9 +8269,9 @@ def test_wps_ext_m7_e_snonce2_mismatch(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3 to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -8309,7 +8318,7 @@ def test_wps_ext_m7_e_snonce2_mismatch(dev, apdev):
def test_wps_ext_m1_pubkey_oom(dev, apdev):
"""WPS proto: M1 PubKey OOM"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8340,7 +8349,7 @@ def wps_wait_eap_failure(hapd, dev):
def test_wps_ext_m3_m1(dev, apdev):
"""WPS proto: M3 replaced with M1"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8364,9 +8373,9 @@ def test_wps_ext_m3_m1(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3(M1) to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -8385,7 +8394,7 @@ def test_wps_ext_m3_m1(dev, apdev):
def test_wps_ext_m5_m3(dev, apdev):
"""WPS proto: M5 replaced with M3"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8409,9 +8418,9 @@ def test_wps_ext_m5_m3(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3 to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -8444,7 +8453,7 @@ def test_wps_ext_m5_m3(dev, apdev):
def test_wps_ext_m3_m2(dev, apdev):
"""WPS proto: M3 replaced with M2"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8468,9 +8477,9 @@ def test_wps_ext_m3_m2(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3(M2) to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -8487,7 +8496,7 @@ def test_wps_ext_m3_m2(dev, apdev):
def test_wps_ext_m3_m5(dev, apdev):
"""WPS proto: M3 replaced with M5"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8511,9 +8520,9 @@ def test_wps_ext_m3_m5(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3(M5) to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -8532,7 +8541,7 @@ def test_wps_ext_m3_m5(dev, apdev):
def test_wps_ext_m3_m7(dev, apdev):
"""WPS proto: M3 replaced with M7"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8556,9 +8565,9 @@ def test_wps_ext_m3_m7(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3(M7) to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -8577,7 +8586,7 @@ def test_wps_ext_m3_m7(dev, apdev):
def test_wps_ext_m3_done(dev, apdev):
"""WPS proto: M3 replaced with WSC_Done"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8601,9 +8610,9 @@ def test_wps_ext_m3_done(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3(WSC_Done) to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -8619,7 +8628,7 @@ def test_wps_ext_m3_done(dev, apdev):
def test_wps_ext_m2_nack_invalid(dev, apdev):
"""WPS proto: M2 followed by invalid NACK"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8643,9 +8652,9 @@ def test_wps_ext_m2_nack_invalid(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send WSC_NACK to AP")
attrs = b'\x10\x00\x00'
@@ -8658,7 +8667,7 @@ def test_wps_ext_m2_nack_invalid(dev, apdev):
def test_wps_ext_m2_nack_no_msg_type(dev, apdev):
"""WPS proto: M2 followed by NACK without Msg Type"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8682,13 +8691,13 @@ def test_wps_ext_m2_nack_no_msg_type(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send WSC_NACK to AP")
- nack,attrs = build_nack(msg['eap_identifier'], e_nonce, r_nonce,
- msg_type=None, eap_code=2)
+ nack, attrs = build_nack(msg['eap_identifier'], e_nonce, r_nonce,
+ msg_type=None, eap_code=2)
send_wsc_msg(hapd, addr, nack)
wps_wait_eap_failure(hapd, dev[0])
@@ -8697,7 +8706,7 @@ def test_wps_ext_m2_nack_no_msg_type(dev, apdev):
def test_wps_ext_m2_nack_invalid_msg_type(dev, apdev):
"""WPS proto: M2 followed by NACK with invalid Msg Type"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8721,13 +8730,13 @@ def test_wps_ext_m2_nack_invalid_msg_type(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send WSC_NACK to AP")
- nack,attrs = build_nack(msg['eap_identifier'], e_nonce, r_nonce,
- msg_type=WPS_WSC_ACK, eap_code=2)
+ nack, attrs = build_nack(msg['eap_identifier'], e_nonce, r_nonce,
+ msg_type=WPS_WSC_ACK, eap_code=2)
send_wsc_msg(hapd, addr, nack)
wps_wait_eap_failure(hapd, dev[0])
@@ -8736,7 +8745,7 @@ def test_wps_ext_m2_nack_invalid_msg_type(dev, apdev):
def test_wps_ext_m2_nack_e_nonce_mismatch(dev, apdev):
"""WPS proto: M2 followed by NACK with e-nonce mismatch"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8760,13 +8769,13 @@ def test_wps_ext_m2_nack_e_nonce_mismatch(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send WSC_NACK to AP")
- nack,attrs = build_nack(msg['eap_identifier'], 16*b'\x00', r_nonce,
- eap_code=2)
+ nack, attrs = build_nack(msg['eap_identifier'], 16*b'\x00', r_nonce,
+ eap_code=2)
send_wsc_msg(hapd, addr, nack)
wps_wait_eap_failure(hapd, dev[0])
@@ -8775,7 +8784,7 @@ def test_wps_ext_m2_nack_e_nonce_mismatch(dev, apdev):
def test_wps_ext_m2_nack_no_config_error(dev, apdev):
"""WPS proto: M2 followed by NACK without Config Error"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8799,13 +8808,13 @@ def test_wps_ext_m2_nack_no_config_error(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send WSC_NACK to AP")
- nack,attrs = build_nack(msg['eap_identifier'], e_nonce, r_nonce,
- config_error=None, eap_code=2)
+ nack, attrs = build_nack(msg['eap_identifier'], e_nonce, r_nonce,
+ config_error=None, eap_code=2)
send_wsc_msg(hapd, addr, nack)
wps_wait_eap_failure(hapd, dev[0])
@@ -8814,7 +8823,7 @@ def test_wps_ext_m2_nack_no_config_error(dev, apdev):
def test_wps_ext_m2_ack_invalid(dev, apdev):
"""WPS proto: M2 followed by invalid ACK"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8838,9 +8847,9 @@ def test_wps_ext_m2_ack_invalid(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send WSC_ACK to AP")
attrs = b'\x10\x00\x00'
@@ -8853,7 +8862,7 @@ def test_wps_ext_m2_ack_invalid(dev, apdev):
def test_wps_ext_m2_ack(dev, apdev):
"""WPS proto: M2 followed by ACK"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8877,12 +8886,12 @@ def test_wps_ext_m2_ack(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send WSC_ACK to AP")
- ack,attrs = build_ack(msg['eap_identifier'], e_nonce, r_nonce, eap_code=2)
+ ack, attrs = build_ack(msg['eap_identifier'], e_nonce, r_nonce, eap_code=2)
send_wsc_msg(hapd, addr, ack)
wps_wait_eap_failure(hapd, dev[0])
@@ -8891,7 +8900,7 @@ def test_wps_ext_m2_ack(dev, apdev):
def test_wps_ext_m2_ack_no_msg_type(dev, apdev):
"""WPS proto: M2 followed by ACK missing Msg Type"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8915,13 +8924,13 @@ def test_wps_ext_m2_ack_no_msg_type(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send WSC_ACK to AP")
- ack,attrs = build_ack(msg['eap_identifier'], e_nonce, r_nonce,
- msg_type=None, eap_code=2)
+ ack, attrs = build_ack(msg['eap_identifier'], e_nonce, r_nonce,
+ msg_type=None, eap_code=2)
send_wsc_msg(hapd, addr, ack)
wps_wait_eap_failure(hapd, dev[0])
@@ -8930,7 +8939,7 @@ def test_wps_ext_m2_ack_no_msg_type(dev, apdev):
def test_wps_ext_m2_ack_invalid_msg_type(dev, apdev):
"""WPS proto: M2 followed by ACK with invalid Msg Type"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8954,12 +8963,12 @@ def test_wps_ext_m2_ack_invalid_msg_type(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send WSC_ACK to AP")
- ack,attrs = build_ack(msg['eap_identifier'], e_nonce, r_nonce,
+ ack, attrs = build_ack(msg['eap_identifier'], e_nonce, r_nonce,
msg_type=WPS_WSC_NACK, eap_code=2)
send_wsc_msg(hapd, addr, ack)
@@ -8969,7 +8978,7 @@ def test_wps_ext_m2_ack_invalid_msg_type(dev, apdev):
def test_wps_ext_m2_ack_e_nonce_mismatch(dev, apdev):
"""WPS proto: M2 followed by ACK with e-nonce mismatch"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -8993,13 +9002,13 @@ def test_wps_ext_m2_ack_e_nonce_mismatch(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send WSC_ACK to AP")
- ack,attrs = build_ack(msg['eap_identifier'], 16*b'\x00', r_nonce,
- eap_code=2)
+ ack, attrs = build_ack(msg['eap_identifier'], 16*b'\x00', r_nonce,
+ eap_code=2)
send_wsc_msg(hapd, addr, ack)
wps_wait_eap_failure(hapd, dev[0])
@@ -9008,7 +9017,7 @@ def test_wps_ext_m2_ack_e_nonce_mismatch(dev, apdev):
def test_wps_ext_m1_invalid(dev, apdev):
"""WPS proto: M1 failing parsing"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -9027,7 +9036,7 @@ def test_wps_ext_m1_invalid(dev, apdev):
def test_wps_ext_m1_missing_msg_type(dev, apdev):
"""WPS proto: M1 missing Msg Type"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -9045,7 +9054,7 @@ def test_wps_ext_m1_missing_msg_type(dev, apdev):
def wps_ext_wsc_done(dev, apdev):
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -9069,9 +9078,9 @@ def wps_ext_wsc_done(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3 to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -9191,7 +9200,7 @@ def test_wps_ext_wsc_done_no_r_nonce(dev, apdev):
def test_wps_ext_m7_no_encr_settings(dev, apdev):
"""WPS proto: M7 without Encr Settings"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -9215,9 +9224,9 @@ def test_wps_ext_m7_no_encr_settings(dev, apdev):
r_nonce = m2_attrs[ATTR_REGISTRAR_NONCE]
r_pk = m2_attrs[ATTR_PUBLIC_KEY]
- authkey,keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
- r_nonce)
- e_s1,e_s2,e_hash1,e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
+ authkey, keywrapkey = wsc_dh_kdf(r_pk, own_private, mac_addr, e_nonce,
+ r_nonce)
+ e_s1, e_s2, e_hash1, e_hash2 = wsc_dev_pw_hash(authkey, pin, e_pk, r_pk)
logger.debug("Send M3 to AP")
attrs = build_wsc_attr(ATTR_VERSION, '\x10')
@@ -9264,7 +9273,7 @@ def test_wps_ext_m7_no_encr_settings(dev, apdev):
def test_wps_ext_m1_workaround(dev, apdev):
"""WPS proto: M1 Manufacturer/Model workaround"""
pin = "12345670"
- addr,bssid,hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
+ addr, bssid, hapd = wps_start_ext(apdev[0], dev[0], pin=pin)
wps_ext_eap_identity_req(dev[0], hapd, bssid)
wps_ext_eap_identity_resp(hapd, dev[0], addr)
@@ -9403,9 +9412,9 @@ def test_ap_wps_upnp_web_oom(dev, apdev, params):
with alloc_fail(hapd, 1, "web_connection_parse_subscribe"):
conn = HTTPConnection(url.netloc)
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
try:
resp = conn.getresponse()
@@ -9414,9 +9423,9 @@ def test_ap_wps_upnp_web_oom(dev, apdev, params):
with alloc_fail(hapd, 1, "dup_binstr;web_connection_parse_subscribe"):
conn = HTTPConnection(url.netloc)
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("SUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
resp = conn.getresponse()
if resp.status != 500:
@@ -9424,9 +9433,9 @@ def test_ap_wps_upnp_web_oom(dev, apdev, params):
with alloc_fail(hapd, 1, "wpabuf_alloc;web_connection_parse_unsubscribe"):
conn = HTTPConnection(url.netloc)
- headers = { "callback": '<http://127.0.0.1:12345/event>',
- "NT": "upnp:event",
- "timeout": "Second-1234" }
+ headers = {"callback": '<http://127.0.0.1:12345/event>',
+ "NT": "upnp:event",
+ "timeout": "Second-1234"}
conn.request("UNSUBSCRIBE", eventurl.path, "\r\n\r\n", headers)
try:
resp = conn.getresponse()
@@ -9462,10 +9471,10 @@ def test_ap_wps_eap_wsc_errors(dev, apdev):
"""WPS and EAP-WSC error cases"""
ssid = "test-wps-conf-pin"
appin = "12345670"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "fragment_size": "300", "ap_pin": appin }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "fragment_size": "300", "ap_pin": appin}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@@ -9514,9 +9523,9 @@ def test_ap_wps_eap_wsc_errors(dev, apdev):
wait_scan_stopped(dev[0])
dev[0].dump_monitor()
- tests = [ "eap_wsc_init",
- "eap_msg_alloc;eap_wsc_build_msg",
- "wpabuf_alloc;eap_wsc_process_fragment" ]
+ tests = ["eap_wsc_init",
+ "eap_msg_alloc;eap_wsc_build_msg",
+ "wpabuf_alloc;eap_wsc_process_fragment"]
for func in tests:
with alloc_fail(dev[0], 1, func):
dev[0].request("WPS_PIN %s %s" % (bssid, pin))
@@ -9656,14 +9665,14 @@ def test_ap_wps_and_bss_limit(dev, apdev):
pass
def _test_ap_wps_and_bss_limit(dev, apdev):
- params = { "ssid": "test-wps", "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP" }
+ params = {"ssid": "test-wps", "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"}
hapd = hostapd.add_ap(apdev[0], params)
- params = { "ssid": "test-wps-2", "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "1234567890", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP" }
+ params = {"ssid": "test-wps-2", "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "1234567890", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"}
hapd2 = hostapd.add_ap(apdev[1], params)
id = dev[1].add_network()
@@ -9722,15 +9731,15 @@ def _test_ap_wps_and_bss_limit(dev, apdev):
def test_ap_wps_pbc_2ap(dev, apdev):
"""WPS PBC with two APs advertising same SSID"""
- params = { "ssid": "wps", "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "wps_independent": "1"}
+ params = {"ssid": "wps", "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "wps_independent": "1"}
hapd = hostapd.add_ap(apdev[0], params)
- params = { "ssid": "wps", "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "123456789", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "wps_independent": "1"}
+ params = {"ssid": "wps", "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "123456789", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "wps_independent": "1"}
hapd2 = hostapd.add_ap(apdev[1], params)
hapd.request("WPS_PBC")
@@ -9759,15 +9768,15 @@ def _test_ap_wps_er_enrollee_to_conf_ap(dev, apdev):
ssid = "wps-er-enrollee-to-conf-ap"
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"}
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@@ -9816,15 +9825,15 @@ def _test_ap_wps_er_enrollee_to_conf_ap2(dev, apdev):
ssid = "wps-er-enrollee-to-conf-ap"
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "device_name": "Wireless AP", "manufacturer": "Company",
- "model_name": "WAP", "model_number": "123",
- "serial_number": "12345", "device_type": "6-0050F204-1",
- "os_version": "01020300",
- "config_methods": "label push_button",
- "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"}
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "device_name": "Wireless AP", "manufacturer": "Company",
+ "model_name": "WAP", "model_number": "123",
+ "serial_number": "12345", "device_type": "6-0050F204-1",
+ "os_version": "01020300",
+ "config_methods": "label push_button",
+ "ap_pin": ap_pin, "uuid": ap_uuid, "upnp_iface": "lo"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@@ -9868,8 +9877,8 @@ def test_ap_wps_ignore_broadcast_ssid(dev, apdev):
"""WPS AP trying to ignore broadcast SSID"""
ssid = "test-wps"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "1",
- "ignore_broadcast_ssid": "1" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "1",
+ "ignore_broadcast_ssid": "1"})
if "FAIL" not in hapd.request("WPS_PBC"):
raise Exception("WPS unexpectedly enabled")
@@ -9877,8 +9886,8 @@ def test_ap_wps_wep(dev, apdev):
"""WPS AP trying to enable WEP"""
ssid = "test-wps"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "1",
- "ieee80211n": "0", "wep_key0": '"hello"' })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "1",
+ "ieee80211n": "0", "wep_key0": '"hello"'})
if "FAIL" not in hapd.request("WPS_PBC"):
raise Exception("WPS unexpectedly enabled")
@@ -9886,10 +9895,10 @@ def test_ap_wps_tkip(dev, apdev):
"""WPS AP trying to enable TKIP"""
ssid = "test-wps"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "1",
- "ieee80211n": "0", "wpa": '1',
- "wpa_key_mgmt": "WPA-PSK",
- "wpa_passphrase": "12345678" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "1",
+ "ieee80211n": "0", "wpa": '1',
+ "wpa_key_mgmt": "WPA-PSK",
+ "wpa_passphrase": "12345678"})
if "FAIL" not in hapd.request("WPS_PBC"):
raise Exception("WPS unexpectedly enabled")
@@ -9897,9 +9906,9 @@ def test_ap_wps_conf_dummy_cred(dev, apdev):
"""WPS PIN provisioning with configured AP using dummy cred"""
ssid = "test-wps-conf"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
hapd.request("WPS_PIN any 12345670")
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
dev[0].dump_monitor()
@@ -9917,10 +9926,10 @@ def test_ap_wps_conf_dummy_cred(dev, apdev):
def test_ap_wps_rf_bands(dev, apdev):
"""WPS and wps_rf_bands configuration"""
ssid = "test-wps-conf"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "wps_rf_bands": "ag" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "wps_rf_bands": "ag"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@@ -9947,11 +9956,11 @@ def test_ap_wps_rf_bands(dev, apdev):
def test_ap_wps_pbc_in_m1(dev, apdev):
"""WPS and pbc_in_m1"""
ssid = "test-wps-conf"
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "config_methods": "virtual_push_button virtual_display",
- "pbc_in_m1": "1" }
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "config_methods": "virtual_push_button virtual_display",
+ "pbc_in_m1": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@@ -10001,9 +10010,9 @@ def test_ap_wps_random_uuid(dev, apdev, params):
"""WPS and random UUID on Enrollee"""
ssid = "test-wps-conf"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
config = os.path.join(params['logdir'], 'ap_wps_random_uuid.conf')
with open(config, "w") as f:
@@ -10051,10 +10060,10 @@ def run_ap_wps_conf_pin_cipher(dev, apdev, cipher):
raise HwsimSkip("Cipher %s not supported" % cipher)
ssid = "test-wps-conf-pin"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK",
- "rsn_pairwise": cipher })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK",
+ "rsn_pairwise": cipher})
logger.info("WPS provisioning step")
pin = dev[0].wps_read_pin()
hapd.request("WPS_PIN any " + pin)
@@ -10072,8 +10081,8 @@ def test_ap_wps_and_sae(dev, apdev):
def run_ap_wps_and_sae(dev, apdev):
ssid = "test-wps-sae"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "1",
- "wps_cred_add_sae": "1" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "1",
+ "wps_cred_add_sae": "1"})
logger.info("WPS provisioning step")
pin = dev[0].wps_read_pin()
hapd.request("WPS_PIN any " + pin)
@@ -10109,11 +10118,11 @@ def test_ap_wps_conf_and_sae(dev, apdev):
def run_ap_wps_conf_and_sae(dev, apdev):
ssid = "test-wps-conf-sae"
hapd = hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "ieee80211w": "1", "sae_require_mfp": "1",
- "wpa_key_mgmt": "WPA-PSK SAE",
- "rsn_pairwise": "CCMP" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "ieee80211w": "1", "sae_require_mfp": "1",
+ "wpa_key_mgmt": "WPA-PSK SAE",
+ "rsn_pairwise": "CCMP"})
dev[0].set("wps_cred_add_sae", "1")
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
@@ -10141,8 +10150,8 @@ def run_ap_wps_reg_config_and_sae(dev, apdev):
ssid = "test-wps-init-ap-pin-sae"
appin = "12345670"
hostapd.add_ap(apdev[0],
- { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "ap_pin": appin, "wps_cred_add_sae": "1" })
+ {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "ap_pin": appin, "wps_cred_add_sae": "1"})
logger.info("WPS configuration step")
dev[0].set("wps_cred_add_sae", "1")
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
diff --git a/tests/hwsim/test_authsrv.py b/tests/hwsim/test_authsrv.py
index ef11728..bdd47bf 100644
--- a/tests/hwsim/test_authsrv.py
+++ b/tests/hwsim/test_authsrv.py
@@ -8,16 +8,16 @@ import hostapd
from utils import alloc_fail, fail_test, wait_fail_trigger
def authsrv_params():
- params = { "ssid": "as", "beacon_int": "2000",
- "radius_server_clients": "auth_serv/radius_clients.conf",
- "radius_server_auth_port": '18128',
- "eap_server": "1",
- "eap_user_file": "auth_serv/eap_user.conf",
- "eap_sim_db": "unix:/tmp/hlr_auc_gw.sock",
- "ca_cert": "auth_serv/ca.pem",
- "server_cert": "auth_serv/server.pem",
- "private_key": "auth_serv/server.key",
- "eap_message": "hello" }
+ params = {"ssid": "as", "beacon_int": "2000",
+ "radius_server_clients": "auth_serv/radius_clients.conf",
+ "radius_server_auth_port": '18128',
+ "eap_server": "1",
+ "eap_user_file": "auth_serv/eap_user.conf",
+ "eap_sim_db": "unix:/tmp/hlr_auc_gw.sock",
+ "ca_cert": "auth_serv/ca.pem",
+ "server_cert": "auth_serv/server.pem",
+ "private_key": "auth_serv/server.key",
+ "eap_message": "hello"}
return params
def test_authsrv_oom(dev, apdev):
@@ -84,8 +84,8 @@ def test_authsrv_oom(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
- tests = [ "radius_server_encapsulate_eap",
- "radius_server_receive_auth" ]
+ tests = ["radius_server_encapsulate_eap",
+ "radius_server_receive_auth"]
for t in tests:
with alloc_fail(authsrv, 1, t):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
@@ -98,9 +98,9 @@ def test_authsrv_oom(dev, apdev):
dev[0].wait_disconnected()
dev[0].dump_monitor()
- tests = [ "radius_msg_add_attr;radius_server_encapsulate_eap",
- "radius_msg_add_eap;radius_server_encapsulate_eap",
- "radius_msg_finish_srv;radius_server_encapsulate_eap" ]
+ tests = ["radius_msg_add_attr;radius_server_encapsulate_eap",
+ "radius_msg_add_eap;radius_server_encapsulate_eap",
+ "radius_msg_finish_srv;radius_server_encapsulate_eap"]
for t in tests:
with fail_test(authsrv, 1, t):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
@@ -204,16 +204,16 @@ def test_authsrv_testing_options(dev, apdev):
# The first two would be fine to run with any server build; the rest are
# actually supposed to fail, but they don't fail when using a server build
# that does not support the TLS protocol tests.
- tests = [ "foo@test-unknown",
- "foo@test-tls-unknown",
- "foo@test-tls-1",
- "foo@test-tls-2",
- "foo@test-tls-3",
- "foo@test-tls-4",
- "foo@test-tls-5",
- "foo@test-tls-6",
- "foo@test-tls-7",
- "foo@test-tls-8" ]
+ tests = ["foo@test-unknown",
+ "foo@test-tls-unknown",
+ "foo@test-tls-1",
+ "foo@test-tls-2",
+ "foo@test-tls-3",
+ "foo@test-tls-4",
+ "foo@test-tls-5",
+ "foo@test-tls-6",
+ "foo@test-tls-7",
+ "foo@test-tls-8"]
for t in tests:
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
eap="TTLS", identity="user",
diff --git a/tests/hwsim/test_autoscan.py b/tests/hwsim/test_autoscan.py
index 25db662..544cd00 100644
--- a/tests/hwsim/test_autoscan.py
+++ b/tests/hwsim/test_autoscan.py
@@ -14,7 +14,7 @@ import hostapd
def test_autoscan_periodic(dev, apdev):
"""autoscan_periodic"""
- hostapd.add_ap(apdev[0], { "ssid": "autoscan" })
+ hostapd.add_ap(apdev[0], {"ssid": "autoscan"})
try:
if "OK" not in dev[0].request("AUTOSCAN periodic:1"):
@@ -55,7 +55,7 @@ def test_autoscan_periodic(dev, apdev):
@remote_compatible
def test_autoscan_exponential(dev, apdev):
"""autoscan_exponential"""
- hostapd.add_ap(apdev[0], { "ssid": "autoscan" })
+ hostapd.add_ap(apdev[0], {"ssid": "autoscan"})
try:
if "OK" not in dev[0].request("AUTOSCAN exponential:2:10"):
diff --git a/tests/hwsim/test_bgscan.py b/tests/hwsim/test_bgscan.py
index 06eb126..f418f56 100644
--- a/tests/hwsim/test_bgscan.py
+++ b/tests/hwsim/test_bgscan.py
@@ -14,8 +14,8 @@ from utils import alloc_fail, fail_test
def test_bgscan_simple(dev, apdev):
"""bgscan_simple"""
- hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
- hostapd.add_ap(apdev[1], { "ssid": "bgscan" })
+ hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
+ hostapd.add_ap(apdev[1], {"ssid": "bgscan"})
dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
bgscan="simple:1:-20:2")
@@ -71,7 +71,7 @@ def test_bgscan_simple(dev, apdev):
def test_bgscan_simple_beacon_loss(dev, apdev):
"""bgscan_simple and beacon loss"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
bgscan="simple:1:-20:2")
@@ -84,7 +84,7 @@ def test_bgscan_simple_beacon_loss(dev, apdev):
def test_bgscan_simple_scan_failure(dev, apdev):
"""bgscan_simple and scan failure"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
bgscan="simple:1:-20:2")
@@ -99,7 +99,7 @@ def test_bgscan_simple_scan_failure(dev, apdev):
def test_bgscan_simple_scanning(dev, apdev):
"""bgscan_simple and scanning behavior"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
bgscan="simple:1:-20:2")
@@ -113,7 +113,7 @@ def test_bgscan_simple_scanning(dev, apdev):
def test_bgscan_simple_same_scan_int(dev, apdev):
"""bgscan_simple and same short/long scan interval"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
bgscan="simple:1:-20:1")
@@ -124,7 +124,7 @@ def test_bgscan_simple_same_scan_int(dev, apdev):
def test_bgscan_simple_oom(dev, apdev):
"""bgscan_simple OOM"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
with alloc_fail(dev[0], 1, "bgscan_simple_init"):
dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
@@ -132,7 +132,7 @@ def test_bgscan_simple_oom(dev, apdev):
def test_bgscan_simple_driver_conf_failure(dev, apdev):
"""bgscan_simple driver configuration failure"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
with fail_test(dev[0], 1, "bgscan_simple_init"):
dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
@@ -140,8 +140,8 @@ def test_bgscan_simple_driver_conf_failure(dev, apdev):
def test_bgscan_learn(dev, apdev):
"""bgscan_learn"""
- hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
- hostapd.add_ap(apdev[1], { "ssid": "bgscan" })
+ hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
+ hostapd.add_ap(apdev[1], {"ssid": "bgscan"})
try:
os.remove("/tmp/test_bgscan_learn.bgscan")
@@ -238,7 +238,7 @@ def test_bgscan_learn(dev, apdev):
def test_bgscan_learn_beacon_loss(dev, apdev):
"""bgscan_simple and beacon loss"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
bgscan="learn:1:-20:2")
@@ -251,7 +251,7 @@ def test_bgscan_learn_beacon_loss(dev, apdev):
def test_bgscan_learn_scan_failure(dev, apdev):
"""bgscan_learn and scan failure"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
bgscan="learn:1:-20:2")
@@ -266,7 +266,7 @@ def test_bgscan_learn_scan_failure(dev, apdev):
def test_bgscan_learn_oom(dev, apdev):
"""bgscan_learn OOM"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
with alloc_fail(dev[0], 1, "bgscan_learn_init"):
dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
@@ -274,7 +274,7 @@ def test_bgscan_learn_oom(dev, apdev):
def test_bgscan_learn_driver_conf_failure(dev, apdev):
"""bgscan_learn driver configuration failure"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
with fail_test(dev[0], 1, "bgscan_learn_init"):
dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
@@ -282,6 +282,6 @@ def test_bgscan_learn_driver_conf_failure(dev, apdev):
def test_bgscan_unknown_module(dev, apdev):
"""bgscan init failing due to unknown module"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "bgscan" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
bgscan="unknown:-20:2")
diff --git a/tests/hwsim/test_cfg80211.py b/tests/hwsim/test_cfg80211.py
index 0890984..a461fe0 100644
--- a/tests/hwsim/test_cfg80211.py
+++ b/tests/hwsim/test_cfg80211.py
@@ -27,9 +27,9 @@ def nl80211_command(dev, cmd, attr):
@remote_compatible
def test_cfg80211_disassociate(dev, apdev):
"""cfg80211 disassociation command"""
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
- ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5)
+ ev = hapd.wait_event(["AP-STA-CONNECTED"], timeout=5)
if ev is None:
raise Exception("No connection event received from hostapd")
@@ -39,7 +39,7 @@ def test_cfg80211_disassociate(dev, apdev):
attrs += build_nl80211_attr_mac('MAC', apdev[0]['bssid'])
nl80211_command(dev[0], 'DISASSOCIATE', attrs)
- ev = hapd.wait_event([ "AP-STA-DISCONNECTED" ], timeout=5)
+ ev = hapd.wait_event(["AP-STA-DISCONNECTED"], timeout=5)
if ev is None:
raise Exception("No disconnection event received from hostapd")
@@ -102,10 +102,10 @@ def test_cfg80211_tx_frame(dev, apdev, params):
def test_cfg80211_wep_key_idx_change(dev, apdev):
"""WEP Shared Key authentication and key index change without deauth"""
hapd = hostapd.add_ap(apdev[0],
- { "ssid": "wep-shared-key",
- "wep_key0": '"hello12345678"',
- "wep_key1": '"other12345678"',
- "auth_algs": "2" })
+ {"ssid": "wep-shared-key",
+ "wep_key0": '"hello12345678"',
+ "wep_key1": '"other12345678"',
+ "auth_algs": "2"})
id = dev[0].connect("wep-shared-key", key_mgmt="NONE", auth_alg="SHARED",
wep_key0='"hello12345678"',
wep_key1='"other12345678"',
@@ -131,8 +131,7 @@ def test_cfg80211_wep_key_idx_change(dev, apdev):
@remote_compatible
def test_cfg80211_hostapd_ext_sta_remove(dev, apdev):
"""cfg80211 DEL_STATION issued externally to hostapd"""
- hapd = hostapd.add_ap(apdev[0],
- { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
id = dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
ifindex = int(hapd.get_driver_status_field("ifindex"))
diff --git a/tests/hwsim/test_connect_cmd.py b/tests/hwsim/test_connect_cmd.py
index 630ea22..87122aa 100644
--- a/tests/hwsim/test_connect_cmd.py
+++ b/tests/hwsim/test_connect_cmd.py
@@ -15,9 +15,9 @@ from p2p_utils import *
def test_connect_cmd_open(dev, apdev):
"""Open connection using cfg80211 connect command"""
- params = { "ssid": "sta-connect",
- "manage_p2p": "1",
- "allow_cross_connection": "1" }
+ params = {"ssid": "sta-connect",
+ "manage_p2p": "1",
+ "allow_cross_connection": "1"}
hostapd.add_ap(apdev[0], params)
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@@ -31,7 +31,7 @@ def test_connect_cmd_open(dev, apdev):
def test_connect_cmd_wep(dev, apdev):
"""WEP Open System using cfg80211 connect command"""
- params = { "ssid": "sta-connect-wep", "wep_key0": '"hello"' }
+ params = {"ssid": "sta-connect-wep", "wep_key0": '"hello"'}
hapd = hostapd.add_ap(apdev[0], params)
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@@ -46,8 +46,8 @@ def test_connect_cmd_wep(dev, apdev):
def test_connect_cmd_wep_shared(dev, apdev):
"""WEP Shared key using cfg80211 connect command"""
- params = { "ssid": "sta-connect-wep", "wep_key0": '"hello"',
- "auth_algs": "2" }
+ params = {"ssid": "sta-connect-wep", "wep_key0": '"hello"',
+ "auth_algs": "2"}
hapd = hostapd.add_ap(apdev[0], params)
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@@ -68,9 +68,9 @@ def test_connect_cmd_wep_shared(dev, apdev):
def test_connect_cmd_p2p_management(dev, apdev):
"""Open connection using cfg80211 connect command and AP using P2P management"""
- params = { "ssid": "sta-connect",
- "manage_p2p": "1",
- "allow_cross_connection": "0" }
+ params = {"ssid": "sta-connect",
+ "manage_p2p": "1",
+ "allow_cross_connection": "0"}
hostapd.add_ap(apdev[0], params)
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@@ -97,7 +97,7 @@ def test_connect_cmd_wpa2_psk(dev, apdev):
def test_connect_cmd_concurrent_grpform_while_connecting(dev, apdev):
"""Concurrent P2P group formation while connecting to an AP using cfg80211 connect command"""
logger.info("Start connection to an infrastructure AP")
- hapd = hostapd.add_ap(apdev[0], { "ssid": "test-open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "test-open"})
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
@@ -122,8 +122,8 @@ def test_connect_cmd_concurrent_grpform_while_connecting(dev, apdev):
def test_connect_cmd_reject_assoc(dev, apdev):
"""Connection using cfg80211 connect command getting rejected"""
- params = { "ssid": "sta-connect",
- "require_ht": "1" }
+ params = {"ssid": "sta-connect",
+ "require_ht": "1"}
hostapd.add_ap(apdev[0], params)
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@@ -141,7 +141,7 @@ def test_connect_cmd_reject_assoc(dev, apdev):
def test_connect_cmd_disconnect_event(dev, apdev):
"""Connection using cfg80211 connect command getting disconnected by the AP"""
- params = { "ssid": "sta-connect" }
+ params = {"ssid": "sta-connect"}
hapd = hostapd.add_ap(apdev[0], params)
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@@ -170,7 +170,7 @@ def test_connect_cmd_disconnect_event(dev, apdev):
def test_connect_cmd_roam(dev, apdev):
"""cfg80211 connect command to trigger roam"""
- params = { "ssid": "sta-connect" }
+ params = {"ssid": "sta-connect"}
hostapd.add_ap(apdev[0], params)
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@@ -188,7 +188,7 @@ def test_connect_cmd_roam(dev, apdev):
def test_connect_cmd_bssid_hint(dev, apdev):
"""cfg80211 connect command with bssid_hint"""
- params = { "ssid": "sta-connect" }
+ params = {"ssid": "sta-connect"}
hostapd.add_ap(apdev[0], params)
hostapd.add_ap(apdev[1], params)
diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py
index 16fcf3c..55d74bb 100644
--- a/tests/hwsim/test_dbus.py
+++ b/tests/hwsim/test_dbus.py
@@ -55,7 +55,7 @@ def prepare_dbus(dev):
wpas = dbus.Interface(wpas_obj, WPAS_DBUS_SERVICE)
path = wpas.GetInterface(dev.ifname)
if_obj = bus.get_object(WPAS_DBUS_SERVICE, path)
- return (bus,wpas_obj,path,if_obj)
+ return (bus, wpas_obj, path, if_obj)
except Exception as e:
raise HwsimSkip("Could not connect to D-Bus: %s" % e)
@@ -103,15 +103,15 @@ class alloc_fail_dbus(object):
def start_ap(ap, ssid="test-wps",
ap_uuid="27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"):
- params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
- "wpa_passphrase": "12345678", "wpa": "2",
- "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
- "ap_pin": "12345670", "uuid": ap_uuid}
+ params = {"ssid": ssid, "eap_server": "1", "wps_state": "2",
+ "wpa_passphrase": "12345678", "wpa": "2",
+ "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+ "ap_pin": "12345670", "uuid": ap_uuid}
return hostapd.add_ap(ap, params)
def test_dbus_getall(dev, apdev):
"""D-Bus GetAll"""
- (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0])
+ (bus, wpas_obj, path, if_obj) = prepare_dbus(dev[0])
props = wpas_obj.GetAll(WPAS_DBUS_SERVICE,
dbus_interface=dbus.PROPERTIES_IFACE)
@@ -135,7 +135,7 @@ def test_dbus_getall(dev, apdev):
if len(res) != 0:
raise Exception("Unexpected Networks entry: " + str(res))
- hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+ hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
bssid = apdev[0]['bssid']
dev[0].scan_for_bss(bssid, freq=2412)
id = dev[0].add_network()
@@ -171,7 +171,7 @@ def test_dbus_getall(dev, apdev):
def test_dbus_getall_oom(dev, apdev):
"""D-Bus GetAll wpa_config_get_all() OOM"""
- (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0])
+ (bus, wpas_obj, path, if_obj) = prepare_dbus(dev[0])
id = dev[0].add_network()
dev[0].set_network(id, "disabled", "0")
@@ -205,13 +205,13 @@ def dbus_set(dbus, wpas_obj, prop, val):
def test_dbus_properties(dev, apdev):
"""D-Bus Get/Set fi.w1.wpa_supplicant1 properties"""
- (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0])
+ (bus, wpas_obj, path, if_obj) = prepare_dbus(dev[0])
dbus_get(dbus, wpas_obj, "DebugLevel", expect="msgdump")
dbus_set(dbus, wpas_obj, "DebugLevel", "debug")
dbus_get(dbus, wpas_obj, "DebugLevel", expect="debug")
- for (val,err) in [ (3, "Error.Failed: wrong property type"),
- ("foo", "Error.Failed: wrong debug level value") ]:
+ for (val, err) in [(3, "Error.Failed: wrong property type"),
+ ("foo", "Error.Failed: wrong debug level value")]:
try:
dbus_set(dbus, wpas_obj, "DebugLevel", val)
raise Exception("Invalid DebugLevel value accepted: " + str(val))
@@ -328,10 +328,10 @@ def test_dbus_properties(dev, apdev):
def test_dbus_set_global_properties(dev, apdev):
"""D-Bus Get/Set fi.w1.wpa_supplicant1 interface global properties"""
- (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0])
+ (bus, wpas_obj, path, if_obj) = prepare_dbus(dev[0])
dev[0].set("model_name", "")
- props = [ ('Okc', '0', '1'), ('ModelName', '', 'blahblahblah') ]
+ props = [('Okc', '0', '1'), ('ModelName', '', 'blahblahblah')]
for p in props:
res = if_obj.Get(WPAS_DBUS_IFACE, p[0],
@@ -350,7 +350,7 @@ def test_dbus_set_global_properties(dev, apdev):
def test_dbus_invalid_method(dev, apdev):
"""D-Bus invalid method"""
- (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0])
+ (bus, wpas_obj, path, if_obj) = prepare_dbus(dev[0])
wps = dbus.Interface(if_obj, WPAS_DBUS_IFACE_WPS)
try:
@@ -384,7 +384,7 @@ def test_dbus_get_set_wps(dev, apdev):
dev[0].set("device_type", "0-00000000-0")
def _test_dbus_get_set_wps(dev, apdev):
- (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0])
+ (bus, wpas_obj, path, if_obj) = prepare_dbus(dev[0])
if_obj.Get(WPAS_DBUS_IFACE_WPS, "ConfigMethods",
dbus_interface=dbus.PROPERTIES_IFACE)
@@ -415,13 +415,13 @@ def _test_dbus_get_set_wps(dev, apdev):
if val != expected_val: