tests: Python coding style cleanup (pylint3 bad-whitespace)

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-03-15 12:10:37 +02:00 committed by Jouni Malinen
parent 009b54bedd
commit fab49f6145
102 changed files with 7660 additions and 7645 deletions

View File

@ -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()

View File

@ -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:

View File

@ -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",
fields = ["ssid", "wpa_passphrase", "nas_identifier", "wpa_key_mgmt",
"wpa",
"wpa_pairwise", "rsn_pairwise", "auth_server_addr",
"acct_server_addr", "osu_server_uri" ]
"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",
params = {"wpa": "2",
"wpa_key_mgmt": "WPA-PSK",
"rsn_pairwise": "CCMP" }
"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",
params = {"wpa": "1",
"wpa_key_mgmt": "WPA-PSK",
"wpa_pairwise": "TKIP" }
"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",
params = {"wpa": "3",
"wpa_key_mgmt": "WPA-PSK",
"wpa_pairwise": "TKIP",
"rsn_pairwise": "CCMP" }
"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",
params = {"auth_server_addr": "127.0.0.1",
"auth_server_port": "1812",
"auth_server_shared_secret": "radius",
"nas_identifier": "nas.w1.fi" }
"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:

View File

@ -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 |
flags=netlink.NLM_F_REQUEST |
netlink.NLM_F_ACK,
attrs = attrs)
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 |
flags=netlink.NLM_F_REQUEST |
netlink.NLM_F_ACK,
attrs = attrs)
attrs=attrs)
msg.send_and_recv(self._conn)
class HWSimRadio(object):

View File

@ -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)

View File

@ -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):
@ -184,7 +184,7 @@ 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
@ -207,7 +207,7 @@ 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):

View File

@ -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

View File

@ -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)

View File

@ -83,7 +83,7 @@ class Host():
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

View File

@ -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

View File

@ -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))

View File

@ -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",
params = {"ssid": "test-wpa2-psk",
"wpa_passphrase": "12345678",
"wpa": "2",
"wpa_key_mgmt": "WPA-PSK",
"rsn_pairwise": cipher }
"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",
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 }
"group_mgmt_cipher": cipher}
hapd = hostapd.add_ap(ap, params)
Wlantest.setup(hapd)
@ -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",
params = {"ssid": "tkip-countermeasures",
"wpa_passphrase": "12345678",
"wpa": "1",
"wpa_key_mgmt": "WPA-PSK",
"wpa_pairwise": "TKIP" }
"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",
params = {"ssid": "tkip-countermeasures",
"wpa_passphrase": "12345678",
"wpa": "3",
"wpa_key_mgmt": "WPA-PSK",
"wpa_pairwise": "TKIP",
"rsn_pairwise": "CCMP" }
"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",
params = {"ssid": "tkip-countermeasures",
"wpa_passphrase": "12345678",
"wpa": "1",
"wpa_key_mgmt": "WPA-PSK",
"wpa_pairwise": "TKIP" }
"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",
params = {"ssid": "tkip-countermeasures",
"wpa_passphrase": "12345678",
"wpa": "1",
"wpa_key_mgmt": "WPA-PSK",
"wpa_pairwise": "TKIP" }
"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",
params = {"ssid": "test-wpa2-psk",
"wpa_passphrase": "12345678",
"wpa": "2",
"wpa_key_mgmt": "WPA-PSK",
"rsn_pairwise": "CCMP GCMP CCMP-256 GCMP-256" }
"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,
params = {"ssid": ssid,
"wpa_passphrase": passphrase,
"wpa": "3",
"wpa_key_mgmt": "WPA-PSK",
"rsn_pairwise": "CCMP",
"wpa_pairwise": "TKIP" }
"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",
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" }
"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",
params = {"ssid": "test-wpa2-psk",
"wpa_passphrase": "12345678",
"wpa": "2",
"wpa_key_mgmt": "WPA-PSK",
"rsn_pairwise": cipher }
"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",
params = {"ssid": "test-wpa2-psk",
"wpa_passphrase": "12345678",
"wpa": "2",
"wpa_key_mgmt": "WPA-PSK",
"rsn_pairwise": cipher }
"rsn_pairwise": cipher}
hapd = hostapd.add_ap(apdev[0], params)
Wlantest.setup(hapd)

View File

@ -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",
params = {"wpa": "2",
"wpa_key_mgmt": "FT-PSK",
"rsn_pairwise": "CCMP",
"wpa_passphrase": "12345678" }
"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,9 +285,9 @@ 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"),
tests = [("driver", "foobar"),
("ssid2", "Q"),
("macaddr_acl", "255"),
("accept_mac_file", not_exist),
@ -323,7 +323,7 @@ def test_ap_config_invalid_value(dev, apdev, params):
("anqp_elem", "265:1q"),
("fst_priority", ""),
("fils_cache_id", "q"),
("unknown-item", "foo") ]
("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,13 +333,13 @@ 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=:",
tests = ["#\n\n*\tTLS\nradius_accept_attr=:",
"foo\n",
"\"foo\n",
"\"foo\"\n",
@ -353,14 +353,14 @@ def test_ap_config_eap_user_file_parsing(dev, apdev, params):
"\"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" ]
"\"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"),
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"),
@ -375,7 +375,7 @@ def test_ap_config_eap_user_file_parsing(dev, apdev, params):
"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") ]
("* 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,9 +385,9 @@ 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" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "foobar"})
tests = [ (1, "hostapd_parse_das_client",
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"),
@ -433,7 +433,7 @@ def test_ap_config_set_oom(dev, apdev):
(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") ]
(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,7 +453,7 @@ def test_ap_config_set_oom(dev, apdev):
hapd.set("lci", "")
hapd.set("civic", "")
tests = [ (1, "hs20_parse_icon",
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"),
@ -465,13 +465,13 @@ def test_ap_config_set_oom(dev, apdev):
(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") ]
(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",
tests = ["SET eap_reauth_period -1",
"SET fst_llt ",
"SET auth_server_addr_replace foo",
"SET acct_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)

View File

@ -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)

View File

@ -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",
params = {"ssid": "test-1",
"bridge": br_ifname,
"iapp_interface": 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',
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' ]
'-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")

View File

@ -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,7 +843,7 @@ 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"),
tests = [(1, "milenage_f2345"),
(2, "milenage_f2345"),
(3, "milenage_f2345"),
(4, "milenage_f2345"),
@ -854,7 +854,7 @@ def test_ap_wpa2_eap_sim_oom(dev, apdev):
(9, "milenage_f2345"),
(10, "milenage_f2345"),
(11, "milenage_f2345"),
(12, "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",
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" ]
":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,7 +1287,7 @@ 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",
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",
@ -1295,7 +1295,7 @@ def test_ap_wpa2_eap_ttls_pap_check_cert_subject(dev, apdev):
"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",
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" ]
"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",
tests = ["auth=MSCHAPv2", "auth=MSCHAPV2 autheap=MD5",
"autheap=MD5 auth=MSCHAPV2", "auth=PAP auth=CHAP",
"autheap=MD5 autheap=FOO autheap=MSCHAPV2" ]
"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", ""),
tests = [("peap-ver0", ""),
("peap-ver1", ""),
("peap-ver0", "peapver=0"),
("peap-ver1", "peapver=1") ]
for anon,phase1 in tests:
("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",
tests = ["incorrect.example.com",
"DNS:incorrect.example.com",
"DNS:w1.fi",
"DNS:erver.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",
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 ]
"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",
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" }
"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",
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" }
"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",
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" ]:
"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"),
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") ]:
(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",
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" }
"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"),
tests = [(1, "dh_init"),
(2, "dh_init"),
(1, "dh_derive_shared") ]
(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,7 +3102,7 @@ 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"),
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"),
@ -3110,7 +3110,7 @@ def test_ap_wpa2_eap_psk_oom(dev, apdev):
(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") ]
(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,7 +3166,7 @@ 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",
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",
@ -3179,8 +3179,8 @@ def test_ap_wpa2_eap_interactive(dev, apdev):
("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:
"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",
tests = ["eap_vendor_test_init",
"eap_msg_alloc;eap_vendor_test_process",
"eap_vendor_test_getKey" ]
"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"),
tests = [(1, "=eap_fast_save_pac_bin"),
(1, "eap_fast_write_pac"),
(2, "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,7 +3388,7 @@ 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",
tests = ["00", "000000000000", "6ae4920c0001",
"6ae4920c000000",
"6ae4920c0000" + "0000" + 32*"00" + "ffff" + "0000",
"6ae4920c0000" + "0000" + 32*"00" + "0001" + "0000",
@ -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"),
tests = [(1, "eap_fast_load_pac_bin"),
(2, "eap_fast_load_pac_bin"),
(3, "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"),
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") ]
(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",
tests = ["DHE-RSA-AES128-SHA",
"RC4-SHA",
"AES128-SHA",
"AES256-SHA",
"DHE-RSA-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",
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" }
"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",
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" ]
"-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",
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" ]
"-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"),
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") ]
(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',
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:
'30020100')]
for txt, ie in tests:
dev[0].request("DISCONNECT")
dev[0].wait_disconnected()
logger.info(txt)
@ -5894,7 +5894,7 @@ 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",
params = {"ssid": "as", "beacon_int": "2000",
"radius_server_clients": "auth_serv/radius_clients.conf",
"radius_server_auth_port": '18128',
"eap_server": "1",
@ -5902,7 +5902,7 @@ def test_eap_tls_session_resumption_radius(dev, apdev):
"ca_cert": "auth_serv/ca.pem",
"server_cert": "auth_serv/server.pem",
"private_key": "auth_serv/server.key",
"tls_session_lifetime": "60" }
"tls_session_lifetime": "60"}
authsrv = hostapd.add_ap(apdev[1], params)
check_tls_session_resumption_capa(dev[0], authsrv)
@ -5927,7 +5927,7 @@ 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",
params = {"ssid": "as", "beacon_int": "2000",
"radius_server_clients": "auth_serv/radius_clients.conf",
"radius_server_auth_port": '18128',
"eap_server": "1",
@ -5935,7 +5935,7 @@ def test_eap_tls_no_session_resumption_radius(dev, apdev):
"ca_cert": "auth_serv/ca.pem",
"server_cert": "auth_serv/server.pem",
"private_key": "auth_serv/server.key",
"tls_session_lifetime": "0" }
"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"),
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") ]
(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"),
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") ]
(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"),
tests = [(1, "eap_mschapv2_init"),
(1, "eap_msg_alloc;eap_mschapv2_challenge_reply"),
(1, "eap_msg_alloc;eap_mschapv2_success"),
(1, "eap_mschapv2_getKey") ]
(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,7 +6050,7 @@ 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),
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",
@ -6063,7 +6063,7 @@ def test_eap_gpsk_errors(dev, apdev):
"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) ]
(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,7 +6075,7 @@ def test_eap_gpsk_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "eap_gpsk_init"),
tests = [(1, "eap_gpsk_init"),
(2, "eap_gpsk_init"),
(3, "eap_gpsk_init"),
(1, "eap_gpsk_process_id_server"),
@ -6087,7 +6087,7 @@ def test_eap_gpsk_errors(dev, apdev):
(1, "eap_msg_alloc;eap_gpsk_send_gpsk_4"),
(1, "eap_gpsk_getKey"),
(1, "eap_gpsk_get_emsk"),
(1, "eap_gpsk_get_session_id") ]
(1, "eap_gpsk_get_session_id")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].request("ERP_FLUSH")
@ -6229,7 +6229,7 @@ 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",
tests = [("Normal wpa_supplicant assoc req RSN IE",
"30140100000fac040100000fac040100000fac010000"),
("Extra PMKIDCount field in RSN IE",
"30160100000fac040100000fac040100000fac0100000000"),
@ -6241,7 +6241,7 @@ def test_ap_wpa2_eap_assoc_rsn(dev, apdev):
"30120100000fac040100000fac040100000fac01"),
("RSN IE without AKM", "300c0100000fac040100000fac04"),
("RSN IE without pairwise", "30060100000fac04"),
("RSN IE without group", "30020100") ]
("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",
tests = [("Normal wpa_supplicant assoc req RSN IE",
"30140100000fac040100000fac040100000fac01cc00"),
("Group management cipher included in assoc req RSN IE",
"301a0100000fac040100000fac040100000fac01cc000000000fac06") ]
"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",
tests = [("Management frame protection not enabled",
"30140100000fac040100000fac040100000fac010000", 31),
("Unsupported management group cipher",
"301a0100000fac040100000fac040100000fac01cc000000000fac0b", 46) ]
"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",
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" ]
"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)

View File

@ -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",
params = {"wpa": "2",
"wpa_key_mgmt": "FT-PSK",
"rsn_pairwise": "CCMP" }
"rsn_pairwise": "CCMP"}
return params
def ft_base_mixed():
params = { "wpa": "3",
params = {"wpa": "3",
"wpa_key_mgmt": "WPA-PSK FT-PSK",
"wpa_pairwise": "TKIP",
"rsn_pairwise": "CCMP" }
"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
@ -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,7 +1995,7 @@ 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",
tests = ["0601",
"0601" + _addr,
"0601" + _addr + _bssid0,
"0601" + _addr + "ffffffffffff",
@ -2014,7 +2014,7 @@ def test_ap_ft_over_ds_proto_ap(dev, apdev):
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" ]
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,7 +2181,7 @@ def test_rsn_ie_proto_ft_psk_sta(dev, apdev):
ieee80211w="1", scan_freq="2412",
pairwise="CCMP", group="CCMP")
tests = [ ('PMKIDCount field included',
tests = [('PMKIDCount field included',
'30160100000fac040100000fac040100000fac048c000000' + '3603a1b201'),
('Extra IE before RSNE',
'dd0400000000' + '30140100000fac040100000fac040100000fac048c00' + '3603a1b201'),
@ -2190,8 +2190,8 @@ def test_rsn_ie_proto_ft_psk_sta(dev, apdev):
('Extra octet after defined fields (future extensibility)',
'301b0100000fac040100000fac040100000fac048c000000000fac0600' + '3603a1b201'),
('No RSN Capabilities field (PMF disabled in practice)',
'30120100000fac040100000fac040100000fac04' + '3603a1b201') ]
for txt,ie in tests:
'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",
tests = ["3900",
"3900ff04eeeeeeee",
"390400000000",
"390400000000" + "390400000000",
"390400000000" + "dd050050f20202",
"390400000000" + "dd3d0050f2020201" + 55*"00",
"390400000000" + "dd3d0050f2020201aa300010270000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000040420f00ffff0000",
"390401010000" + "dd3d0050f2020201aa3000dc050000000000000000000000000000000000000000000000000000dc050000000000000000000000000000808d5b0028230000" ]
"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"

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@ 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",
params = {"ssid": "test-ht40",
"channel": "5",
"ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
@ -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,12 +104,12 @@ 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",
params = {"ssid": "test-ht40",
"channel": "6",
"ht_capab": "[HT40+]"}
hostapd.add_ap(apdev[1], params)
params = { "ssid": "test-ht40",
params = {"ssid": "test-ht40",
"channel": "5",
"ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
@ -145,12 +145,12 @@ 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",
params = {"ssid": "test-ht40",
"channel": "11",
"ht_capab": "[HT40-]"}
hostapd.add_ap(apdev[1], params)
params = { "ssid": "test-ht40",
params = {"ssid": "test-ht40",
"channel": "1",
"ht_capab": "[HT40+]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
@ -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,7 +197,7 @@ 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",
params = {"ssid": "test-ht40",
"channel": "1",
"ht_capab": "[HT40+]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
@ -233,11 +233,11 @@ 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",
params = {"ssid": "test-ht40",
"channel": "5",
"ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
@ -273,11 +273,11 @@ 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",
params = {"ssid": "test-ht40",
"channel": "5",
"ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
@ -312,12 +312,12 @@ 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",
params = {"ssid": "another-bss",
"channel": "1",
"ht_capab": "[40-INTOLERANT]" }
"ht_capab": "[40-INTOLERANT]"}
hostapd.add_ap(apdev[1], params)
params = { "ssid": "test-ht40",
params = {"ssid": "test-ht40",
"channel": "1",
"ht_capab": "[HT40+]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
@ -352,12 +352,12 @@ 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",
params = {"ssid": "test-ht40",
"channel": "5",
"ht_capab": "[HT40-]"}
hostapd.add_ap(apdev[1], params)
params = { "ssid": "test-ht40",
params = {"ssid": "test-ht40",
"channel": "5",
"ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
@ -395,14 +395,14 @@ def test_ap_ht40_5ghz_match(dev, apdev):
try:
hapd = None
hapd2 = None
params = { "ssid": "test-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",
params = {"ssid": "test-ht40",
"hw_mode": "a",
"channel": "36",
"ht_capab": "[HT40+]"}
@ -449,14 +449,14 @@ def test_ap_ht40_5ghz_switch(dev, apdev):
try:
hapd = None
hapd2 = None
params = { "ssid": "test-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",
params = {"ssid": "test-ht40",
"hw_mode": "a",
"channel": "40",
"ht_capab": "[HT40-]"}
@ -502,7 +502,7 @@ def test_ap_ht40_5ghz_switch2(dev, apdev):
try:
hapd = None
hapd2 = None
params = { "ssid": "test-ht40",
params = {"ssid": "test-ht40",
"hw_mode": "a",
"channel": "36",
"country_code": "US",
@ -518,7 +518,7 @@ def test_ap_ht40_5ghz_switch2(dev, apdev):
dev[0].select_network(id)
time.sleep(1)
params = { "ssid": "test-ht40",
params = {"ssid": "test-ht40",
"hw_mode": "a",
"channel": "40",
"ht_capab": "[HT40-]"}
@ -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",
params = {"ssid": "obss-scan",
"channel": "6",
"ht_capab": "[HT40-]",
"obss_interval": "10" }
"obss_interval": "10"}
hapd = hostapd.add_ap(apdev[0], params)
params = { "ssid": "another-bss",
params = {"ssid": "another-bss",
"channel": "9",
"ieee80211n": "0" }
"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",
params = {"ssid": "obss-scan",
"channel": "6",
"ht_capab": "[HT40+]",
"obss_interval": "10" }
"obss_interval": "10"}
hapd = hostapd.add_ap(apdev[0], params)
params = { "ssid": "another-bss",
params = {"ssid": "another-bss",
"channel": "9",
"ieee80211n": "0" }
"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",
params = {"ssid": "obss-scan",
"channel": "6",
"ht_capab": "[HT40-]",
"obss_interval": "10" }
"obss_interval": "10"}
hapd = hostapd.add_ap(apdev[0], params)
params = { "ssid": "another-bss",
params = {"ssid": "another-bss",
"channel": "7",
"ht_capab": "[40-INTOLERANT]" }
"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",
params = {"ssid": "obss-scan",
"channel": "6",
"ht_capab": "[HT40-]" }
"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',
tests = ['0400', '040048', '04004801', '0400480000', '0400490100',
'040048ff0000', '04004801ff49ff00', '04004801004900',
'0400480100490101', '0400480100490201ff',
'040048010449020005' ]
'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",
params = {"ssid": "obss-scan",
"channel": "6",
"ht_capab": "[HT40+]",
"obss_interval": "1" }
"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",
params = {"ssid": "obss-scan",
"channel": "6",
"ht_capab": "[HT40+]",
"obss_interval": "1" }
"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",
params = {"ssid": "test-olbc",
"channel": "6",
"ht_capab": "[HT40-]",
"ap_table_expiration_time": "2" }
"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",
params = {"ssid": "olbc-ap",
"hw_mode": "b",
"channel": "6",
"wmm_enabled": "0" }
"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",
params = {"ssid": "test-olbc",
"channel": "1",
"ap_table_max_size": "2" }
"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",
params = {"ssid": "test-olbc",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
"ht_capab": "[HT40+]" }
"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",
params = {"ssid": "olbc-ap",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
"ieee80211n": "0",
"wmm_enabled": "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",
params = {"ssid": "require-ht",
"supported_rates": "60 120 240 360 480 540",
"require_ht": "1" }
"require_ht": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[1].connect("require-ht", key_mgmt="NONE", scan_freq="2412",
@ -911,7 +911,7 @@ 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",
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)
@ -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",
params = {"ssid": "intolerant",
"channel": "6",
"ht_capab": "[HT40-]" }
"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",
params = {"ssid": "intolerant",
"channel": "6",
"ht_capab": "[HT40-]",
"obss_interval": "0" }
"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",
params = {"ssid": "ht",
"channel": "6",
"ht_capab": "[HT40-]",
"obss_interval": "3" }
"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",
params = {"ssid": "intolerant",
"channel": "5",
"ht_capab": "[40-INTOLERANT]" }
"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",
params = {"ssid": "ht",
"country_code": "US",
"hw_mode": "a",
"channel": "36",
"ht_capab": "[HT40+]",
"ieee80211n": "1" }
"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",
params = {"ssid": "ht",
"country_code": "US",
"hw_mode": "a",
"channel": "36",
"ht_capab": "[HT40+]",
"ieee80211n": "1" }
"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",
params = {"ssid": "ht",
"country_code": "US",
"hw_mode": "a",
"channel": "36",
"ht_capab": "[HT40+]",
"ieee80211n": "1" }
"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",
params = {"ssid": "test",
"channel": "1",
"ieee80211n": "0" }
"ieee80211n": "0"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
params = { "ssid": "test",
params = {"ssid": "test",
"channel": "1",
"ieee80211n": "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",
params = {"ssid": "test",
"channel": "1",
"ieee80211n": "1" }
"ieee80211n": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
params = { "ssid": "test",
params = {"ssid": "test",
"channel": "1",
"ieee80211n": "1",
"ht_capab": "[HT40+]" }
"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",
params = {"ssid": "test",
"channel": "1",
"ieee80211n": "0" }
"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",
params = {"ssid": "test",
"channel": "1",
"ieee80211n": "1" }
"ieee80211n": "1"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
dev[0].scan_for_bss(bssid2, freq=2412)
@ -1253,7 +1253,7 @@ 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",
params = {"ssid": "test-ht40",
"hw_mode": "a",
"channel": "40",
"country_code": "US",
@ -1274,7 +1274,7 @@ 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",
params = {"ssid": "test-ht40",
"hw_mode": "a",
"channel": "48",
"country_code": "US",
@ -1295,13 +1295,13 @@ 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",
params = {"ssid": "legacy-20",
"channel": "7", "ieee80211n": "0",
"wmm_enabled": "1",
"vendor_elements": "2d1a0e001bffff000000000000000000000100000000000000000000" }
"vendor_elements": "2d1a0e001bffff000000000000000000000100000000000000000000"}
hapd2 = hostapd.add_ap(apdev[1], params)
params = { "ssid": "test-ht40",
params = {"ssid": "test-ht40",
"channel": "5",
"ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
@ -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",
params = {"ssid": "test-ht40",
"hw_mode": hw_mode,
"channel": channel,
"ht_capab": ht_capab }
"ht_capab": ht_capab}
if country:
params['country_code'] = country
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
@ -1439,7 +1439,7 @@ 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",
params = {"ssid": "test-ht40",
"channel": "11",
"ht_capab": "[HT40+][HT40-]"}
hapd = hostapd.add_ap(apdev[0], params)
@ -1459,7 +1459,7 @@ 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",
params = {"ssid": "test-ht40",
"channel": "1",
"ht_capab": "[HT40+][HT40-]"}
hapd = hostapd.add_ap(apdev[0], params)
@ -1479,7 +1479,7 @@ 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",
params = {"ssid": "test-ht40",
"channel": "6",
"ht_capab": "[HT40-]"}
hapd = hostapd.add_ap(apdev[0], params)

View File

@ -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",
params = {"ssid": "open",
"ignore_probe_probability": "0.5",
"ignore_auth_probability": "0.5",
"ignore_assoc_probability": "0.5",
"ignore_reassoc_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",
{"ssid": "open",
"bss_load_update_period": "10",
"chan_util_avg_period": "20" })
"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",
hapd = hostapd.add_ap(apdev[0], {"ssid": "open",
"country_code": country_code,
"country3": country3,
"ieee80211d": "1" })
"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"

View File

@ -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",
params = {'ssid': ssid, 'preamble': "0",
'hw_mode': 'b', 'ieee80211n': '0',
'supported_rates': '10', 'basic_rates': '10' }
'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")

View File

@ -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"),
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") ])
("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,7 +1513,7 @@ 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],
(bssid, ssid, hapd, snonce, pmk, addr, wpae) = eapol_test(apdev[0], dev[0],
wpa2=False)
msg = recv_eapol(hapd)
@ -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,7 +2675,7 @@ def test_ap_wpa_ie_parsing(dev, apdev):
id = dev[0].connect(ssid, psk=passphrase, scan_freq="2412",
only_add_network=True)
tests = [ "dd040050f201",
tests = ["dd040050f201",
"dd050050f20101",
"dd060050f2010100",
"dd060050f2010001",
@ -2697,7 +2697,7 @@ def test_ap_wpa_ie_parsing(dev, apdev):
"dd120050f20101000050f20201000050f202ffff",
"dd130050f20101000050f20201000050f202010000",
"dd140050f20101000050f20201000050f20201000050",
"dd150050f20101000050f20201000050f20201000050f2" ]
"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",
tests = ["dd170050f20101000050f20201000050f20201000050f202ff",
"dd180050f20101000050f20201000050f20201000050f202ffff",
"dd190050f20101000050f20201000050f20201000050f202ffffff" ]
"dd190050f20101000050f20201000050f20201000050f202ffffff"]
for t in tests:
try:
if "OK" not in dev[0].request("VENDOR_ELEM_ADD 13 " + t):
@ -2761,7 +2761,7 @@ 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',
tests = [('No RSN Capabilities field',
'30120100000fac040100000fac040100000fac02'),
('Reserved RSN Capabilities bits set',
'30140100000fac040100000fac040100000fac023cff'),
@ -2778,8 +2778,8 @@ def test_rsn_ie_proto_psk_sta(dev, apdev):
('Unexpected Group Management Cipher Suite with PMF disabled',
'301a0100000fac040100000fac040100000fac020c000000000fac06'),
('Extra octet after defined fields (future extensibility)',
'301b0100000fac040100000fac040100000fac020c000000000fac0600') ]
for txt,ie in tests:
'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",
tests = [("Normal wpa_supplicant assoc req RSN IE",
"30140100000fac040100000fac040100000fac020000"),
("RSN IE without RSN Capabilities",
"30120100000fac040100000fac040100000fac02") ]
"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",
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) ]
("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",
params = {"wpa": "2",
"wpa_key_mgmt": "FT-PSK WPA-PSK",
"rsn_pairwise": "CCMP",
"ssid": ssid,
"wpa_passphrase": passphrase }
"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")

View File

@ -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,7 +95,7 @@ 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,
params = {"ssid": ssid,
"wmm_ac_bk_aifs": "7",
"wmm_ac_bk_cwmin": "4",
"wmm_ac_bk_cwmax": "10",
@ -115,18 +115,18 @@ def test_ap_qosmap_default_acm(dev, apdev):
"wmm_ac_vo_cwmin": "2",
"wmm_ac_vo_cwmax": "2",
"wmm_ac_vo_txop_limit": "47",
"wmm_ac_vo_acm": "1" }
"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")

View File

@ -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']:

View File

@ -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,7 +381,7 @@ 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",
params = {"ssid": "test-open",
"country_code": "DE",
"hw_mode": "a",
"channel": "36",
@ -390,7 +390,7 @@ def test_ap_open_tdls_vht(dev, apdev):
"ht_capab": "",
"vht_capab": "",
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "0" }
"vht_oper_centr_freq_seg0_idx": "0"}
hapd = None
try:
hapd = hostapd.add_ap(apdev[0], params)
@ -405,7 +405,7 @@ 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",
params = {"ssid": "test-open",
"country_code": "US",
"hw_mode": "a",
"channel": "36",
@ -414,7 +414,7 @@ def test_ap_open_tdls_vht80(dev, apdev):
"ieee80211ac": "1",
"vht_capab": "",
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "42" }
"vht_oper_centr_freq_seg0_idx": "42"}
try:
hapd = None
hapd = hostapd.add_ap(apdev[0], params)
@ -442,7 +442,7 @@ 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",
params = {"ssid": "test-open",
"country_code": "US",
"hw_mode": "a",
"channel": "36",
@ -452,7 +452,7 @@ def test_ap_open_tdls_vht80plus80(dev, apdev):
"vht_capab": "",
"vht_oper_chwidth": "3",
"vht_oper_centr_freq_seg0_idx": "42",
"vht_oper_centr_freq_seg1_idx": "155" }
"vht_oper_centr_freq_seg1_idx": "155"}
try:
hapd = None
hapd = hostapd.add_ap(apdev[0], params)
@ -486,7 +486,7 @@ 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",
params = {"ssid": "test-open",
"country_code": "ZA",
"hw_mode": "a",
"channel": "104",
@ -494,7 +494,7 @@ def test_ap_open_tdls_vht160(dev, apdev):
"ieee80211n": "1",
"ieee80211ac": "1",
"vht_oper_chwidth": "2",
"vht_oper_centr_freq_seg0_idx": "114" }
"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()

View File

@ -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",
params = {"ssid": "track",
"country_code": "US",
"hw_mode": "g",
"channel": "6",
"track_sta_max_num": "2" }
"track_sta_max_num": "2"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
params = { "ssid": "track",
params = {"ssid": "track",
"country_code": "US",
"hw_mode": "a",
"channel": "40",
"track_sta_max_num": "100",
"track_sta_max_age": "1" }
"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",
params = {"ssid": "track",
"country_code": "US",
"hw_mode": "g",
"channel": "6",
"beacon_int": "10000",
"no_probe_resp_if_seen_on": apdev[1]['ifname'] }
"no_probe_resp_if_seen_on": apdev[1]['ifname']}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
params = { "ssid": "track",
params = {"ssid": "track",
"country_code": "US",
"hw_mode": "a",
"channel": "40",
"track_sta_max_num": "100" }
"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",
params = {"ssid": "track",
"country_code": "US",
"hw_mode": "g",
"channel": "6",
"track_sta_max_num": "100",
"no_auth_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",
params = {"ssid": "track",
"country_code": "US",
"hw_mode": "a",
"channel": "40",
"track_sta_max_num": "100" }
"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",
params = {"ssid": "track",
"country_code": "US",
"hw_mode": "g",
"channel": "6",
"no_auth_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",
params = {"ssid": "track",
"country_code": "US",
"hw_mode": "a",
"channel": "40",
"interworking": "1",
"venue_name": "eng:Venue",
"track_sta_max_num": "100" }
"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",
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'] }
"no_auth_if_seen_on": apdev[1]['ifname']}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
params = { "ssid": "track",
params = {"ssid": "track",
"country_code": "US",
"hw_mode": "a",
"channel": "40",
"track_sta_max_num": "100" }
"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",
params = {"ssid": "track",
"country_code": "US",
"hw_mode": "g",
"channel": "6",
"track_sta_max_num": "100" }
"track_sta_max_num": "100"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
params = { "ssid": "track",
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'] }
"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",
params = {"ssid": "track",
"country_code": "US",
"hw_mode": "g",
"channel": "6",
"track_sta_max_num": "2" }
"track_sta_max_num": "2"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']

View File

@ -29,7 +29,7 @@ def test_ap_vht80(dev, apdev):
"""VHT with 80 MHz channel width"""
try:
hapd = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
@ -37,7 +37,7 @@ def test_ap_vht80(dev, apdev):
"ieee80211n": "1",
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "42" }
"vht_oper_centr_freq_seg0_idx": "42"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@ -91,7 +91,7 @@ def test_ap_vht_wifi_generation(dev, apdev):
"""VHT and wifi_generation"""
try:
hapd = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
@ -99,7 +99,7 @@ def test_ap_vht_wifi_generation(dev, apdev):
"ieee80211n": "1",
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "42" }
"vht_oper_centr_freq_seg0_idx": "42"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@ -138,7 +138,7 @@ def vht80_test(apdev, dev, channel, ht_capab):
clear_scan_cache(apdev)
try:
hapd = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
"channel": str(channel),
@ -146,7 +146,7 @@ def vht80_test(apdev, dev, channel, ht_capab):
"ieee80211n": "1",
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "42" }
"vht_oper_centr_freq_seg0_idx": "42"}
hapd = hostapd.add_ap(apdev, params)
bssid = apdev['bssid']
@ -180,7 +180,7 @@ 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",
params = {"ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
@ -190,7 +190,7 @@ def test_ap_vht80_params(dev, apdev):
"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" }
"require_vht": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[1].connect("vht", key_mgmt="NONE", scan_freq="5180",
@ -225,7 +225,7 @@ def test_ap_vht80_invalid(dev, apdev):
"""VHT with invalid 80 MHz channel configuration (seg1)"""
try:
hapd = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "US",
"hw_mode": "a",
"channel": "36",
@ -236,7 +236,7 @@ def test_ap_vht80_invalid(dev, apdev):
"vht_oper_centr_freq_seg0_idx": "42",
"vht_oper_centr_freq_seg1_idx": "155",
'ieee80211d': '1',
'ieee80211h': '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,7 +257,7 @@ def test_ap_vht80_invalid2(dev, apdev):
"""VHT with invalid 80 MHz channel configuration (seg0)"""
try:
hapd = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "US",
"hw_mode": "a",
"channel": "36",
@ -267,7 +267,7 @@ def test_ap_vht80_invalid2(dev, apdev):
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "46",
'ieee80211d': '1',
'ieee80211h': '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,7 +290,7 @@ def test_ap_vht_20(devs, apdevs):
ap = apdevs[0]
try:
hapd = None
params = { "ssid": "test-vht20",
params = {"ssid": "test-vht20",
"country_code": "DE",
"hw_mode": "a",
"channel": "36",
@ -301,8 +301,7 @@ def test_ap_vht_20(devs, apdevs):
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "0",
"supported_rates": "60 120 240 360 480 540",
"require_vht": "1",
}
"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,7 +318,7 @@ def test_ap_vht_40(devs, apdevs):
ap = apdevs[0]
try:
hapd = None
params = { "ssid": "test-vht40",
params = {"ssid": "test-vht40",
"country_code": "DE",
"hw_mode": "a",
"channel": "36",
@ -328,8 +327,7 @@ def test_ap_vht_40(devs, apdevs):
"ht_capab": "[HT40+]",
"vht_capab": "",
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "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,7 +341,7 @@ 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",
params = {"ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
@ -353,7 +351,7 @@ def test_ap_vht_capab_not_supported(dev, apdev):
"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" }
"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,7 +367,7 @@ def test_ap_vht160(dev, apdev):
"""VHT with 160 MHz channel width (1)"""
try:
hapd = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
@ -379,7 +377,7 @@ def test_ap_vht160(dev, apdev):
"vht_oper_chwidth": "2",
"vht_oper_centr_freq_seg0_idx": "50",
'ieee80211d': '1',
'ieee80211h': '1' }
'ieee80211h': '1'}
hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
ev = wait_dfs_event(hapd, "DFS-CAC-START", 5)
@ -439,7 +437,7 @@ def test_ap_vht160b(dev, apdev):
try:
hapd = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
"channel": "104",
@ -449,7 +447,7 @@ def test_ap_vht160b(dev, apdev):
"vht_oper_chwidth": "2",
"vht_oper_centr_freq_seg0_idx": "114",
'ieee80211d': '1',
'ieee80211h': '1' }
'ieee80211h': '1'}
hapd = hostapd.add_ap(apdev[1], params, wait_enabled=False)
ev = wait_dfs_event(hapd, "DFS-CAC-START", 5)
@ -543,7 +541,7 @@ 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",
params = {"ssid": "vht",
"country_code": "ZA",
"hw_mode": "a",
"channel": channel,
@ -553,7 +551,7 @@ def run_ap_vht160_no_dfs(dev, apdev, channel, ht_capab):
"vht_oper_chwidth": "2",
"vht_oper_centr_freq_seg0_idx": "114",
'ieee80211d': '1',
'ieee80211h': '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,7 +590,7 @@ def test_ap_vht160_no_ht40(dev, apdev):
"""VHT with 160 MHz channel width and HT40 disabled"""
try:
hapd = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "ZA",
"hw_mode": "a",
"channel": "108",
@ -602,7 +600,7 @@ def test_ap_vht160_no_ht40(dev, apdev):
"vht_oper_chwidth": "2",
"vht_oper_centr_freq_seg0_idx": "114",
'ieee80211d': '1',
'ieee80211h': '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,7 +629,7 @@ def test_ap_vht80plus80(dev, apdev):
try:
hapd = None
hapd2 = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "US",
"hw_mode": "a",
"channel": "52",
@ -642,13 +640,13 @@ def test_ap_vht80plus80(dev, apdev):
"vht_oper_centr_freq_seg0_idx": "58",
"vht_oper_centr_freq_seg1_idx": "155",
'ieee80211d': '1',
'ieee80211h': '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",
params = {"ssid": "vht2",
"country_code": "US",
"hw_mode": "a",
"channel": "36",
@ -657,7 +655,7 @@ def test_ap_vht80plus80(dev, apdev):
"ieee80211ac": "1",
"vht_oper_chwidth": "3",
"vht_oper_centr_freq_seg0_idx": "42",
"vht_oper_centr_freq_seg1_idx": "155" }
"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,7 +700,7 @@ def test_ap_vht80plus80_invalid(dev, apdev):
"""VHT with invalid 80+80 MHz channel"""
try:
hapd = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "US",
"hw_mode": "a",
"channel": "36",
@ -713,7 +711,7 @@ def test_ap_vht80plus80_invalid(dev, apdev):
"vht_oper_centr_freq_seg0_idx": "42",
"vht_oper_centr_freq_seg1_idx": "0",
'ieee80211d': '1',
'ieee80211h': '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,7 +733,7 @@ def test_ap_vht80_csa(dev, apdev):
csa_supported(dev[0])
try:
hapd = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "US",
"hw_mode": "a",
"channel": "149",
@ -743,7 +741,7 @@ def test_ap_vht80_csa(dev, apdev):
"ieee80211n": "1",
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "155" }
"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",
params = {"ssid": "vht",
"country_code": "US",
"hw_mode": "a",
"channel": "149",
"ht_capab": "[HT40+]",
"ieee80211n": "1",
"ieee80211ac": "0" }
"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",
params = {"ssid": "vht",
"country_code": "US",
"hw_mode": "a",
"channel": "149",
"ht_capab": "[HT40+]",
"ieee80211n": "1",
"ieee80211ac": "0" }
"ieee80211ac": "0"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -877,7 +875,7 @@ def test_ap_vht_csa_vht40_disable(dev, apdev):
csa_supported(dev[0])
try:
hapd = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "US",
"hw_mode": "a",
"channel": "149",
@ -886,7 +884,7 @@ def test_ap_vht_csa_vht40_disable(dev, apdev):
"ieee80211ac": "1",
"vht_capab": "",
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "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",
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"
}
"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,16 +952,16 @@ def test_prefer_vht40(dev, apdev):
try:
hapd2 = None
params = { "ssid": "test",
params = {"ssid": "test",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
"ieee80211n": "1",
"ht_capab": "[HT40+]" }
"ht_capab": "[HT40+]"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
params = { "ssid": "test",
params = {"ssid": "test",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
@ -973,8 +970,7 @@ def test_prefer_vht40(dev, apdev):
"ht_capab": "[HT40+]",
"vht_capab": "",
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "0",
}
"vht_oper_centr_freq_seg0_idx": "0"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
@ -1002,7 +998,7 @@ def test_ap_vht80_pwr_constraint(dev, apdev):
"""VHT with 80 MHz channel width and local power constraint"""
hapd = None
try:
params = { "ssid": "vht",
params = {"ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
@ -1012,7 +1008,7 @@ def test_ap_vht80_pwr_constraint(dev, apdev):
"ieee80211n": "1",
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "42" }
"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,7 +1032,7 @@ 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",
params = {"ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
@ -1045,7 +1041,7 @@ def test_ap_vht_use_sta_nsts(dev, apdev):
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "42",
"use_sta_nsts": "1" }
"use_sta_nsts": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@ -1067,7 +1063,7 @@ def test_ap_vht_tkip(dev, apdev):
"""VHT and TKIP"""
try:
hapd = None
params = { "ssid": "vht",
params = {"ssid": "vht",
"wpa": "1",
"wpa_key_mgmt": "WPA-PSK",
"wpa_pairwise": "TKIP",
@ -1079,7 +1075,7 @@ def test_ap_vht_tkip(dev, apdev):
"ieee80211n": "1",
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "42" }
"vht_oper_centr_freq_seg0_idx": "42"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@ -1116,7 +1112,7 @@ def test_ap_vht_40_fallback_to_20(devs, apdevs):
ap = apdevs[0]
try:
hapd = None
params = { "ssid": "test-vht40",
params = {"ssid": "test-vht40",
"country_code": "US",
"hw_mode": "a",
"basic_rates": "60 120 240",
@ -1128,8 +1124,7 @@ def test_ap_vht_40_fallback_to_20(devs, apdevs):
"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",
}
"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,7 +1143,7 @@ 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",
params = {"ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
@ -1157,7 +1152,7 @@ def test_ap_vht80_to_24g_ht(dev, apdev):
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"vht_capab": "[MAX-MPDU-11454]",
"vht_oper_centr_freq_seg0_idx": "42" }
"vht_oper_centr_freq_seg0_idx": "42"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']

View File

@ -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",
params = {"ssid": "test-vlan-open",
"dynamic_vlan": "1",
"accept_mac_file": "hostapd.accept" }
"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",
params = {"ssid": "test-vlan-open",
"dynamic_vlan": "1",
"vlan_file": "hostapd.vlan",
"accept_mac_file": "hostapd.accept" }
"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",
params = {"ssid": "test-vlan-open",
"dynamic_vlan": "1",
"vlan_file": "hostapd.vlan2",
"accept_mac_file": "hostapd.accept2" }
"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",
tests = ["#\n\n0\t11\n",
"* ",
"1 netdev12345678901234567890" ]
"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",
tests = ["#\n\n0\tvlan\n",
"4095\tvlan\n",
"vlan\n",
"1\t1234567890abcdef1234567890\n",
"1\n" ]
"1\n"]
for t in tests:
with open(tmp, "w") as f:
f.write(t)
@ -207,7 +207,7 @@ 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",
as_params = {"ssid": "as",
"beacon_int": "2000",
"radius_server_clients": "auth_serv/radius_clients.conf",
"radius_server_auth_port": '18128',
@ -215,7 +215,7 @@ def generic_ap_vlan_wpa2_radius_id_change(dev, apdev, tagged):
"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" }
"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",
params = {"ssid": "test-vlan-open",
"dynamic_vlan": "1",
"vlan_tagged_interface": "lo",
"accept_mac_file": "hostapd.accept" }
"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,7 +394,7 @@ 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",
as_params = {"ssid": "as",
"beacon_int": "2000",
"radius_server_clients": "auth_serv/radius_clients.conf",
"radius_server_auth_port": '18128',
@ -403,7 +403,7 @@ def ap_vlan_iface_cleanup_multibss(dev, apdev, cfgfile):
"ca_cert": "auth_serv/ca.pem",
"server_cert": "auth_serv/server.pem",
"private_key": "auth_serv/server.key",
"vlan_naming": "1" }
"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",
params = {"ssid": "test-vlan-open",
"per_sta_vif": "1",
"dynamic_vlan": "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',
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' ]
'pw3|vlanid=3|id=id3']
params['dynamic_vlan'] = "1"
hapd = hostapd.add_ap(apdev[0], params)

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ import hostapd
from utils import alloc_fail, fail_test, wait_fail_trigger
def authsrv_params():
params = { "ssid": "as", "beacon_int": "2000",
params = {"ssid": "as", "beacon_int": "2000",
"radius_server_clients": "auth_serv/radius_clients.conf",
"radius_server_auth_port": '18128',
"eap_server": "1",
@ -17,7 +17,7 @@ def authsrv_params():
"ca_cert": "auth_serv/ca.pem",
"server_cert": "auth_serv/server.pem",
"private_key": "auth_serv/server.key",
"eap_message": "hello" }
"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",
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" ]
"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,7 +204,7 @@ 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",
tests = ["foo@test-unknown",
"foo@test-tls-unknown",
"foo@test-tls-1",
"foo@test-tls-2",
@ -213,7 +213,7 @@ def test_authsrv_testing_options(dev, apdev):
"foo@test-tls-5",
"foo@test-tls-6",
"foo@test-tls-7",
"foo@test-tls-8" ]
"foo@test-tls-8"]
for t in tests:
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
eap="TTLS", identity="user",

View File

@ -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"):

View File

@ -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")

View File

@ -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",
{"ssid": "wep-shared-key",
"wep_key0": '"hello12345678"',
"wep_key1": '"other12345678"',
"auth_algs": "2" })
"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"))

View File

@ -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",
params = {"ssid": "sta-connect",
"manage_p2p": "1",
"allow_cross_connection": "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",
params = {"ssid": "sta-connect",
"manage_p2p": "1",
"allow_cross_connection": "0" }
"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)

File diff suppressed because it is too large Load Diff

View File

@ -16,9 +16,9 @@ import hostapd
from utils import *
def wait_dfs_event(hapd, event, timeout):
dfs_events = [ "DFS-RADAR-DETECTED", "DFS-NEW-CHANNEL",
dfs_events = ["DFS-RADAR-DETECTED", "DFS-NEW-CHANNEL",
"DFS-CAC-START", "DFS-CAC-COMPLETED",
"DFS-NOP-FINISHED", "AP-ENABLED", "AP-CSA-FINISHED" ]
"DFS-NOP-FINISHED", "AP-ENABLED", "AP-CSA-FINISHED"]
ev = hapd.wait_event(dfs_events, timeout=timeout)
if not ev:
raise Exception("DFS event timed out")
@ -283,7 +283,7 @@ def test_dfs_radar2(dev, apdev):
@remote_compatible
def test_dfs_radar_on_non_dfs_channel(dev, apdev):
"""DFS radar detection test code on non-DFS channel"""
params = { "ssid": "radar" }
params = {"ssid": "radar"}
hapd = hostapd.add_ap(apdev[0], params)
hapd.request("RADAR DETECTED freq=5260 ht_enabled=1 chan_width=1")

View File

@ -46,10 +46,10 @@ def test_dpp_qr_code_parsing(dev, apdev):
check_dpp_capab(dev[0])
id = []
tests = [ "DPP:C:81/1,115/36;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADM2206avxHJaHXgLMkq/24e0rsrfMP9K1Tm8gx+ovP0I=;;",
tests = ["DPP:C:81/1,115/36;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADM2206avxHJaHXgLMkq/24e0rsrfMP9K1Tm8gx+ovP0I=;;",
"DPP:C:81/1,81/2,81/3,81/4,81/5,81/6,81/7,81/8,81/9,81/10,81/11,81/12,81/13,82/14,83/1,83/2,83/3,83/4,83/5,83/6,83/7,83/8,83/9,84/5,84/6,84/7,84/8,84/9,84/10,84/11,84/12,84/13,115/36;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADM2206avxHJaHXgLMkq/24e0rsrfMP9K1Tm8gx+ovP0I=;;",
"DPP:I:SN=4774LH2b4044;M:010203040506;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADURzxmttZoIRIPWGoQMV00XHWCAQIhXruVWOz0NjlkIA=;;",
"DPP:I:;M:010203040506;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADURzxmttZoIRIPWGoQMV00XHWCAQIhXruVWOz0NjlkIA=;;" ]
"DPP:I:;M:010203040506;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADURzxmttZoIRIPWGoQMV00XHWCAQIhXruVWOz0NjlkIA=;;"]
for uri in tests:
id.append(dev[0].dpp_qr_code(uri))
@ -57,7 +57,7 @@ def test_dpp_qr_code_parsing(dev, apdev):
if uri != uri2:
raise Exception("Returned URI does not match")
tests = [ "foo",
tests = ["foo",
"DPP:",
"DPP:;;",
"DPP:C:1/2;M:;K;;",
@ -70,7 +70,7 @@ def test_dpp_qr_code_parsing(dev, apdev):
"DPP:C:1;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADM2206avxHJaHXgLMkqa24e0rsrfMP9K1Tm8gx+ovP0I=;;",
"DPP:C:81/1a;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADM2206avxHJaHXgLMkqa24e0rsrfMP9K1Tm8gx+ovP0I=;;",
"DPP:C:1/2000,81/-1;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADM2206avxHJaHXgLMkqa24e0rsrfMP9K1Tm8gx+ovP0I=;;",
"DPP:C:-1/1;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADM2206avxHJaHXgLMkqa24e0rsrfMP9K1Tm8gx+ovP0I=;;" ]
"DPP:C:-1/1;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADM2206avxHJaHXgLMkqa24e0rsrfMP9K1Tm8gx+ovP0I=;;"]
for t in tests:
res = dev[0].request("DPP_QR_CODE " + t)
if "FAIL" not in res:
@ -117,7 +117,7 @@ def test_dpp_qr_code_parsing_fail(dev, apdev):
if "FAIL" not in dev[0].request("DPP_QR_CODE DPP:I:SN=4774LH2b4044;M:010203040506;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADURzxmttZoIRIPWGoQMV00XHWCAQIhXruVWOz0NjlkIA=;;"):
raise Exception("DPP_QR_CODE failure not reported")
dpp_key_p256 ="30570201010420777fc55dc51e967c10ec051b91d860b5f1e6c934e48d5daffef98d032c64b170a00a06082a8648ce3d030107a124032200020c804188c7f85beb6e91070d2b3e5e39b90ca77b4d3c5251bc1844d6ca29dcad"
dpp_key_p256 = "30570201010420777fc55dc51e967c10ec051b91d860b5f1e6c934e48d5daffef98d032c64b170a00a06082a8648ce3d030107a124032200020c804188c7f85beb6e91070d2b3e5e39b90ca77b4d3c5251bc1844d6ca29dcad"
dpp_key_p384 = "307402010104302f56fdd83b5345cacb630eb7c22fa5ad5daba37307c95191e2a75756d137003bd8b32dbcb00eb5650c1eb499ecfcaec0a00706052b81040022a13403320003615ec2141b5b77aebb6523f8a012755f9a34405a8398d2ceeeebca7f5ce868bf55056cba4c4ec62fad3ed26dd29e0f23"
dpp_key_p521 = "308198020101044200c8010d5357204c252551aaf4e210343111e503fd1dc615b257058997c49b6b643c975226e93be8181cca3d83a7072defd161dfbdf433c19abe1f2ad51867a05761a00706052b81040023a1460344000301cdf3608b1305fe34a1f976095dcf001182b9973354efe156291a66830292f9babd8f412ad462958663e7a75d1d0610abdfc3dd95d40669f7ab3bc001668cfb3b7c"
dpp_key_bp256 = "3058020101042057133a676fb60bf2a3e6797e19833c7b0f89dc192ab99ab5fa377ae23a157765a00b06092b2403030208010107a12403220002945d9bf7ce30c9c1ac0ff21ca62b984d5bb80ff69d2be8c9716ab39a10d2caf0"
@ -127,9 +127,9 @@ dpp_key_bp512 = "30819802010104405803494226eb7e50bf0e90633f37e7e35d33f5fa502165e
def test_dpp_qr_code_curves(dev, apdev):
"""DPP QR Code and supported curves"""
check_dpp_capab(dev[0])
tests = [ ("prime256v1", dpp_key_p256),
tests = [("prime256v1", dpp_key_p256),
("secp384r1", dpp_key_p384),
("secp521r1", dpp_key_p521) ]
("secp521r1", dpp_key_p521)]
for curve, hex in tests:
id = dev[0].dpp_bootstrap_gen(key=hex)
info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id)
@ -141,9 +141,9 @@ def test_dpp_qr_code_curves(dev, apdev):
def test_dpp_qr_code_curves_brainpool(dev, apdev):
"""DPP QR Code and supported Brainpool curves"""
check_dpp_capab(dev[0], brainpool=True)
tests = [ ("brainpoolP256r1", dpp_key_bp256),
tests = [("brainpoolP256r1", dpp_key_bp256),
("brainpoolP384r1", dpp_key_bp384),
("brainpoolP512r1", dpp_key_bp512) ]
("brainpoolP512r1", dpp_key_bp512)]
for curve, hex in tests:
id = dev[0].dpp_bootstrap_gen(key=hex)
info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id)
@ -160,8 +160,8 @@ def test_dpp_qr_code_unsupported_curve(dev, apdev):
if "FAIL" not in id:
raise Exception("Unsupported curve accepted")
tests = [ "30",
"305f02010104187f723ed9e1b41979ec5cd02eb82696efc76b40e277661049a00a06082a8648ce3d030101a134033200043f292614dea97c43f500f069e79ae9fb48f8b07369180de5eec8fa2bc9eea5af7a46dc335f52f10cb1c0e9464201d41b" ]
tests = ["30",
"305f02010104187f723ed9e1b41979ec5cd02eb82696efc76b40e277661049a00a06082a8648ce3d030101a134033200043f292614dea97c43f500f069e79ae9fb48f8b07369180de5eec8fa2bc9eea5af7a46dc335f52f10cb1c0e9464201d41b"]
for hex in tests:
id = dev[0].request("DPP_BOOTSTRAP_GEN type=qrcode key=" + hex)
if "FAIL" not in id:
@ -185,8 +185,8 @@ def test_dpp_qr_code_curve_select(dev, apdev):
check_dpp_capab(dev[1], brainpool=True)
bi = []
for key in [ dpp_key_p256, dpp_key_p384, dpp_key_p521,
dpp_key_bp256, dpp_key_bp384, dpp_key_bp512 ]:
for key in [dpp_key_p256, dpp_key_p384, dpp_key_p521,
dpp_key_bp256, dpp_key_bp384, dpp_key_bp512]:
id = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True, key=key)
info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id)
for i in info.splitlines():
@ -610,7 +610,7 @@ def test_dpp_qr_code_auth_mutual_curve_mismatch(dev, apdev):
def test_dpp_qr_code_auth_hostapd_mutual2(dev, apdev):
"""DPP QR Code and authentication exchange (hostapd mutual2)"""
check_dpp_capab(dev[0])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured"})
check_dpp_capab(hapd)
logger.info("AP displays QR Code")
@ -1226,32 +1226,32 @@ def test_dpp_config_jws_error_prot_hdr_not_an_object(dev, apdev):
def test_dpp_config_jws_error_prot_hdr_no_typ(dev, apdev):
"""DPP Config Object JWS error - protected header - no typ"""
prot_hdr='{"kid":"TnGKjIlNZaatrEAYrbbjiB67rjkL_AGVWXO6q9hDJKU","alg":"ES256"}'
prot_hdr = '{"kid":"TnGKjIlNZaatrEAYrbbjiB67rjkL_AGVWXO6q9hDJKU","alg":"ES256"}'
run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr=prot_hdr))
def test_dpp_config_jws_error_prot_hdr_unsupported_typ(dev, apdev):
"""DPP Config Object JWS error - protected header - unsupported typ"""
prot_hdr='{"typ":"unsupported","kid":"TnGKjIlNZaatrEAYrbbjiB67rjkL_AGVWXO6q9hDJKU","alg":"ES256"}'
prot_hdr = '{"typ":"unsupported","kid":"TnGKjIlNZaatrEAYrbbjiB67rjkL_AGVWXO6q9hDJKU","alg":"ES256"}'
run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr=prot_hdr))
def test_dpp_config_jws_error_prot_hdr_no_alg(dev, apdev):
"""DPP Config Object JWS error - protected header - no alg"""
prot_hdr='{"typ":"dppCon","kid":"TnGKjIlNZaatrEAYrbbjiB67rjkL_AGVWXO6q9hDJKU"}'
prot_hdr = '{"typ":"dppCon","kid":"TnGKjIlNZaatrEAYrbbjiB67rjkL_AGVWXO6q9hDJKU"}'
run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr=prot_hdr))
def test_dpp_config_jws_error_prot_hdr_unexpected_alg(dev, apdev):
"""DPP Config Object JWS error - protected header - unexpected alg"""
prot_hdr='{"typ":"dppCon","kid":"TnGKjIlNZaatrEAYrbbjiB67rjkL_AGVWXO6q9hDJKU","alg":"unexpected"}'
prot_hdr = '{"typ":"dppCon","kid":"TnGKjIlNZaatrEAYrbbjiB67rjkL_AGVWXO6q9hDJKU","alg":"unexpected"}'
run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr=prot_hdr))
def test_dpp_config_jws_error_prot_hdr_no_kid(dev, apdev):
"""DPP Config Object JWS error - protected header - no kid"""
prot_hdr='{"typ":"dppCon","alg":"ES256"}'
prot_hdr = '{"typ":"dppCon","alg":"ES256"}'
run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr=prot_hdr))
def test_dpp_config_jws_error_prot_hdr_unexpected_kid(dev, apdev):
"""DPP Config Object JWS error - protected header - unexpected kid"""
prot_hdr='{"typ":"dppCon","kid":"MTIz","alg":"ES256"}'
prot_hdr = '{"typ":"dppCon","kid":"MTIz","alg":"ES256"}'
run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr=prot_hdr))
def test_dpp_config_signed_connector_error_no_dot_1(dev, apdev):
@ -1368,14 +1368,14 @@ def test_dpp_config_error_legacy_too_short_psk(dev, apdev):
def ecdsa_sign(pkey, message, alg="sha256"):
sign = OpenSSL.crypto.sign(pkey, message, alg)
a,b = struct.unpack('BB', sign[0:2])
a, b = struct.unpack('BB', sign[0:2])
if a != 0x30:
raise Exception("Invalid DER encoding of ECDSA signature")
if b != len(sign) - 2:
raise Exception("Invalid length of ECDSA signature")
sign = sign[2:]
a,b = struct.unpack('BB', sign[0:2])
a, b = struct.unpack('BB', sign[0:2])
if a != 0x02:
raise Exception("Invalid DER encoding of ECDSA signature r")
if b > len(sign) - 2:
@ -1390,7 +1390,7 @@ def ecdsa_sign(pkey, message, alg="sha256"):
else:
raise Exception("Invalid length of ECDSA signature r")
a,b = struct.unpack('BB', sign[0:2])
a, b = struct.unpack('BB', sign[0:2])
if a != 0x02:
raise Exception("Invalid DER encoding of ECDSA signature s")
if b > len(sign) - 2:
@ -1608,11 +1608,11 @@ def test_dpp_akm_sha512(dev, apdev):
def run_dpp_akm(dev, apdev, pmk_len):
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
params = { "ssid": "dpp",
params = {"ssid": "dpp",
"wpa": "2",
"wpa_key_mgmt": "DPP",
"rsn_pairwise": "CCMP",
"ieee80211w": "2" }
"ieee80211w": "2"}
try:
hapd = hostapd.add_ap(apdev[0], params)
except:
@ -1664,14 +1664,14 @@ def test_dpp_network_introduction(dev, apdev):
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
params = { "ssid": "dpp",
params = {"ssid": "dpp",
"wpa": "2",
"wpa_key_mgmt": "DPP",
"ieee80211w": "2",
"rsn_pairwise": "CCMP",
"dpp_connector": params1_ap_connector,
"dpp_csign": params1_csign,
"dpp_netaccesskey": params1_ap_netaccesskey }
"dpp_netaccesskey": params1_ap_netaccesskey}
try:
hapd = hostapd.add_ap(apdev[0], params)
except:
@ -1693,7 +1693,7 @@ def test_dpp_and_sae_akm(dev, apdev):
if "SAE" not in dev[1].get_capability("auth_alg"):
raise HwsimSkip("SAE not supported")
params = { "ssid": "dpp+sae",
params = {"ssid": "dpp+sae",
"wpa": "2",
"wpa_key_mgmt": "DPP SAE",
"ieee80211w": "2",
@ -1701,7 +1701,7 @@ def test_dpp_and_sae_akm(dev, apdev):
"sae_password": "sae-password",
"dpp_connector": params1_ap_connector,
"dpp_csign": params1_csign,
"dpp_netaccesskey": params1_ap_netaccesskey }
"dpp_netaccesskey": params1_ap_netaccesskey}
try:
hapd = hostapd.add_ap(apdev[0], params)
except:
@ -1808,7 +1808,7 @@ def run_dpp_ap_config(dev, apdev, curve=None, conf_curve=None,
reconf_configurator=False):
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured"})
check_dpp_capab(hapd)
id_h = hapd.dpp_bootstrap_gen(chan="81/1", mac=True, curve=curve)
@ -1942,7 +1942,7 @@ def test_dpp_auto_connect_2_connect_cmd(dev, apdev):
"""DPP and auto connect (2) using connect_cmd"""
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
dev_new = [ wpas, dev[1] ]
dev_new = [wpas, dev[1]]
try:
run_dpp_auto_connect(dev_new, apdev, 2)
finally:
@ -1957,14 +1957,14 @@ def run_dpp_auto_connect(dev, apdev, processing):
ap_connector = "eyJ0eXAiOiJkcHBDb24iLCJraWQiOiJwYWtZbXVzd1dCdWpSYTl5OEsweDViaTVrT3VNT3dzZHRlaml2UG55ZHZzIiwiYWxnIjoiRVMyNTYifQ.eyJncm91cHMiOlt7Imdyb3VwSWQiOiIqIiwibmV0Um9sZSI6ImFwIn1dLCJuZXRBY2Nlc3NLZXkiOnsia3R5IjoiRUMiLCJjcnYiOiJQLTI1NiIsIngiOiIybU5vNXZuRkI5bEw3d1VWb1hJbGVPYzBNSEE1QXZKbnpwZXZULVVTYzVNIiwieSI6IlhzS3dqVHJlLTg5WWdpU3pKaG9CN1haeUttTU05OTl3V2ZaSVl0bi01Q3MifX0.XhjFpZgcSa7G2lHy0OCYTvaZFRo5Hyx6b7g7oYyusLC7C_73AJ4_BxEZQVYJXAtDuGvb3dXSkHEKxREP9Q6Qeg"
ap_netaccesskey = "30770201010420ceba752db2ad5200fa7bc565b9c05c69b7eb006751b0b329b0279de1c19ca67ca00a06082a8648ce3d030107a14403420004da6368e6f9c507d94bef0515a1722578e73430703902f267ce97af4fe51273935ec2b08d3adefbcf588224b3261a01ed76722a630cf7df7059f64862d9fee42b"
params = { "ssid": "test",
params = {"ssid": "test",
"wpa": "2",
"wpa_key_mgmt": "DPP",
"ieee80211w": "2",
"rsn_pairwise": "CCMP",
"dpp_connector": ap_connector,
"dpp_csign": csign_pub,
"dpp_netaccesskey": ap_netaccesskey }
"dpp_netaccesskey": ap_netaccesskey}
try:
hapd = hostapd.add_ap(apdev[0], params)
except:
@ -2190,8 +2190,8 @@ def run_dpp_qr_code_auth_responder_configurator(dev, apdev, extra):
def test_dpp_qr_code_hostapd_init(dev, apdev):
"""DPP QR Code and hostapd as initiator"""
check_dpp_capab(dev[0])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured",
"channel": "6" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured",
"channel": "6"})
check_dpp_capab(hapd)
cmd = "DPP_CONFIGURATOR_ADD"
@ -2239,8 +2239,8 @@ def test_dpp_qr_code_hostapd_init_offchannel_neg_freq(dev, apdev):
def run_dpp_qr_code_hostapd_init_offchannel(dev, apdev, extra):
check_dpp_capab(dev[0])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured",
"channel": "6" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured",
"channel": "6"})
check_dpp_capab(hapd)
cmd = "DPP_CONFIGURATOR_ADD"
@ -2948,8 +2948,8 @@ def test_dpp_pkex_after_retry(dev, apdev):
def test_dpp_pkex_hostapd_responder(dev, apdev):
"""DPP PKEX with hostapd as responder"""
check_dpp_capab(dev[0])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured",
"channel": "6" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured",
"channel": "6"})
check_dpp_capab(hapd)
id_h = hapd.dpp_bootstrap_gen(type="pkex")
@ -2990,8 +2990,8 @@ def test_dpp_pkex_hostapd_responder(dev, apdev):
def test_dpp_pkex_hostapd_initiator(dev, apdev):
"""DPP PKEX with hostapd as initiator"""
check_dpp_capab(dev[0])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured",
"channel": "6" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured",
"channel": "6"})
check_dpp_capab(hapd)
cmd = "DPP_CONFIGURATOR_ADD"
@ -3039,8 +3039,8 @@ def test_dpp_pkex_hostapd_initiator(dev, apdev):
def test_dpp_hostapd_configurator(dev, apdev):
"""DPP with hostapd as configurator/initiator"""
check_dpp_capab(dev[0])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured",
"channel": "1" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured",
"channel": "1"})
check_dpp_capab(hapd)
cmd = "DPP_CONFIGURATOR_ADD"
@ -3087,8 +3087,8 @@ def test_dpp_hostapd_configurator(dev, apdev):
def test_dpp_hostapd_configurator_responder(dev, apdev):
"""DPP with hostapd as configurator/responder"""
check_dpp_capab(dev[0])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured",
"channel": "1" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured",
"channel": "1"})
check_dpp_capab(hapd)
cmd = "DPP_CONFIGURATOR_ADD"
@ -3148,7 +3148,7 @@ def test_dpp_own_config_curve_mismatch(dev, apdev):
def run_dpp_own_config(dev, apdev, own_curve=None, expect_failure=False,
extra=""):
check_dpp_capab(dev[0], own_curve and "BP" in own_curve)
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured"})
check_dpp_capab(hapd)
id_h = hapd.dpp_bootstrap_gen(chan="81/1", mac=True)
@ -3224,7 +3224,7 @@ def test_dpp_own_config_ap_reconf(dev, apdev):
def run_dpp_own_config_ap(dev, apdev, reconf_configurator=False, extra=""):
check_dpp_capab(dev[0])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured"})
check_dpp_capab(hapd)
cmd = "DPP_CONFIGURATOR_ADD"
@ -3299,7 +3299,7 @@ def run_dpp_intro_mismatch(dev, apdev, wpas):
check_dpp_capab(dev[2])
logger.info("Start AP in unconfigured state")
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured"})
check_dpp_capab(hapd)
id_h = hapd.dpp_bootstrap_gen(chan="81/1", mac=True)
@ -4226,20 +4226,20 @@ def test_dpp_proto_network_introduction(dev, apdev):
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
params = { "ssid": "dpp",
params = {"ssid": "dpp",
"wpa": "2",
"wpa_key_mgmt": "DPP",
"ieee80211w": "2",
"rsn_pairwise": "CCMP",
"dpp_connector": params1_ap_connector,
"dpp_csign": params1_csign,
"dpp_netaccesskey": params1_ap_netaccesskey }
"dpp_netaccesskey": params1_ap_netaccesskey}
try:
hapd = hostapd.add_ap(apdev[0], params)
except:
raise HwsimSkip("DPP not supported")
for test in [ 60, 61, 80, 82 ]:
for test in [60, 61, 80, 82]:
dev[0].set("dpp_test", str(test))
dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412", ieee80211w="2",
dpp_csign=params1_csign,
@ -4270,7 +4270,7 @@ def test_dpp_proto_network_introduction(dev, apdev):
hapd.dump_monitor()
dev[0].set("dpp_test", "0")
for test in [ 62, 63, 64, 77, 78, 79 ]:
for test in [62, 63, 64, 77, 78, 79]:
hapd.set("dpp_test", str(test))
dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412", ieee80211w="2",
dpp_csign=params1_csign,
@ -4384,8 +4384,8 @@ def test_dpp_pkex_alloc_fail(dev, apdev):
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
tests = [ (1, "=dpp_keygen_configurator"),
(1, "base64_gen_encode;dpp_keygen_configurator") ]
tests = [(1, "=dpp_keygen_configurator"),
(1, "base64_gen_encode;dpp_keygen_configurator")]
for count, func in tests:
with alloc_fail(dev[1], count, func):
cmd = "DPP_CONFIGURATOR_ADD"
@ -4403,7 +4403,7 @@ def test_dpp_pkex_alloc_fail(dev, apdev):
id1 = dev[1].dpp_bootstrap_gen(type="pkex")
# Local error cases on the Initiator
tests = [ (1, "dpp_get_pubkey_point"),
tests = [(1, "dpp_get_pubkey_point"),
(1, "dpp_alloc_msg;dpp_pkex_build_exchange_req"),
(1, "dpp_alloc_msg;dpp_pkex_build_commit_reveal_req"),
(1, "dpp_alloc_msg;dpp_auth_build_req"),
@ -4435,7 +4435,7 @@ def test_dpp_pkex_alloc_fail(dev, apdev):
(1, "=dpp_pkex_rx_commit_reveal_resp"),
(1, "dpp_get_pubkey_point;dpp_build_jwk"),
(2, "dpp_get_pubkey_point;dpp_build_jwk"),
(1, "dpp_get_pubkey_point;dpp_auth_init") ]
(1, "dpp_get_pubkey_point;dpp_auth_init")]
for count, func in tests:
dev[0].request("DPP_STOP_LISTEN")
dev[1].request("DPP_STOP_LISTEN")
@ -4460,7 +4460,7 @@ def test_dpp_pkex_alloc_fail(dev, apdev):
dev[0].wait_event(["GAS-QUERY-DONE"], timeout=3)
# Local error cases on the Responder
tests = [ (1, "dpp_get_pubkey_point"),
tests = [(1, "dpp_get_pubkey_point"),
(1, "dpp_alloc_msg;dpp_pkex_build_exchange_resp"),
(1, "dpp_alloc_msg;dpp_pkex_build_commit_reveal_resp"),
(1, "dpp_alloc_msg;dpp_auth_build_resp"),
@ -4489,7 +4489,7 @@ def test_dpp_pkex_alloc_fail(dev, apdev):
(3, "=dpp_pkex_rx_exchange_req"),
(1, "=dpp_pkex_rx_commit_reveal_req"),
(1, "dpp_get_pubkey_point;dpp_pkex_rx_commit_reveal_req"),
(1, "dpp_bootstrap_key_hash") ]
(1, "dpp_bootstrap_key_hash")]
for count, func in tests:
dev[0].request("DPP_STOP_LISTEN")
dev[1].request("DPP_STOP_LISTEN")
@ -4518,7 +4518,7 @@ def test_dpp_pkex_test_fail(dev, apdev):
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
tests = [ (1, "dpp_keygen_configurator") ]
tests = [(1, "dpp_keygen_configurator")]
for count, func in tests:
with fail_test(dev[1], count, func):
cmd = "DPP_CONFIGURATOR_ADD"
@ -4526,7 +4526,7 @@ def test_dpp_pkex_test_fail(dev, apdev):
if "FAIL" not in res:
raise Exception("Unexpected DPP_CONFIGURATOR_ADD success")
tests = [ (1, "dpp_keygen") ]
tests = [(1, "dpp_keygen")]
for count, func in tests:
with fail_test(dev[1], count, func):
cmd = "DPP_BOOTSTRAP_GEN type=pkex"
@ -4544,7 +4544,7 @@ def test_dpp_pkex_test_fail(dev, apdev):
id1 = dev[1].dpp_bootstrap_gen(type="pkex")
# Local error cases on the Initiator
tests = [ (1, "aes_siv_encrypt;dpp_auth_build_req"),
tests = [(1, "aes_siv_encrypt;dpp_auth_build_req"),
(1, "os_get_random;dpp_auth_init"),
(1, "dpp_derive_k1;dpp_auth_init"),
(1, "dpp_hkdf_expand;dpp_derive_k1;dpp_auth_init"),
@ -4561,7 +4561,7 @@ def test_dpp_pkex_test_fail(dev, apdev):
(1, "hmac_sha256_vector;dpp_pkex_rx_exchange_resp"),
(1, "aes_siv_decrypt;dpp_pkex_rx_commit_reveal_resp"),
(1, "hmac_sha256_vector;dpp_pkex_rx_commit_reveal_resp"),
(1, "dpp_bootstrap_key_hash") ]
(1, "dpp_bootstrap_key_hash")]
for count, func in tests:
dev[0].request("DPP_STOP_LISTEN")
dev[1].request("DPP_STOP_LISTEN")
@ -4586,7 +4586,7 @@ def test_dpp_pkex_test_fail(dev, apdev):
dev[0].wait_event(["GAS-QUERY-DONE"], timeout=3)
# Local error cases on the Responder
tests = [ (1, "aes_siv_encrypt;dpp_auth_build_resp"),
tests = [(1, "aes_siv_encrypt;dpp_auth_build_resp"),
(1, "aes_siv_encrypt;dpp_auth_build_resp;dpp_auth_build_resp_ok"),
(1, "os_get_random;dpp_build_conf_req"),
(1, "aes_siv_encrypt;dpp_build_conf_req"),
@ -4607,7 +4607,7 @@ def test_dpp_pkex_test_fail(dev, apdev):
(1, "aes_siv_encrypt;dpp_pkex_build_commit_reveal_resp"),
(1, "aes_siv_decrypt;dpp_pkex_rx_commit_reveal_req"),
(1, "hmac_sha256_vector;dpp_pkex_rx_commit_reveal_req"),
(2, "hmac_sha256_vector;dpp_pkex_rx_commit_reveal_req") ]
(2, "hmac_sha256_vector;dpp_pkex_rx_commit_reveal_req")]
for count, func in tests:
dev[0].request("DPP_STOP_LISTEN")
dev[1].request("DPP_STOP_LISTEN")
@ -4976,11 +4976,11 @@ def test_dpp_own_config_sign_fail(dev, apdev):
if "FAIL" in res:
raise Exception("Failed to add configurator")
conf_id = int(res)
tests = [ "",
tests = ["",
" ",
" conf=sta-dpp",
" configurator=%d" % conf_id,
" conf=sta-dpp configurator=%d curve=unsupported" % conf_id ]
" conf=sta-dpp configurator=%d curve=unsupported" % conf_id]
for t in tests:
if "FAIL" not in dev[0].request("DPP_CONFIGURATOR_SIGN " + t):
raise Exception("Invalid command accepted: " + t)
@ -4994,7 +4994,7 @@ def test_dpp_peer_intro_failures(dev, apdev):
def run_dpp_peer_intro_failures(dev, apdev):
check_dpp_capab(dev[0])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured"})
check_dpp_capab(hapd)
res = hapd.request("DPP_CONFIGURATOR_ADD key=" + dpp_key_p256)
@ -5035,9 +5035,9 @@ def run_dpp_peer_intro_failures(dev, apdev):
dev[0].wait_disconnected()
dev[0].dump_monitor()
tests = [ "eyJ0eXAiOiJkcHBDb24iLCJraWQiOiIwTlNSNTlxRTc0alFfZTFLVGVPV1lYY1pTWnFUaDdNXzU0aHJPcFRpaFJnIiwiYWxnIjoiRVMyNTYifQ.eyJncm91cHMiOltdLCJuZXRBY2Nlc3NLZXkiOnsia3R5IjoiRUMiLCJjcnYiOiJQLTI1NiIsIngiOiJiVmFMRGlBT09OQmFjcVFVN1pYamFBVEtEMVhhbDVlUExqOUZFZUl3VkN3IiwieSI6Il95c25JR1hTYjBvNEsyMWg0anZmSkZxMHdVNnlPNWp1VUFPd3FuM0dHVHMifX0.WgzZBOJaisWBRxvtXPbVYPXU7OIZxs6sZD-cPOLmJVTIYZKdMkSOMvP5b6si_j61FIrjhm43tmGq1P6cpoxB_g",
tests = ["eyJ0eXAiOiJkcHBDb24iLCJraWQiOiIwTlNSNTlxRTc0alFfZTFLVGVPV1lYY1pTWnFUaDdNXzU0aHJPcFRpaFJnIiwiYWxnIjoiRVMyNTYifQ.eyJncm91cHMiOltdLCJuZXRBY2Nlc3NLZXkiOnsia3R5IjoiRUMiLCJjcnYiOiJQLTI1NiIsIngiOiJiVmFMRGlBT09OQmFjcVFVN1pYamFBVEtEMVhhbDVlUExqOUZFZUl3VkN3IiwieSI6Il95c25JR1hTYjBvNEsyMWg0anZmSkZxMHdVNnlPNWp1VUFPd3FuM0dHVHMifX0.WgzZBOJaisWBRxvtXPbVYPXU7OIZxs6sZD-cPOLmJVTIYZKdMkSOMvP5b6si_j61FIrjhm43tmGq1P6cpoxB_g",
"eyJ0eXAiOiJkcHBDb24iLCJraWQiOiIwTlNSNTlxRTc0alFfZTFLVGVPV1lYY1pTWnFUaDdNXzU0aHJPcFRpaFJnIiwiYWxnIjoiRVMyNTYifQ.eyJncm91cHMiOlt7fV0sIm5ldEFjY2Vzc0tleSI6eyJrdHkiOiJFQyIsImNydiI6IlAtMjU2IiwieCI6IkJhY3BWSDNpNDBrZklNS0RHa1FFRzhCODBCaEk4cEFmTWpLbzM5NlFZT2ciLCJ5IjoiMjBDYjhDNjRsSjFzQzV2NXlKMnBFZXRRempxMjI4YVV2cHMxNmQ0M3EwQSJ9fQ.dG2y8VvZQJ5hfob8E5F2FAeR7Nd700qstYkxDgA2QfARaNMZ0_SfKfoG-yKXsIZNM-TvGBfACgfhagG9Oaw_Xw",
"eyJ0eXAiOiJkcHBDb24iLCJraWQiOiIwTlNSNTlxRTc0alFfZTFLVGVPV1lYY1pTWnFUaDdNXzU0aHJPcFRpaFJnIiwiYWxnIjoiRVMyNTYifQ.eyJncm91cHMiOlt7Imdyb3VwSWQiOiIqIn1dLCJuZXRBY2Nlc3NLZXkiOnsia3R5IjoiRUMiLCJjcnYiOiJQLTI1NiIsIngiOiJkc2VmcmJWWlhad0RMWHRpLWlObDBBYkFIOXpqeFFKd0R1SUd5NzNuZGU0IiwieSI6IjZFQnExN3cwYW1fZlh1OUQ4UGxWYk9XZ2I3b19DcTUxWHlmSG8wcHJyeDQifX0.caBvdDUtXrhnS61-juVZ_2FQdprepv0yZjC04G4ERvLUpeX7cgu0Hp-A1aFDogP1PEFGpkaEdcAWRQnSSRiIKQ" ]
"eyJ0eXAiOiJkcHBDb24iLCJraWQiOiIwTlNSNTlxRTc0alFfZTFLVGVPV1lYY1pTWnFUaDdNXzU0aHJPcFRpaFJnIiwiYWxnIjoiRVMyNTYifQ.eyJncm91cHMiOlt7Imdyb3VwSWQiOiIqIn1dLCJuZXRBY2Nlc3NLZXkiOnsia3R5IjoiRUMiLCJjcnYiOiJQLTI1NiIsIngiOiJkc2VmcmJWWlhad0RMWHRpLWlObDBBYkFIOXpqeFFKd0R1SUd5NzNuZGU0IiwieSI6IjZFQnExN3cwYW1fZlh1OUQ4UGxWYk9XZ2I3b19DcTUxWHlmSG8wcHJyeDQifX0.caBvdDUtXrhnS61-juVZ_2FQdprepv0yZjC04G4ERvLUpeX7cgu0Hp-A1aFDogP1PEFGpkaEdcAWRQnSSRiIKQ"]
for t in tests:
dev[0].set_network_quoted(id, "dpp_connector", t)
dev[0].select_network(id, freq=2412)
@ -5052,22 +5052,22 @@ def test_dpp_peer_intro_local_failures(dev, apdev):
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
params = { "ssid": "dpp",
params = {"ssid": "dpp",
"wpa": "2",
"wpa_key_mgmt": "DPP",
"ieee80211w": "2",
"rsn_pairwise": "CCMP",
"dpp_connector": params1_ap_connector,
"dpp_csign": params1_csign,
"dpp_netaccesskey": params1_ap_netaccesskey }
"dpp_netaccesskey": params1_ap_netaccesskey}
try:
hapd = hostapd.add_ap(apdev[0], params)
except:
raise HwsimSkip("DPP not supported")
tests = [ "dpp_derive_pmk",
tests = ["dpp_derive_pmk",
"dpp_hkdf_expand;dpp_derive_pmk",
"dpp_derive_pmkid" ]
"dpp_derive_pmkid"]
for func in tests:
with fail_test(dev[0], 1, func):
dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412",
@ -5082,12 +5082,12 @@ def test_dpp_peer_intro_local_failures(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
tests = [ (1, "base64_gen_decode;dpp_peer_intro"),
tests = [(1, "base64_gen_decode;dpp_peer_intro"),
(1, "json_parse;dpp_peer_intro"),
(50, "json_parse;dpp_peer_intro"),
(1, "=dpp_peer_intro"),
(1, "dpp_parse_jwk") ]
for count,func in tests:
(1, "dpp_parse_jwk")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412",
ieee80211w="2",
@ -5102,7 +5102,7 @@ def test_dpp_peer_intro_local_failures(dev, apdev):
dev[0].dump_monitor()
parts = params1_ap_connector.split('.')
for ap_connector in [ '.'.join(parts[0:2]), '.'.join(parts[0:1]) ]:
for ap_connector in ['.'.join(parts[0:2]), '.'.join(parts[0:1])]:
hapd.set("dpp_connector", ap_connector)
dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412",
ieee80211w="2",
@ -5158,18 +5158,18 @@ def run_dpp_configurator_id_unknown(dev):
def test_dpp_configurator_id_unknown(dev, apdev):
"""DPP and unknown configurator id"""
run_dpp_configurator_id_unknown(dev[0])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured"})
run_dpp_configurator_id_unknown(hapd)
def run_dpp_bootstrap_gen_failures(dev, hostapd):
check_dpp_capab(dev)
tests = [ "type=unsupported",
tests = ["type=unsupported",
"type=qrcode chan=-1",
"type=qrcode mac=a",
"type=qrcode key=qq",
"type=qrcode key=",
"type=qrcode info=abc\tdef" ]
"type=qrcode info=abc\tdef"]
for t in tests:
if "FAIL" not in dev.request("DPP_BOOTSTRAP_GEN " + t):
raise Exception("Command accepted unexpectedly")
@ -5207,7 +5207,7 @@ def run_dpp_bootstrap_gen_failures(dev, hostapd):
def test_dpp_bootstrap_gen_failures(dev, apdev):
"""DPP_BOOTSTRAP_GEN/REMOVE/GET_URI/INFO error cases"""
run_dpp_bootstrap_gen_failures(dev[0], False)
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured"})
run_dpp_bootstrap_gen_failures(hapd, True)
def test_dpp_listen_continue(dev, apdev):
@ -5251,12 +5251,12 @@ def run_dpp_network_addition_failure(dev, apdev):
dev[0].set("dpp_config_processing", "1")
cmd = "DPP_CONFIGURATOR_SIGN conf=sta-dpp configurator=%d" % conf_id
tests = [ (1, "=wpas_dpp_add_network"),
tests = [(1, "=wpas_dpp_add_network"),
(2, "=wpas_dpp_add_network"),
(3, "=wpas_dpp_add_network"),
(4, "=wpas_dpp_add_network"),
(1, "wpa_config_add_network;wpas_dpp_add_network") ]
for count,func in tests:
(1, "wpa_config_add_network;wpas_dpp_add_network")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
res = dev[0].request(cmd)
if "OK" in res:
@ -5267,8 +5267,8 @@ def run_dpp_network_addition_failure(dev, apdev):
dev[0].dump_monitor()
cmd = "DPP_CONFIGURATOR_SIGN conf=sta-psk pass=%s configurator=%d" % (binascii.hexlify(b"passphrase").decode(), conf_id)
tests = [ (1, "wpa_config_set_quoted;wpas_dpp_add_network") ]
for count,func in tests:
tests = [(1, "wpa_config_set_quoted;wpas_dpp_add_network")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
res = dev[0].request(cmd)
if "OK" in res:
@ -5326,7 +5326,7 @@ def test_dpp_conf_file_update(dev, apdev, params):
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5", config=config)
wpas.set("dpp_config_processing", "1")
run_dpp_qr_code_auth_unicast([ wpas, dev[1] ], apdev, None,
run_dpp_qr_code_auth_unicast([wpas, dev[1]], apdev, None,
init_extra="conf=sta-dpp",
require_conf_success=True,
configurator=True)
@ -5334,8 +5334,8 @@ def test_dpp_conf_file_update(dev, apdev, params):
with open(config, "r") as f:
res = f.read()
for i in [ "network={", "dpp_connector=", "key_mgmt=DPP", "ieee80211w=2",
"dpp_netaccesskey=", "dpp_csign=" ]:
for i in ["network={", "dpp_connector=", "key_mgmt=DPP", "ieee80211w=2",
"dpp_netaccesskey=", "dpp_csign="]:
if i not in res:
raise Exception("Configuration file missing '%s'" % i)
@ -5425,7 +5425,7 @@ def test_dpp_enrollee_ap_reject_config(dev, apdev):
"""DPP and Enrollee AP rejecting Config Object"""
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured"})
check_dpp_capab(hapd)
hapd.set("dpp_test", "91")

View File

@ -155,7 +155,7 @@ def start_radius_server(eap_handler):
t = threading.Thread(target=run_pyrad_server, args=(srv, t_stop, eap_handler))
t.start()
return { 'srv': srv, 'stop': t_stop, 'thread': t }
return {'srv': srv, 'stop': t_stop, 'thread': t}
def stop_radius_server(srv):
srv['stop'].set()
@ -794,15 +794,15 @@ def test_eap_proto_sake_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ ( 1, "eap_msg_alloc;eap_sake_build_msg;eap_sake_process_challenge" ),
( 1, "=eap_sake_process_challenge" ),
( 1, "eap_sake_compute_mic;eap_sake_process_challenge" ),
( 1, "eap_sake_build_msg;eap_sake_process_confirm" ),
( 1, "eap_sake_compute_mic;eap_sake_process_confirm" ),
( 2, "eap_sake_compute_mic;eap_sake_process_confirm" ),
( 1, "eap_sake_getKey" ),
( 1, "eap_sake_get_emsk" ),
( 1, "eap_sake_get_session_id" ) ]
tests = [(1, "eap_msg_alloc;eap_sake_build_msg;eap_sake_process_challenge"),
(1, "=eap_sake_process_challenge"),
(1, "eap_sake_compute_mic;eap_sake_process_challenge"),
(1, "eap_sake_build_msg;eap_sake_process_confirm"),
(1, "eap_sake_compute_mic;eap_sake_process_confirm"),
(2, "eap_sake_compute_mic;eap_sake_process_confirm"),
(1, "eap_sake_getKey"),
(1, "eap_sake_get_emsk"),
(1, "eap_sake_get_session_id")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -2276,7 +2276,7 @@ def test_eap_proto_eke(dev, apdev):
timeout=15)
if ev is None:
raise Exception("Timeout on EAP start")
if i in [ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ]:
if i in [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]:
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"],
timeout=10)
if ev is None:
@ -2292,8 +2292,8 @@ def eap_eke_test_fail(dev, phase1=None, success=False):
dev.connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
eap="EKE", identity="eke user@domain", password="hello",
phase1=phase1, erp="1", wait_connect=False)
ev = dev.wait_event([ "CTRL-EVENT-EAP-FAILURE",
"CTRL-EVENT-EAP-SUCCESS" ], timeout=5)
ev = dev.wait_event(["CTRL-EVENT-EAP-FAILURE",
"CTRL-EVENT-EAP-SUCCESS"], timeout=5)
if ev is None:
raise Exception("Timeout on EAP failure")
if not success and "CTRL-EVENT-EAP-FAILURE" not in ev:
@ -2320,7 +2320,7 @@ def test_eap_proto_eke_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "eap_eke_dh_init", None),
tests = [(1, "eap_eke_dh_init", None),
(1, "eap_eke_prf_hmac_sha1", "dhgroup=3 encr=1 prf=1 mac=1"),
(1, "eap_eke_prf_hmac_sha256", "dhgroup=5 encr=1 prf=2 mac=2"),
(1, "eap_eke_prf", None),
@ -2346,12 +2346,12 @@ def test_eap_proto_eke_errors(dev, apdev):
(1, "eap_eke_auth;eap_eke_process_confirm", None),
(2, "eap_eke_auth;eap_eke_process_confirm", None),
(1, "eap_eke_prot;eap_eke_process_confirm", None),
(1, "eap_eke_derive_msk;eap_eke_process_confirm", None) ]
(1, "eap_eke_derive_msk;eap_eke_process_confirm", None)]
for count, func, phase1 in tests:
with fail_test(dev[0], count, func):
eap_eke_test_fail(dev[0], phase1)
tests = [ (1, "=eap_eke_derive_ke_ki", None),
tests = [(1, "=eap_eke_derive_ke_ki", None),
(1, "=eap_eke_derive_ka", None),
(1, "=eap_eke_derive_msk", None),
(1, "eap_eke_build_msg;eap_eke_process_id", None),
@ -2361,14 +2361,14 @@ def test_eap_proto_eke_errors(dev, apdev):
(1, "wpabuf_alloc;eap_eke_process_id", None),
(1, "eap_eke_build_msg;eap_eke_process_commit", None),
(1, "wpabuf_resize;eap_eke_process_commit", None),
(1, "eap_eke_build_msg;eap_eke_process_confirm", None) ]
(1, "eap_eke_build_msg;eap_eke_process_confirm", None)]
for count, func, phase1 in tests:
with alloc_fail(dev[0], count, func):
eap_eke_test_fail(dev[0], phase1)
tests = [ (1, "eap_eke_getKey", None),
tests = [(1, "eap_eke_getKey", None),
(1, "eap_eke_get_emsk", None),
(1, "eap_eke_get_session_id", None) ]
(1, "eap_eke_get_session_id", None)]
for count, func, phase1 in tests:
with alloc_fail(dev[0], count, func):
eap_eke_test_fail(dev[0], phase1, success=True)
@ -2733,11 +2733,11 @@ def test_eap_proto_pax_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ "eap_msg_alloc;eap_pax_alloc_resp;eap_pax_process_std_1",
tests = ["eap_msg_alloc;eap_pax_alloc_resp;eap_pax_process_std_1",
"eap_msg_alloc;eap_pax_alloc_resp;eap_pax_process_std_3",
"eap_pax_getKey",
"eap_pax_get_emsk",
"eap_pax_get_session_id" ]
"eap_pax_get_session_id"]
for func in tests:
with alloc_fail(dev[0], 1, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -2748,12 +2748,12 @@ def test_eap_proto_pax_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "os_get_random;eap_pax_process_std_1"),
tests = [(1, "os_get_random;eap_pax_process_std_1"),
(1, "eap_pax_initial_key_derivation"),
(1, "eap_pax_mac;eap_pax_process_std_3"),
(2, "eap_pax_mac;eap_pax_process_std_3"),
(1, "eap_pax_kdf;eap_pax_getKey"),
(1, "eap_pax_kdf;eap_pax_get_emsk") ]
(1, "eap_pax_kdf;eap_pax_get_emsk")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -2922,7 +2922,7 @@ def test_eap_proto_psk_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "=eap_psk_process_1"),
tests = [(1, "=eap_psk_process_1"),
(2, "=eap_psk_process_1"),
(1, "eap_msg_alloc;eap_psk_process_1"),
(1, "=eap_psk_process_3"),
@ -2930,7 +2930,7 @@ def test_eap_proto_psk_errors(dev, apdev):
(1, "eap_msg_alloc;eap_psk_process_3"),
(1, "eap_psk_getKey"),
(1, "eap_psk_get_session_id"),
(1, "eap_psk_get_emsk") ]
(1, "eap_psk_get_emsk")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -2946,7 +2946,7 @@ def test_eap_proto_psk_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "os_get_random;eap_psk_process_1"),
tests = [(1, "os_get_random;eap_psk_process_1"),
(1, "omac1_aes_128;eap_psk_process_3"),
(1, "aes_128_eax_decrypt;eap_psk_process_3"),
(2, "aes_128_eax_decrypt;eap_psk_process_3"),
@ -2965,7 +2965,7 @@ def test_eap_proto_psk_errors(dev, apdev):
(9, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
(10, "aes_128_encrypt_block;eap_psk_derive_keys;eap_psk_process_3"),
(1, "aes_ctr_encrypt;aes_128_eax_decrypt;eap_psk_process_3"),
(1, "aes_ctr_encrypt;aes_128_eax_encrypt;eap_psk_process_3") ]
(1, "aes_ctr_encrypt;aes_128_eax_encrypt;eap_psk_process_3")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -3707,7 +3707,7 @@ def test_eap_proto_aka(dev, apdev):
timeout=15)
if ev is None:
raise Exception("Timeout on EAP start")
if i in [ 0, 15 ]:
if i in [0, 15]:
time.sleep(0.1)
else:
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"],
@ -4134,7 +4134,7 @@ def test_eap_proto_aka_prime(dev, apdev):
timeout=15)
if ev is None:
raise Exception("Timeout on EAP start")
if i in [ 0 ]:
if i in [0]:
time.sleep(0.1)
else:
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"],
@ -4540,7 +4540,7 @@ def test_eap_proto_sim(dev, apdev):
timeout=15)
if ev is None:
raise Exception("Timeout on EAP start")
if i in [ 0 ]:
if i in [0]:
time.sleep(0.1)
else:
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"],
@ -4635,7 +4635,7 @@ def test_eap_proto_sim_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
tests = [ (1, "eap_sim_verify_mac;eap_sim_process_challenge"),
tests = [(1, "eap_sim_verify_mac;eap_sim_process_challenge"),
(1, "eap_sim_parse_encr;eap_sim_process_challenge"),
(1, "eap_sim_msg_init;eap_sim_response_start"),
(1, "wpabuf_alloc;eap_sim_msg_init;eap_sim_response_start"),
@ -4646,7 +4646,7 @@ def test_eap_proto_sim_errors(dev, apdev):
(1, "eap_sim_process_start"),
(1, "eap_sim_getKey"),
(1, "eap_sim_get_emsk"),
(1, "eap_sim_get_session_id") ]
(1, "eap_sim_get_session_id")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -4657,7 +4657,7 @@ def test_eap_proto_sim_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
tests = [ (1, "aes_128_cbc_decrypt;eap_sim_parse_encr") ]
tests = [(1, "aes_128_cbc_decrypt;eap_sim_parse_encr")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -4686,8 +4686,8 @@ def test_eap_proto_sim_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
tests = [ "eap_sim_msg_add_encr_start;eap_sim_response_notification",
"aes_128_cbc_encrypt;eap_sim_response_notification" ]
tests = ["eap_sim_msg_add_encr_start;eap_sim_response_notification",
"aes_128_cbc_encrypt;eap_sim_response_notification"]
for func in tests:
with fail_test(dev[0], 1, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
@ -4704,7 +4704,7 @@ def test_eap_proto_sim_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
tests = [ "eap_sim_parse_encr;eap_sim_process_notification_reauth" ]
tests = ["eap_sim_parse_encr;eap_sim_process_notification_reauth"]
for func in tests:
with alloc_fail(dev[0], 1, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
@ -4740,14 +4740,14 @@ def test_eap_proto_aka_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "=eap_aka_learn_ids"),
tests = [(1, "=eap_aka_learn_ids"),
(2, "=eap_aka_learn_ids"),
(1, "eap_sim_parse_encr;eap_aka_process_challenge"),
(1, "wpabuf_dup;eap_aka_add_id_msg"),
(1, "wpabuf_resize;eap_aka_add_id_msg"),
(1, "eap_aka_getKey"),
(1, "eap_aka_get_emsk"),
(1, "eap_aka_get_session_id") ]
(1, "eap_aka_get_session_id")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -4775,8 +4775,8 @@ def test_eap_proto_aka_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
tests = [ "eap_sim_msg_add_encr_start;eap_aka_response_notification",
"aes_128_cbc_encrypt;eap_aka_response_notification" ]
tests = ["eap_sim_msg_add_encr_start;eap_aka_response_notification",
"aes_128_cbc_encrypt;eap_aka_response_notification"]
for func in tests:
with fail_test(dev[0], 1, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
@ -4793,7 +4793,7 @@ def test_eap_proto_aka_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
tests = [ "eap_sim_parse_encr;eap_aka_process_notification_reauth" ]
tests = ["eap_sim_parse_encr;eap_aka_process_notification_reauth"]
for func in tests:
with alloc_fail(dev[0], 1, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
@ -4855,8 +4855,8 @@ def test_eap_proto_aka_prime_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
tests = [ (1, "eap_sim_verify_mac_sha256"),
(1, "=eap_aka_process_challenge") ]
tests = [(1, "eap_sim_verify_mac_sha256"),
(1, "=eap_aka_process_challenge")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -5337,7 +5337,7 @@ def test_eap_proto_ikev2(dev, apdev):
timeout=15)
if ev is None:
raise Exception("Timeout on EAP method start")
if i in [ 41, 46 ]:
if i in [41, 46]:
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"],
timeout=10)
if ev is None:
@ -5399,7 +5399,7 @@ def test_eap_proto_ikev2_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "ikev2_encr_encrypt"),
tests = [(1, "ikev2_encr_encrypt"),
(1, "ikev2_encr_decrypt"),
(1, "ikev2_derive_auth_data"),
(2, "ikev2_derive_auth_data"),
@ -5432,7 +5432,7 @@ def test_eap_proto_ikev2_errors(dev, apdev):
(6, "wpabuf_alloc;ikev2_build_sa_init"),
(1, "wpabuf_alloc;ikev2_build_sa_auth"),
(2, "wpabuf_alloc;ikev2_build_sa_auth"),
(1, "ikev2_build_auth;ikev2_build_sa_auth") ]
(1, "ikev2_build_auth;ikev2_build_sa_auth")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -5454,9 +5454,9 @@ def test_eap_proto_ikev2_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "wpabuf_alloc;ikev2_build_notify"),
tests = [(1, "wpabuf_alloc;ikev2_build_notify"),
(2, "wpabuf_alloc;ikev2_build_notify"),
(1, "ikev2_build_encrypted;ikev2_build_notify") ]
(1, "ikev2_build_encrypted;ikev2_build_notify")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -5479,7 +5479,7 @@ def test_eap_proto_ikev2_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "ikev2_integ_hash"),
tests = [(1, "ikev2_integ_hash"),
(1, "ikev2_integ_hash;ikev2_decrypt_payload"),
(1, "os_get_random;ikev2_build_encrypted"),
(1, "ikev2_prf_plus;ikev2_derive_sk_keys"),
@ -5490,7 +5490,7 @@ def test_eap_proto_ikev2_errors(dev, apdev):
(1, "hmac_sha1_vector;?ikev2_prf_hash;ikev2_derive_keys"),
(1, "hmac_sha1_vector;?ikev2_prf_hash;ikev2_derive_auth_data"),
(2, "hmac_sha1_vector;?ikev2_prf_hash;ikev2_derive_auth_data"),
(3, "hmac_sha1_vector;?ikev2_prf_hash;ikev2_derive_auth_data") ]
(3, "hmac_sha1_vector;?ikev2_prf_hash;ikev2_derive_auth_data")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -5512,15 +5512,15 @@ def test_eap_proto_ikev2_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
params = { "ssid": "eap-test2", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
params = {"ssid": "eap-test2", "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" }
"fragment_size": "50"}
hapd2 = hostapd.add_ap(apdev[1], params)
dev[0].scan_for_bss(hapd2.own_addr(), freq=2412)
tests = [ (1, "eap_ikev2_build_frag_ack"),
(1, "wpabuf_alloc;eap_ikev2_process_fragment") ]
tests = [(1, "eap_ikev2_build_frag_ack"),
(1, "wpabuf_alloc;eap_ikev2_process_fragment")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("eap-test2", key_mgmt="WPA-EAP", scan_freq="2412",
@ -5851,14 +5851,14 @@ def test_eap_proto_mschapv2(dev, apdev):
if ev is None:
raise Exception("Timeout on EAP start")
if i in [ 8, 11, 12 ]:
if i in [8, 11, 12]:
ev = dev[0].wait_event(["CTRL-REQ-NEW_PASSWORD"],
timeout=10)
if ev is None:
raise Exception("Timeout on new password request")
id = ev.split(':')[0].split('-')[-1]
dev[0].request("CTRL-RSP-NEW_PASSWORD-" + id + ":new-pw")
if i in [ 11, 12 ]:
if i in [11, 12]:
ev = dev[0].wait_event(["CTRL-EVENT-PASSWORD-CHANGED"],
timeout=10)
if ev is None:
@ -5873,7 +5873,7 @@ def test_eap_proto_mschapv2(dev, apdev):
if ev is None:
raise Exception("Timeout on EAP failure")
if i in [ 13 ]:
if i in [13]:
ev = dev[0].wait_event(["CTRL-REQ-IDENTITY"],
timeout=10)
if ev is None:
@ -5895,7 +5895,7 @@ def test_eap_proto_mschapv2(dev, apdev):
if ev is None:
raise Exception("Timeout on EAP failure")
if i in [ 4, 5, 6, 7, 14 ]:
if i in [4, 5, 6, 7, 14]:
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"],
timeout=10)
if ev is None:
@ -6061,11 +6061,11 @@ def test_eap_proto_mschapv2_errors(dev, apdev):
hapd = start_ap(apdev[0])
dev[0].scan_for_bss(hapd.own_addr(), freq=2412)
tests = [ "os_get_random;eap_mschapv2_change_password",
tests = ["os_get_random;eap_mschapv2_change_password",
"generate_nt_response;eap_mschapv2_change_password",
"get_master_key;eap_mschapv2_change_password",
"nt_password_hash;eap_mschapv2_change_password",
"old_nt_password_hash_encrypted_with_new_nt_password_hash" ]
"old_nt_password_hash_encrypted_with_new_nt_password_hash"]
for func in tests:
with fail_test(dev[0], 1, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -6081,9 +6081,9 @@ def test_eap_proto_mschapv2_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected(timeout=1)
tests = [ "encrypt_pw_block_with_password_hash;eap_mschapv2_change_password",
tests = ["encrypt_pw_block_with_password_hash;eap_mschapv2_change_password",
"nt_password_hash;eap_mschapv2_change_password",
"nt_password_hash;eap_mschapv2_success" ]
"nt_password_hash;eap_mschapv2_success"]
for func in tests:
with fail_test(dev[0], 1, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -6100,7 +6100,7 @@ def test_eap_proto_mschapv2_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected(timeout=1)
tests = [ "eap_msg_alloc;eap_mschapv2_change_password" ]
tests = ["eap_msg_alloc;eap_mschapv2_change_password"]
for func in tests:
with alloc_fail(dev[0], 1, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -6404,7 +6404,7 @@ def test_eap_proto_pwd_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
funcs = [ "eap_pwd_getkey", "eap_pwd_get_emsk" ]
funcs = ["eap_pwd_getkey", "eap_pwd_get_emsk"]
for func in funcs:
with alloc_fail(dev[0], 1, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -6530,10 +6530,10 @@ def test_eap_proto_pwd_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
params = { "ssid": "eap-test2", "wpa": "2", "wpa_key_mgmt": "WPA-EAP",
params = {"ssid": "eap-test2", "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" }
"pwd_group": "19", "fragment_size": "40"}
hapd2 = hostapd.add_ap(apdev[1], params)
dev[0].scan_for_bss(hapd2.own_addr(), freq=2412)
@ -6736,7 +6736,7 @@ def test_eap_proto_fast_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "wpabuf_alloc;eap_fast_tlv_eap_payload"),
tests = [(1, "wpabuf_alloc;eap_fast_tlv_eap_payload"),
(1, "eap_fast_derive_key;eap_fast_derive_key_auth"),
(1, "eap_msg_alloc;eap_peer_tls_phase2_nak"),
(1, "wpabuf_alloc;eap_fast_tlv_result"),
@ -6745,7 +6745,7 @@ def test_eap_proto_fast_errors(dev, apdev):
(1, "eap_peer_tls_decrypt;eap_fast_decrypt"),
(1, "eap_fast_getKey"),
(1, "eap_fast_get_session_id"),
(1, "eap_fast_get_emsk") ]
(1, "eap_fast_get_emsk")]
for count, func in tests:
dev[0].request("SET blob fast_pac_auth_errors ")
with alloc_fail(dev[0], count, func):
@ -6765,14 +6765,14 @@ def test_eap_proto_fast_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "eap_fast_derive_key;eap_fast_derive_key_provisioning"),
tests = [(1, "eap_fast_derive_key;eap_fast_derive_key_provisioning"),
(1, "eap_mschapv2_getKey;eap_fast_get_phase2_key"),
(1, "=eap_fast_use_pac_opaque"),
(1, "eap_fast_copy_buf"),
(1, "=eap_fast_add_pac"),
(1, "=eap_fast_init_pac_data"),
(1, "=eap_fast_write_pac"),
(2, "=eap_fast_write_pac") ]
(2, "=eap_fast_write_pac")]
for count, func in tests:
dev[0].request("SET blob fast_pac_errors ")
with alloc_fail(dev[0], count, func):
@ -6792,9 +6792,9 @@ def test_eap_proto_fast_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "eap_fast_get_cmk;eap_fast_process_crypto_binding"),
tests = [(1, "eap_fast_get_cmk;eap_fast_process_crypto_binding"),
(1, "eap_fast_derive_eap_msk;eap_fast_process_crypto_binding"),
(1, "eap_fast_derive_eap_emsk;eap_fast_process_crypto_binding") ]
(1, "eap_fast_derive_eap_emsk;eap_fast_process_crypto_binding")]
for count, func in tests:
dev[0].request("SET blob fast_pac_auth_errors ")
with fail_test(dev[0], count, func):
@ -6851,7 +6851,7 @@ def test_eap_proto_fast_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ "FOOBAR\n",
tests = ["FOOBAR\n",
"wpa_supplicant EAP-FAST PAC file - version 1\nFOOBAR\n",
"wpa_supplicant EAP-FAST PAC file - version 1\nSTART\n",
"wpa_supplicant EAP-FAST PAC file - version 1\nSTART\nSTART\n",
@ -6863,7 +6863,7 @@ def test_eap_proto_fast_errors(dev, apdev):
"wpa_supplicant EAP-FAST PAC file - version 1\nSTART\nPAC-Opaque=1\nEND\n",
"wpa_supplicant EAP-FAST PAC file - version 1\nSTART\nA-ID=1\nEND\n",
"wpa_supplicant EAP-FAST PAC file - version 1\nSTART\nI-ID=1\nEND\n",
"wpa_supplicant EAP-FAST PAC file - version 1\nSTART\nA-ID-Info=1\nEND\n" ]
"wpa_supplicant EAP-FAST PAC file - version 1\nSTART\nA-ID-Info=1\nEND\n"]
for pac in tests:
blob = binascii.hexlify(pac.encode()).decode()
dev[0].request("SET blob fast_pac_errors " + blob)
@ -6881,8 +6881,8 @@ def test_eap_proto_fast_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ "wpa_supplicant EAP-FAST PAC file - version 1\nSTART\nEND\n",
"wpa_supplicant EAP-FAST PAC file - version 1\nSTART\nEND\nSTART\nEND\nSTART\nEND\n" ]
tests = ["wpa_supplicant EAP-FAST PAC file - version 1\nSTART\nEND\n",
"wpa_supplicant EAP-FAST PAC file - version 1\nSTART\nEND\nSTART\nEND\nSTART\nEND\n"]
for pac in tests:
blob = binascii.hexlify(pac.encode()).decode()
dev[0].request("SET blob fast_pac_errors " + blob)
@ -6919,7 +6919,7 @@ def test_eap_proto_peap_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "eap_mschapv2_getKey;eap_peap_get_isk;eap_peap_derive_cmk"),
tests = [(1, "eap_mschapv2_getKey;eap_peap_get_isk;eap_peap_derive_cmk"),
(1, "eap_msg_alloc;eap_tlv_build_result"),
(1, "eap_mschapv2_init;eap_peap_phase2_request"),
(1, "eap_peer_tls_decrypt;eap_peap_decrypt"),
@ -6929,7 +6929,7 @@ def test_eap_proto_peap_errors(dev, apdev):
(1, "eap_peer_tls_derive_key;eap_peap_process"),
(1, "eap_peer_tls_derive_session_id;eap_peap_process"),
(1, "eap_peap_getKey"),
(1, "eap_peap_get_session_id") ]
(1, "eap_peap_get_session_id")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -6946,9 +6946,9 @@ def test_eap_proto_peap_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "peap_prfplus;eap_peap_derive_cmk"),
tests = [(1, "peap_prfplus;eap_peap_derive_cmk"),
(1, "eap_tlv_add_cryptobinding;eap_tlv_build_result"),
(1, "peap_prfplus;eap_peap_getKey") ]
(1, "peap_prfplus;eap_peap_getKey")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -6999,7 +6999,7 @@ def test_eap_proto_ttls_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "eap_peer_tls_derive_key;eap_ttls_v0_derive_key",
tests = [(1, "eap_peer_tls_derive_key;eap_ttls_v0_derive_key",
"DOMAIN\mschapv2 user", "auth=MSCHAPV2"),
(1, "eap_peer_tls_derive_session_id;eap_ttls_v0_derive_key",
"DOMAIN\mschapv2 user", "auth=MSCHAPV2"),
@ -7048,7 +7048,7 @@ def test_eap_proto_ttls_errors(dev, apdev):
(1, "tls_connection_decrypt;eap_peer_tls_decrypt",
"user", "autheap=MSCHAPV2"),
(1, "eap_peer_tls_phase2_nak;eap_ttls_phase2_request_eap_method",
"cert user", "autheap=MSCHAPV2") ]
"cert user", "autheap=MSCHAPV2")]
for count, func, identity, phase2 in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -7065,8 +7065,8 @@ def test_eap_proto_ttls_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "os_get_random;eap_ttls_phase2_request_mschapv2"),
(1, "mschapv2_derive_response;eap_ttls_phase2_request_mschapv2") ]
tests = [(1, "os_get_random;eap_ttls_phase2_request_mschapv2"),
(1, "mschapv2_derive_response;eap_ttls_phase2_request_mschapv2")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -7083,7 +7083,7 @@ def test_eap_proto_ttls_errors(dev, apdev):
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
tests = [ (1, "nt_challenge_response;eap_ttls_phase2_request_mschap") ]
tests = [(1, "nt_challenge_response;eap_ttls_phase2_request_mschap")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("eap-test", key_mgmt="WPA-EAP", scan_freq="2412",
@ -7187,14 +7187,14 @@ def test_eap_proto_expanded(dev, apdev):
ev = dev[0].wait_event(["CTRL-EVENT-EAP-STARTED"], timeout=5)
if ev is None:
raise Exception("Timeout on EAP start")
if i in [ 1 ]:
if i in [1]:
ev = dev[0].wait_event(["CTRL-EVENT-EAP-METHOD"], timeout=5)
if ev is None:
raise Exception("Timeout on EAP method start")
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=5)
if ev is None:
raise Exception("Timeout on EAP failure")
elif i in [ 2, 3 ]:
elif i in [2, 3]:
ev = dev[0].wait_event(["CTRL-EVENT-EAP-PROPOSED-METHOD"],
timeout=5)
if ev is None:
@ -8322,7 +8322,7 @@ def test_eap_fast_proto_phase2(dev, apdev):
hapd = start_ap(apdev[0])
dev[0].scan_for_bss(hapd.own_addr(), freq=2412)
tests = [ ("Too short Phase 2 TLV frame (len=3)",
tests = [("Too short Phase 2 TLV frame (len=3)",
"ABC",
False),
("EAP-FAST: TLV overflow",
@ -8451,7 +8451,7 @@ def test_eap_fast_proto_phase2(dev, apdev):
True),
("EAP-FAST: Invalid version/subtype in Crypto-Binding TLV",
struct.pack(">HH", EAP_TLV_CRYPTO_BINDING_TLV, 60) + 60*b'A',
True) ]
True)]
for title, payload, failure in tests:
logger.info("Phase 2 test: " + title)
run_eap_fast_phase2(dev, payload, failure)

View File

@ -108,7 +108,7 @@ def test_erp_server_no_match(dev, apdev):
dev[0].wait_connected(timeout=15, error="Reconnection timed out")
def start_erp_as(apdev, erp_domain="example.com", msk_dump=None, tls13=False):
params = { "ssid": "as", "beacon_int": "2000",
params = {"ssid": "as", "beacon_int": "2000",
"radius_server_clients": "auth_serv/radius_clients.conf",
"radius_server_auth_port": '18128',
"eap_server": "1",
@ -122,7 +122,7 @@ def start_erp_as(apdev, erp_domain="example.com", msk_dump=None, tls13=False):
"eap_fast_a_id": "101112131415161718191a1b1c1d1e1f",
"eap_fast_a_id_info": "test server",
"eap_server_erp": "1",
"erp_domain": erp_domain }
"erp_domain": erp_domain}
if msk_dump:
params["dump_msk_file"] = msk_dump
if tls13:
@ -176,7 +176,7 @@ def erp_test(dev, hapd, **kwargs):
if "EAP re-authentication completed successfully" not in ev:
raise Exception("Did not use ERP")
dev.wait_connected(timeout=15, error="Reconnection timed out")
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")
dev.request("DISCONNECT")

View File

@ -74,8 +74,8 @@ def test_ext_password_interworking(dev, apdev):
dev[0].hs20_enable()
dev[0].request("SET ext_password_backend test:pw1=password")
id = dev[0].add_cred_values({ 'realm': "example.com",
'username': "hs20-test" })
id = dev[0].add_cred_values({'realm': "example.com",
'username': "hs20-test"})
dev[0].set_cred(id, "password", "ext:pw1")
interworking_select(dev[0], bssid, freq="2412")
interworking_connect(dev[0], bssid, "TTLS")

View File

@ -567,13 +567,13 @@ def test_fils_sk_multiple_realms(dev, apdev, params):
params['wpa_key_mgmt'] = "FILS-SHA256"
params['auth_server_port'] = "18128"
params['erp_domain'] = 'example.com'
fils_realms = [ 'r1.example.org', 'r2.EXAMPLE.org', 'r3.example.org',
fils_realms = ['r1.example.org', 'r2.EXAMPLE.org', 'r3.example.org',
'r4.example.org', 'r5.example.org', 'r6.example.org',
'r7.example.org', 'r8.example.org',
'example.com',
'r9.example.org', 'r10.example.org', 'r11.example.org',
'r12.example.org', 'r13.example.org', 'r14.example.org',
'r15.example.org', 'r16.example.org' ]
'r15.example.org', 'r16.example.org']
params['fils_realm'] = fils_realms
params['fils_cache_id'] = "1234"
params['hessid'] = bssid
@ -644,22 +644,22 @@ def test_fils_sk_multiple_realms(dev, apdev, params):
hwsim_utils.test_connectivity(dev[0], hapd)
# DHCP message op codes
BOOTREQUEST=1
BOOTREPLY=2
BOOTREQUEST = 1
BOOTREPLY = 2
OPT_PAD=0
OPT_DHCP_MESSAGE_TYPE=53
OPT_RAPID_COMMIT=80
OPT_END=255
OPT_PAD = 0
OPT_DHCP_MESSAGE_TYPE = 53
OPT_RAPID_COMMIT = 80
OPT_END = 255
DHCPDISCOVER=1
DHCPOFFER=2
DHCPREQUEST=3
DHCPDECLINE=4
DHCPACK=5
DHCPNAK=6
DHCPRELEASE=7
DHCPINFORM=8
DHCPDISCOVER = 1
DHCPOFFER = 2
DHCPREQUEST = 3
DHCPDECLINE = 4
DHCPACK = 5
DHCPNAK = 6
DHCPRELEASE = 7
DHCPINFORM = 8
def build_dhcp(req, dhcp_msg, chaddr, giaddr="0.0.0.0",
ip_src="0.0.0.0", ip_dst="255.255.255.255",
@ -673,7 +673,7 @@ def build_dhcp(req, dhcp_msg, chaddr, giaddr="0.0.0.0",
_yiaddr = b'\x00\x00\x00\x00'
_siaddr = b'\x00\x00\x00\x00'
_giaddr = socket.inet_pton(socket.AF_INET, giaddr)
_chaddr = binascii.unhexlify(chaddr.replace(':','')) + 10 * b'\x00'
_chaddr = binascii.unhexlify(chaddr.replace(':', '')) + 10 * b'\x00'
htype = 1 # Hardware address type; 1 = Ethernet
hlen = 6 # Hardware address length
hops = 0
@ -764,19 +764,19 @@ def run_fils_sk_hlp(dev, apdev, rapid_commit_server, params):
dev[0].request("ERP_FLUSH")
if "OK" not in dev[0].request("FILS_HLP_REQ_FLUSH"):
raise Exception("Failed to flush pending FILS HLP requests")
tests = [ "",
tests = ["",
"q",
"ff:ff:ff:ff:ff:ff",
"ff:ff:ff:ff:ff:ff q" ]
"ff:ff:ff:ff:ff:ff q"]
for t in tests:
if "FAIL" not in dev[0].request("FILS_HLP_REQ_ADD " + t):
raise Exception("Invalid FILS_HLP_REQ_ADD accepted: " + t)
dhcpdisc = build_dhcp(req=True, dhcp_msg=DHCPDISCOVER,
chaddr=dev[0].own_addr())
tests = [ "ff:ff:ff:ff:ff:ff aabb",
tests = ["ff:ff:ff:ff:ff:ff aabb",
"ff:ff:ff:ff:ff:ff " + 255*'cc',
hapd.own_addr() + " ddee010203040506070809",
"ff:ff:ff:ff:ff:ff " + binascii.hexlify(dhcpdisc).decode() ]
"ff:ff:ff:ff:ff:ff " + binascii.hexlify(dhcpdisc).decode()]
for t in tests:
if "OK" not in dev[0].request("FILS_HLP_REQ_ADD " + t):
raise Exception("FILS_HLP_REQ_ADD failed: " + t)
@ -791,7 +791,7 @@ def run_fils_sk_hlp(dev, apdev, rapid_commit_server, params):
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
if rapid_commit_server:
# TODO: Proper rapid commit response
@ -802,7 +802,7 @@ def run_fils_sk_hlp(dev, apdev, rapid_commit_server, params):
dhcpdisc = build_dhcp(req=False, dhcp_msg=DHCPOFFER, rapid_commit=False,
chaddr=dev[0].own_addr(), giaddr="127.0.0.3")
sock.sendto(dhcpdisc[2+20+8:], addr)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dhcpdisc = build_dhcp(req=False, dhcp_msg=DHCPACK, rapid_commit=False,
chaddr=dev[0].own_addr(), giaddr="127.0.0.3")
@ -827,7 +827,7 @@ def run_fils_sk_hlp(dev, apdev, rapid_commit_server, params):
raise Exception("Unexpected UDP port in HLP response")
dhcp = frame[0:28]
frame = frame[28:]
op,htype,hlen,hops,xid,secs,flags,ciaddr,yiaddr,siaddr,giaddr = struct.unpack('>4BL2H4L', dhcp)
op, htype, hlen, hops, xid, secs, flags, ciaddr, yiaddr, siaddr, giaddr = struct.unpack('>4BL2H4L', dhcp)
chaddr = frame[0:16]
frame = frame[16:]
sname = frame[0:64]
@ -881,7 +881,7 @@ def test_fils_sk_hlp_timeout(dev, apdev, params):
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
# Wait for HLP wait timeout to hit
# FILS: HLP response timeout - continue with association response
@ -946,7 +946,7 @@ def test_fils_sk_hlp_oom(dev, apdev, params):
dev[0].dump_monitor()
with alloc_fail(hapd, 1, "wpabuf_alloc;fils_dhcp_handler"):
dev[0].select_network(id, freq=2412)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dhcpdisc = build_dhcp(req=False, dhcp_msg=DHCPACK,
chaddr=dev[0].own_addr(), giaddr="127.0.0.3")
@ -958,7 +958,7 @@ def test_fils_sk_hlp_oom(dev, apdev, params):
dev[0].dump_monitor()
with alloc_fail(hapd, 1, "wpabuf_resize;fils_dhcp_handler"):
dev[0].select_network(id, freq=2412)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dhcpdisc = build_dhcp(req=False, dhcp_msg=DHCPACK,
chaddr=dev[0].own_addr(), giaddr="127.0.0.3")
@ -969,7 +969,7 @@ def test_fils_sk_hlp_oom(dev, apdev, params):
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dhcpoffer = build_dhcp(req=False, dhcp_msg=DHCPOFFER, rapid_commit=False,
chaddr=dev[0].own_addr(), giaddr="127.0.0.3")
@ -1068,7 +1068,7 @@ def test_fils_sk_hlp_req_parsing(dev, apdev, params):
dhcp_valid = build_dhcp(req=True, dhcp_msg=DHCPDISCOVER,
chaddr=dev[0].own_addr())
tests = [ "ff",
tests = ["ff",
"0800",
"0800" + 20*"00",
"0800" + binascii.hexlify(ipv4_overflow).decode(),
@ -1080,7 +1080,7 @@ def test_fils_sk_hlp_req_parsing(dev, apdev, params):
"0800" + binascii.hexlify(dhcp_missing_data).decode(),
binascii.hexlify(dhcp_not_req).decode(),
binascii.hexlify(dhcp_no_magic).decode(),
binascii.hexlify(dhcp_unknown_magic).decode() ]
binascii.hexlify(dhcp_unknown_magic).decode()]
for t in tests:
if "OK" not in dev[0].request("FILS_HLP_REQ_ADD ff:ff:ff:ff:ff:ff " + t):
raise Exception("FILS_HLP_REQ_ADD failed: " + t)
@ -1099,8 +1099,8 @@ def test_fils_sk_hlp_req_parsing(dev, apdev, params):
dev[0].wait_disconnected()
dev[0].request("FILS_HLP_REQ_FLUSH")
tests = [ binascii.hexlify(dhcp_opts).decode(),
binascii.hexlify(dhcp_opts2).decode() ]
tests = [binascii.hexlify(dhcp_opts).decode(),
binascii.hexlify(dhcp_opts2).decode()]
for t in tests:
if "OK" not in dev[0].request("FILS_HLP_REQ_ADD ff:ff:ff:ff:ff:ff " + t):
raise Exception("FILS_HLP_REQ_ADD failed: " + t)
@ -1192,13 +1192,13 @@ def test_fils_sk_hlp_dhcp_parsing(dev, apdev, params):
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dhcpdisc = build_dhcp(req=False, dhcp_msg=DHCPACK,
chaddr=dev[0].own_addr(), giaddr="127.0.0.3")
#sock.sendto(dhcpdisc[2+20+8:], addr)
chaddr = binascii.unhexlify(dev[0].own_addr().replace(':','')) + 10*b'\x00'
tests = [ b"\x00",
chaddr = binascii.unhexlify(dev[0].own_addr().replace(':', '')) + 10*b'\x00'
tests = [b"\x00",
b"\x02" + 500 * b"\x00",
b"\x02\x00\x00\x00" + 20*b"\x00" + b"\x7f\x00\x00\x03" + 500*b"\x00",
b"\x02\x00\x00\x00" + 20*b"\x00" + b"\x7f\x00\x00\x03" + 16*b"\x00" + 64*b"\x00" + 128*b"\x00" + b"\x63\x82\x53\x63",
@ -1206,7 +1206,7 @@ def test_fils_sk_hlp_dhcp_parsing(dev, apdev, params):
b"\x02\x00\x00\x00" + 20*b"\x00" + b"\x7f\x00\x00\x03" + 16*b"\x00" + 64*b"\x00" + 128*b"\x00" + b"\x63\x82\x53\x63" + b"\x11\x01",
b"\x02\x00\x00\x00" + 20*b"\x00" + b"\x7f\x00\x00\x03" + chaddr + 64*b"\x00" + 128*b"\x00" + b"\x63\x82\x53\x63" + b"\x35\x00\xff",
b"\x02\x00\x00\x00" + 20*b"\x00" + b"\x7f\x00\x00\x03" + chaddr + 64*b"\x00" + 128*b"\x00" + b"\x63\x82\x53\x63" + b"\x35\x01\x00\xff",
1501 * b"\x00" ]
1501 * b"\x00"]
for t in tests:
sock.sendto(t, addr)
dev[0].wait_connected()
@ -1216,7 +1216,7 @@ def test_fils_sk_hlp_dhcp_parsing(dev, apdev, params):
# FILS: DHCP sendto failed: Invalid argument for second DHCP TX in proxy
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
hapd.set("dhcp_server_port", "0")
dhcpoffer = build_dhcp(req=False, dhcp_msg=DHCPOFFER, rapid_commit=False,
@ -1230,13 +1230,13 @@ def test_fils_sk_hlp_dhcp_parsing(dev, apdev, params):
# Options in DHCPOFFER
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dhcpoffer = build_dhcp(req=False, dhcp_msg=DHCPOFFER, rapid_commit=False,
chaddr=dev[0].own_addr(), giaddr="127.0.0.3",
extra_op=b"\x00\x11", opt_end=False)
sock.sendto(dhcpoffer[2+20+8:], addr)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dev[0].wait_connected()
dev[0].request("DISCONNECT")
@ -1245,13 +1245,13 @@ def test_fils_sk_hlp_dhcp_parsing(dev, apdev, params):
# Options in DHCPOFFER (2)
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dhcpoffer = build_dhcp(req=False, dhcp_msg=DHCPOFFER, rapid_commit=False,
chaddr=dev[0].own_addr(), giaddr="127.0.0.3",
extra_op=b"\x11\x01", opt_end=False)
sock.sendto(dhcpoffer[2+20+8:], addr)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dev[0].wait_connected()
dev[0].request("DISCONNECT")
@ -1260,13 +1260,13 @@ def test_fils_sk_hlp_dhcp_parsing(dev, apdev, params):
# Server ID in DHCPOFFER
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dhcpoffer = build_dhcp(req=False, dhcp_msg=DHCPOFFER, rapid_commit=False,
chaddr=dev[0].own_addr(), giaddr="127.0.0.3",
extra_op=b"\x36\x01\x30")
sock.sendto(dhcpoffer[2+20+8:], addr)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dev[0].wait_connected()
dev[0].request("DISCONNECT")
@ -1281,7 +1281,7 @@ def test_fils_sk_hlp_dhcp_parsing(dev, apdev, params):
raise Exception("FILS_HLP_REQ_ADD failed")
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dhcpoffer = build_dhcp(req=False, dhcp_msg=DHCPOFFER, rapid_commit=False,
chaddr=dev[0].own_addr(), giaddr="127.0.0.3",
@ -1300,7 +1300,7 @@ def test_fils_sk_hlp_dhcp_parsing(dev, apdev, params):
raise Exception("FILS_HLP_REQ_ADD failed")
dev[0].dump_monitor()
dev[0].select_network(id, freq=2412)
(msg,addr) = sock.recvfrom(1000)
(msg, addr) = sock.recvfrom(1000)
logger.debug("Received DHCP message from %s" % str(addr))
dhcpoffer = build_dhcp(req=False, dhcp_msg=DHCPOFFER, rapid_commit=False,
chaddr=dev[0].own_addr(), giaddr="127.0.0.3",
@ -1356,7 +1356,7 @@ def test_fils_sk_erp_sim(dev, apdev, params):
check_fils_capa(dev[0])
check_erp_capa(dev[0])
realm='wlan.mnc001.mcc232.3gppnetwork.org'
realm = 'wlan.mnc001.mcc232.3gppnetwork.org'
start_erp_as(apdev[1], erp_domain=realm,
msk_dump=os.path.join(params['logdir'], "msk.lst"))
@ -1431,10 +1431,10 @@ def run_fils_sk_pfs(dev, apdev, group, params):
check_erp_capa(dev[0])
tls = dev[0].request("GET tls_library")
if int(group) in [ 25 ]:
if int(group) in [25]:
if not (tls.startswith("OpenSSL") and ("build=OpenSSL 1.0.2" in tls or "build=OpenSSL 1.1" in tls) and ("run=OpenSSL 1.0.2" in tls or "run=OpenSSL 1.1" in tls)):
raise HwsimSkip("EC group not supported")
if int(group) in [ 27, 28, 29, 30 ]:
if int(group) in [27, 28, 29, 30]:
if not (tls.startswith("OpenSSL") and ("build=OpenSSL 1.0.2" in tls or "build=OpenSSL 1.1" in tls) and ("run=OpenSSL 1.0.2" in tls or "run=OpenSSL 1.1" in tls)):
raise HwsimSkip("Brainpool EC group not supported")
@ -1744,7 +1744,7 @@ def test_fils_and_ft(dev, apdev, params):
params["reassociation_deadline"] = "1000"
params['nas_identifier'] = "nas1.w1.fi"
params['r1_key_holder'] = "000102030405"
params['r0kh'] = [ "02:00:00:00:04:00 nas2.w1.fi 300102030405060708090a0b0c0d0e0f" ]
params['r0kh'] = ["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"
params['ieee80211w'] = "1"
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
@ -1781,7 +1781,7 @@ def test_fils_and_ft(dev, apdev, params):
params['wpa_key_mgmt'] = "FT-EAP"
params['nas_identifier'] = "nas2.w1.fi"
params['r1_key_holder'] = "000102030406"
params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0e0f" ]
params['r0kh'] = ["02:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0e0f"]
params['r1kh'] = "02:00:00:00:03:00 00:01:02:03:04:05 300102030405060708090a0b0c0d0e0f"
hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
@ -1893,8 +1893,8 @@ def run_fils_and_ft_setup(dev, apdev, params, key_mgmt):
params["reassociation_deadline"] = "1000"
params['nas_identifier'] = "nas1.w1.fi"
params['r1_key_holder'] = "000102030405"
params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 100102030405060708090a0b0c0d0e0f100102030405060708090a0b0c0d0e0f",
"02:00:00:00:04:00 nas2.w1.fi 300102030405060708090a0b0c0d0e0f" ]
params['r0kh'] = ["02:00:00:00:03:00 nas1.w1.fi 100102030405060708090a0b0c0d0e0f100102030405060708090a0b0c0d0e0f",
"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"
params['ieee80211w'] = "2"
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
@ -1924,8 +1924,8 @@ def run_fils_and_ft_setup(dev, apdev, params, key_mgmt):
params['wpa_key_mgmt'] = key_mgmt
params['nas_identifier'] = "nas2.w1.fi"
params['r1_key_holder'] = "000102030406"
params['r0kh'] = [ "02:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0e0f",
"02:00:00:00:04:00 nas2.w1.fi 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f" ]
params['r0kh'] = ["02:00:00:00:03:00 nas1.w1.fi 200102030405060708090a0b0c0d0e0f",
"02:00:00:00:04:00 nas2.w1.fi 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f"]
params['r1kh'] = "02:00:00:00:03:00 00:01:02:03:04:05 300102030405060708090a0b0c0d0e0f"
hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
@ -2009,7 +2009,7 @@ def test_fils_assoc_replay(dev, apdev, params):
filt = "wlan.fc.type == 2 && " + \
"wlan.da == " + sta + " && " + \
"wlan.sa == " + ap + " && wlan.ccmp.extiv"
fields = [ "wlan.ccmp.extiv" ]
fields = ["wlan.ccmp.extiv"]
res = run_tshark(capfile, filt, fields)
vals = res.splitlines()
logger.info("CCMP PN: " + str(vals))

View File

@ -162,7 +162,7 @@ class FstLauncher:
'alt-hostapd/hostapd/hostapd')
if not os.path.exists(prg):
prg = '../../hostapd/hostapd'
cmd = [ prg, '-B', '-dddt',
cmd = [prg, '-B', '-dddt',
'-P', pidfile, '-f', mylogfile, '-g', self.hapd_fst_global]
for i in range(0, len(self.cfgs_to_run)):
cfg = self.cfgs_to_run[i]
@ -189,8 +189,8 @@ class FstLauncher:
'alt-wpa_supplicant/wpa_supplicant/wpa_supplicant')
if not os.path.exists(prg):
prg = '../../wpa_supplicant/wpa_supplicant'
cmd = [ prg, '-B', '-dddt',
'-P' + pidfile, '-f', mylogfile, '-g', self.wsup_fst_global ]
cmd = [prg, '-B', '-dddt',
'-P' + pidfile, '-f', mylogfile, '-g', self.wsup_fst_global]
sta_no = 0
for i in range(0, len(self.cfgs_to_run)):
cfg = self.cfgs_to_run[i]
@ -295,9 +295,9 @@ def scan_and_get_bss(dev, frq):
# AP configuration tests
def run_test_ap_configuration(apdev, test_params,
fst_group = fst_test_common.fst_test_def_group,
fst_pri = fst_test_common.fst_test_def_prio_high,
fst_llt = fst_test_common.fst_test_def_llt):
fst_group=fst_test_common.fst_test_def_group,
fst_pri=fst_test_common.fst_test_def_prio_high,
fst_llt=fst_test_common.fst_test_def_llt):
"""Runs FST hostapd where the 1st AP configuration is fixed, the 2nd fst
configuration is provided by the parameters. Returns the result of the run:
0 - no errors discovered, an error otherwise. The function is used for
@ -318,9 +318,9 @@ def run_test_ap_configuration(apdev, test_params,
return res
def run_test_sta_configuration(test_params,
fst_group = fst_test_common.fst_test_def_group,
fst_pri = fst_test_common.fst_test_def_prio_high,
fst_llt = fst_test_common.fst_test_def_llt):
fst_group=fst_test_common.fst_test_def_group,
fst_pri=fst_test_common.fst_test_def_prio_high,
fst_llt=fst_test_common.fst_test_def_llt):
"""Runs FST wpa_supplicant where the 1st STA configuration is fixed, the
2nd fst configuration is provided by the parameters. Returns the result of
the run: 0 - no errors discovered, an error otherwise. The function is used
@ -339,57 +339,57 @@ def run_test_sta_configuration(test_params,
def test_fst_ap_config_llt_neg(dev, apdev, test_params):
"""FST AP configuration negative LLT"""
res = run_test_ap_configuration(apdev, test_params, fst_llt = '-1')
res = run_test_ap_configuration(apdev, test_params, fst_llt='-1')
if res == 0:
raise Exception("hostapd started with a negative llt")
def test_fst_ap_config_llt_zero(dev, apdev, test_params):
"""FST AP configuration zero LLT"""
res = run_test_ap_configuration(apdev, test_params, fst_llt = '0')
res = run_test_ap_configuration(apdev, test_params, fst_llt='0')
if res == 0:
raise Exception("hostapd started with a zero llt")
def test_fst_ap_config_llt_too_big(dev, apdev, test_params):
"""FST AP configuration LLT is too big"""
res = run_test_ap_configuration(apdev, test_params,
fst_llt = '4294967296') #0x100000000
fst_llt='4294967296') #0x100000000
if res == 0:
raise Exception("hostapd started with llt that is too big")
def test_fst_ap_config_llt_nan(dev, apdev, test_params):
"""FST AP configuration LLT is not a number"""
res = run_test_ap_configuration(apdev, test_params, fst_llt = 'nan')
res = run_test_ap_configuration(apdev, test_params, fst_llt='nan')
if res == 0:
raise Exception("hostapd started with llt not a number")
def test_fst_ap_config_pri_neg(dev, apdev, test_params):
"""FST AP configuration Priority negative"""
res = run_test_ap_configuration(apdev, test_params, fst_pri = '-1')
res = run_test_ap_configuration(apdev, test_params, fst_pri='-1')
if res == 0:
raise Exception("hostapd started with a negative fst priority")
def test_fst_ap_config_pri_zero(dev, apdev, test_params):
"""FST AP configuration Priority zero"""
res = run_test_ap_configuration(apdev, test_params, fst_pri = '0')
res = run_test_ap_configuration(apdev, test_params, fst_pri='0')
if res == 0:
raise Exception("hostapd started with a zero fst priority")
def test_fst_ap_config_pri_large(dev, apdev, test_params):
"""FST AP configuration Priority too large"""
res = run_test_ap_configuration(apdev, test_params, fst_pri = '256')
res = run_test_ap_configuration(apdev, test_params, fst_pri='256')
if res == 0:
raise Exception("hostapd started with too large fst priority")
def test_fst_ap_config_pri_nan(dev, apdev, test_params):
"""FST AP configuration Priority not a number"""
res = run_test_ap_configuration(apdev, test_params, fst_pri = 'nan')
res = run_test_ap_configuration(apdev, test_params, fst_pri='nan')
if res == 0:
raise Exception("hostapd started with fst priority not a number")
def test_fst_ap_config_group_len(dev, apdev, test_params):
"""FST AP configuration Group max length"""
res = run_test_ap_configuration(apdev, test_params,
fst_group = 'fstg5678abcd34567')
fst_group='fstg5678abcd34567')
if res == 0:
raise Exception("hostapd started with fst_group length too big")
@ -401,7 +401,7 @@ def test_fst_ap_config_good(dev, apdev, test_params):
def test_fst_ap_config_default(dev, apdev, test_params):
"""FST AP configuration default parameters"""
res = run_test_ap_configuration(apdev, test_params, fst_llt = None)
res = run_test_ap_configuration(apdev, test_params, fst_llt=None)
if res != 0:
raise Exception("hostapd didn't start with valid config parameters")
@ -410,57 +410,57 @@ def test_fst_ap_config_default(dev, apdev, test_params):
def test_fst_sta_config_llt_neg(dev, apdev, test_params):
"""FST STA configuration negative LLT"""
res = run_test_sta_configuration(test_params, fst_llt = '-1')
res = run_test_sta_configuration(test_params, fst_llt='-1')
if res == 0:
raise Exception("wpa_supplicant started with a negative llt")
def test_fst_sta_config_llt_zero(dev, apdev, test_params):
"""FST STA configuration zero LLT"""
res = run_test_sta_configuration(test_params, fst_llt = '0')
res = run_test_sta_configuration(test_params, fst_llt='0')
if res == 0:
raise Exception("wpa_supplicant started with a zero llt")
def test_fst_sta_config_llt_large(dev, apdev, test_params):
"""FST STA configuration LLT is too large"""
res = run_test_sta_configuration(test_params,
fst_llt = '4294967296') #0x100000000
fst_llt='4294967296') #0x100000000
if res == 0:
raise Exception("wpa_supplicant started with llt that is too large")
def test_fst_sta_config_llt_nan(dev, apdev, test_params):
"""FST STA configuration LLT is not a number"""
res = run_test_sta_configuration(test_params, fst_llt = 'nan')
res = run_test_sta_configuration(test_params, fst_llt='nan')
if res == 0:
raise Exception("wpa_supplicant started with llt not a number")
def test_fst_sta_config_pri_neg(dev, apdev, test_params):
"""FST STA configuration Priority negative"""
res = run_test_sta_configuration(test_params, fst_pri = '-1')
res = run_test_sta_configuration(test_params, fst_pri='-1')
if res == 0:
raise Exception("wpa_supplicant started with a negative fst priority")
def test_fst_sta_config_pri_zero(dev, apdev, test_params):
"""FST STA configuration Priority zero"""
res = run_test_sta_configuration(test_params, fst_pri = '0')
res = run_test_sta_configuration(test_params, fst_pri='0')
if res == 0:
raise Exception("wpa_supplicant started with a zero fst priority")
def test_fst_sta_config_pri_big(dev, apdev, test_params):
"""FST STA configuration Priority too large"""
res = run_test_sta_configuration(test_params, fst_pri = '256')
res = run_test_sta_configuration(test_params, fst_pri='256')
if res == 0:
raise Exception("wpa_supplicant started with too large fst priority")
def test_fst_sta_config_pri_nan(dev, apdev, test_params):
"""FST STA configuration Priority not a number"""
res = run_test_sta_configuration(test_params, fst_pri = 'nan')
res = run_test_sta_configuration(test_params, fst_pri='nan')
if res == 0:
raise Exception("wpa_supplicant started with fst priority not a number")
def test_fst_sta_config_group_len(dev, apdev, test_params):
"""FST STA configuration Group max length"""
res = run_test_sta_configuration(test_params,
fst_group = 'fstg5678abcd34567')
fst_group='fstg5678abcd34567')
if res == 0:
raise Exception("wpa_supplicant started with fst_group length too big")
@ -472,7 +472,7 @@ def test_fst_sta_config_good(dev, apdev, test_params):
def test_fst_sta_config_default(dev, apdev, test_params):
"""FST STA configuration default parameters"""
res = run_test_sta_configuration(test_params, fst_llt = None)
res = run_test_sta_configuration(test_params, fst_llt=None)
if res != 0:
raise Exception("wpa_supplicant didn't start with valid config parameters")
@ -496,9 +496,9 @@ def test_fst_scan_mb(dev, apdev, test_params):
if res != 0:
raise Exception("hostapd didn't start properly")
try:
mbie1=[]
mbie1 = []
flags1 = ''
mbie2=[]
mbie2 = []
flags2 = ''
# Scan 1st AP
vals1 = scan_and_get_bss(dev[0], fst_test_common.fst_test_def_freq_a)
@ -511,7 +511,7 @@ def test_fst_scan_mb(dev, apdev, test_params):
vals2 = scan_and_get_bss(dev[2], fst_test_common.fst_test_def_freq_g)
if vals2 != None:
if 'ie' in vals2:
mbie2 = parse_ies(vals2['ie'],0x9e)
mbie2 = parse_ies(vals2['ie'], 0x9e)
if 'flags' in vals2:
flags2 = vals2['flags']
finally:
@ -538,7 +538,7 @@ def test_fst_scan_nomb(dev, apdev, test_params):
raise Exception("Hostapd didn't start properly")
try:
time.sleep(2)
mbie1=[]
mbie1 = []
flags1 = ''
vals1 = scan_and_get_bss(dev[0], fst_test_common.fst_test_def_freq_a)
if vals1 != None:

View File

@ -84,7 +84,7 @@ bad_param_names = ("None",
"Bad fsts_id")
def fst_start_session(apdev, test_params, bad_param_type, start_on_ap,
peer_addr = None):
peer_addr=None):
"""This function makes the necessary preparations and the adds and sets a
session using either correct or incorrect parameters depending on the value
of bad_param_type. If the call ends as expected (with session being
@ -354,7 +354,7 @@ def fst_transfer_session(apdev, test_params, bad_param_type, init_on_ap,
responder = ap1
new_iface = sta2.ifname()
new_peer_addr = sta2.get_actual_peer_addr()
initiator.add_peer(responder, new_peer_addr = new_peer_addr)
initiator.add_peer(responder, new_peer_addr=new_peer_addr)
sid = initiator.add_session()
initiator.configure_session(sid, new_iface)
if bad_param_type != bad_param_session_transfer_setup_skipped:
@ -413,7 +413,7 @@ def fst_tear_down_session(apdev, test_params, bad_param_type, init_on_ap):
responder = ap1
new_iface = sta2.ifname()
new_peer_addr = sta2.get_actual_peer_addr()
initiator.add_peer(responder, new_peer_addr = new_peer_addr)
initiator.add_peer(responder, new_peer_addr=new_peer_addr)
sid = initiator.add_session()
initiator.configure_session(sid, new_iface)
if bad_param_type != bad_param_session_teardown_setup_skipped:
@ -492,7 +492,7 @@ def fst_remove_session(apdev, test_params, remove_session_scenario, init_on_ap):
responder = ap1
new_iface = sta2.ifname()
new_peer_addr = sta2.get_actual_peer_addr()
initiator.add_peer(responder, new_peer_addr = new_peer_addr)
initiator.add_peer(responder, new_peer_addr=new_peer_addr)
sid = initiator.add_session()
initiator.configure_session(sid, new_iface)
if remove_session_scenario != remove_scenario_no_params:
@ -544,7 +544,7 @@ frame_type_names = ("Session request",
"Ack response",
"Tear down")
def fst_send_unexpected_frame(apdev, test_params, frame_type, send_from_ap, additional_param = ''):
def fst_send_unexpected_frame(apdev, test_params, frame_type, send_from_ap, additional_param=''):
"""This function creates two pairs of APs and stations, makes them connect
and then causes one side to send an unexpected FST frame of the specified
type to the other. The other side should then identify and ignore the
@ -568,8 +568,8 @@ def fst_send_unexpected_frame(apdev, test_params, frame_type, send_from_ap, addi
receiver = ap1
new_iface = sta2.ifname()
new_peer_addr = sta2.get_actual_peer_addr()
sender.add_peer(receiver, new_peer_addr = new_peer_addr)
sid=sender.add_session()
sender.add_peer(receiver, new_peer_addr=new_peer_addr)
sid = sender.add_session()
sender.configure_session(sid, new_iface)
if frame_type == frame_type_session_request:
sender.send_session_setup_request(sid)
@ -663,7 +663,7 @@ def fst_bad_transfer(apdev, test_params, bad_scenario_type, init_on_ap):
responder = ap1
new_iface = sta2.ifname()
new_peer_addr = sta2.get_actual_peer_addr()
initiator.add_peer(responder, new_peer_addr = new_peer_addr)
initiator.add_peer(responder, new_peer_addr=new_peer_addr)
sid = initiator.add_session()
initiator.configure_session(sid, new_iface)
if (bad_scenario_type != bad_scenario_ack_req_session_not_set_up and
@ -739,7 +739,7 @@ def test_fst_sta_connect_to_non_fst_ap(dev, apdev, test_params):
"""FST STA connecting to non-FST AP"""
ap1, ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
with HWSimRadio() as (radio, iface):
non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
non_fst_ap = hostapd.add_ap(iface, {"ssid": "non_fst_11g"})
try:
orig_sta1_mbies = sta1.get_local_mbies()
orig_sta2_mbies = sta2.get_local_mbies()
@ -822,7 +822,7 @@ def test_fst_second_sta_connect_to_non_fst_ap(dev, apdev, test_params):
"""FST STA 2nd connecting to non-FST AP"""
fst_ap1, fst_ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
with HWSimRadio() as (radio, iface):
non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
non_fst_ap = hostapd.add_ap(iface, {"ssid": "non_fst_11g"})
try:
vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
@ -852,7 +852,7 @@ def test_fst_second_sta_connect_to_fst_ap(dev, apdev, test_params):
"""FST STA 2nd connecting to FST AP"""
fst_ap1, fst_ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
with HWSimRadio() as (radio, iface):
non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
non_fst_ap = hostapd.add_ap(iface, {"ssid": "non_fst_11g"})
try:
sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g",
key_mgmt="NONE", scan_freq='2412')
@ -882,7 +882,7 @@ def test_fst_disconnect_1_of_2_stas_from_non_fst_ap(dev, apdev, test_params):
"""FST disconnect 1 of 2 STAs from non-FST AP"""
fst_ap1, fst_ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
with HWSimRadio() as (radio, iface):
non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
non_fst_ap = hostapd.add_ap(iface, {"ssid": "non_fst_11g"})
try:
vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
@ -913,7 +913,7 @@ def test_fst_disconnect_1_of_2_stas_from_fst_ap(dev, apdev, test_params):
"""FST disconnect 1 of 2 STAs from FST AP"""
fst_ap1, fst_ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
with HWSimRadio() as (radio, iface):
non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
non_fst_ap = hostapd.add_ap(iface, {"ssid": "non_fst_11g"})
try:
vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
@ -944,7 +944,7 @@ def test_fst_disconnect_2_of_2_stas_from_non_fst_ap(dev, apdev, test_params):
"""FST disconnect 2 of 2 STAs from non-FST AP"""
fst_ap1, fst_ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
with HWSimRadio() as (radio, iface):
non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
non_fst_ap = hostapd.add_ap(iface, {"ssid": "non_fst_11g"})
try:
vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
@ -977,7 +977,7 @@ def test_fst_disconnect_2_of_2_stas_from_fst_ap(dev, apdev, test_params):
"""FST disconnect 2 of 2 STAs from FST AP"""
fst_ap1, fst_ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
with HWSimRadio() as (radio, iface):
non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g"})
non_fst_ap = hostapd.add_ap(iface, {"ssid": "non_fst_11g"})
try:
vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
@ -1444,7 +1444,7 @@ def test_fst_ap_ctrl_iface(dev, apdev, test_params):
if len(res) != 1 + start_num_groups:
raise Exception("Unexpected number of groups")
tests = [ "LIST_IFACES unknown",
tests = ["LIST_IFACES unknown",
"LIST_IFACES unknown2",
"SESSION_GET 12345678",
"SESSION_SET " + sid + " unknown=foo",
@ -1479,16 +1479,16 @@ def test_fst_ap_ctrl_iface(dev, apdev, test_params):
"IFACE_PEERS unknown",
"IFACE_PEERS unknown unknown",
"IFACE_PEERS " + initiator.fst_group,
"IFACE_PEERS " + initiator.fst_group + " unknown" ]
"IFACE_PEERS " + initiator.fst_group + " unknown"]
for t in tests:
if "FAIL" not in initiator.grequest("FST-MANAGER " + t):
raise Exception("Unexpected response for invalid FST-MANAGER command " + t)
if "UNKNOWN FST COMMAND" not in initiator.grequest("FST-MANAGER unknown"):
raise Exception("Unexpected response for unknown FST-MANAGER command")
tests = [ "FST-DETACH", "FST-DETACH ", "FST-DETACH unknown",
tests = ["FST-DETACH", "FST-DETACH ", "FST-DETACH unknown",
"FST-ATTACH", "FST-ATTACH ", "FST-ATTACH unknown",
"FST-ATTACH unknown unknown" ]
"FST-ATTACH unknown unknown"]
for t in tests:
if "FAIL" not in initiator.grequest(t):
raise Exception("Unexpected response for invalid command " + t)
@ -1823,7 +1823,7 @@ FST_ACTION_ON_CHANNEL_TUNNEL = 5
def hostapd_tx_and_status(hapd, msg):
hapd.set("ext_mgmt_frame_handling", "1")
hapd.mgmt_tx(msg)
ev = hapd.wait_event([ "MGMT-TX-STATUS" ], timeout=1)
ev = hapd.wait_event(["MGMT-TX-STATUS"], timeout=1)
if ev is None or "ok=1" not in ev:
raise Exception("No ACK")
hapd.set("ext_mgmt_frame_handling", "0")
@ -2067,7 +2067,7 @@ def test_fst_ack_response_proto(dev, apdev, test_params):
s = sta1.grequest("FST-MANAGER SESSION_INITIATE "+ sid)
if not s.startswith('OK'):
raise Exception("Cannot initiate fst session: %s" % s)
ev = sta1.peer_obj.wait_gevent([ "FST-EVENT-SESSION" ], timeout=5)
ev = sta1.peer_obj.wait_gevent(["FST-EVENT-SESSION"], timeout=5)
if ev is None:
raise Exception("No FST-EVENT-SESSION received")
event = fst_module_aux.parse_fst_session_event(ev)
@ -2103,7 +2103,7 @@ def test_fst_ack_response_proto(dev, apdev, test_params):
msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST,
FST_ACTION_ACK_RESPONSE)
hapd.mgmt_tx(msg)
ev = hapd.wait_event([ "MGMT-TX-STATUS" ], timeout=1)
ev = hapd.wait_event(["MGMT-TX-STATUS"], timeout=1)
if ev is None or "ok=1" not in ev:
raise Exception("No ACK")
@ -2169,7 +2169,7 @@ def test_fst_send_oom(dev, apdev, test_params):
if not res.startswith("OK"):
raise Exception("SESSION_INITIATE failed")
tests = [ "", "foo", sid, sid + " foo", sid + " foo=bar" ]
tests = ["", "foo", sid, sid + " foo", sid + " foo=bar"]
for t in tests:
res = initiator.grequest("FST-MANAGER SESSION_SET " + t)
if not res.startswith("FAIL"):
@ -2264,7 +2264,7 @@ def fst_attach_ap(dev, ifname, group):
ev = dev.wait_event(['FST-EVENT-IFACE'], timeout=5)
if ev is None:
raise Exception("No FST-EVENT-IFACE attached (AP)")
for t in [ "attached", "ifname=" + ifname, "group=" + group ]:
for t in ["attached", "ifname=" + ifname, "group=" + group]:
if t not in ev:
raise Exception("Unexpected FST-EVENT-IFACE data (AP): " + ev)
@ -2274,7 +2274,7 @@ def fst_attach_sta(dev, ifname, group):
ev = dev.wait_global_event(['FST-EVENT-IFACE'], timeout=5)
if ev is None:
raise Exception("No FST-EVENT-IFACE attached (STA)")
for t in [ "attached", "ifname=" + ifname, "group=" + group ]:
for t in ["attached", "ifname=" + ifname, "group=" + group]:
if t not in ev:
raise Exception("Unexpected FST-EVENT-IFACE data (STA): " + ev)
@ -2284,7 +2284,7 @@ def fst_detach_ap(dev, ifname, group):
ev = dev.wait_event(['FST-EVENT-IFACE'], timeout=5)
if ev is None:
raise Exception("No FST-EVENT-IFACE detached (AP) for " + ifname)
for t in [ "detached", "ifname=" + ifname, "group=" + group ]:
for t in ["detached", "ifname=" + ifname, "group=" + group]:
if t not in ev:
raise Exception("Unexpected FST-EVENT-IFACE data (AP): " + ev)
@ -2295,7 +2295,7 @@ def fst_detach_sta(dev, ifname, group):
ev = dev.wait_global_event(['FST-EVENT-IFACE'], timeout=5)
if ev is None:
raise Exception("No FST-EVENT-IFACE detached (STA) for " + ifname)
for t in [ "detached", "ifname=" + ifname, "group=" + group ]:
for t in ["detached", "ifname=" + ifname, "group=" + group]:
if t not in ev:
raise Exception("Unexpected FST-EVENT-IFACE data (STA): " + ev)
@ -2303,7 +2303,7 @@ def fst_wait_event_peer_ap(dev, event, ifname, addr):
ev = dev.wait_event(['FST-EVENT-PEER'], timeout=5)
if ev is None:
raise Exception("No FST-EVENT-PEER connected (AP)")
for t in [ " " + event + " ", "ifname=" + ifname, "peer_addr=" + addr ]:
for t in [" " + event + " ", "ifname=" + ifname, "peer_addr=" + addr]:
if t not in ev:
raise Exception("Unexpected FST-EVENT-PEER data (AP): " + ev)
@ -2311,7 +2311,7 @@ def fst_wait_event_peer_sta(dev, event, ifname, addr):
ev = dev.wait_global_event(['FST-EVENT-PEER'], timeout=5)
if ev is None:
raise Exception("No FST-EVENT-PEER connected (STA)")
for t in [ " " + event + " ", "ifname=" + ifname, "peer_addr=" + addr ]:
for t in [" " + event + " ", "ifname=" + ifname, "peer_addr=" + addr]:
if t not in ev:
raise Exception("Unexpected FST-EVENT-PEER data (STA): " + ev)
@ -2336,8 +2336,8 @@ def fst_start_and_connect(apdev, group, sgroup):
if "OK" not in hglobal.request("FST-MANAGER TEST_REQUEST IS_SUPPORTED"):
raise HwsimSkip("No FST testing support")
params = { "ssid": "fst_11a", "hw_mode": "a", "channel": "36",
"country_code": "US" }
params = {"ssid": "fst_11a", "hw_mode": "a", "channel": "36",
"country_code": "US"}
hapd = hostapd.add_ap(apdev[0], params)
fst_attach_ap(hglobal, apdev[0]['ifname'], group)
@ -2346,8 +2346,8 @@ def fst_start_and_connect(apdev, group, sgroup):
if "FAIL" not in hglobal.request(cmd):
raise Exception("Duplicated FST-ATTACH (AP) accepted")
params = { "ssid": "fst_11g", "hw_mode": "g", "channel": "1",
"country_code": "US" }
params = {"ssid": "fst_11g", "hw_mode": "g", "channel": "1",
"country_code": "US"}
hapd2 = hostapd.add_ap(apdev[1], params)
fst_attach_ap(hglobal, apdev[1]['ifname'], group)

View File

@ -36,19 +36,19 @@ def hs20_ap_params():
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['anqp_3gpp_cell_net'] = "244,91"
params['network_auth_type'] = "02http://www.example.com/redirect/me/here/"
params['ipaddr_type_availability'] = "14"
params['hs20'] = "1"
params['hs20_oper_friendly_name'] = [ "eng:Example operator", "fin:Esimerkkioperaattori" ]
params['hs20_oper_friendly_name'] = ["eng:Example operator", "fin:Esimerkkioperaattori"]
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"
return params
@ -110,7 +110,7 @@ def test_gas_generic(dev, apdev):
params['hessid'] = bssid
hostapd.add_ap(apdev[0], params)
cmds = [ "foo",
cmds = ["foo",
"00:11:22:33:44:55",
"00:11:22:33:44:55 ",
"00:11:22:33:44:55 ",
@ -121,7 +121,7 @@ def test_gas_generic(dev, apdev):
"00:11:22:33:44:55 00 1",
"00:11:22:33:44:55 00 123",
"00:11:22:33:44:55 00 ",
"00:11:22:33:44:55 00 qq" ]
"00:11:22:33:44:55 00 qq"]
for cmd in cmds:
if "FAIL" not in dev[0].request("GAS_REQUEST " + cmd):
raise Exception("Invalid GAS_REQUEST accepted: " + cmd)
@ -454,7 +454,7 @@ def test_gas_anqp_get(dev, apdev):
if ev is None:
raise Exception("GAS query timed out (2)")
cmds = [ "",
cmds = ["",
"foo",
"00:11:22:33:44:55 258,hs20:-1",
"00:11:22:33:44:55 258,hs20:0",
@ -469,12 +469,12 @@ def test_gas_anqp_get(dev, apdev):
"00:11:22:33:44:55",
"00:11:22:33:44:55 ",
"00:11:22:33:44:55 0",
"00:11:22:33:44:55 1" ]
"00:11:22:33:44:55 1"]
for cmd in cmds:
if "FAIL" not in dev[0].request("ANQP_GET " + cmd):
raise Exception("Invalid ANQP_GET accepted")
cmds = [ "",
cmds = ["",
"foo",
"00:11:22:33:44:55 -1",
"00:11:22:33:44:55 0",
@ -482,7 +482,7 @@ def test_gas_anqp_get(dev, apdev):
"00:11:22:33:44:55",
"00:11:22:33:44:55 ",
"00:11:22:33:44:55 0",
"00:11:22:33:44:55 1" ]
"00:11:22:33:44:55 1"]
for cmd in cmds:
if "FAIL" not in dev[0].request("HS20_ANQP_GET " + cmd):
raise Exception("Invalid HS20_ANQP_GET accepted")
@ -517,8 +517,8 @@ def test_gas_anqp_icon_binary_proto(dev, apdev):
dev[0].scan_for_bss(bssid, freq="2412", force_scan=True)
hapd.set("ext_mgmt_frame_handling", "1")
tests = [ '010000', '01000000', '00000000', '00030000', '00020000',
'00000100', '0001ff0100ee', '0001ff0200ee' ]
tests = ['010000', '01000000', '00000000', '00030000', '00020000',
'00000100', '0001ff0100ee', '0001ff0200ee']
for test in tests:
dev[0].request("HS20_ICON_REQUEST " + bssid + " w1fi_logo")
query = gas_rx(hapd)
@ -539,8 +539,8 @@ def test_gas_anqp_hs20_proto(dev, apdev):
dev[0].scan_for_bss(bssid, freq="2412", force_scan=True)
hapd.set("ext_mgmt_frame_handling", "1")
tests = [ '00', '0100', '0201', '0300', '0400', '0500', '0600', '0700',
'0800', '0900', '0a00', '0b0000000000' ]
tests = ['00', '0100', '0201', '0300', '0400', '0500', '0600', '0700',
'0800', '0900', '0a00', '0b0000000000']
for test in tests:
dev[0].request("HS20_ANQP_GET " + bssid + " 3,4")
query = gas_rx(hapd)
@ -592,8 +592,8 @@ GAS_INITIAL_REQUEST = 10
GAS_INITIAL_RESPONSE = 11
GAS_COMEBACK_REQUEST = 12
GAS_COMEBACK_RESPONSE = 13
GAS_ACTIONS = [ GAS_INITIAL_REQUEST, GAS_INITIAL_RESPONSE,
GAS_COMEBACK_REQUEST, GAS_COMEBACK_RESPONSE ]
GAS_ACTIONS = [GAS_INITIAL_REQUEST, GAS_INITIAL_RESPONSE,
GAS_COMEBACK_REQUEST, GAS_COMEBACK_RESPONSE]
def anqp_adv_proto():
return struct.pack('BBBB', 108, 2, 127, 0)
@ -1197,15 +1197,15 @@ def test_gas_anqp_extra_elements(dev, apdev):
supl_fqdn = "supl.example.com"
supl = struct.pack('BBB', 0, 1 + len(supl_fqdn), 1) + supl_fqdn.encode()
public_id = binascii.hexlify(held + supl).decode()
params = { "ssid": "gas/anqp",
params = {"ssid": "gas/anqp",
"interworking": "1",
"anqp_elem": [ "265:" + geo_loc,
"anqp_elem": ["265:" + geo_loc,
"266:" + civic_loc,
"262:1122334455",
"267:" + public_id,
"279:01020304",
"60000:01",
"299:0102" ] }
"299:0102"]}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@ -1559,13 +1559,13 @@ def test_gas_failures(dev, apdev):
dev[0].scan_for_bss(bssid, freq="2412", force_scan=True)
dev[0].scan_for_bss(bssid2, freq="2412")
tests = [ (bssid, "gas_build_req;gas_query_tx_comeback_req"),
tests = [(bssid, "gas_build_req;gas_query_tx_comeback_req"),
(bssid, "gas_query_tx;gas_query_tx_comeback_req"),
(bssid, "gas_query_append;gas_query_rx_comeback"),
(bssid2, "gas_query_append;gas_query_rx_initial"),
(bssid2, "wpabuf_alloc_copy;gas_query_rx_initial"),
(bssid, "gas_query_tx;gas_query_tx_initial_req") ]
for addr,func in tests:
(bssid, "gas_query_tx;gas_query_tx_initial_req")]
for addr, func in tests:
with alloc_fail(dev[0], 1, func):
dev[0].request("ANQP_GET " + addr + " 258")
ev = dev[0].wait_event(["GAS-QUERY-DONE"], timeout=5)
@ -1575,7 +1575,7 @@ def test_gas_failures(dev, apdev):
raise Exception("Unexpected result code: " + ev)
dev[0].dump_monitor()
tests = [ "=gas_query_req", "radio_add_work;gas_query_req" ]
tests = ["=gas_query_req", "radio_add_work;gas_query_req"]
for func in tests:
with alloc_fail(dev[0], 1, func):
if "FAIL" not in dev[0].request("ANQP_GET " + bssid + " 258"):
@ -1599,7 +1599,7 @@ def test_gas_anqp_venue_url(dev, apdev):
venue_type = 13
venue_info = struct.pack('BB', venue_group, venue_type)
lang1 = "eng"
name1= "Example venue"
name1 = "Example venue"
lang2 = "fin"
name2 = "Esimerkkipaikka"
venue1 = struct.pack('B', len(lang1 + name1)) + lang1.encode() + name1.encode()
@ -1612,12 +1612,12 @@ def test_gas_anqp_venue_url(dev, apdev):
duple2 = struct.pack('BB', 1 + len(url2), 2) + url2
venue_url = binascii.hexlify(duple1 + duple2).decode()
params = { "ssid": "gas/anqp",
params = {"ssid": "gas/anqp",
"interworking": "1",
"venue_group": str(venue_group),
"venue_type": str(venue_type),
"venue_name": [ lang1 + ":" + name1, lang2 + ":" + name2 ],
"anqp_elem": [ "277:" + venue_url ] }
"venue_name": [lang1 + ":" + name1, lang2 + ":" + name2],
"anqp_elem": ["277:" + venue_url]}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@ -1656,7 +1656,7 @@ def test_gas_anqp_venue_url2(dev, apdev):
venue_type = 13
venue_info = struct.pack('BB', venue_group, venue_type)
lang1 = "eng"
name1= "Example venue"
name1 = "Example venue"
lang2 = "fin"
name2 = "Esimerkkipaikka"
venue1 = struct.pack('B', len(lang1 + name1)) + lang1.encode() + name1.encode()
@ -1669,12 +1669,12 @@ def test_gas_anqp_venue_url2(dev, apdev):
duple2 = struct.pack('BB', 1 + len(url2.encode()), 2) + url2.encode()
venue_url = binascii.hexlify(duple1 + duple2).decode()
params = { "ssid": "gas/anqp",
params = {"ssid": "gas/anqp",
"interworking": "1",
"venue_group": str(venue_group),
"venue_type": str(venue_type),
"venue_name": [ lang1 + ":" + name1, lang2 + ":" + name2 ],
"venue_url": [ "1:" + url1, "2:" + url2 ] }
"venue_name": [lang1 + ":" + name1, lang2 + ":" + name2],
"venue_url": ["1:" + url1, "2:" + url2]}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@ -1710,7 +1710,7 @@ def test_gas_anqp_venue_url_pmf(dev, apdev):
venue_type = 13
venue_info = struct.pack('BB', venue_group, venue_type)
lang1 = "eng"
name1= "Example venue"
name1 = "Example venue"
lang2 = "fin"
name2 = "Esimerkkipaikka"
venue1 = struct.pack('B', len(lang1 + name1)) + lang1.encode() + name1.encode()
@ -1720,7 +1720,7 @@ def test_gas_anqp_venue_url_pmf(dev, apdev):
url1 = "http://example.com/venue"
url2 = "https://example.org/venue-info/"
params = { "ssid": "gas/anqp/pmf",
params = {"ssid": "gas/anqp/pmf",
"wpa": "2",
"wpa_key_mgmt": "WPA-PSK",
"rsn_pairwise": "CCMP",
@ -1729,8 +1729,8 @@ def test_gas_anqp_venue_url_pmf(dev, apdev):
"interworking": "1",
"venue_group": str(venue_group),
"venue_type": str(venue_type),
"venue_name": [ lang1 + ":" + name1, lang2 + ":" + name2 ],
"venue_url": [ "1:" + url1, "2:" + url2 ] }
"venue_name": [lang1 + ":" + name1, lang2 + ":" + name2],
"venue_url": ["1:" + url1, "2:" + url2]}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@ -1757,12 +1757,12 @@ def test_gas_anqp_venue_url_pmf(dev, apdev):
def test_gas_anqp_capab_list(dev, apdev):
"""GAS/ANQP and Capability List ANQP-element"""
params = { "ssid": "gas/anqp",
"interworking": "1" }
params = {"ssid": "gas/anqp",
"interworking": "1"}
params["anqp_elem"] = []
for i in range(0, 400):
if i not in [ 257 ]:
params["anqp_elem"] += [ "%d:010203" % i ]
if i not in [257]:
params["anqp_elem"] += ["%d:010203" % i]
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@ -1790,7 +1790,7 @@ def test_gas_anqp_capab_list(dev, apdev):
val = val[4:]
logger.info("InfoIDs: " + str(ids))
for i in range(257, 300):
if i in [ 273, 274 ]:
if i in [273, 274]:
continue
if i not in ids:
raise Exception("Unexpected Capability List ANQP-element value (missing %d): %s" % (i, bss['anqp_capability_list']))
@ -1805,9 +1805,9 @@ def test_gas_server_oom(dev, apdev):
dev[0].scan_for_bss(bssid, freq="2412", force_scan=True)
tests = [ "ap_sta_add;gas_dialog_create",
tests = ["ap_sta_add;gas_dialog_create",
"=gas_dialog_create",
"wpabuf_alloc_copy;gas_serv_rx_gas_comeback_req" ]
"wpabuf_alloc_copy;gas_serv_rx_gas_comeback_req"]
for t in tests:
with alloc_fail(hapd, 1, t):
if "OK" not in dev[0].request("ANQP_GET " + bssid + " 258"):
@ -1819,7 +1819,7 @@ def test_gas_server_oom(dev, apdev):
hapd.set("gas_comeback_delay", "0")
tests = [ "gas_serv_build_gas_resp_payload" ]
tests = ["gas_serv_build_gas_resp_payload"]
for t in tests:
with alloc_fail(hapd, 1, t):
if "OK" not in dev[0].request("ANQP_GET " + bssid + " 258"):
@ -1858,9 +1858,9 @@ def test_gas_server_oom(dev, apdev):
def test_gas_anqp_overrides(dev, apdev):
"""GAS and ANQP overrides"""
params = { "ssid": "gas/anqp",
params = {"ssid": "gas/anqp",
"interworking": "1",
"anqp_elem": [ "257:111111",
"anqp_elem": ["257:111111",
"258:222222",
"260:333333",
"261:444444",
@ -1868,7 +1868,7 @@ def test_gas_anqp_overrides(dev, apdev):
"263:666666",
"264:777777",
"268:888888",
"275:999999" ] }
"275:999999"]}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@ -1951,7 +1951,7 @@ def test_gas_vendor_spec_errors(dev, apdev):
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(bssid, freq="2412", force_scan=True)
tests = [ "00 12340000",
tests = ["00 12340000",
"00 dddd0300506fff",
"00 dddd0400506fffff",
"00 dddd0400506f9aff",
@ -1969,7 +1969,7 @@ def test_gas_vendor_spec_errors(dev, apdev):
"00 dddd0700506f9a110100ff",
"00 dddd0700506f9a11010008",
"00 dddd14",
"00 dddd1400506f9a11" ]
"00 dddd1400506f9a11"]
for t in tests:
req = dev[0].request("GAS_REQUEST " + bssid + " " + t)
if "FAIL" in req:
@ -2010,7 +2010,7 @@ def test_gas_vendor_spec_errors(dev, apdev):
msg5 = struct.pack('<BBB', ACTION_CATEG_PUBLIC, GAS_INITIAL_REQUEST,
dialog_token) + anqp_adv_proto() + struct.pack('<H', 1)
msg6 = struct.pack('<BB', ACTION_CATEG_PUBLIC, GAS_COMEBACK_REQUEST)
tests = [ msg, msg2, msg3, msg4, msg5, msg6 ]
tests = [msg, msg2, msg3, msg4, msg5, msg6]
for t in tests:
req = "MGMT_TX {} {} freq=2412 wait_time=10 action={}".format(bssid, bssid, binascii.hexlify(t).decode())
if "OK" not in wpas.request(req):

View File

@ -143,7 +143,7 @@ def test_hapd_ctrl_disconnect(dev, apdev):
def test_hapd_ctrl_chan_switch(dev, apdev):
"""hostapd and CHAN_SWITCH ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "FAIL" not in hapd.request("CHAN_SWITCH "):
raise Exception("Unexpected CHAN_SWITCH success")
@ -158,7 +158,7 @@ def test_hapd_ctrl_chan_switch(dev, apdev):
def test_hapd_ctrl_level(dev, apdev):
"""hostapd and LEVEL ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "FAIL" not in hapd.request("LEVEL 0"):
raise Exception("Unexpected LEVEL success on non-monitor interface")
@ -167,7 +167,7 @@ def test_hapd_ctrl_level(dev, apdev):
def test_hapd_ctrl_new_sta(dev, apdev):
"""hostapd and NEW_STA ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "FAIL" not in hapd.request("NEW_STA 00:11:22:33:44"):
raise Exception("Unexpected NEW_STA success")
@ -185,7 +185,7 @@ def test_hapd_ctrl_new_sta(dev, apdev):
def test_hapd_ctrl_get(dev, apdev):
"""hostapd and GET ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "FAIL" not in hapd.request("GET foo"):
raise Exception("Unexpected GET success")
@ -196,7 +196,7 @@ def test_hapd_ctrl_get(dev, apdev):
def test_hapd_ctrl_unknown(dev, apdev):
"""hostapd and unknown ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "UNKNOWN COMMAND" not in hapd.request("FOO"):
raise Exception("Unexpected response")
@ -205,7 +205,7 @@ def test_hapd_ctrl_unknown(dev, apdev):
def test_hapd_ctrl_hs20_wnm_notif(dev, apdev):
"""hostapd and HS20_WNM_NOTIF ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "FAIL" not in hapd.request("HS20_WNM_NOTIF 00:11:22:33:44 http://example.com/"):
raise Exception("Unexpected HS20_WNM_NOTIF success")
@ -216,7 +216,7 @@ def test_hapd_ctrl_hs20_wnm_notif(dev, apdev):
def test_hapd_ctrl_hs20_deauth_req(dev, apdev):
"""hostapd and HS20_DEAUTH_REQ ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "FAIL" not in hapd.request("HS20_DEAUTH_REQ 00:11:22:33:44 1 120 http://example.com/"):
raise Exception("Unexpected HS20_DEAUTH_REQ success")
@ -229,7 +229,7 @@ def test_hapd_ctrl_hs20_deauth_req(dev, apdev):
def test_hapd_ctrl_disassoc_imminent(dev, apdev):
"""hostapd and DISASSOC_IMMINENT ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "FAIL" not in hapd.request("DISASSOC_IMMINENT 00:11:22:33:44"):
raise Exception("Unexpected DISASSOC_IMMINENT success")
@ -249,7 +249,7 @@ def test_hapd_ctrl_disassoc_imminent(dev, apdev):
def test_hapd_ctrl_ess_disassoc(dev, apdev):
"""hostapd and ESS_DISASSOC ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "FAIL" not in hapd.request("ESS_DISASSOC 00:11:22:33:44"):
raise Exception("Unexpected ESS_DISASSOCT success")
@ -272,7 +272,7 @@ def test_hapd_ctrl_ess_disassoc(dev, apdev):
def test_hapd_ctrl_set_deny_mac_file(dev, apdev):
"""hostapd and SET deny_mac_file ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
dev[1].connect(ssid, key_mgmt="NONE", scan_freq="2412")
@ -286,7 +286,7 @@ def test_hapd_ctrl_set_deny_mac_file(dev, apdev):
def test_hapd_ctrl_set_accept_mac_file(dev, apdev):
"""hostapd and SET accept_mac_file ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
dev[1].connect(ssid, key_mgmt="NONE", scan_freq="2412")
@ -301,7 +301,7 @@ def test_hapd_ctrl_set_accept_mac_file(dev, apdev):
def test_hapd_ctrl_set_accept_mac_file_vlan(dev, apdev):
"""hostapd and SET accept_mac_file ctrl_iface command (VLAN ID)"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
dev[1].connect(ssid, key_mgmt="NONE", scan_freq="2412")
@ -315,9 +315,9 @@ def test_hapd_ctrl_set_accept_mac_file_vlan(dev, apdev):
def test_hapd_ctrl_set_error_cases(dev, apdev):
"""hostapd and SET error cases"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
errors = [ "wpa_key_mgmt FOO",
errors = ["wpa_key_mgmt FOO",
"wpa_key_mgmt WPA-PSK \t FOO",
"wpa_key_mgmt \t ",
"wpa_pairwise FOO",
@ -482,7 +482,7 @@ def test_hapd_ctrl_set_error_cases(dev, apdev):
"tx_queue_data3_cwmin 4",
"tx_queue_data3_cwmax 4",
"tx_queue_data3_aifs -4",
"tx_queue_data3_foo 1" ]
"tx_queue_data3_foo 1"]
for e in errors:
if "FAIL" not in hapd.request("SET " + e):
raise Exception("Unexpected SET success: '%s'" % e)
@ -492,20 +492,20 @@ def test_hapd_ctrl_set_error_cases(dev, apdev):
if "OK" not in hapd.request("SET osu_friendly_name eng:Example"):
raise Exception("Unexpected SET osu_friendly_name failure")
errors = [ "osu_friendly_name eng1:Example",
"osu_service_desc eng1:Example services" ]
errors = ["osu_friendly_name eng1:Example",
"osu_service_desc eng1:Example services"]
for e in errors:
if "FAIL" not in hapd.request("SET " + e):
raise Exception("Unexpected SET success: '%s'" % e)
no_err = [ "wps_nfc_dh_pubkey 0",
no_err = ["wps_nfc_dh_pubkey 0",
"wps_nfc_dh_privkey 0q",
"wps_nfc_dev_pw 012",
"manage_p2p 0",
"disassoc_low_ack 0",
"network_auth_type 01",
"tdls_prohibit 0",
"tdls_prohibit_chan_switch 0" ]
"tdls_prohibit_chan_switch 0"]
for e in no_err:
if "OK" not in hapd.request("SET " + e):
raise Exception("Unexpected SET failure: '%s'" % e)
@ -514,7 +514,7 @@ def test_hapd_ctrl_set_error_cases(dev, apdev):
def test_hapd_ctrl_global(dev, apdev):
"""hostapd and GET ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
ifname = apdev[0]['ifname']
hapd = hostapd.add_ap(apdev[0], params)
hapd_global = hostapd.HostapdGlobal(apdev[0])
@ -549,7 +549,7 @@ def dup_network(hapd_global, src, dst, param):
def test_hapd_dup_network_global_wpa2(dev, apdev):
"""hostapd and DUP_NETWORK command (WPA2)"""
passphrase="12345678"
passphrase = "12345678"
src_ssid = "hapd-ctrl-src"
dst_ssid = "hapd-ctrl-dst"
@ -557,13 +557,13 @@ def test_hapd_dup_network_global_wpa2(dev, apdev):
src_ifname = apdev[0]['ifname']
src_hapd = hostapd.add_ap(apdev[0], src_params)
dst_params = { "ssid": dst_ssid }
dst_params = {"ssid": dst_ssid}
dst_ifname = apdev[1]['ifname']
dst_hapd = hostapd.add_ap(apdev[1], dst_params, no_enable=True)
hapd_global = hostapd.HostapdGlobal()
for param in [ "wpa", "wpa_passphrase", "wpa_key_mgmt", "rsn_pairwise" ]:
for param in ["wpa", "wpa_passphrase", "wpa_key_mgmt", "rsn_pairwise"]:
dup_network(hapd_global, src_ifname, dst_ifname, param)
dst_hapd.enable()
@ -574,11 +574,11 @@ def test_hapd_dup_network_global_wpa2(dev, apdev):
if "FAIL" in dst_hapd.request("STA " + addr):
raise Exception("Could not connect using duplicated wpa params")
tests = [ "a",
tests = ["a",
"no-such-ifname no-such-ifname",
src_ifname + " no-such-ifname",
src_ifname + " no-such-ifname no-such-param",
src_ifname + " " + dst_ifname + " no-such-param" ]
src_ifname + " " + dst_ifname + " no-such-param"]
for t in tests:
if "FAIL" not in hapd_global.request("DUP_NETWORK " + t):
raise Exception("Invalid DUP_NETWORK accepted: " + t)
@ -598,13 +598,13 @@ def test_hapd_dup_network_global_wpa(dev, apdev):
src_ifname = apdev[0]['ifname']
src_hapd = hostapd.add_ap(apdev[0], src_params)
dst_params = { "ssid": dst_ssid }
dst_params = {"ssid": dst_ssid}
dst_ifname = apdev[1]['ifname']
dst_hapd = hostapd.add_ap(apdev[1], dst_params, no_enable=True)
hapd_global = hostapd.HostapdGlobal()
for param in [ "wpa", "wpa_psk", "wpa_key_mgmt", "wpa_pairwise" ]:
for param in ["wpa", "wpa_psk", "wpa_key_mgmt", "wpa_pairwise"]:
dup_network(hapd_global, src_ifname, dst_ifname, param)
dst_hapd.enable()
@ -618,7 +618,7 @@ def test_hapd_dup_network_global_wpa(dev, apdev):
@remote_compatible
def test_hapd_ctrl_log_level(dev, apdev):
"""hostapd ctrl_iface LOG_LEVEL"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
level = hapd.request("LOG_LEVEL")
if "Current level: MSGDUMP" not in level:
raise Exception("Unexpected debug level(1): " + level)
@ -644,7 +644,7 @@ def test_hapd_ctrl_log_level(dev, apdev):
if "FAIL" not in hapd.request("LOG_LEVEL FOO"):
raise Exception("Invalid LOG_LEVEL accepted")
for lev in [ "EXCESSIVE", "MSGDUMP", "DEBUG", "INFO", "WARNING", "ERROR" ]:
for lev in ["EXCESSIVE", "MSGDUMP", "DEBUG", "INFO", "WARNING", "ERROR"]:
if "OK" not in hapd.request("LOG_LEVEL " + lev):
raise Exception("LOG_LEVEL failed for " + lev)
level = hapd.request("LOG_LEVEL")
@ -701,7 +701,7 @@ def test_hapd_ctrl_disconnect_no_tx(dev, apdev):
def test_hapd_ctrl_mib(dev, apdev):
"""hostapd and MIB ctrl_iface command with open network"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
mib = hapd.request("MIB")
@ -731,7 +731,7 @@ def test_hapd_ctrl_mib(dev, apdev):
def test_hapd_ctrl_not_yet_fully_enabled(dev, apdev):
"""hostapd and ctrl_iface commands when BSS not yet fully enabled"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
if not hapd.ping():
@ -748,7 +748,7 @@ def test_hapd_ctrl_not_yet_fully_enabled(dev, apdev):
raise Exception("Unexpected response to STA-FIRST")
if "FAIL" not in hapd.request("STA ff:ff:ff:ff:ff:ff"):
raise Exception("Unexpected response to STA")
cmds = [ "NEW_STA 02:ff:ff:ff:ff:ff",
cmds = ["NEW_STA 02:ff:ff:ff:ff:ff",
"DEAUTHENTICATE 02:ff:ff:ff:ff:ff",
"DEAUTHENTICATE 02:ff:ff:ff:ff:ff test=0",
"DEAUTHENTICATE 02:ff:ff:ff:ff:ff p2p=0",
@ -788,19 +788,19 @@ def test_hapd_ctrl_not_yet_fully_enabled(dev, apdev):
"REQ_LCI 00:11:22:33:44:55",
"REQ_RANGE 00:11:22:33:44:55",
"DRIVER_FLAGS",
"STOP_AP" ]
"STOP_AP"]
for cmd in cmds:
hapd.request(cmd)
def test_hapd_ctrl_set(dev, apdev):
"""hostapd and SET ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
tests = [ "foo",
tests = ["foo",
"wps_version_number 300",
"gas_frag_limit 0",
"mbo_assoc_disallow 0" ]
"mbo_assoc_disallow 0"]
for t in tests:
if "FAIL" not in hapd.request("SET " + t):
raise Exception("Invalid SET command accepted: " + t)
@ -808,32 +808,32 @@ def test_hapd_ctrl_set(dev, apdev):
def test_hapd_ctrl_radar(dev, apdev):
"""hostapd and RADAR ctrl_iface command"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
tests = [ "foo", "foo bar" ]
tests = ["foo", "foo bar"]
for t in tests:
if "FAIL" not in hapd.request("RADAR " + t):
raise Exception("Invalid RADAR command accepted: " + t)
tests = [ "DETECTED freq=2412 chan_offset=12 cf1=1234 cf2=2345",
tests = ["DETECTED freq=2412 chan_offset=12 cf1=1234 cf2=2345",
"CAC-FINISHED freq=2412",
"CAC-ABORTED freq=2412",
"NOP-FINISHED freq=2412" ]
"NOP-FINISHED freq=2412"]
for t in tests:
hapd.request("RADAR " + t)
def test_hapd_ctrl_ext_io_errors(dev, apdev):
"""hostapd and external I/O errors"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
tests = [ "MGMT_TX 1",
tests = ["MGMT_TX 1",
"MGMT_TX 1q",
"MGMT_RX_PROCESS freq=2412",
"EAPOL_RX foo",
"EAPOL_RX 00:11:22:33:44:55 1",
"EAPOL_RX 00:11:22:33:44:55 1q" ]
"EAPOL_RX 00:11:22:33:44:55 1q"]
for t in tests:
if "FAIL" not in hapd.request(t):
raise Exception("Invalid command accepted: " + t)
@ -845,10 +845,10 @@ def test_hapd_ctrl_ext_io_errors(dev, apdev):
raise Exception("EAPOL_RX accepted during OOM")
hapd.set("ext_mgmt_frame_handling", "1")
tests = [ "MGMT_RX_PROCESS freq=2412",
tests = ["MGMT_RX_PROCESS freq=2412",
"MGMT_RX_PROCESS freq=2412 ssi_signal=0",
"MGMT_RX_PROCESS freq=2412 frame=1",
"MGMT_RX_PROCESS freq=2412 frame=1q" ]
"MGMT_RX_PROCESS freq=2412 frame=1q"]
for t in tests:
if "FAIL" not in hapd.request(t):
raise Exception("Invalid command accepted: " + t)
@ -861,20 +861,20 @@ def test_hapd_ctrl_ext_io_errors(dev, apdev):
raise Exception("Failed to enable l2_test")
if "OK" not in hapd.request("DATA_TEST_CONFIG 1"):
raise Exception("Failed to enable l2_test(2)")
tests = [ "DATA_TEST_TX foo",
tests = ["DATA_TEST_TX foo",
"DATA_TEST_TX 00:11:22:33:44:55 foo",
"DATA_TEST_TX 00:11:22:33:44:55 00:11:22:33:44:55 -1",
"DATA_TEST_TX 00:11:22:33:44:55 00:11:22:33:44:55 256" ]
"DATA_TEST_TX 00:11:22:33:44:55 00:11:22:33:44:55 256"]
for t in tests:
if "FAIL" not in hapd.request(t):
raise Exception("Invalid command accepted: " + t)
if "OK" not in hapd.request("DATA_TEST_CONFIG 0"):
raise Exception("Failed to disable l2_test")
tests = [ "DATA_TEST_TX 00:11:22:33:44:55 00:11:22:33:44:55 0",
tests = ["DATA_TEST_TX 00:11:22:33:44:55 00:11:22:33:44:55 0",
"DATA_TEST_FRAME ifname=foo",
"DATA_TEST_FRAME 1",
"DATA_TEST_FRAME 11",
"DATA_TEST_FRAME 112233445566778899aabbccddeefq" ]
"DATA_TEST_FRAME 112233445566778899aabbccddeefq"]
for t in tests:
if "FAIL" not in hapd.request(t):
raise Exception("Invalid command accepted: " + t)
@ -885,13 +885,13 @@ def test_hapd_ctrl_ext_io_errors(dev, apdev):
def test_hapd_ctrl_vendor_errors(dev, apdev):
"""hostapd and VENDOR errors"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
tests = [ "q",
tests = ["q",
"10q",
"10 10q",
"10 10 123q",
"10 10" ]
"10 10"]
for t in tests:
if "FAIL" not in hapd.request("VENDOR " + t):
raise Exception("Invalid VENDOR command accepted: " + t)
@ -905,10 +905,10 @@ def test_hapd_ctrl_vendor_errors(dev, apdev):
def test_hapd_ctrl_eapol_reauth_errors(dev, apdev):
"""hostapd and EAPOL_REAUTH errors"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
tests = [ "foo",
"11:22:33:44:55:66" ]
tests = ["foo",
"11:22:33:44:55:66"]
for t in tests:
if "FAIL" not in hapd.request("EAPOL_REAUTH " + t):
raise Exception("Invalid EAPOL_REAUTH command accepted: " + t)
@ -916,7 +916,7 @@ def test_hapd_ctrl_eapol_reauth_errors(dev, apdev):
def test_hapd_ctrl_eapol_relog(dev, apdev):
"""hostapd and RELOG"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "OK" not in hapd.request("RELOG"):
raise Exception("RELOG failed")
@ -924,10 +924,10 @@ def test_hapd_ctrl_eapol_relog(dev, apdev):
def test_hapd_ctrl_poll_sta_errors(dev, apdev):
"""hostapd and POLL_STA errors"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
tests = [ "foo",
"11:22:33:44:55:66" ]
tests = ["foo",
"11:22:33:44:55:66"]
for t in tests:
if "FAIL" not in hapd.request("POLL_STA " + t):
raise Exception("Invalid POLL_STA command accepted: " + t)
@ -935,7 +935,7 @@ def test_hapd_ctrl_poll_sta_errors(dev, apdev):
def test_hapd_ctrl_update_beacon(dev, apdev):
"""hostapd and UPDATE_BEACON"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "OK" not in hapd.request("UPDATE_BEACON"):
raise Exception("UPDATE_BEACON failed")
@ -947,7 +947,7 @@ def test_hapd_ctrl_update_beacon(dev, apdev):
def test_hapd_ctrl_test_fail(dev, apdev):
"""hostapd and TEST_ALLOC_FAIL/TEST_FAIL"""
ssid = "hapd-ctrl"
params = { "ssid": ssid }
params = {"ssid": ssid}
hapd = hostapd.add_ap(apdev[0], params)
if "OK" not in hapd.request("TEST_ALLOC_FAIL 1:unknownfunc"):
raise HwsimSkip("TEST_ALLOC_FAIL not supported")

View File

@ -13,7 +13,7 @@ import hostapd
from utils import HwsimSkip
def hostapd_oom_loop(apdev, params, start_func="main"):
hapd = hostapd.add_ap(apdev[0], { "ssid": "ctrl" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "ctrl"})
count = 0
for i in range(1, 1000):
@ -41,7 +41,7 @@ def hostapd_oom_loop(apdev, params, start_func="main"):
@remote_compatible
def test_hostapd_oom_open(dev, apdev):
"""hostapd failing to setup open mode due to OOM"""
params = { "ssid": "open" }
params = {"ssid": "open"}
hostapd_oom_loop(apdev, params)
def test_hostapd_oom_wpa2_psk(dev, apdev):
@ -50,9 +50,9 @@ def test_hostapd_oom_wpa2_psk(dev, apdev):
params['wpa_psk_file'] = 'hostapd.wpa_psk'
hostapd_oom_loop(apdev, params)
tests = [ "hostapd_config_read_wpa_psk", "hostapd_derive_psk" ]
tests = ["hostapd_config_read_wpa_psk", "hostapd_derive_psk"]
for t in tests:
hapd = hostapd.add_ap(apdev[0], { "ssid": "ctrl" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "ctrl"})
hapd.request("TEST_ALLOC_FAIL 1:%s" % t)
try:
hostapd.add_ap(apdev[1], params, timeout=2.5)

View File

@ -62,12 +62,12 @@ def hs20_filters_connect(dev, apdev, disable_dgaf=False, proxy_arp=False):
dev[0].hs20_enable()
id = dev[0].add_cred_values({ 'realm': "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",
'update_identifier': "1234" })
'update_identifier': "1234"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "TTLS")
@ -97,7 +97,7 @@ def _test_ip4_gtk_drop(devs, apdevs, params, dst):
raise Exception("DATA_TEST_FRAME failed")
try:
logger.info(s.recvfrom(1024))
logger.info("procfile=" + procfile + " val=" + open(procfile,'r').read().rstrip())
logger.info("procfile=" + procfile + " val=" + open(procfile, 'r').read().rstrip())
raise Exception("erroneously received frame!")
except socket.timeout:
# this is the expected behaviour
@ -133,7 +133,7 @@ def _test_ip6_gtk_drop(devs, apdevs, params, dst):
raise Exception("DATA_TEST_FRAME failed")
try:
logger.info(s.recvfrom(1024))
logger.info("procfile=" + procfile + " val=" + open(procfile,'r').read().rstrip())
logger.info("procfile=" + procfile + " val=" + open(procfile, 'r').read().rstrip())
raise Exception("erroneously received frame!")
except socket.timeout:
# this is the expected behaviour

View File

@ -30,8 +30,8 @@ def test_hs20_pps_mo_1(dev, apdev):
bssid = apdev[0]['bssid']
params = hs20_ap_params()
params['hessid'] = bssid
params['nai_realm'] = [ "0,w1.fi,13[5:6],21[2:4][5:7]",
"0,another.example.com" ]
params['nai_realm'] = ["0,w1.fi,13[5:6],21[2:4][5:7]",
"0,another.example.com"]
params['domain_name'] = "w1.fi"
hapd = hostapd.add_ap(apdev[0], params)

View File

@ -95,7 +95,7 @@ def add_ibss_wpa_none_ccmp(dev, ssid):
def test_ibss_rsn(dev):
"""IBSS RSN"""
ssid="ibss-rsn"
ssid = "ibss-rsn"
logger.info("Start IBSS on the first STA")
id = add_ibss_rsn(dev[0], ssid)
@ -160,7 +160,7 @@ def test_ibss_rsn(dev):
def test_ibss_rsn_group_rekey(dev):
"""IBSS RSN group rekeying"""
ssid="ibss-rsn"
ssid = "ibss-rsn"
logger.info("Start IBSS on the first STA")
id = add_ibss_rsn(dev[0], ssid, group_rekey=4, scan_freq=2412)
@ -189,7 +189,7 @@ def test_ibss_rsn_group_rekey(dev):
def test_ibss_wpa_none(dev):
"""IBSS WPA-None"""
ssid="ibss-wpa-none"
ssid = "ibss-wpa-none"
logger.info("Start IBSS on the first STA")
id = add_ibss_wpa_none(dev[0], ssid)
@ -257,7 +257,7 @@ def test_ibss_wpa_none(dev):
def test_ibss_wpa_none_ccmp(dev):
"""IBSS WPA-None/CCMP"""
ssid="ibss-wpa-none"
ssid = "ibss-wpa-none"
logger.info("Start IBSS on the first STA")
id = add_ibss_wpa_none(dev[0], ssid)
@ -296,7 +296,7 @@ def test_ibss_wpa_none_ccmp(dev):
def test_ibss_open(dev):
"""IBSS open (no security)"""
ssid="ibss"
ssid = "ibss"
id = add_ibss(dev[0], ssid, key_mgmt="NONE", beacon_int="150")
connect_ibss_cmd(dev[0], id)
bssid0 = wait_ibss_connection(dev[0])
@ -333,8 +333,8 @@ def test_ibss_open(dev):
def test_ibss_open_fixed_bssid(dev):
"""IBSS open (no security) and fixed BSSID"""
ssid="ibss"
bssid="02:11:22:33:44:55"
ssid = "ibss"
bssid = "02:11:22:33:44:55"
try:
dev[0].request("AP_SCAN 2")
add_ibss(dev[0], ssid, key_mgmt="NONE", bssid=bssid, beacon_int="150")
@ -360,7 +360,7 @@ def test_ibss_open_retry(dev):
subprocess.check_call(['iw', 'dev', dev[0].ifname, 'ibss', 'join',
'ibss-test', '2412', 'HT20', 'fixed-freq',
'02:22:33:44:55:66'])
ssid="ibss"
ssid = "ibss"
try:
dev[0].request("AP_SCAN 2")
id = add_ibss(dev[0], ssid, key_mgmt="NONE", beacon_int="150",
@ -377,7 +377,7 @@ def test_ibss_open_retry(dev):
def test_ibss_rsn_tkip(dev):
"""IBSS RSN with TKIP as the cipher"""
ssid="ibss-rsn-tkip"
ssid = "ibss-rsn-tkip"
id = add_ibss_rsn_tkip(dev[0], ssid)
connect_ibss_cmd(dev[0], id)
@ -395,7 +395,7 @@ def test_ibss_rsn_tkip(dev):
def test_ibss_wep(dev):
"""IBSS with WEP"""
ssid="ibss-wep"
ssid = "ibss-wep"
id = add_ibss(dev[0], ssid, key_mgmt="NONE", wep_key0='"hello"')
connect_ibss_cmd(dev[0], id)
@ -431,7 +431,7 @@ def _test_ibss_5ghz(dev):
break
dev[i].dump_monitor()
ssid="ibss"
ssid = "ibss"
id = add_ibss(dev[0], ssid, key_mgmt="NONE", beacon_int="150", freq=5180)
connect_ibss_cmd(dev[0], id, freq=5180)
bssid0 = wait_ibss_connection(dev[0])
@ -468,7 +468,7 @@ def _test_ibss_vht_80p80(dev):
break
dev[i].dump_monitor()
ssid="ibss"
ssid = "ibss"
id = add_ibss(dev[0], ssid, key_mgmt="NONE", freq=5180, chwidth=3)
connect_ibss_cmd(dev[0], id, freq=5180)
bssid0 = wait_ibss_connection(dev[0])
@ -504,7 +504,7 @@ def _test_ibss_vht_80p80(dev):
def test_ibss_rsn_oom(dev):
"""IBSS RSN OOM during wpa_init"""
with alloc_fail(dev[0], 1, "wpa_init"):
ssid="ibss-rsn"
ssid = "ibss-rsn"
id = add_ibss_rsn(dev[0], ssid, scan_freq=2412)
connect_ibss_cmd(dev[0], id)
bssid0 = wait_ibss_connection(dev[0])
@ -512,7 +512,7 @@ def test_ibss_rsn_oom(dev):
dev[0].dump_monitor()
with alloc_fail(dev[0], 1, "=ibss_rsn_init"):
ssid="ibss-rsn"
ssid = "ibss-rsn"
id = add_ibss_rsn(dev[0], ssid, scan_freq=2412)
connect_ibss_cmd(dev[0], id)
bssid0 = wait_ibss_connection(dev[0])
@ -525,7 +525,7 @@ def send_eapol_rx(dev, dst):
def test_ibss_rsn_eapol_trigger(dev):
"""IBSS RSN and EAPOL trigger for a new peer"""
ssid="ibss-rsn"
ssid = "ibss-rsn"
id = add_ibss_rsn(dev[0], ssid, scan_freq=2412)
connect_ibss_cmd(dev[0], id)

View File

@ -134,14 +134,14 @@ def test_ieee8021x_proto(dev, apdev):
start = dev[0].get_mib()
tests = [ "11",
tests = ["11",
"11223344",
"020000050a93000501",
"020300050a93000501",
"0203002c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"0203002c0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"0203002c0100050000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"02aa00050a93000501" ]
"02aa00050a93000501"]
for frame in tests:
res = dev[0].request("EAPOL_RX " + bssid + " " + frame)
if "OK" not in res:
@ -153,8 +153,8 @@ def test_ieee8021x_proto(dev, apdev):
logger.info("MIB before test frames: " + str(start))
logger.info("MIB after test frames: " + str(stop))
vals = [ 'dot1xSuppInvalidEapolFramesRx',
'dot1xSuppEapLengthErrorFramesRx' ]
vals = ['dot1xSuppInvalidEapolFramesRx',
'dot1xSuppEapLengthErrorFramesRx']
for val in vals:
if int(stop[val]) <= int(start[val]):
raise Exception(val + " did not increase")
@ -230,8 +230,8 @@ def test_ieee8021x_held(dev, apdev):
time.sleep(0.25)
if held:
raise Exception("PAE state HELD not left")
ev = dev[0].wait_event([ "CTRL-EVENT-CONNECTED",
"CTRL-EVENT-DISCONNECTED" ], timeout=10)
ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
"CTRL-EVENT-DISCONNECTED"], timeout=10)
if ev is None:
raise Exception("Connection timed out")
if "CTRL-EVENT-DISCONNECTED" in ev:
@ -381,7 +381,7 @@ def test_ieee8021x_set_conf(dev, apdev):
scan_freq="2412")
addr0 = dev[0].own_addr()
tests = [ "EAPOL_SET 1",
tests = ["EAPOL_SET 1",
"EAPOL_SET %sfoo bar" % addr0,
"EAPOL_SET %s foo" % addr0,
"EAPOL_SET %s foo bar" % addr0,
@ -389,12 +389,12 @@ def test_ieee8021x_set_conf(dev, apdev):
"EAPOL_SET %s AdminControlledPortControl bar" % addr0,
"EAPOL_SET %s reAuthEnabled bar" % addr0,
"EAPOL_SET %s KeyTransmissionEnabled bar" % addr0,
"EAPOL_SET 11:22:33:44:55:66 AdminControlledDirections Both" ]
"EAPOL_SET 11:22:33:44:55:66 AdminControlledDirections Both"]
for t in tests:
if "FAIL" not in hapd.request(t):
raise Exception("Invalid EAPOL_SET command accepted: " + t)
tests = [ ("AdminControlledDirections", "adminControlledDirections", "In"),
tests = [("AdminControlledDirections", "adminControlledDirections", "In"),
("AdminControlledDirections", "adminControlledDirections",
"Both"),
("quietPeriod", "quietPeriod", "13"),
@ -407,8 +407,8 @@ def test_ieee8021x_set_conf(dev, apdev):
("AdminControlledPortControl", "portControl", "ForceAuthorized"),
("AdminControlledPortControl", "portControl",
"ForceUnauthorized"),
("AdminControlledPortControl", "portControl", "Auto") ]
for param,mibparam,val in tests:
("AdminControlledPortControl", "portControl", "Auto")]
for param, mibparam, val in tests:
if "OK" not in hapd.request("EAPOL_SET %s %s %s" % (addr0, param, val)):
raise Exception("Failed to set %s %s" % (param, val))
mib = hapd.get_sta(addr0, info="eapol")

View File

@ -71,7 +71,7 @@ def expect_no_ack(hapd):
def test_kernel_unknown_action_frame_rejection_sta(dev, apdev, params):
"""mac80211 and unknown Action frame rejection in STA mode"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "unknown-action" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unknown-action"})
dev[0].connect("unknown-action", key_mgmt="NONE", scan_freq="2412")
bssid = hapd.own_addr()
addr = dev[0].own_addr()
@ -120,7 +120,7 @@ def test_kernel_unknown_action_frame_rejection_sta(dev, apdev, params):
"wlan.sa == %s && wlan.fc.type_subtype == 0x0d" % addr,
display=["wlan_mgt.fixed.category_code"])
res = out.splitlines()
categ = [ int(x) for x in res ]
categ = [int(x) for x in res]
if 0xf2 in categ or 0xf3 in categ:
raise Exception("Unexpected Action frame rejection: " + str(categ))

View File

@ -137,7 +137,7 @@ def set_mka_psk_config(dev, mka_priority=None, integ_only=False, port=None,
dev.select_network(id)
def log_ip_macsec():
cmd = subprocess.Popen([ "ip", "macsec", "show" ],
cmd = subprocess.Popen(["ip", "macsec", "show"],
stdout=subprocess.PIPE,
stderr=open('/dev/null', 'w'))
res = cmd.stdout.read().decode()
@ -145,7 +145,7 @@ def log_ip_macsec():
logger.info("ip macsec:\n" + res)
def log_ip_link():
cmd = subprocess.Popen([ "ip", "link", "show" ],
cmd = subprocess.Popen(["ip", "link", "show"],
stdout=subprocess.PIPE)
res = cmd.stdout.read().decode()
cmd.stdout.close()
@ -153,8 +153,8 @@ def log_ip_link():
def add_veth():
try:
subprocess.check_call([ "ip", "link", "add", "veth0", "type", "veth",
"peer", "name", "veth1" ])
subprocess.check_call(["ip", "link", "add", "veth0", "type", "veth",
"peer", "name", "veth1"])
except subprocess.CalledProcessError:
raise HwsimSkip("veth not supported (kernel CONFIG_VETH)")
@ -235,8 +235,7 @@ def run_macsec_psk(dev, apdev, params, prefix, integ_only=False, port0=None,
cap_macsec1 = os.path.join(params['logdir'], prefix + ".macsec1.pcap")
for i in range(2):
subprocess.check_call([ "ip", "link", "set", "dev", "veth%d" % i,
"up" ])
subprocess.check_call(["ip", "link", "set", "dev", "veth%d" % i, "up"])
cmd = {}
cmd[0] = subprocess.Popen(['tcpdump', '-p', '-U', '-i', 'veth0',
@ -364,12 +363,12 @@ def run_macsec_psk_br(dev, apdev, count, mka_priority):
try:
for i in range(count):
subprocess.check_call([ "ip", "link", "add", "veth%d" % i,
subprocess.check_call(["ip", "link", "add", "veth%d" % i,
"type", "veth",
"peer", "name", "vethbr%d" % i ])
"peer", "name", "vethbr%d" % i])
subprocess.check_call(["ip", "link", "set", "vethbr%d" % i, "up"])
subprocess.check_call([ "brctl", "addif", "brveth",
"vethbr%d" % i ])
subprocess.check_call(["brctl", "addif", "brveth",
"vethbr%d" % i])
except subprocess.CalledProcessError:
raise HwsimSkip("veth not supported (kernel CONFIG_VETH)")
@ -463,23 +462,23 @@ def test_macsec_psk_ns(dev, apdev, params):
stderr=open('/dev/null', 'w'))
def log_ip_macsec_ns():
cmd = subprocess.Popen([ "ip", "macsec", "show" ],
cmd = subprocess.Popen(["ip", "macsec", "show"],
stdout=subprocess.PIPE,
stderr=open('/dev/null', 'w'))
res = cmd.stdout.read().decode()
cmd.stdout.close()
logger.info("ip macsec show:\n" + res)
cmd = subprocess.Popen([ "ip", "netns", "exec", "ns0",
"ip", "macsec", "show" ],
cmd = subprocess.Popen(["ip", "netns", "exec", "ns0",
"ip", "macsec", "show"],
stdout=subprocess.PIPE,
stderr=open('/dev/null', 'w'))
res = cmd.stdout.read().decode()
cmd.stdout.close()
logger.info("ip macsec show (ns0):\n" + res)
cmd = subprocess.Popen([ "ip", "netns", "exec", "ns1",
"ip", "macsec", "show" ],
cmd = subprocess.Popen(["ip", "netns", "exec", "ns1",
"ip", "macsec", "show"],
stdout=subprocess.PIPE,
stderr=open('/dev/null', 'w'))
res = cmd.stdout.read().decode()
@ -487,22 +486,22 @@ def log_ip_macsec_ns():
logger.info("ip macsec show (ns1):\n" + res)
def log_ip_link_ns():
cmd = subprocess.Popen([ "ip", "link", "show" ],
cmd = subprocess.Popen(["ip", "link", "show"],
stdout=subprocess.PIPE)
res = cmd.stdout.read().decode()
cmd.stdout.close()
logger.info("ip link:\n" + res)
cmd = subprocess.Popen([ "ip", "netns", "exec", "ns0",
"ip", "link", "show" ],
cmd = subprocess.Popen(["ip", "netns", "exec", "ns0",
"ip", "link", "show"],
stdout=subprocess.PIPE,
stderr=open('/dev/null', 'w'))
res = cmd.stdout.read().decode()
cmd.stdout.close()
logger.info("ip link show (ns0):\n" + res)
cmd = subprocess.Popen([ "ip", "netns", "exec", "ns1",
"ip", "link", "show" ],
cmd = subprocess.Popen(["ip", "netns", "exec", "ns1",
"ip", "link", "show"],
stdout=subprocess.PIPE,
stderr=open('/dev/null', 'w'))
res = cmd.stdout.read().decode()
@ -527,8 +526,8 @@ def write_conf(conffile, mka_priority=None):
def run_macsec_psk_ns(dev, apdev, params):
try:
subprocess.check_call([ "ip", "link", "add", "veth0", "type", "veth",
"peer", "name", "veth1" ])
subprocess.check_call(["ip", "link", "add", "veth0", "type", "veth",
"peer", "name", "veth1"])
except subprocess.CalledProcessError:
raise HwsimSkip("veth not supported (kernel CONFIG_VETH)")
@ -544,14 +543,14 @@ def run_macsec_psk_ns(dev, apdev, params):
for i in range(2):
try:
subprocess.check_call([ "ip", "netns", "add", "ns%d" % i ])
subprocess.check_call(["ip", "netns", "add", "ns%d" % i])
except subprocess.CalledProcessError:
raise HwsimSkip("network namespace not supported (kernel CONFIG_NAMESPACES, CONFIG_NET_NS)")
subprocess.check_call([ "ip", "link", "set", "veth%d" % i,
"netns", "ns%d" %i ])
subprocess.check_call([ "ip", "netns", "exec", "ns%d" % i,
subprocess.check_call(["ip", "link", "set", "veth%d" % i,
"netns", "ns%d" %i])
subprocess.check_call(["ip", "netns", "exec", "ns%d" % i,
"ip", "link", "set", "dev", "veth%d" % i,
"up" ])
"up"])
cmd = {}
cmd[0] = subprocess.Popen(['ip', 'netns', 'exec', 'ns0',
@ -573,10 +572,10 @@ def run_macsec_psk_ns(dev, apdev, params):
if not os.path.exists(prg):
prg = '../../wpa_supplicant/wpa_supplicant'
arg = [ "ip", "netns", "exec", "ns0",
arg = ["ip", "netns", "exec", "ns0",
prg, '-BdddtKW', '-P', pidfile + '0', '-f', logfile0,
'-g', '/tmp/wpas-veth0',
'-Dmacsec_linux', '-c', conffile + '0', '-i', "veth0" ]
'-Dmacsec_linux', '-c', conffile + '0', '-i', "veth0"]
logger.info("Start wpa_supplicant: " + str(arg))
try:
subprocess.check_call(arg)
@ -587,10 +586,10 @@ def run_macsec_psk_ns(dev, apdev, params):
logger.info("Use alternative wpa_supplicant binary for one of the macsec devices")
prg = "wpa_supplicant-macsec2"
arg = [ "ip", "netns", "exec", "ns1",
arg = ["ip", "netns", "exec", "ns1",
prg, '-BdddtKW', '-P', pidfile + '1', '-f', logfile1,
'-g', '/tmp/wpas-veth1',
'-Dmacsec_linux', '-c', conffile + '1', '-i', "veth1" ]
'-Dmacsec_linux', '-c', conffile + '1', '-i', "veth1"]
logger.info("Start wpa_supplicant: " + str(arg))
subprocess.check_call(arg)

View File

@ -90,24 +90,24 @@ def run_mbo_supp_oper_class(dev, apdev, country, expected, inc5,
freq_list=None, disable_ht=False,
disable_vht=False):
if inc5:
params = { 'ssid': "test-wnm-mbo",
params = {'ssid': "test-wnm-mbo",
'mbo': '1',
"country_code": "US",
'ieee80211d': '1',
"ieee80211n": "1",
"hw_mode": "a",
"channel": "36" }
"channel": "36"}
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
else:
hapd = None
params = { 'ssid': "test-wnm-mbo-2",
params = {'ssid': "test-wnm-mbo-2",
'mbo': '1',
"country_code": "US",
'ieee80211d': '1',
"ieee80211n": "1",
"hw_mode": "g",
"channel": "1" }
"channel": "1"}
hapd2 = hostapd.add_ap(apdev[1], params, no_enable=True)
try:
@ -194,8 +194,8 @@ def test_mbo_supp_oper_classes_us_disable_vht(dev, apdev):
def test_mbo_assoc_disallow(dev, apdev, params):
"""MBO and association disallowed"""
hapd1 = hostapd.add_ap(apdev[0], { "ssid": "MBO", "mbo": "1" })
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "MBO", "mbo": "1" })
hapd1 = hostapd.add_ap(apdev[0], {"ssid": "MBO", "mbo": "1"})
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "MBO", "mbo": "1"})
logger.debug("Set mbo_assoc_disallow with invalid value")
if "FAIL" not in hapd1.request("SET mbo_assoc_disallow 2"):
@ -247,7 +247,7 @@ def test_mbo_assoc_disallow_ignore(dev, apdev):
dev[0].request("SCAN_INTERVAL 5")
def _test_mbo_assoc_disallow_ignore(dev, apdev):
hapd1 = hostapd.add_ap(apdev[0], { "ssid": "MBO", "mbo": "1" })
hapd1 = hostapd.add_ap(apdev[0], {"ssid": "MBO", "mbo": "1"})
if "OK" not in hapd1.request("SET mbo_assoc_disallow 1"):
raise Exception("Failed to set mbo_assoc_disallow for AP1")
@ -274,7 +274,7 @@ def _test_mbo_assoc_disallow_ignore(dev, apdev):
def test_mbo_cell_capa_update(dev, apdev):
"""MBO cellular data capability update"""
ssid = "test-wnm-mbo"
params = { 'ssid': ssid, 'mbo': '1' }
params = {'ssid': ssid, 'mbo': '1'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
if "OK" not in dev[0].request("SET mbo_cell_capa 1"):
@ -335,7 +335,7 @@ def test_mbo_cell_capa_update_pmf(dev, apdev):
def test_mbo_wnm_token_wrap(dev, apdev):
"""MBO WNM token wrap around"""
ssid = "test-wnm-mbo"
params = { 'ssid': ssid, 'mbo': '1' }
params = {'ssid': ssid, 'mbo': '1'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@ -353,7 +353,7 @@ def test_mbo_wnm_token_wrap(dev, apdev):
def test_mbo_non_pref_chan(dev, apdev):
"""MBO non-preferred channel list"""
ssid = "test-wnm-mbo"
params = { 'ssid': ssid, 'mbo': '1' }
params = {'ssid': ssid, 'mbo': '1'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
if "FAIL" not in dev[0].request("SET non_pref_chan 81:7:200:99"):
@ -439,7 +439,7 @@ def test_mbo_non_pref_chan(dev, apdev):
def test_mbo_sta_supp_op_classes(dev, apdev):
"""MBO STA supported operating classes"""
ssid = "test-wnm-mbo"
params = { 'ssid': ssid, 'mbo': '1' }
params = {'ssid': ssid, 'mbo': '1'}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
@ -458,7 +458,7 @@ def test_mbo_sta_supp_op_classes(dev, apdev):
def test_mbo_failures(dev, apdev):
"""MBO failure cases"""
ssid = "test-wnm-mbo"
params = { 'ssid': ssid, 'mbo': '1' }
params = {'ssid': ssid, 'mbo': '1'}
hapd = hostapd.add_ap(apdev[0], params)
with alloc_fail(dev[0], 1, "wpas_mbo_ie"):
@ -491,7 +491,7 @@ def test_mbo_wnm_bss_tm_ie_parsing(dev, apdev):
hdr = "d0003a01" + addr.replace(':', '') + bssid.replace(':', '') + bssid.replace(':', '') + "3000"
btm_hdr = "0a070100030001"
tests = [ ("Truncated attribute in MBO IE", "dd06506f9a160101"),
tests = [("Truncated attribute in MBO IE", "dd06506f9a160101"),
("Unexpected cell data capa attribute length in MBO IE",
"dd09506f9a160501030500"),
("Unexpected transition reason attribute length in MBO IE",
@ -499,7 +499,7 @@ def test_mbo_wnm_bss_tm_ie_parsing(dev, apdev):
("Unexpected assoc retry delay attribute length in MBO IE",
"dd0c506f9a160100080200000800"),
("Unknown attribute id 255 in MBO IE",
"dd06506f9a16ff00") ]
"dd06506f9a16ff00")]
for test, mbo_ie in tests:
logger.info(test)
@ -521,9 +521,9 @@ def test_mbo_wnm_bss_tm_ie_parsing(dev, apdev):
def test_mbo_without_pmf(dev, apdev):
"""MBO and WPA2 without PMF"""
ssid = "test-wnm-mbo"
params = { 'ssid': ssid, 'mbo': '1', "wpa": '2',
params = {'ssid': ssid, 'mbo': '1', "wpa": '2',
"wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
"wpa_passphrase": "12345678" }
"wpa_passphrase": "12345678"}
try:
# "MBO: PMF needs to be enabled whenever using WPA2 with MBO"
hostapd.add_ap(apdev[0], params)
@ -557,10 +557,10 @@ def check_mbo_anqp(dev, bssid, cell_data_conn_pref):
def test_mbo_anqp(dev, apdev):
"""MBO ANQP"""
params = { 'ssid': "test-wnm-mbo",
params = {'ssid': "test-wnm-mbo",
'mbo': '1',
'interworking': '1',
'mbo_cell_data_conn_pref': '1' }
'mbo_cell_data_conn_pref': '1'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()

View File

@ -45,7 +45,7 @@ def test_monitor_iface_wpa2_psk(dev, apdev):
def test_monitor_iface_multi_bss(dev, apdev):
"""AP mode mmonitor interface with hostapd multi-BSS setup"""
params = { "ssid": "monitor-iface", "driver_params": "use_monitor=1" }
params = {"ssid": "monitor-iface", "driver_params": "use_monitor=1"}
hapd = hostapd.add_ap(apdev[0], params)
hostapd.add_bss(apdev[0], apdev[0]['ifname'] + '-2', 'bss-2.conf')
dev[0].connect("monitor-iface", key_mgmt="NONE", scan_freq="2412")

View File

@ -11,9 +11,9 @@ def test_multi_ap_association(dev, apdev):
run_multi_ap_association(dev, apdev, 1)
dev[1].connect("multi-ap", psk="12345678", scan_freq="2412",
wait_connect=False)
ev = dev[1].wait_event([ "CTRL-EVENT-DISCONNECTED",
ev = dev[1].wait_event(["CTRL-EVENT-DISCONNECTED",
"CTRL-EVENT-CONNECTED",
"CTRL-EVENT-ASSOC-REJECT" ],
"CTRL-EVENT-ASSOC-REJECT"],
timeout=5)
dev[1].request("DISCONNECT")
if ev is None:
@ -40,8 +40,8 @@ def run_multi_ap_association(dev, apdev, multi_ap, wait_connect=True):
def test_multi_ap_disabled_on_ap(dev, apdev):
"""Multi-AP association attempt when disabled on AP"""
run_multi_ap_association(dev, apdev, 0, wait_connect=False)
ev = dev[0].wait_event([ "CTRL-EVENT-DISCONNECTED",
"CTRL-EVENT-CONNECTED" ],
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED",
"CTRL-EVENT-CONNECTED"],
timeout=5)
dev[0].request("DISCONNECT")
if ev is None:
@ -52,9 +52,9 @@ def test_multi_ap_disabled_on_ap(dev, apdev):
def test_multi_ap_fronthaul_on_ap(dev, apdev):
"""Multi-AP association attempt when only fronthaul BSS on AP"""
run_multi_ap_association(dev, apdev, 2, wait_connect=False)
ev = dev[0].wait_event([ "CTRL-EVENT-DISCONNECTED",
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED",
"CTRL-EVENT-CONNECTED",
"CTRL-EVENT-ASSOC-REJECT" ],
"CTRL-EVENT-ASSOC-REJECT"],
timeout=5)
dev[0].request("DISCONNECT")
if ev is None:
@ -73,7 +73,7 @@ def run_multi_ap_wps(dev, apdev, params, multi_ap_bssid=None):
if multi_ap_bssid is None:
multi_ap_bssid = apdev[0]['bssid']
params.update({ "wps_state": "2", "eap_server": "1" })
params.update({"wps_state": "2", "eap_server": "1"})
# WPS with multi-ap station dev[0]
hapd = hostapd.add_ap(apdev[0], params)
@ -134,9 +134,9 @@ def test_multi_ap_wps_shared(dev, apdev):
ssid = "multi-ap-wps"
passphrase = "12345678"
params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
params.update({ "multi_ap": "3",
params.update({"multi_ap": "3",
"multi_ap_backhaul_ssid": '"%s"' % ssid,
"multi_ap_backhaul_wpa_passphrase": passphrase })
"multi_ap_backhaul_wpa_passphrase": passphrase})
run_multi_ap_wps(dev, apdev, params)
def test_multi_ap_wps_shared_psk(dev, apdev):
@ -144,10 +144,10 @@ def test_multi_ap_wps_shared_psk(dev, apdev):
ssid = "multi-ap-wps"
psk = "1234567890abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
params = hostapd.wpa2_params(ssid=ssid)
params.update({ "wpa_psk": psk,
params.update({"wpa_psk": psk,
"multi_ap": "3",
"multi_ap_backhaul_ssid": '"%s"' % ssid,
"multi_ap_backhaul_wpa_psk": psk })
"multi_ap_backhaul_wpa_psk": psk})
run_multi_ap_wps(dev, apdev, params)
def test_multi_ap_wps_split(dev, apdev):
@ -156,12 +156,12 @@ def test_multi_ap_wps_split(dev, apdev):
backhaul_passphrase = "87654321"
params = hostapd.wpa2_params(ssid="multi-ap-fronthaul-wps",
passphrase="12345678")
params.update({ "multi_ap": "2",
params.update({"multi_ap": "2",
"multi_ap_backhaul_ssid": '"%s"' % backhaul_ssid,
"multi_ap_backhaul_wpa_passphrase": backhaul_passphrase })
"multi_ap_backhaul_wpa_passphrase": backhaul_passphrase})
params_backhaul = hostapd.wpa2_params(ssid=backhaul_ssid,
passphrase=backhaul_passphrase)
params_backhaul.update({ "multi_ap": "1" })
params_backhaul.update({"multi_ap": "1"})
hapd_backhaul = hostapd.add_ap(apdev[1], params_backhaul)
run_multi_ap_wps(dev, apdev, params, hapd_backhaul.own_addr())
@ -172,11 +172,11 @@ def test_multi_ap_wps_split_psk(dev, apdev):
backhaul_psk = "1234567890abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
params = hostapd.wpa2_params(ssid="multi-ap-fronthaul-wps",
passphrase="12345678")
params.update({ "multi_ap": "2",
params.update({"multi_ap": "2",
"multi_ap_backhaul_ssid": '"%s"' % backhaul_ssid,
"multi_ap_backhaul_wpa_psk": backhaul_psk })
"multi_ap_backhaul_wpa_psk": backhaul_psk})
params_backhaul = hostapd.wpa2_params(ssid=backhaul_ssid)
params_backhaul.update({ "multi_ap": "1", "wpa_psk": backhaul_psk })
params_backhaul.update({"multi_ap": "1", "wpa_psk": backhaul_psk})
hapd_backhaul = hostapd.add_ap(apdev[1], params_backhaul)
run_multi_ap_wps(dev, apdev, params, hapd_backhaul.own_addr())
@ -187,12 +187,12 @@ def test_multi_ap_wps_split_mixed(dev, apdev):
backhaul_passphrase = "87654321"
params = hostapd.wpa_mixed_params(ssid="multi-ap-fronthaul-wps",
passphrase="12345678")
params.update({ "multi_ap": "2",
params.update({"multi_ap": "2",
"multi_ap_backhaul_ssid": '"%s"' % backhaul_ssid,
"multi_ap_backhaul_wpa_passphrase": backhaul_passphrase })
"multi_ap_backhaul_wpa_passphrase": backhaul_passphrase})
params_backhaul = hostapd.wpa2_params(ssid=backhaul_ssid,
passphrase=backhaul_passphrase)
params_backhaul.update({ "multi_ap": "1" })
params_backhaul.update({"multi_ap": "1"})
hapd_backhaul = hostapd.add_ap(apdev[1], params_backhaul)
run_multi_ap_wps(dev, apdev, params, hapd_backhaul.own_addr())
@ -201,12 +201,12 @@ def test_multi_ap_wps_split_open(dev, apdev):
"""WPS on split fronthaul and backhaul AP with open fronthaul"""
backhaul_ssid = "multi-ap-backhaul-wps"
backhaul_passphrase = "87654321"
params = { "ssid": "multi-ap-wps-fronthaul", "multi_ap": "2",
params = {"ssid": "multi-ap-wps-fronthaul", "multi_ap": "2",
"multi_ap_backhaul_ssid": '"%s"' % backhaul_ssid,
"multi_ap_backhaul_wpa_passphrase": backhaul_passphrase }
"multi_ap_backhaul_wpa_passphrase": backhaul_passphrase}
params_backhaul = hostapd.wpa2_params(ssid=backhaul_ssid,
passphrase=backhaul_passphrase)
params_backhaul.update({ "multi_ap": "1" })
params_backhaul.update({"multi_ap": "1"})
hapd_backhaul = hostapd.add_ap(apdev[1], params_backhaul)
run_multi_ap_wps(dev, apdev, params, hapd_backhaul.own_addr())
@ -215,7 +215,7 @@ def test_multi_ap_wps_fail_non_multi_ap(dev, apdev):
"""Multi-AP WPS on non-WPS AP fails"""
params = hostapd.wpa2_params(ssid="non-multi-ap-wps", passphrase="12345678")
params.update({ "wps_state": "2", "eap_server": "1" })
params.update({"wps_state": "2", "eap_server": "1"})
hapd = hostapd.add_ap(apdev[0], params)
hapd.request("WPS_PBC")
@ -229,7 +229,7 @@ def test_multi_ap_wps_fail_non_multi_ap(dev, apdev):
# to change the timeout from 2 minutes. Instead of waiting for the timeout,
# just check that WPS doesn't finish within reasonable time.
for i in range(2):
ev = dev[0].wait_event([ "WPS-SUCCESS", "WPS-FAIL",
ev = dev[0].wait_event(["WPS-SUCCESS", "WPS-FAIL",
"CTRL-EVENT-DISCONNECTED"], timeout=10)
if ev and "WPS-" in ev:
raise Exception("WPS operation completed: " + ev)

View File

@ -32,7 +32,7 @@ def check_wpa2_connection(sta, ap, hapd, ssid, mixed=False):
hwsim_utils.test_connectivity(sta, hapd)
def ap_wps_params(ssid):
return { "ssid": ssid, "eap_server": "1", "wps_state": "2",
return {"ssid": ssid, "eap_server": "1", "wps_state": "2",
"wpa_passphrase": "12345678", "wpa": "2",
"wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"}
@ -104,7 +104,7 @@ def test_nfc_wps_config_token_init(dev, apdev):
"""NFC tag with configuration token from AP with auto configuration"""
ssid = "test-wps-nfc-conf-token-init"
hapd = hostapd.add_ap(apdev[0],
{ "ssid": ssid, "eap_server": "1", "wps_state": "1" })
{"ssid": ssid, "eap_server": "1", "wps_state": "1"})
logger.info("NFC configuration token from AP to station")
conf = hapd.request("WPS_NFC_CONFIG_TOKEN NDEF").rstrip()
if "FAIL" in conf:
@ -121,7 +121,7 @@ def test_nfc_wps_password_token_sta_init(dev, apdev):
"""Initial AP configuration with first WPS NFC Enrollee"""
ssid = "test-wps-nfc-pw-token-init"
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 using password token from station")
pw = dev[0].request("WPS_NFC_TOKEN NDEF").rstrip()
if "FAIL" in pw:
@ -141,7 +141,7 @@ def test_nfc_wps_password_token_ap(dev, apdev):
"""WPS registrar configuring an AP using AP password token"""
ssid = "test-wps-nfc-pw-token-init"
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 configuration step")
pw = hapd.request("WPS_NFC_TOKEN NDEF").rstrip()
if "FAIL" in pw:
@ -189,7 +189,7 @@ def _test_nfc_wps_handover_init(dev, apdev):
dev[0].request("SET ignore_old_scan_res 1")
ssid = "test-wps-nfc-handover-init"
hapd = hostapd.add_ap(apdev[0],
{ "ssid": ssid, "eap_server": "1", "wps_state": "1" })
{"ssid": ssid, "eap_server": "1", "wps_state": "1"})
logger.info("NFC connection handover")
req = dev[0].request("NFC_GET_HANDOVER_REQ NDEF WPS-CR").rstrip()
if "FAIL" in req:
@ -227,7 +227,7 @@ def test_nfc_wps_handover_errors(dev, apdev):
"""WPS AP NFC handover report error cases"""
ssid = "test-wps-nfc-handover"
hapd = hostapd.add_ap(apdev[0],
{ "ssid": ssid, "eap_server": "1", "wps_state": "1" })
{"ssid": ssid, "eap_server": "1", "wps_state": "1"})
sel = hapd.request("NFC_GET_HANDOVER_SEL NDEF WPS-CR").rstrip()
if "FAIL" in sel:
raise Exception("Failed to generate NFC connection handover select")
@ -431,7 +431,7 @@ def test_nfc_wps_handover_pk_hash_mismatch_ap(dev, apdev):
def start_ap_er(er, ap, ssid):
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
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",
@ -617,7 +617,7 @@ def _test_nfc_wps_er_handover_pk_hash_mismatch_er(dev, apdev):
@remote_compatible
def test_nfc_invalid_ndef_record(dev, apdev):
"""Invalid NFC NDEF record handling"""
tests = [ "11223344",
tests = ["11223344",
"00112233",
"0000112233445566",
"0800112233445566",
@ -635,7 +635,7 @@ def test_nfc_invalid_ndef_record(dev, apdev):
"0017ffffffe46170706c69636174696f6e2f766e642e7766612e777363",
"0017ffffffff6170706c69636174696f6e2f766e642e7766612e777363",
"0017000000006170706c69636174696f6e2f766e642e7766612e7773ff",
"080000000000" ]
"080000000000"]
for test in tests:
if "FAIL" not in dev[0].request("WPS_NFC_TAG_READ " + test):
raise Exception("Invalid tag accepted: " + test)

View File

@ -16,7 +16,7 @@ from datetime import datetime
from utils import HwsimSkip
def check_set_tx_power(dev, apdev):
hapd = hostapd.add_ap(apdev[0], {'ssid' : 'check_tx_power'})
hapd = hostapd.add_ap(apdev[0], {'ssid': 'check_tx_power'})
set_rx_rssi(hapd, -50)
dev[0].scan(freq=2412)
@ -38,9 +38,9 @@ def check_set_tx_power(dev, apdev):
def run_rssi_based_assoc_rej_timeout(dev, apdev, params):
rssi_retry_to = 5
ap_params = { 'ssid': "test-RSSI-ar-to",
ap_params = {'ssid': "test-RSSI-ar-to",
'rssi_reject_assoc_rssi': '-45',
'rssi_reject_assoc_timeout': str(rssi_retry_to) }
'rssi_reject_assoc_timeout': str(rssi_retry_to)}
logger.info("Set APs RSSI rejection threshold to -45 dBm, retry timeout: " +
str(rssi_retry_to))
@ -88,9 +88,9 @@ def test_rssi_based_assoc_rej_timeout(dev, apdev, params):
dev[0].request("SCAN_INTERVAL 5")
def run_rssi_based_assoc_rej_good_rssi(dev, apdev):
ap_params = { 'ssid': "test-RSSI-ar-to",
ap_params = {'ssid': "test-RSSI-ar-to",
'rssi_reject_assoc_rssi': '-45',
'rssi_reject_assoc_timeout': '60' }
'rssi_reject_assoc_timeout': '60'}
logger.info("Set APs RSSI rejection threshold to -45 dBm")
hapd = hostapd.add_ap(apdev[0], ap_params)
@ -139,9 +139,9 @@ def test_rssi_based_assoc_rssi_change(dev, apdev):
"""RSSI-based association rejection: connect after improving RSSI"""
check_set_tx_power(dev, apdev)
try:
ap_params = { 'ssid': "test-RSSI-ar-to",
ap_params = {'ssid': "test-RSSI-ar-to",
'rssi_reject_assoc_rssi': '-45',
'rssi_reject_assoc_timeout': '60' }
'rssi_reject_assoc_timeout': '60'}
logger.info("Set APs RSSI rejection threshold to -45 dBm, retry timeout: 60")
hapd = hostapd.add_ap(apdev[0], ap_params)

View File

@ -69,9 +69,9 @@ def build_eapol_key_2_2(kck, key_data, replay_counter=3, key_info=0x0302,
@remote_compatible
def test_wpa2_ocv(dev, apdev):
"""OCV on 2.4 GHz"""
params = { "channel": "1",
params = {"channel": "1",
"ieee80211w": "2",
"ocv": "1" }
"ocv": "1"}
hapd, ssid, passphrase = ocv_setup_ap(apdev[0], params)
for ocv in range(2):
dev[0].connect(ssid, psk=passphrase, scan_freq="2412", ocv=str(ocv),
@ -89,11 +89,11 @@ def test_wpa2_ocv_5ghz(dev, apdev):
dev[0].flush_scan_cache()
def run_wpa2_ocv_5ghz(dev, apdev):
params = { "hw_mode": "a",
params = {"hw_mode": "a",
"channel": "40",
"ieee80211w": "2",
"country_code": "US",
"ocv": "1" }
"ocv": "1"}
hapd, ssid, passphrase = ocv_setup_ap(apdev[0], params)
for ocv in range(2):
dev[0].connect(ssid, psk=passphrase, scan_freq="5200", ocv=str(ocv),
@ -105,10 +105,10 @@ def run_wpa2_ocv_5ghz(dev, apdev):
@remote_compatible
def test_wpa2_ocv_ht20(dev, apdev):
"""OCV with HT20 channel"""
params = { "channel": "6",
params = {"channel": "6",
"ieee80211n": "1",
"ieee80211w": "1",
"ocv": "1" }
"ocv": "1"}
hapd, ssid, passphrase = ocv_setup_ap(apdev[0], params)
for ocv in range(2):
dev[0].connect(ssid, psk=passphrase, scan_freq="2437", ocv=str(ocv),
@ -131,17 +131,17 @@ def test_wpa2_ocv_ht40(dev, apdev):
dev[1].flush_scan_cache()
def run_wpa2_ocv_ht40(dev, apdev):
for channel, capab, freq, mode in [( "6", "[HT40-]", "2437", "g"),
( "6", "[HT40+]", "2437", "g"),
for channel, capab, freq, mode in [("6", "[HT40-]", "2437", "g"),
("6", "[HT40+]", "2437", "g"),
("40", "[HT40-]", "5200", "a"),
("36", "[HT40+]", "5180", "a")]:
params = { "hw_mode": mode,
params = {"hw_mode": mode,
"channel": channel,
"country_code": "US",
"ieee80211n": "1",
"ht_capab": capab,
"ieee80211w": "1",
"ocv": "1" }
"ocv": "1"}
hapd, ssid, passphrase = ocv_setup_ap(apdev[0], params)
dev[0].flush_scan_cache()
dev[1].flush_scan_cache()
@ -171,7 +171,7 @@ def test_wpa2_ocv_vht40(dev, apdev):
def run_wpa2_ocv_vht40(dev, apdev):
for channel, capab, freq in [("40", "[HT40-]", "5200"),
("36", "[HT40+]", "5180")]:
params = { "hw_mode": "a",
params = {"hw_mode": "a",
"channel": channel,
"country_code": "US",
"ht_capab": capab,
@ -180,7 +180,7 @@ def run_wpa2_ocv_vht40(dev, apdev):
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "38",
"ieee80211w": "1",
"ocv": "1" }
"ocv": "1"}
hapd, ssid, passphrase = ocv_setup_ap(apdev[0], params)
dev[0].flush_scan_cache()
dev[1].flush_scan_cache()
@ -215,7 +215,7 @@ def test_wpa2_ocv_vht80(dev, apdev):
def run_wpa2_ocv_vht80(dev, apdev):
for channel, capab, freq in [("40", "[HT40-]", "5200"),
("36", "[HT40+]", "5180")]:
params = { "hw_mode": "a",
params = {"hw_mode": "a",
"channel": channel,
"country_code": "US",
"ht_capab": capab,
@ -224,7 +224,7 @@ def run_wpa2_ocv_vht80(dev, apdev):
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "42",
"ieee80211w": "1",
"ocv": "1" }
"ocv": "1"}
hapd, ssid, passphrase = ocv_setup_ap(apdev[0], params)
for ocv in range(2):
dev[0].connect(ssid, psk=passphrase, scan_freq=freq, ocv=str(ocv),
@ -256,7 +256,7 @@ def test_wpa2_ocv_vht160(dev, apdev):
def run_wpa2_ocv_vht160(dev, apdev):
for channel, capab, freq in [("100", "[HT40+]", "5500"),
("104", "[HT40-]", "5520")]:
params = { "hw_mode": "a",
params = {"hw_mode": "a",
"channel": channel,
"country_code": "ZA",
"ht_capab": capab,
@ -265,7 +265,7 @@ def run_wpa2_ocv_vht160(dev, apdev):
"vht_oper_chwidth": "2",
"vht_oper_centr_freq_seg0_idx": "114",
"ieee80211w": "1",
"ocv": "1" }
"ocv": "1"}
hapd, ssid, passphrase = ocv_setup_ap(apdev[0], params)
for ocv in range(2):
dev[0].connect(ssid, psk=passphrase, scan_freq=freq, ocv=str(ocv),
@ -298,7 +298,7 @@ def test_wpa2_ocv_vht80plus80(dev, apdev):
def run_wpa2_ocv_vht80plus80(dev, apdev):
for channel, capab, freq in [("36", "[HT40+]", "5180"),
("40", "[HT40-]", "5200")]:
params = { "hw_mode": "a",
params = {"hw_mode": "a",
"channel": channel,
"country_code": "US",
"ht_capab": capab,
@ -310,7 +310,7 @@ def run_wpa2_ocv_vht80plus80(dev, apdev):
"ieee80211w": "1",
"ieee80211d": "1",
"ieee80211h": "1",
"ocv": "1" }
"ocv": "1"}
hapd, ssid, passphrase = ocv_setup_ap(apdev[0], params)
for ocv in range(2):
dev[0].connect(ssid, psk=passphrase, scan_freq=freq, ocv=str(ocv),
@ -397,7 +397,7 @@ class APConnection:
self.msg = recv_eapol(self.hapd)
self.anonce = self.msg['rsn_key_nonce']
(ptk, self.kck, self.kek) = pmk_to_ptk(pmk, self.addr, self.bssid,
self.snonce,self.anonce)
self.snonce, self.anonce)
# hapd, addr, rsne, kck, msg, anonce, snonce
def test_bad_oci(self, logmsg, op_class, channel, seg1_idx):
@ -430,9 +430,9 @@ class APConnection:
@remote_compatible
def test_wpa2_ocv_ap_mismatch(dev, apdev):
"""OCV AP mismatch"""
params = { "channel": "1",
params = {"channel": "1",
"ieee80211w": "1",
"freq": "2412" }
"freq": "2412"}
conn = APConnection(apdev[0], dev[0], params)
conn.test_bad_oci("element missing", None, 0, 0)
conn.test_bad_oci("wrong channel number", 81, 6, 0)
@ -444,10 +444,10 @@ def test_wpa2_ocv_ap_mismatch(dev, apdev):
@remote_compatible
def test_wpa2_ocv_ap_ht_mismatch(dev, apdev):
"""OCV AP mismatch (HT)"""
params = { "channel": "6",
params = {"channel": "6",
"ht_capab": "[HT40-]",
"ieee80211w": "1",
"freq": "2437" }
"freq": "2437"}
conn = APConnection(apdev[0], dev[0], params)
conn.test_bad_oci("wrong primary channel", 84, 5, 0)
conn.test_bad_oci("lower bandwidth than negotiated", 81, 6, 0)
@ -464,7 +464,7 @@ def test_wpa2_ocv_ap_vht80_mismatch(dev, apdev):
dev[0].flush_scan_cache()
def run_wpa2_ocv_ap_vht80_mismatch(dev, apdev):
params = { "hw_mode": "a",
params = {"hw_mode": "a",
"channel": "36",
"country_code": "US",
"ht_capab": "[HT40+]",
@ -473,7 +473,7 @@ def run_wpa2_ocv_ap_vht80_mismatch(dev, apdev):
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"freq": "5180",
"vht_oper_centr_freq_seg0_idx": "42" }
"vht_oper_centr_freq_seg0_idx": "42"}
conn = APConnection(apdev[0], dev[0], params)
conn.test_bad_oci("wrong primary channel", 128, 38, 0)
conn.test_bad_oci("wrong primary channel", 128, 32, 0)
@ -496,7 +496,7 @@ def test_wpa2_ocv_ap_vht160_mismatch(dev, apdev):
dev[0].flush_scan_cache()
def run_wpa2_ocv_ap_vht160_mismatch(dev, apdev):
params = { "hw_mode": "a",
params = {"hw_mode": "a",
"channel": "100",
"country_code": "ZA",
"ht_capab": "[HT40+]",
@ -507,7 +507,7 @@ def run_wpa2_ocv_ap_vht160_mismatch(dev, apdev):
"freq": "5500",
"vht_oper_centr_freq_seg0_idx": "114",
"ieee80211d": "1",
"ieee80211h": "1" }
"ieee80211h": "1"}
conn = APConnection(apdev[0], dev[0], params)
conn.test_bad_oci("wrong primary channel", 129, 36, 0)
conn.test_bad_oci("wrong primary channel", 129, 114, 0)
@ -535,7 +535,7 @@ def test_wpa2_ocv_ap_vht80plus80_mismatch(dev, apdev):
dev[0].flush_scan_cache()
def run_wpa2_ocv_ap_vht80plus80_mismatch(dev, apdev):
params = { "hw_mode": "a",
params = {"hw_mode": "a",
"channel": "36",
"country_code": "US",
"ht_capab": "[HT40+]",
@ -547,7 +547,7 @@ def run_wpa2_ocv_ap_vht80plus80_mismatch(dev, apdev):
"vht_oper_centr_freq_seg0_idx": "42",
"ieee80211d": "1",
"vht_oper_centr_freq_seg1_idx": "155",
"ieee80211h": "1" }
"ieee80211h": "1"}
conn = APConnection(apdev[0], dev[0], params)
conn.test_bad_oci("using 80 MHz operating class", 128, 36, 155)
conn.test_bad_oci("wrong frequency segment 1", 130, 36, 138)
@ -563,11 +563,11 @@ def run_wpa2_ocv_ap_vht80plus80_mismatch(dev, apdev):
@remote_compatible
def test_wpa2_ocv_ap_unexpected1(dev, apdev):
"""OCV and unexpected OCI KDE from station"""
params = { "channel": "1",
params = {"channel": "1",
"ieee80211w": "1",
"ap_ocv": "0",
"sta_ocv": "1",
"freq": "2412" }
"freq": "2412"}
conn = APConnection(apdev[0], dev[0], params)
logger.debug("Client will send OCI KDE even if it was not negotiated")
conn.confirm_valid_oci(81, 1, 0)
@ -575,11 +575,11 @@ def test_wpa2_ocv_ap_unexpected1(dev, apdev):
@remote_compatible
def test_wpa2_ocv_ap_unexpected2(dev, apdev):
"""OCV and unexpected OCI KDE from station"""
params = { "channel": "1",
params = {"channel": "1",
"ieee80211w": "1",
"ap_ocv": "1",
"sta_ocv": "0",
"freq": "2412" }
"freq": "2412"}
conn = APConnection(apdev[0], dev[0], params)
logger.debug("Client will send OCI KDE even if it was not negotiated")
conn.confirm_valid_oci(81, 1, 0)
@ -643,10 +643,10 @@ def test_wpa2_ocv_ap_retransmit_msg3(dev, apdev):
def test_wpa2_ocv_ap_group_hs(dev, apdev):
"""OCV group handshake (AP)"""
params = { "channel": "1",
params = {"channel": "1",
"ieee80211w": "1",
"freq": "2412",
"wpa_strict_rekey": "1" }
"wpa_strict_rekey": "1"}
conn = APConnection(apdev[0], dev[0], params)
conn.confirm_valid_oci(81, 1, 0)
@ -760,7 +760,7 @@ class STAConnection:
self.msg = recv_eapol(dev)
self.snonce = self.msg['rsn_key_nonce']
(ptk, self.kck, self.kek) = pmk_to_ptk(pmk, self.addr, self.bssid,
self.snonce,self.anonce)
self.snonce, self.anonce)
self.counter = struct.unpack('>Q',
self.msg['rsn_replay_counter'])[0] + 1
@ -803,10 +803,10 @@ class STAConnection:
@remote_compatible
def test_wpa2_ocv_mismatch_client(dev, apdev):
"""OCV client mismatch"""
params = { "channel": "1",
params = {"channel": "1",
"ieee80211w": "1",
"ocv": "1",
"freq": "2412" }
"freq": "2412"}
conn = STAConnection(apdev[0], dev[0], params)
conn.test_bad_oci("element missing", None, 0, 0,
"did not receive mandatory OCI")
@ -831,7 +831,7 @@ def test_wpa2_ocv_vht160_mismatch_client(dev, apdev):
dev[0].flush_scan_cache()
def run_wpa2_ocv_vht160_mismatch_client(dev, apdev):
params = { "hw_mode": "a",
params = {"hw_mode": "a",
"channel": "100",
"country_code": "ZA",
"ht_capab": "[HT40+]",
@ -843,8 +843,8 @@ def run_wpa2_ocv_vht160_mismatch_client(dev, apdev):
"vht_oper_centr_freq_seg0_idx": "114",
"freq": "5500",
"ieee80211d": "1",
"ieee80211h": "1" }
sta_params = { "disable_vht": "1" }
"ieee80211h": "1"}
sta_params = {"disable_vht": "1"}
conn = STAConnection(apdev[0], dev[0], params, sta_params)
conn.test_bad_oci("smaller bandwidth (20 Mhz) than negotiated",
121, 100, 0, "channel bandwidth mismatch")
@ -863,11 +863,11 @@ def run_wpa2_ocv_vht160_mismatch_client(dev, apdev):
def test_wpa2_ocv_sta_group_hs(dev, apdev):
"""OCV group handshake (STA)"""
params = { "channel": "1",
params = {"channel": "1",
"ieee80211w": "1",
"ocv": "1",
"freq": "2412",
"wpa_strict_rekey": "1" }
"wpa_strict_rekey": "1"}
conn = STAConnection(apdev[0], dev[0], params.copy())
conn.confirm_valid_oci(81, 1, 0)

View File

@ -19,11 +19,11 @@ def test_owe(dev, apdev):
"""Opportunistic Wireless Encryption"""
if "OWE" not in dev[0].get_capability("key_mgmt"):
raise HwsimSkip("OWE not supported")
params = { "ssid": "owe",
params = {"ssid": "owe",
"wpa": "2",
"ieee80211w": "2",
"wpa_key_mgmt": "OWE",
"rsn_pairwise": "CCMP" }
"rsn_pairwise": "CCMP"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -43,15 +43,15 @@ def test_owe_groups(dev, apdev):
"""Opportunistic Wireless Encryption - DH groups"""
if "OWE" not in dev[0].get_capability("key_mgmt"):
raise HwsimSkip("OWE not supported")
params = { "ssid": "owe",
params = {"ssid": "owe",
"wpa": "2",
"wpa_key_mgmt": "OWE",
"rsn_pairwise": "CCMP" }
"rsn_pairwise": "CCMP"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq="2412")
for group in [ 19, 20, 21 ]:
for group in [19, 20, 21]:
dev[0].connect("owe", key_mgmt="OWE", owe_group=str(group))
hwsim_utils.test_connectivity(dev[0], hapd)
dev[0].request("REMOVE_NETWORK all")
@ -66,15 +66,15 @@ def test_owe_pmksa_caching_connect_cmd(dev, apdev):
"""Opportunistic Wireless Encryption and PMKSA caching using cfg80211 connect command"""
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
run_owe_pmksa_caching([ wpas ], apdev)
run_owe_pmksa_caching([wpas], apdev)
def run_owe_pmksa_caching(dev, apdev):
if "OWE" not in dev[0].get_capability("key_mgmt"):
raise HwsimSkip("OWE not supported")
params = { "ssid": "owe",
params = {"ssid": "owe",
"wpa": "2",
"wpa_key_mgmt": "OWE",
"rsn_pairwise": "CCMP" }
"rsn_pairwise": "CCMP"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -116,11 +116,11 @@ def test_owe_and_psk(dev, apdev):
"""Opportunistic Wireless Encryption and WPA2-PSK enabled"""
if "OWE" not in dev[0].get_capability("key_mgmt"):
raise HwsimSkip("OWE not supported")
params = { "ssid": "owe+psk",
params = {"ssid": "owe+psk",
"wpa": "2",
"wpa_key_mgmt": "OWE WPA-PSK",
"rsn_pairwise": "CCMP",
"wpa_passphrase": "12345678" }
"wpa_passphrase": "12345678"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -140,26 +140,26 @@ def test_owe_transition_mode_connect_cmd(dev, apdev):
"""Opportunistic Wireless Encryption transition mode using cfg80211 connect command"""
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
run_owe_transition_mode([ wpas ], apdev)
run_owe_transition_mode([wpas], apdev)
def run_owe_transition_mode(dev, apdev):
if "OWE" not in dev[0].get_capability("key_mgmt"):
raise HwsimSkip("OWE not supported")
dev[0].flush_scan_cache()
params = { "ssid": "owe-random",
params = {"ssid": "owe-random",
"wpa": "2",
"wpa_key_mgmt": "OWE",
"rsn_pairwise": "CCMP",
"ieee80211w": "2",
"owe_transition_bssid": apdev[1]['bssid'],
"owe_transition_ssid": '"owe-test"',
"ignore_broadcast_ssid": "1" }
"ignore_broadcast_ssid": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
params = { "ssid": "owe-test",
params = {"ssid": "owe-test",
"owe_transition_bssid": apdev[0]['bssid'],
"owe_transition_ssid": '"owe-random"' }
"owe_transition_ssid": '"owe-random"'}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = hapd2.own_addr()
@ -207,7 +207,7 @@ def test_owe_transition_mode_open_only_ap(dev, apdev):
if "OWE" not in dev[0].get_capability("key_mgmt"):
raise HwsimSkip("OWE not supported")
dev[0].flush_scan_cache()
params = { "ssid": "owe-test-open" }
params = {"ssid": "owe-test-open"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -227,9 +227,9 @@ def test_owe_transition_mode_open_multiple_scans(dev, apdev):
if "OWE" not in dev[0].get_capability("key_mgmt"):
raise HwsimSkip("OWE not supported")
dev[0].flush_scan_cache()
params = { "ssid": "owe-test",
params = {"ssid": "owe-test",
"owe_transition_bssid": apdev[0]['bssid'],
"owe_transition_ssid": '"owe-random"' }
"owe_transition_ssid": '"owe-random"'}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = hapd2.own_addr()
@ -240,14 +240,14 @@ def test_owe_transition_mode_open_multiple_scans(dev, apdev):
scan_freq="2412", wait_connect=False)
ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], timeout=1)
params = { "ssid": "owe-random",
params = {"ssid": "owe-random",
"wpa": "2",
"wpa_key_mgmt": "OWE",
"rsn_pairwise": "CCMP",
"ieee80211w": "2",
"owe_transition_bssid": apdev[1]['bssid'],
"owe_transition_ssid": '"owe-test"',
"ignore_broadcast_ssid": "1" }
"ignore_broadcast_ssid": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -306,7 +306,7 @@ def test_owe_unsupported_group_connect_cmd(dev, apdev):
wpas = None
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
run_owe_unsupported_group([ wpas ], apdev)
run_owe_unsupported_group([wpas], apdev)
finally:
if wpas:
wpas.request("VENDOR_ELEM_REMOVE 13 *")
@ -319,10 +319,10 @@ def run_owe_unsupported_group(dev, apdev):
# status code 77.
dev[0].request("VENDOR_ELEM_ADD 13 ff23200000783590fb7440e03d5b3b33911f86affdcc6b4411b707846ac4ff08ddc8831ccd")
params = { "ssid": "owe",
params = {"ssid": "owe",
"wpa": "2",
"wpa_key_mgmt": "OWE",
"rsn_pairwise": "CCMP" }
"rsn_pairwise": "CCMP"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -339,11 +339,11 @@ def test_owe_limited_group_set(dev, apdev):
"""Opportunistic Wireless Encryption and limited group set"""
if "OWE" not in dev[0].get_capability("key_mgmt"):
raise HwsimSkip("OWE not supported")
params = { "ssid": "owe",
params = {"ssid": "owe",
"wpa": "2",
"wpa_key_mgmt": "OWE",
"rsn_pairwise": "CCMP",
"owe_groups": "20 21" }
"owe_groups": "20 21"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -357,7 +357,7 @@ def test_owe_limited_group_set(dev, apdev):
raise Exception("Unexpected rejection reason: " + ev)
dev[0].dump_monitor()
for group in [ 20, 21 ]:
for group in [20, 21]:
dev[0].connect("owe", key_mgmt="OWE", owe_group=str(group))
dev[0].request("REMOVE_NETWORK all")
dev[0].wait_disconnected()
@ -369,12 +369,12 @@ def test_owe_limited_group_set_pmf(dev, apdev, params):
raise HwsimSkip("OWE not supported")
pcapng = os.path.join(params['logdir'], "hwsim0.pcapng")
params = { "ssid": "owe",
params = {"ssid": "owe",
"wpa": "2",
"ieee80211w": "2",
"wpa_key_mgmt": "OWE",
"rsn_pairwise": "CCMP",
"owe_groups": "21" }
"owe_groups": "21"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -428,11 +428,11 @@ def test_owe_group_negotiation_connect_cmd(dev, apdev):
def run_owe_group_negotiation(dev, apdev):
if "OWE" not in dev.get_capability("key_mgmt"):
raise HwsimSkip("OWE not supported")
params = { "ssid": "owe",
params = {"ssid": "owe",
"wpa": "2",
"wpa_key_mgmt": "OWE",
"rsn_pairwise": "CCMP",
"owe_groups": "21" }
"owe_groups": "21"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -443,13 +443,13 @@ def test_owe_assoc_reject(dev, apdev):
"""Opportunistic Wireless Encryption association rejection handling"""
if "OWE" not in dev[0].get_capability("key_mgmt"):
raise HwsimSkip("OWE not supported")
params = { "ssid": "owe",
params = {"ssid": "owe",
"require_ht": "1",
"wpa": "2",
"ieee80211w": "2",
"wpa_key_mgmt": "OWE",
"rsn_pairwise": "CCMP",
"owe_groups": "19" }
"owe_groups": "19"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -457,7 +457,7 @@ def test_owe_assoc_reject(dev, apdev):
dev[0].scan_for_bss(bssid, freq="2412")
dev[0].connect("owe", key_mgmt="OWE", ieee80211w="2",
disable_ht="1", scan_freq="2412", wait_connect=False)
for i in range(0,2):
for i in range(0, 2):
ev = dev[0].wait_event(["CTRL-EVENT-ASSOC-REJECT"], timeout=10)
if ev is None:
raise Exception("Association rejection not reported")
@ -465,7 +465,7 @@ def test_owe_assoc_reject(dev, apdev):
# Then, verify that STA tries OWE with the default group (19) on the next
# attempt instead of having moved to testing another group.
hapd.set("require_ht", "0")
for i in range(0,2):
for i in range(0, 2):
ev = dev[0].wait_event(["CTRL-EVENT-ASSOC-REJECT",
"CTRL-EVENT-CONNECTED"], timeout=10)
if ev is None:

View File

@ -746,7 +746,7 @@ def _test_autogo_many_clients(dev):
raise Exception("Could not find peer (3)")
dev[1].p2p_stop_find()
for i in [ name0, name2, name3 ]:
for i in [name0, name2, name3]:
if i not in ev1 and i not in ev2 and i not in ev3:
raise Exception('name "%s" not found' % i)

View File

@ -75,7 +75,7 @@ def test_p2p_channel_random_social(dev):
test_data=False)
check_grpform_results(i_res, r_res)
freq = int(i_res['freq'])
if freq not in [ 2412, 2437, 2462 ]:
if freq not in [2412, 2437, 2462]:
raise Exception("Unexpected channel %d MHz - did not pick random social channel" % freq)
remove_group(dev[0], dev[1])
finally:
@ -94,7 +94,7 @@ def test_p2p_channel_random(dev):
test_data=False)
check_grpform_results(i_res, r_res)
freq = int(i_res['freq'])
if freq > 2500 or freq in [ 2412, 2437, 2462 ]:
if freq > 2500 or freq in [2412, 2437, 2462]:
raise Exception("Unexpected channel %d MHz" % freq)
remove_group(dev[0], dev[1])
finally:
@ -125,7 +125,7 @@ def test_p2p_channel_random_social_with_op_class_change(dev, apdev, params):
test_data=False)
check_grpform_results(i_res, r_res)
freq = int(i_res['freq'])
if freq not in [ 2412, 2437, 2462 ]:
if freq not in [2412, 2437, 2462]:
raise Exception("Unexpected channel %d MHz - did not pick random social channel" % freq)
remove_group(dev[0], dev[1])
@ -162,7 +162,7 @@ def test_p2p_channel_avoid(dev):
test_data=False)
check_grpform_results(i_res, r_res)
freq = int(i_res['freq'])
if freq > 2500 or freq in [ 2412, 2437, 2462 ]:
if freq > 2500 or freq in [2412, 2437, 2462]:
raise Exception("Unexpected channel %d MHz" % freq)
if "OK" not in dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES"):
@ -260,10 +260,10 @@ def test_autogo_following_bss(dev, apdev):
dev[0].global_request("SET p2p_no_group_iface 0")
channels = { 3 : "2422", 5 : "2432", 9 : "2452" }
channels = {3: "2422", 5: "2432", 9: "2452"}
for key in channels:
hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test',
"channel" : str(key) })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'ap-test',
"channel": str(key)})
dev[0].connect("ap-test", key_mgmt="NONE",
scan_freq=str(channels[key]))
res_go = autogo(dev[0])
@ -281,7 +281,7 @@ def test_go_neg_with_bss_connected(dev, apdev):
dev[0].global_request("SET p2p_no_group_iface 0")
hapd = hostapd.add_ap(apdev[0],
{ "ssid": 'bss-2.4ghz', "channel": '5' })
{"ssid": 'bss-2.4ghz', "channel": '5'})
dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2432")
#dev[0] as GO
[i_res, r_res] = go_neg_pbc(i_dev=dev[0], i_intent=10, r_dev=dev[1],
@ -328,8 +328,8 @@ def test_autogo_with_bss_on_disallowed_chan(dev, apdev):
raise Exception("New radio does not support MCC")
try:
hapd = hostapd.add_ap(apdev[0], { "ssid": 'bss-2.4ghz',
"channel": '1' })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'bss-2.4ghz',
"channel": '1'})
wpas.global_request("P2P_SET disallow_freq 2412")
wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
res = autogo(wpas)
@ -353,7 +353,7 @@ def test_go_neg_with_bss_on_disallowed_chan(dev, apdev):
try:
hapd = hostapd.add_ap(apdev[0],
{ "ssid": 'bss-2.4ghz', "channel": '1' })
{"ssid": 'bss-2.4ghz', "channel": '1'})
# make sure PBC overlap from old test cases is not maintained
dev[1].flush_scan_cache()
wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
@ -406,10 +406,10 @@ def test_autogo_force_diff_channel(dev, apdev):
wpas.global_request("SET p2p_no_group_iface 0")
hapd = hostapd.add_ap(apdev[0],
{"ssid" : 'ap-test', "channel" : '1'})
wpas.connect("ap-test", key_mgmt = "NONE", scan_freq = "2412")
{"ssid": 'ap-test', "channel": '1'})
wpas.connect("ap-test", key_mgmt="NONE", scan_freq="2412")
wpas.dump_monitor()
channels = { 2 : 2417, 5 : 2432, 9 : 2452 }
channels = {2: 2417, 5: 2432, 9: 2452}
for key in channels:
res_go = autogo(wpas, channels[key])
wpas.dump_monitor()
@ -434,9 +434,9 @@ def test_go_neg_forced_freq_diff_than_bss_freq(dev, apdev):
wpas.global_request("SET p2p_no_group_iface 0")
hapd = hostapd.add_ap(apdev[0],
{ "country_code": 'US',
{"country_code": 'US',
"ssid": 'bss-5ghz', "hw_mode": 'a',
"channel": '40' })
"channel": '40'})
wpas.connect("bss-5ghz", key_mgmt="NONE", scan_freq="5200")
# GO and peer force the same freq, different than BSS freq,
@ -478,8 +478,8 @@ def test_go_pref_chan_bss_on_diff_chan(dev, apdev):
dev[0].global_request("SET p2p_no_group_iface 0")
try:
hapd = hostapd.add_ap(apdev[0], { "ssid": 'bss-2.4ghz',
"channel": '1' })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'bss-2.4ghz',
"channel": '1'})
dev[0].global_request("SET p2p_pref_chan 81:2")
dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
res = autogo(dev[0])
@ -501,8 +501,8 @@ def test_go_pref_chan_bss_on_disallowed_chan(dev, apdev):
wpas.global_request("SET p2p_no_group_iface 0")
try:
hapd = hostapd.add_ap(apdev[0], { "ssid": 'bss-2.4ghz',
"channel": '1' })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'bss-2.4ghz',
"channel": '1'})
wpas.global_request("P2P_SET disallow_freq 2412")
wpas.global_request("SET p2p_pref_chan 81:2")
wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
@ -580,7 +580,7 @@ def test_p2p_autogo_pref_chan_disallowed(dev, apdev):
dev[0].global_request("P2P_SET disallow_freq 2412,2422,2437,2452,2462")
for i in range(0, 5):
res = autogo(dev[0])
if res['freq'] in [ "2412", "2422", "2437", "2452", "2462" ]:
if res['freq'] in ["2412", "2422", "2437", "2452", "2462"]:
raise Exception("GO channel is disallowed")
dev[0].remove_group(res['ifname'])
finally:
@ -668,7 +668,7 @@ def test_p2p_listen_chan_optimize(dev, apdev):
channel = "1" if lfreq != '2412' else "6"
freq = "2412" if lfreq != '2412' else "2437"
params = { "ssid": "test-open", "channel": channel }
params = {"ssid": "test-open", "channel": channel}
hapd = hostapd.add_ap(apdev[0], params)
id = wpas.connect("test-open", key_mgmt="NONE", scan_freq=freq)
@ -811,15 +811,15 @@ def test_p2p_go_move_active(dev, apdev):
if wpas.get_mcc() < 2:
raise Exception("New radio does not support MCC")
ndev = [ wpas, dev[1] ]
ndev = [wpas, dev[1]]
_test_p2p_go_move_active(ndev, apdev)
def _test_p2p_go_move_active(dev, apdev):
dev[0].global_request("SET p2p_no_group_iface 0")
try:
dev[0].global_request("P2P_SET disallow_freq 2430-6000")
hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test',
"channel" : '11' })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'ap-test',
"channel": '11'})
dev[0].connect("ap-test", key_mgmt="NONE",
scan_freq="2462")
@ -858,15 +858,15 @@ def test_p2p_go_move_scm(dev, apdev):
if wpas.get_mcc() < 2:
raise Exception("New radio does not support MCC")
ndev = [ wpas, dev[1] ]
ndev = [wpas, dev[1]]
_test_p2p_go_move_scm(ndev, apdev)
def _test_p2p_go_move_scm(dev, apdev):
dev[0].global_request("SET p2p_no_group_iface 0")
try:
dev[0].global_request("P2P_SET disallow_freq 2430-6000")
hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test',
"channel" : '11' })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'ap-test',
"channel": '11'})
dev[0].connect("ap-test", key_mgmt="NONE",
scan_freq="2462")
@ -912,7 +912,7 @@ def test_p2p_go_move_scm_peer_supports(dev, apdev):
if wpas.get_mcc() < 2:
raise Exception("New radio does not support MCC")
ndev = [ wpas, dev[1] ]
ndev = [wpas, dev[1]]
_test_p2p_go_move_scm_peer_supports(ndev, apdev)
def _test_p2p_go_move_scm_peer_supports(dev, apdev):
@ -929,8 +929,8 @@ def _test_p2p_go_move_scm_peer_supports(dev, apdev):
if freq < 5000:
raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq)
hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test',
"channel" : '11' })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'ap-test',
"channel": '11'})
logger.info('Connecting client to to an AP on channel 11')
dev[0].connect("ap-test", key_mgmt="NONE",
scan_freq="2462")
@ -960,7 +960,7 @@ def test_p2p_go_move_scm_peer_does_not_support(dev, apdev):
if wpas.get_mcc() < 2:
raise Exception("New radio does not support MCC")
ndev = [ wpas, dev[1] ]
ndev = [wpas, dev[1]]
_test_p2p_go_move_scm_peer_does_not_support(ndev, apdev)
def _test_p2p_go_move_scm_peer_does_not_support(dev, apdev):
@ -979,8 +979,8 @@ def _test_p2p_go_move_scm_peer_does_not_support(dev, apdev):
if freq < 5000:
raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq)
hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test',
"channel" : '11' })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'ap-test',
"channel": '11'})
logger.info('Connecting client to to an AP on channel 11')
dev[0].connect("ap-test", key_mgmt="NONE",
scan_freq="2462")
@ -1006,15 +1006,15 @@ def test_p2p_go_move_scm_multi(dev, apdev):
if wpas.get_mcc() < 2:
raise Exception("New radio does not support MCC")
ndev = [ wpas, dev[1] ]
ndev = [wpas, dev[1]]
_test_p2p_go_move_scm_multi(ndev, apdev)
def _test_p2p_go_move_scm_multi(dev, apdev):
dev[0].request("SET p2p_no_group_iface 0")
try:
dev[0].global_request("P2P_SET disallow_freq 2430-6000")
hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test-1',
"channel" : '11' })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'ap-test-1',
"channel": '11'})
dev[0].connect("ap-test-1", key_mgmt="NONE",
scan_freq="2462")
@ -1046,8 +1046,8 @@ def _test_p2p_go_move_scm_multi(dev, apdev):
if freq != '2462':
raise Exception("Unexpected freq after group reform=" + freq)
hapd = hostapd.add_ap(apdev[0], { "ssid" : 'ap-test-2',
"channel" : '6' })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'ap-test-2',
"channel": '6'})
dev[0].connect("ap-test-2", key_mgmt="NONE",
scan_freq="2437")
@ -1087,8 +1087,8 @@ def test_p2p_delay_go_csa(dev, apdev, params):
raise Exception("Peer " + addr1 + " not found")
wpas.p2p_stop_find()
hapd = hostapd.add_ap(apdev[0], { "ssid": 'bss-2.4ghz',
"channel": '1' })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'bss-2.4ghz',
"channel": '1'})
wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")

View File

@ -21,7 +21,7 @@ def test_concurrent_autogo(dev, apdev):
"""Concurrent P2P autonomous GO"""
logger.info("Connect to an infrastructure AP")
dev[0].request("P2P_SET cross_connect 0")
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")
hwsim_utils.test_connectivity(dev[0], hapd)
@ -45,17 +45,17 @@ def test_concurrent_autogo_5ghz_ht40(dev, apdev):
try:
hapd = None
hapd2 = None
params = { "ssid": "ht40",
params = {"ssid": "ht40",
"hw_mode": "a",
"channel": "153",
"country_code": "US",
"ht_capab": "[HT40-]" }
"ht_capab": "[HT40-]"}
hapd2 = hostapd.add_ap(apdev[1], params)
params = { "ssid": "test-open-5",
params = {"ssid": "test-open-5",
"hw_mode": "a",
"channel": "149",
"country_code": "US" }
"country_code": "US"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].request("P2P_SET cross_connect 0")
@ -98,7 +98,7 @@ def test_concurrent_autogo_5ghz_ht40(dev, apdev):
def test_concurrent_autogo_crossconnect(dev, apdev):
"""Concurrent P2P autonomous GO"""
dev[0].global_request("P2P_SET cross_connect 1")
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[0].global_request("SET p2p_no_group_iface 0")
@ -136,7 +136,7 @@ def test_concurrent_autogo_crossconnect(dev, apdev):
def test_concurrent_p2pcli(dev, apdev):
"""Concurrent P2P client join"""
logger.info("Connect to an infrastructure AP")
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")
hwsim_utils.test_connectivity(dev[0], hapd)
@ -158,7 +158,7 @@ def test_concurrent_p2pcli(dev, apdev):
def test_concurrent_grpform_go(dev, apdev):
"""Concurrent P2P group formation to become GO"""
logger.info("Connect to an infrastructure AP")
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")
hwsim_utils.test_connectivity(dev[0], hapd)
@ -177,7 +177,7 @@ def test_concurrent_grpform_go(dev, apdev):
def test_concurrent_grpform_cli(dev, apdev):
"""Concurrent P2P group formation to become P2P Client"""
logger.info("Connect to an infrastructure AP")
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")
hwsim_utils.test_connectivity(dev[0], hapd)
@ -196,7 +196,7 @@ def test_concurrent_grpform_cli(dev, apdev):
def test_concurrent_grpform_while_connecting(dev, apdev):
"""Concurrent P2P group formation while connecting to an AP"""
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"})
dev[0].connect("test-open", key_mgmt="NONE", wait_connect=False)
logger.info("Form a P2P group while connecting to an AP")
@ -214,7 +214,7 @@ def test_concurrent_grpform_while_connecting(dev, apdev):
def test_concurrent_grpform_while_connecting2(dev, apdev):
"""Concurrent P2P group formation while connecting to an AP (2)"""
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"})
dev[0].connect("test-open", key_mgmt="NONE", wait_connect=False)
dev[1].flush_scan_cache()
@ -234,7 +234,7 @@ def test_concurrent_grpform_while_connecting2(dev, apdev):
def test_concurrent_grpform_while_connecting3(dev, apdev):
"""Concurrent P2P group formation while connecting to an AP (3)"""
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"})
dev[0].connect("test-open", key_mgmt="NONE", wait_connect=False)
logger.info("Form a P2P group while connecting to an AP")
@ -253,7 +253,7 @@ def test_concurrent_grpform_while_connecting3(dev, apdev):
def test_concurrent_persistent_group(dev, apdev):
"""Concurrent P2P persistent group"""
logger.info("Connect to an infrastructure AP")
hostapd.add_ap(apdev[0], { "ssid": "test-open", "channel": "2" })
hostapd.add_ap(apdev[0], {"ssid": "test-open", "channel": "2"})
dev[0].global_request("SET p2p_no_group_iface 0")
dev[0].connect("test-open", key_mgmt="NONE", scan_freq="2417")
@ -276,7 +276,7 @@ def test_concurrent_invitation_channel_mismatch(dev, apdev):
dev[1].dump_monitor()
logger.info("Connect to an infrastructure AP")
hostapd.add_ap(apdev[0], { "ssid": "test-open", "channel": "2" })
hostapd.add_ap(apdev[0], {"ssid": "test-open", "channel": "2"})
dev[0].global_request("SET p2p_no_group_iface 0")
dev[0].connect("test-open", key_mgmt="NONE", scan_freq="2417")
invite(dev[1], dev[0], extra="freq=2412")

View File

@ -35,7 +35,7 @@ def test_p2p_device_grpform(dev, apdev):
found = False
for l in lines:
try:
[name,value] = l.split('=', 1)
[name, value] = l.split('=', 1)
if name == "wdev_id":
found = True
break
@ -169,7 +169,7 @@ def run_p2p_device_nfc_invite(dev, apdev, no_group_iface):
def test_p2p_device_misuses(dev, apdev):
"""cfg80211 P2P Device misuses"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
with HWSimRadio(use_p2p_device=True) as (radio, iface):
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add(iface)
@ -214,7 +214,7 @@ def test_p2p_device_misuses(dev, apdev):
time.sleep(1)
hwsim_utils.test_connectivity(wpas, hapd)
ev = hapd.wait_event([ "AP-STA-DISCONNECTED" ], timeout=0.1)
ev = hapd.wait_event(["AP-STA-DISCONNECTED"], timeout=0.1)
if ev is not None:
raise Exception("Unexpected disconnection event received from hostapd")
ev = wpas.wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.1)

View File

@ -492,11 +492,11 @@ def test_p2p_peer_command(dev):
res0 = dev[0].request("P2P_PEER FIRST")
peer = res0.splitlines()[0]
if peer not in [ addr1, addr2 ]:
if peer not in [addr1, addr2]:
raise Exception("Unexpected P2P_PEER FIRST address")
res1 = dev[0].request("P2P_PEER NEXT-" + peer)
peer2 = res1.splitlines()[0]
if peer2 not in [ addr1, addr2 ] or peer == peer2:
if peer2 not in [addr1, addr2] or peer == peer2:
raise Exception("Unexpected P2P_PEER NEXT address")
if "FAIL" not in dev[0].request("P2P_PEER NEXT-foo"):
@ -679,7 +679,7 @@ def run_discovery_while_go(wpas, dev, params):
terminate_group(wpas, dev[1])
out = run_tshark(os.path.join(params['logdir'], "hwsim0.pcapng"),
"wifi_p2p.public_action.subtype == 8", [ "wlan.da" ])
"wifi_p2p.public_action.subtype == 8", ["wlan.da"])
da = out.splitlines()
logger.info("PD Response DAs: " + str(da))
if len(da) != 3:
@ -714,7 +714,7 @@ def run_discovery_while_cli(wpas, dev, params):
terminate_group(dev[1], wpas)
out = run_tshark(os.path.join(params['logdir'], "hwsim0.pcapng"),
"wifi_p2p.public_action.subtype == 8", [ "wlan.da" ])
"wifi_p2p.public_action.subtype == 8", ["wlan.da"])
da = out.splitlines()
logger.info("PD Response DAs: " + str(da))
if len(da) != 3:

View File

@ -648,7 +648,7 @@ def clear_pbc_overlap(dev, ap):
@remote_compatible
def test_grpform_pbc_overlap(dev, apdev):
"""P2P group formation during PBC overlap"""
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)
hapd.request("WPS_PBC")
time.sleep(0.1)
@ -688,8 +688,8 @@ def test_grpform_pbc_overlap_group_iface(dev, apdev):
"""P2P group formation during PBC overlap using group interfaces"""
# Note: Need to include P2P IE from the AP to get the P2P interface BSS
# update use this information.
params = { "ssid": "wps", "eap_server": "1", "wps_state": "1",
"beacon_int": "15", 'manage_p2p': '1' }
params = {"ssid": "wps", "eap_server": "1", "wps_state": "1",
"beacon_int": "15", 'manage_p2p': '1'}
hapd = hostapd.add_ap(apdev[0], params)
hapd.request("WPS_PBC")
@ -877,14 +877,14 @@ def test_grpform_wait_peer(dev):
def test_invalid_p2p_connect_command(dev):
"""P2P_CONNECT error cases"""
id = dev[0].add_network()
for cmd in [ "foo",
for cmd in ["foo",
"00:11:22:33:44:55",
"00:11:22:33:44:55 pbc persistent=123",
"00:11:22:33:44:55 pbc persistent=%d" % id,
"00:11:22:33:44:55 pbc go_intent=-1",
"00:11:22:33:44:55 pbc go_intent=16",
"00:11:22:33:44:55 pin",
"00:11:22:33:44:55 pbc freq=0" ]:
"00:11:22:33:44:55 pbc freq=0"]:
if "FAIL" not in dev[0].request("P2P_CONNECT " + cmd):
raise Exception("Invalid P2P_CONNECT command accepted: " + cmd)

View File

@ -184,12 +184,12 @@ def test_p2p_cli_invite(dev):
def test_p2p_invite_invalid(dev):
"""Invalid parameters to P2P_INVITE"""
id = dev[0].add_network()
for cmd in [ "foo=bar",
for cmd in ["foo=bar",
"persistent=123 peer=foo",
"persistent=123",
"persistent=%d" % id,
"group=foo",
"group=foo peer=foo",
"group=foo peer=00:11:22:33:44:55 go_dev_addr=foo" ]:
"group=foo peer=00:11:22:33:44:55 go_dev_addr=foo"]:
if "FAIL" not in dev[0].request("P2P_INVITE " + cmd):
raise Exception("Invalid P2P_INVITE accepted: " + cmd)

View File

@ -43,7 +43,7 @@ def p2p_attr_capability(dev_capab=0, group_capab=0):
return struct.pack("<BHBB", P2P_ATTR_CAPABILITY, 2, dev_capab, group_capab)
def p2p_attr_device_id(addr):
val = struct.unpack('6B', binascii.unhexlify(addr.replace(':','')))
val = struct.unpack('6B', binascii.unhexlify(addr.replace(':', '')))
t = (P2P_ATTR_DEVICE_ID, 6) + val
return struct.pack('<BH6B', *t)
@ -60,7 +60,7 @@ def p2p_attr_listen_channel(op_class=81, chan=1):
0x58, 0x58, 0x04, op_class, chan)
def p2p_attr_group_bssid(addr):
val = struct.unpack('6B', binascii.unhexlify(addr.replace(':','')))
val = struct.unpack('6B', binascii.unhexlify(addr.replace(':', '')))
t = (P2P_ATTR_GROUP_BSSID, 6) + val
return struct.pack('<BH6B', *t)
@ -68,7 +68,7 @@ def p2p_attr_ext_listen_timing(period=0, interval=0):
return struct.pack("<BHHH", P2P_ATTR_EXT_LISTEN_TIMING, 4, period, interval)
def p2p_attr_intended_interface_addr(addr):
val = struct.unpack('6B', binascii.unhexlify(addr.replace(':','')))
val = struct.unpack('6B', binascii.unhexlify(addr.replace(':', '')))
t = (P2P_ATTR_INTENDED_INTERFACE_ADDR, 6) + val
return struct.pack('<BH6B', *t)
@ -81,14 +81,14 @@ def p2p_attr_channel_list():
81, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
def p2p_attr_device_info(addr, name="Test", config_methods=0, dev_type="00010050F2040001"):
val = struct.unpack('6B', binascii.unhexlify(addr.replace(':','')))
val = struct.unpack('6B', binascii.unhexlify(addr.replace(':', '')))
val2 = struct.unpack('8B', binascii.unhexlify(dev_type))
t = (P2P_ATTR_DEVICE_INFO, 6 + 2 + 8 + 1 + 4 + len(name)) + val
t2 = val2 + (0,)
return struct.pack("<BH6B", *t) + struct.pack(">H", config_methods) + struct.pack("8BB", *t2) + struct.pack('>HH', 0x1011, len(name)) + name.encode()
def p2p_attr_group_id(addr, ssid):
val = struct.unpack('6B', binascii.unhexlify(addr.replace(':','')))
val = struct.unpack('6B', binascii.unhexlify(addr.replace(':', '')))
t = (P2P_ATTR_GROUP_ID, 6 + len(ssid)) + val
return struct.pack('<BH6B', *t) + ssid.encode()
@ -133,7 +133,7 @@ def start_p2p(dev, apdev):
peer = dev[1].get_peer(addr0)
bssid = apdev[0]['bssid']
params = { 'ssid': "test", 'beacon_int': "2000" }
params = {'ssid': "test", 'beacon_int': "2000"}
if peer['listen_freq'] == "2412":
params['channel'] = '1'
elif peer['listen_freq'] == "2437":
@ -162,25 +162,25 @@ def parse_p2p_public_action(payload):
if action != 9:
return None
pos = pos[2:]
(oui1,oui2,oui3,subtype) = struct.unpack('BBBB', pos[0:4])
(oui1, oui2, oui3, subtype) = struct.unpack('BBBB', pos[0:4])
if oui1 != 0x50 or oui2 != 0x6f or oui3 != 0x9a or subtype != 9:
return None
pos = pos[4:]
(subtype,dialog_token) = struct.unpack('BB', pos[0:2])
(subtype, dialog_token) = struct.unpack('BB', pos[0:2])
p2p = {}
p2p['subtype'] = subtype
p2p['dialog_token'] = dialog_token
pos = pos[2:]
p2p['elements'] = pos
while len(pos) > 2:
(id,elen) = struct.unpack('BB', pos[0:2])
(id, elen) = struct.unpack('BB', pos[0:2])
pos = pos[2:]
if elen > len(pos):
raise Exception("Truncated IE in P2P Public Action frame (elen=%d left=%d)" % (elen, len(pos)))
if id == WLAN_EID_VENDOR_SPECIFIC:
if elen < 4:
raise Exception("Too short vendor specific IE in P2P Public Action frame (elen=%d)" % elen)
(oui1,oui2,oui3,subtype) = struct.unpack('BBBB', pos[0:4])
(oui1, oui2, oui3, subtype) = struct.unpack('BBBB', pos[0:4])
if oui1 == 0x50 and oui2 == 0x6f and oui3 == 0x9a and subtype == 9:
if 'p2p' in p2p:
p2p['p2p'] += pos[4:elen]
@ -196,7 +196,7 @@ def parse_p2p_public_action(payload):
p2p['p2p_attrs'] = {}
pos = p2p['p2p']
while len(pos) >= 3:
(id,alen) = struct.unpack('<BH', pos[0:3])
(id, alen) = struct.unpack('<BH', pos[0:3])
pos = pos[3:]
if alen > len(pos):
logger.info("P2P payload: " + binascii.hexlify(p2p['p2p']))
@ -210,7 +210,7 @@ def parse_p2p_public_action(payload):
p2p['wsc_attrs'] = {}
pos = p2p['wsc']
while len(pos) >= 4:
(id,alen) = struct.unpack('>HH', pos[0:4])
(id, alen) = struct.unpack('>HH', pos[0:4])
pos = pos[4:]
if alen > len(pos):
logger.info("WSC payload: " + binascii.hexlify(p2p['wsc']))
@ -1955,13 +1955,13 @@ def test_p2p_msg_group_info(dev):
dev[0].request("VENDOR_ELEM_REMOVE 2 *")
def _test_p2p_msg_group_info(dev):
tests = [ "dd08506f9a090e010001",
tests = ["dd08506f9a090e010001",
"dd08506f9a090e010000",
"dd20506f9a090e190018" + "112233445566" + "aabbccddeeff" + "00" + "0000" + "0000000000000000" + "ff",
"dd20506f9a090e190018" + "112233445566" + "aabbccddeeff" + "00" + "0000" + "0000000000000000" + "00",
"dd24506f9a090e1d001c" + "112233445566" + "aabbccddeeff" + "00" + "0000" + "0000000000000000" + "00" + "00000000",
"dd24506f9a090e1d001c" + "112233445566" + "aabbccddeeff" + "00" + "0000" + "0000000000000000" + "00" + "10110001",
"dd24506f9a090e1d001c" + "112233445566" + "aabbccddeeff" + "00" + "0000" + "0000000000000000" + "00" + "1011ffff" ]
"dd24506f9a090e1d001c" + "112233445566" + "aabbccddeeff" + "00" + "0000" + "0000000000000000" + "00" + "1011ffff"]
for t in tests:
dev[0].request("VENDOR_ELEM_REMOVE 2 *")
if "OK" not in dev[0].request("VENDOR_ELEM_ADD 2 " + t):

View File

@ -89,7 +89,7 @@ def test_persistent_group_per_sta_psk(dev):
logger.info("Join another client to the group")
pin = dev[2].wps_read_pin()
dev[0].p2p_go_authorize_client(pin)
social = int(i_res['freq']) in [ 2412, 2437, 2462 ]
social = int(i_res['freq']) in [2412, 2437, 2462]
c_res = dev[2].p2p_connect_group(addr0, pin, timeout=60, social=social,
freq=i_res['freq'])
if not c_res['persistent']:
@ -152,7 +152,8 @@ def test_persistent_group_per_sta_psk(dev):
dev[2].dump_monitor()
peer = dev[2].get_peer(addr0)
dev[2].global_request("P2P_GROUP_ADD persistent=" + peer['persistent'] + " freq=2412")
ev = dev[2].wait_global_event(["P2P-GROUP-STARTED","WPA: 4-Way Handshake failed"], timeout=30)
ev = dev[2].wait_global_event(["P2P-GROUP-STARTED",
"WPA: 4-Way Handshake failed"], timeout=30)
if ev is None:
raise Exception("Timeout on group restart (on client)")
if "P2P-GROUP-STARTED" not in ev:
@ -168,7 +169,8 @@ def test_persistent_group_per_sta_psk(dev):
dev[2].dump_monitor()
peer = dev[2].get_peer(addr0)
dev[2].global_request("P2P_GROUP_ADD persistent=" + peer['persistent'] + " freq=2412")
ev = dev[2].wait_global_event(["P2P-GROUP-STARTED","WPA: 4-Way Handshake failed"], timeout=30)
ev = dev[2].wait_global_event(["P2P-GROUP-STARTED",
"WPA: 4-Way Handshake failed"], timeout=30)
if ev is None:
raise Exception("Timeout on group restart (on client)")
if "P2P-GROUP-STARTED" in ev:
@ -192,7 +194,8 @@ def test_persistent_group_per_sta_psk(dev):
dev[1].global_request("P2P_INVITE persistent=" + peer['persistent'] + " peer=" + addr0)
ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=30)
dev[0].group_form_result(ev)
ev = dev[1].wait_global_event(["P2P-GROUP-STARTED","WPA: 4-Way Handshake failed"], timeout=30)
ev = dev[1].wait_global_event(["P2P-GROUP-STARTED",
"WPA: 4-Way Handshake failed"], timeout=30)
if ev is None:
raise Exception("Timeout on group restart (on client)")
if "P2P-GROUP-STARTED" in ev:
@ -228,12 +231,12 @@ def test_persistent_group_invite_removed_client(dev):
raise Exception("Timeout on invitation")
if "sa=" + addr0 + " persistent=" not in ev:
raise Exception("Unexpected invitation event")
[event,addr,persistent] = ev.split(' ', 2)
[event, addr, persistent] = ev.split(' ', 2)
dev[1].global_request("P2P_GROUP_ADD " + persistent)
ev = dev[1].wait_global_event(["P2P-PERSISTENT-PSK-FAIL"], timeout=30)
if ev is None:
raise Exception("Did not receive PSK failure report")
[tmp,id] = ev.split('=', 1)
[tmp, id] = ev.split('=', 1)
ev = dev[1].wait_global_event(["P2P-GROUP-REMOVED"], timeout=10)
if ev is None:
raise Exception("Group removal event timed out")
@ -533,8 +536,8 @@ def test_persistent_group_missed_inv_resp(dev):
dev[1].p2p_stop_find()
# Verify that group re-invocation goes through
ev = dev[1].wait_global_event([ "P2P-GROUP-STARTED",
"P2P-GROUP-FORMATION-FAILURE" ],
ev = dev[1].wait_global_event(["P2P-GROUP-STARTED",
"P2P-GROUP-FORMATION-FAILURE"],
timeout=20)
if ev is None:
raise Exception("Group start event timed out")
@ -542,7 +545,7 @@ def test_persistent_group_missed_inv_resp(dev):
raise Exception("Group re-invocation failed")
dev[0].group_form_result(ev)
ev = dev[0].wait_global_event([ "P2P-GROUP-STARTED" ], timeout=5)
ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=5)
if ev is None:
raise Exception("Group start event timed out on GO")
dev[0].group_form_result(ev)
@ -552,7 +555,7 @@ def test_persistent_group_missed_inv_resp(dev):
@remote_compatible
def test_persistent_group_profile_add(dev):
"""Create a P2P persistent group with ADD_NETWORK"""
passphrase="passphrase here"
passphrase = "passphrase here"
id = dev[0].p2pdev_add_network()
dev[0].p2pdev_set_network_quoted(id, "ssid", "DIRECT-ab")
dev[0].p2pdev_set_network_quoted(id, "psk", passphrase)

View File

@ -93,26 +93,26 @@ def run_sd(dev, dst, query, exp_query=None, fragment=False, query2=None):
def test_p2p_service_discovery(dev):
"""P2P service discovery"""
addr0 = dev[0].p2p_dev_addr()
for dst in [ "00:00:00:00:00:00", addr0 ]:
for dst in ["00:00:00:00:00:00", addr0]:
ev = run_sd(dev, dst, "02000001")
if "0b5f6166706f766572746370c00c000c01" not in ev:
raise Exception("Unexpected service discovery response contents (Bonjour)")
if "496e7465726e6574" not in ev:
raise Exception("Unexpected service discovery response contents (UPnP)")
for req in [ "foo 02000001",
for req in ["foo 02000001",
addr0,
addr0 + " upnp qq urn:schemas-upnp-org:device:InternetGatewayDevice:1",
addr0 + " upnp 10",
addr0 + " 123",
addr0 + " qq" ]:
addr0 + " qq"]:
if "FAIL" not in dev[1].global_request("P2P_SERV_DISC_REQ " + req):
raise Exception("Invalid P2P_SERV_DISC_REQ accepted: " + req)
def test_p2p_service_discovery2(dev):
"""P2P service discovery with one peer having no services"""
dev[2].p2p_listen()
for dst in [ "00:00:00:00:00:00", dev[0].p2p_dev_addr() ]:
for dst in ["00:00:00:00:00:00", dev[0].p2p_dev_addr()]:
ev = run_sd(dev, dst, "02000001")
if "0b5f6166706f766572746370c00c000c01" not in ev:
raise Exception("Unexpected service discovery response contents (Bonjour)")
@ -122,7 +122,7 @@ def test_p2p_service_discovery2(dev):
def test_p2p_service_discovery3(dev):
"""P2P service discovery for Bonjour with one peer having no services"""
dev[2].p2p_listen()
for dst in [ "00:00:00:00:00:00", dev[0].p2p_dev_addr() ]:
for dst in ["00:00:00:00:00:00", dev[0].p2p_dev_addr()]:
ev = run_sd(dev, dst, "02000101")
if "0b5f6166706f766572746370c00c000c01" not in ev:
raise Exception("Unexpected service discovery response contents (Bonjour)")
@ -130,7 +130,7 @@ def test_p2p_service_discovery3(dev):
def test_p2p_service_discovery4(dev):
"""P2P service discovery for UPnP with one peer having no services"""
dev[2].p2p_listen()
for dst in [ "00:00:00:00:00:00", dev[0].p2p_dev_addr() ]:
for dst in ["00:00:00:00:00:00", dev[0].p2p_dev_addr()]:
ev = run_sd(dev, dst, "02000201")
if "496e7465726e6574" not in ev:
raise Exception("Unexpected service discovery response contents (UPnP)")
@ -138,7 +138,7 @@ def test_p2p_service_discovery4(dev):
@remote_compatible
def test_p2p_service_discovery_multiple_queries(dev):
"""P2P service discovery with multiple queries"""
for dst in [ "00:00:00:00:00:00", dev[0].p2p_dev_addr() ]:
for dst in ["00:00:00:00:00:00", dev[0].p2p_dev_addr()]:
ev = run_sd(dev, dst, "02000201", query2="02000101")
if "0b5f6166706f766572746370c00c000c01" not in ev[0] + ev[1]:
raise Exception("Unexpected service discovery response contents (Bonjour)")
@ -148,7 +148,7 @@ def test_p2p_service_discovery_multiple_queries(dev):
def test_p2p_service_discovery_multiple_queries2(dev):
"""P2P service discovery with multiple queries with one peer having no services"""
dev[2].p2p_listen()
for dst in [ "00:00:00:00:00:00", dev[0].p2p_dev_addr() ]:
for dst in ["00:00:00:00:00:00", dev[0].p2p_dev_addr()]:
ev = run_sd(dev, dst, "02000201", query2="02000101")
if "0b5f6166706f766572746370c00c000c01" not in ev[0] + ev[1]:
raise Exception("Unexpected service discovery response contents (Bonjour)")
@ -157,7 +157,7 @@ def test_p2p_service_discovery_multiple_queries2(dev):
def test_p2p_service_discovery_fragmentation(dev):
"""P2P service discovery with fragmentation"""
for dst in [ "00:00:00:00:00:00", dev[0].p2p_dev_addr() ]:
for dst in ["00:00:00:00:00:00", dev[0].p2p_dev_addr()]:
ev = run_sd(dev, dst, "02000001", fragment=True)
if "long response" not in ev:
if "0b5f6166706f766572746370c00c000c01" not in ev:
@ -391,13 +391,13 @@ def _test_p2p_service_discovery_external(dev):
if ver == ver2:
raise Exception("Service list version did not change")
for cmd in [ "%s%s%s%s" % (arg[2], arg[3], arg[4], resp),
for cmd in ["%s%s%s%s" % (arg[2], arg[3], arg[4], resp),
"%s %s %s %s" % ("0", arg[3], arg[4], resp),
"%s %s %s %s" % (arg[2], "foo", arg[4], resp),
"%s %s%s%s" % (arg[2], arg[3], arg[4], resp),
"%s %s %s%s" % (arg[2], arg[3], arg[4], resp),
"%s %s %s %s" % (arg[2], arg[3], arg[4], "12345"),
"%s %s %s %s" % (arg[2], arg[3], arg[4], "qq") ]:
"%s %s %s %s" % (arg[2], arg[3], arg[4], "qq")]:
if "FAIL" not in dev[0].global_request("P2P_SERV_DISC_RESP " + cmd):
raise Exception("Invalid P2P_SERV_DISC_RESP accepted: " + cmd)
@ -412,7 +412,7 @@ def test_p2p_service_discovery_external(dev):
@remote_compatible
def test_p2p_service_discovery_invalid_commands(dev):
"""P2P service discovery invalid commands"""
for cmd in [ "bonjour",
for cmd in ["bonjour",
"bonjour 12",
"bonjour 123 12",
"bonjour qq 12",
@ -420,17 +420,17 @@ def test_p2p_service_discovery_invalid_commands(dev):
"bonjour 12 qq",
"upnp 10",
"upnp qq uuid:",
"foo bar" ]:
"foo bar"]:
if "FAIL" not in dev[0].global_request("P2P_SERVICE_ADD " + cmd):
raise Exception("Invalid P2P_SERVICE_ADD accepted: " + cmd)
for cmd in [ "bonjour",
for cmd in ["bonjour",
"bonjour 123",
"bonjour qq",
"upnp 10",
"upnp ",
"upnp qq uuid:",
"foo bar" ]:
"foo bar"]:
if "FAIL" not in dev[0].global_request("P2P_SERVICE_DEL " + cmd):
raise Exception("Invalid P2P_SERVICE_DEL accepted: " + cmd)

View File

@ -8,7 +8,7 @@ from remotehost import remote_compatible
def test_p2p_set(dev):
"""P2P_SET commands"""
for cmd in [ "",
for cmd in ["",
"foo bar",
"noa 1",
"noa 1,2",
@ -32,7 +32,7 @@ def test_p2p_set(dev):
"disc_int 2 1 10",
"disc_int -1 0 10",
"disc_int 0 -1 10",
"ssid_postfix 123456789012345678901234" ]:
"ssid_postfix 123456789012345678901234"]:
if "FAIL" not in dev[0].request("P2P_SET " + cmd):
raise Exception("Invalid P2P_SET accepted: " + cmd)
dev[0].request("P2P_SET ps 1")

View File

@ -114,7 +114,7 @@ def p2ps_nonexact_seek(i_dev, r_dev, svc_name, srv_info=None, adv_num=None):
if r_dev.p2p_dev_addr() not in ev1:
raise Exception("Unexpected peer")
ev_list = []
for i in range (0, adv_num):
for i in range(0, adv_num):
ev1 = i_dev.wait_global_event(["P2P-SERV-ASP-RESP"], timeout=10)
if ev1 is None:
raise Exception("Failed to receive Service Discovery Response")
@ -683,7 +683,7 @@ def test_p2ps_service_discovery_multiple_queries(dev):
break
dev[1].p2p_stop_find()
for test in [ ("seek=org.wi-fi.wfds.display.TX",
for test in [("seek=org.wi-fi.wfds.display.TX",
"asp_svc=org.wi-fi.wfds.display.tx"),
("seek=foo seek=org.wi-fi.wfds.display.tx seek=bar",
"asp_svc=org.wi-fi.wfds.display.tx"),
@ -1118,7 +1118,7 @@ def test_p2ps_many_services_in_probe(dev):
long3 = 'org.example.0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.c'
long4 = 'org.example.0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.d'
long5 = 'org.example.0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.e'
for name in [ long1, long2, long3, long4, long5 ]:
for name in [long1, long2, long3, long4, long5]:
p2ps_advertise(r_dev=dev[0], r_role='1',
svc_name=name,
srv_info='I can do stuff')
@ -1136,7 +1136,7 @@ def test_p2ps_many_services_in_probe(dev):
events = events + ev
dev[1].p2p_stop_find()
dev[1].dump_monitor()
for name in [ long2, long3, long4, long5 ]:
for name in [long2, long3, long4, long5]:
if name not in events:
raise Exception("Service missing from peer events")
@ -1222,7 +1222,7 @@ def test_p2ps_channel_one_connected(dev, apdev):
try:
hapd = hostapd.add_ap(apdev[0],
{ "ssid": 'bss-2.4ghz', "channel": '7' })
{"ssid": 'bss-2.4ghz', "channel": '7'})
dev[1].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2442")
(grp_ifname0, grp_ifname1, ifnames) = p2ps_connect_p2ps_method(dev, keep_group=True, join_extra=" freq=2442")
@ -1251,12 +1251,12 @@ def test_p2ps_channel_both_connected_same(dev, apdev):
try:
hapd = hostapd.add_ap(apdev[0],
{ "ssid": 'bss-2.4ghz', "channel": '6' })
{"ssid": 'bss-2.4ghz', "channel": '6'})
dev[2].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2437")
dev[1].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2437")
tmpdev = [ dev[2], dev[1] ]
tmpdev = [dev[2], dev[1]]
(grp_ifname0, grp_ifname1, ifnames) = p2ps_connect_p2ps_method(tmpdev, keep_group=True, join_extra=" freq=2437", flush=False)
freq = dev[2].get_group_status_field('freq')
@ -1282,10 +1282,10 @@ def test_p2ps_channel_both_connected_different(dev, apdev):
try:
hapd1 = hostapd.add_ap(apdev[0],
{ "ssid": 'bss-channel-3', "channel": '3' })
{"ssid": 'bss-channel-3', "channel": '3'})
hapd2 = hostapd.add_ap(apdev[1],
{ "ssid": 'bss-channel-10', "channel": '10' })
{"ssid": 'bss-channel-10', "channel": '10'})
dev[0].connect("bss-channel-3", key_mgmt="NONE", scan_freq="2422")
dev[1].connect("bss-channel-10", key_mgmt="NONE", scan_freq="2457")
@ -1318,15 +1318,15 @@ def test_p2ps_channel_both_connected_different_mcc(dev, apdev):
try:
hapd1 = hostapd.add_ap(apdev[0],
{ "ssid": 'bss-channel-3', "channel": '3' })
{"ssid": 'bss-channel-3', "channel": '3'})
hapd2 = hostapd.add_ap(apdev[1],
{ "ssid": 'bss-channel-10', "channel": '10' })
{"ssid": 'bss-channel-10', "channel": '10'})
wpas.connect("bss-channel-3", key_mgmt="NONE", scan_freq="2422")
dev[1].connect("bss-channel-10", key_mgmt="NONE", scan_freq="2457")
(grp_ifname0, grp_ifname1, ifnames) = p2ps_connect_p2ps_method([ wpas, dev[1] ], keep_group=True)
(grp_ifname0, grp_ifname1, ifnames) = p2ps_connect_p2ps_method([wpas, dev[1]], keep_group=True)
freq = wpas.get_group_status_field('freq')
if freq != '2422' and freq != '2457':
@ -1380,7 +1380,7 @@ def test_p2ps_channel_sta_connected_disallow_freq(dev, apdev):
try:
dev[0].global_request("P2P_SET disallow_freq 2437")
hapd = hostapd.add_ap(apdev[0],
{ "ssid": 'bss-channel-6', "channel": '6' })
{"ssid": 'bss-channel-6', "channel": '6'})
dev[1].connect("bss-channel-6", key_mgmt="NONE", scan_freq="2437")
@ -1418,11 +1418,11 @@ def test_p2ps_channel_sta_connected_disallow_freq_mcc(dev, apdev):
try:
dev[0].global_request("P2P_SET disallow_freq 2437")
hapd1 = hostapd.add_ap(apdev[0],
{ "ssid": 'bss-channel-6', "channel": '6' })
{"ssid": 'bss-channel-6', "channel": '6'})
wpas.connect("bss-channel-6", key_mgmt="NONE", scan_freq="2437")
tmpdev = [ dev[0], wpas ]
tmpdev = [dev[0], wpas]
(grp_ifname0, grp_ifname1, ifnames) = p2ps_connect_p2ps_method(tmpdev, keep_group=True)
freq = dev[0].get_group_status_field('freq')
@ -1503,7 +1503,7 @@ def test_p2ps_channel_active_go_and_station_same(dev, apdev):
dev[1].global_request("P2P_SET listen_channel 11")
try:
hapd = hostapd.add_ap(apdev[0],
{ "ssid": 'bss-channel-11', "channel": '11' })
{"ssid": 'bss-channel-11', "channel": '11'})
dev[2].connect("bss-channel-11", key_mgmt="NONE", scan_freq="2462")
@ -1540,7 +1540,7 @@ def test_p2ps_channel_active_go_and_station_different(dev, apdev):
try:
hapd = hostapd.add_ap(apdev[0],
{ "ssid": 'bss-channel-2', "channel": '2' })
{"ssid": 'bss-channel-2', "channel": '2'})
dev[0].connect("bss-channel-2", key_mgmt="NONE", scan_freq="2417")
@ -1585,7 +1585,7 @@ def test_p2ps_channel_active_go_and_station_different_mcc(dev, apdev):
try:
hapd = hostapd.add_ap(apdev[0],
{ "ssid": 'bss-channel-6', "channel": '6' })
{"ssid": 'bss-channel-6', "channel": '6'})
wpas.global_request("P2P_SET listen_channel 1")
wpas.connect("bss-channel-6", key_mgmt="NONE", scan_freq="2437")

View File

@ -353,7 +353,7 @@ def test_pmksa_cache_and_cui(dev, apdev):
pmksa = dev[0].get_pmksa(bssid)
if pmksa is None:
raise Exception("No PMKSA cache entry created")
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")
@ -616,7 +616,7 @@ def test_pmksa_cache_ap_expiration(dev, apdev):
eap="GPSK", identity="gpsk-user-session-timeout",
password="abcdefghijklmnop0123456789abcdef",
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")
dev[0].request("DISCONNECT")
@ -666,7 +666,7 @@ def test_pmksa_cache_multiple_sta(dev, apdev):
bssid2 = apdev[1]['bssid']
logger.info("Roam to AP2")
for sta in [ dev[1], dev[0], dev[2], wpas ]:
for sta in [dev[1], dev[0], dev[2], wpas]:
sta.dump_monitor()
sta.scan_for_bss(bssid2, freq="2412")
if "OK" not in sta.request("ROAM " + bssid2):
@ -678,7 +678,7 @@ def test_pmksa_cache_multiple_sta(dev, apdev):
sta.dump_monitor()
logger.info("Roam back to AP1")
for sta in [ dev[1], wpas, dev[0], dev[2] ]:
for sta in [dev[1], wpas, dev[0], dev[2]]:
sta.dump_monitor()
sta.scan(freq="2412")
sta.dump_monitor()
@ -689,7 +689,7 @@ def test_pmksa_cache_multiple_sta(dev, apdev):
time.sleep(4)
logger.info("Roam back to AP2")
for sta in [ dev[1], wpas, dev[0], dev[2] ]:
for sta in [dev[1], wpas, dev[0], dev[2]]:
sta.dump_monitor()
sta.scan(freq="2412")
sta.dump_monitor()
@ -708,7 +708,7 @@ def test_pmksa_cache_opportunistic_multiple_sta(dev, apdev):
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
wpas.interface_add("wlan5")
wpas.flush_scan_cache()
for sta in [ dev[0], dev[1], dev[2], wpas ]:
for sta in [dev[0], dev[1], dev[2], wpas]:
sta.connect("test-pmksa-cache", proto="RSN", key_mgmt="WPA-EAP",
eap="GPSK", identity="gpsk user",
password="abcdefghijklmnop0123456789abcdef", okc=True,
@ -718,7 +718,7 @@ def test_pmksa_cache_opportunistic_multiple_sta(dev, apdev):
bssid2 = apdev[1]['bssid']
logger.info("Roam to AP2")
for sta in [ dev[2], dev[0], wpas, dev[1] ]:
for sta in [dev[2], dev[0], wpas, dev[1]]:
sta.dump_monitor()
sta.scan_for_bss(bssid2, freq="2412")
if "OK" not in sta.request("ROAM " + bssid2):
@ -735,7 +735,7 @@ def test_pmksa_cache_opportunistic_multiple_sta(dev, apdev):
sta.dump_monitor()
logger.info("Roam back to AP1")
for sta in [ dev[0], dev[1], dev[2], wpas ]:
for sta in [dev[0], dev[1], dev[2], wpas]:
sta.dump_monitor()
sta.scan_for_bss(bssid, freq="2412")
sta.request("ROAM " + bssid)
@ -772,10 +772,10 @@ def _test_pmksa_cache_preauth_oom(dev, apdev):
hapd = hostapd.add_ap(apdev[1], params)
bssid1 = apdev[1]['bssid']
tests = [ (1, "rsn_preauth_receive"),
tests = [(1, "rsn_preauth_receive"),
(2, "rsn_preauth_receive"),
(1, "rsn_preauth_send"),
(1, "wpa_auth_pmksa_add_preauth;rsn_preauth_finished") ]
(1, "wpa_auth_pmksa_add_preauth;rsn_preauth_finished")]
for test in tests:
hapd.request("DEAUTHENTICATE ff:ff:ff:ff:ff:ff")
with alloc_fail(hapd, test[0], test[1]):
@ -1042,25 +1042,25 @@ def test_rsn_preauth_processing(dev, apdev):
proto = b"\x88\xc7"
tests = []
# RSN: too short pre-auth packet (len=14)
tests += [ _bssid + foreign + proto ]
tests += [_bssid + foreign + proto]
# Not EAPOL-Start
tests += [ _bssid + foreign + proto + struct.pack('>BBH', 0, 0, 0) ]
tests += [_bssid + foreign + proto + struct.pack('>BBH', 0, 0, 0)]
# RSN: pre-auth for foreign address 02:03:04:05:06:07
tests += [ foreign + foreign + proto + struct.pack('>BBH', 0, 0, 0) ]
tests += [foreign + foreign + proto + struct.pack('>BBH', 0, 0, 0)]
# RSN: pre-auth for already association STA 02:00:00:00:00:00
tests += [ _bssid + _addr + proto + struct.pack('>BBH', 0, 0, 0) ]
tests += [_bssid + _addr + proto + struct.pack('>BBH', 0, 0, 0)]
# New STA
tests += [ _bssid + foreign + proto + struct.pack('>BBH', 0, 1, 1) ]
tests += [_bssid + foreign + proto + struct.pack('>BBH', 0, 1, 1)]
# IEEE 802.1X: received EAPOL-Start from STA
tests += [ _bssid + foreign + proto + struct.pack('>BBH', 0, 1, 0) ]
tests += [_bssid + foreign + proto + struct.pack('>BBH', 0, 1, 0)]
# frame too short for this IEEE 802.1X packet
tests += [ _bssid + foreign + proto + struct.pack('>BBH', 0, 1, 1) ]
tests += [_bssid + foreign + proto + struct.pack('>BBH', 0, 1, 1)]
# EAPOL-Key - Dropped key data from unauthorized Supplicant
tests += [ _bssid + foreign + proto + struct.pack('>BBH', 2, 3, 0) ]
tests += [_bssid + foreign + proto + struct.pack('>BBH', 2, 3, 0)]
# EAPOL-Encapsulated-ASF-Alert
tests += [ _bssid + foreign + proto + struct.pack('>BBH', 2, 4, 0) ]
tests += [_bssid + foreign + proto + struct.pack('>BBH', 2, 4, 0)]
# unknown IEEE 802.1X packet type
tests += [ _bssid + foreign + proto + struct.pack('>BBH', 2, 255, 0) ]
tests += [_bssid + foreign + proto + struct.pack('>BBH', 2, 255, 0)]
for t in tests:
sock.send(t)
@ -1096,12 +1096,12 @@ def test_rsn_preauth_local_errors(dev, apdev):
sock.send(_bssid + foreign2 + proto + struct.pack('>BBH', 2, 1, 0))
hapd.request("DISABLE")
tests = [ (1, "=rsn_preauth_iface_add"),
tests = [(1, "=rsn_preauth_iface_add"),
(2, "=rsn_preauth_iface_add"),
(1, "l2_packet_init;rsn_preauth_iface_add"),
(1, "rsn_preauth_iface_init"),
(1, "rsn_preauth_iface_init") ]
for count,func in tests:
(1, "rsn_preauth_iface_init")]
for count, func in tests:
with alloc_fail(hapd, count, func):
if "FAIL" not in hapd.request("ENABLE"):
raise Exception("ENABLE succeeded unexpectedly")

View File

@ -104,7 +104,7 @@ def test_radio_work_cancel(dev, apdev):
def test_ext_radio_work_disconnect_connect(dev, apdev):
"""External radio work and DISCONNECT clearing connection attempt"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].scan_for_bss(hapd.own_addr(), freq=2412)
# Start a radio work to block connection attempt

View File

@ -166,10 +166,10 @@ def test_radius_acct(dev, apdev):
params['acct_server_addr'] = "127.0.0.1"
params['acct_server_port'] = "1813"
params['acct_server_shared_secret'] = "radius"
params['radius_auth_req_attr'] = [ "126:s:Operator", "77:s:testing",
"62:d:1" ]
params['radius_acct_req_attr'] = [ "126:s:Operator", "62:d:1",
"77:s:testing" ]
params['radius_auth_req_attr'] = ["126:s:Operator", "77:s:testing",
"62:d:1"]
params['radius_acct_req_attr'] = ["126:s:Operator", "62:d:1",
"77:s:testing"]
hapd = hostapd.add_ap(apdev[0], params)
connect(dev[0], "radius-acct")
dev[1].connect("radius-acct", key_mgmt="WPA-EAP", scan_freq="2412",
@ -231,7 +231,7 @@ def test_radius_acct_pmksa_caching(dev, apdev):
dev[1].connect("radius-acct", key_mgmt="WPA-EAP", scan_freq="2412",
eap="PAX", identity="test-class",
password_hex="0123456789abcdef0123456789abcdef")
for d in [ dev[0], dev[1] ]:
for d in [dev[0], dev[1]]:
d.request("REASSOCIATE")
d.wait_connected(timeout=15, error="Reassociation timed out")
@ -328,13 +328,13 @@ def test_radius_acct_ipaddr(dev, apdev):
stderr=open('/dev/null', 'w'))
def _test_radius_acct_ipaddr(dev, apdev):
params = { "ssid": "radius-acct-open",
params = {"ssid": "radius-acct-open",
'acct_server_addr': "127.0.0.1",
'acct_server_port': "1813",
'acct_server_shared_secret': "radius",
'proxy_arp': '1',
'ap_isolate': '1',
'bridge': 'ap-br0' }
'bridge': 'ap-br0'}
hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
try:
hapd.enable()
@ -731,7 +731,7 @@ def add_message_auth_req(req):
# request attributes
req.AddAttribute("Message-Authenticator", 16*b"\x00")
attrs = b''
for code,datalst in sorted(req.items()):
for code, datalst in sorted(req.items()):
for data in datalst:
attrs += req._PktEncodeAttribute(code, data)
@ -1508,14 +1508,14 @@ def test_ap_vlan_wpa2_psk_radius_required(dev, apdev):
def test_radius_mppe_failure(dev, apdev):
"""RADIUS failure when adding MPPE keys"""
params = { "ssid": "as", "beacon_int": "2000",
params = {"ssid": "as", "beacon_int": "2000",
"radius_server_clients": "auth_serv/radius_clients.conf",
"radius_server_auth_port": '18127',
"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" }
"private_key": "auth_serv/server.key"}
authsrv = hostapd.add_ap(apdev[1], params)
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
@ -1535,26 +1535,26 @@ def test_radius_acct_failure(dev, apdev):
"""RADIUS Accounting and failure to add attributes"""
# Connection goes through, but Accounting-Request cannot be sent out due to
# NAS-Identifier being too long to fit into a RADIUS attribute.
params = { "ssid": "radius-acct-open",
params = {"ssid": "radius-acct-open",
'acct_server_addr': "127.0.0.1",
'acct_server_port': "1813",
'acct_server_shared_secret': "radius",
'nas_identifier': 255*'A' }
'nas_identifier': 255*'A'}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("radius-acct-open", key_mgmt="NONE", scan_freq="2412")
def test_radius_acct_failure_oom(dev, apdev):
"""RADIUS Accounting and failure to add attributes due to OOM"""
params = { "ssid": "radius-acct-open",
params = {"ssid": "radius-acct-open",
'acct_server_addr': "127.0.0.1",
'acct_server_port': "1813",
'acct_server_shared_secret': "radius",
'radius_acct_interim_interval': "1",
'nas_identifier': 250*'A',
'radius_acct_req_attr': [ "126:s:" + 250*'B',
'radius_acct_req_attr': ["126:s:" + 250*'B',
"77:s:" + 250*'C',
"127:s:" + 250*'D',
"181:s:" + 250*'E' ] }
"181:s:" + 250*'E']}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -1572,9 +1572,9 @@ def test_radius_acct_failure_oom(dev, apdev):
dev[1].request("REMOVE_NETWORK all")
dev[1].wait_disconnected()
tests = [ (1, "radius_msg_add_attr;?radius_msg_add_attr_int32;=accounting_msg"),
tests = [(1, "radius_msg_add_attr;?radius_msg_add_attr_int32;=accounting_msg"),
(2, "radius_msg_add_attr;accounting_msg"),
(3, "radius_msg_add_attr;accounting_msg") ]
(3, "radius_msg_add_attr;accounting_msg")]
for count, func in tests:
with fail_test(hapd, count, func):
dev[0].connect("radius-acct-open", key_mgmt="NONE",
@ -1601,10 +1601,10 @@ def test_radius_acct_failure_oom_rsn(dev, apdev):
params['acct_server_shared_secret'] = "radius"
params['radius_acct_interim_interval'] = "1"
params['nas_identifier'] = 250*'A'
params['radius_acct_req_attr'] = [ "126:s:" + 250*'B',
params['radius_acct_req_attr'] = ["126:s:" + 250*'B',
"77:s:" + 250*'C',
"127:s:" + 250*'D',
"181:s:" + 250*'E' ]
"181:s:" + 250*'E']
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -1631,10 +1631,10 @@ def test_radius_acct_failure_oom_rsn(dev, apdev):
def test_radius_acct_failure_sta_data(dev, apdev):
"""RADIUS Accounting and failure to get STA data"""
params = { "ssid": "radius-acct-open",
params = {"ssid": "radius-acct-open",
'acct_server_addr': "127.0.0.1",
'acct_server_port': "1813",
'acct_server_shared_secret': "radius" }
'acct_server_shared_secret': "radius"}
hapd = hostapd.add_ap(apdev[0], params)
with fail_test(hapd, 1, "accounting_sta_update_stats"):

View File

@ -30,7 +30,7 @@ def test_rfkill_open(dev, apdev):
"""rfkill block/unblock during open mode connection"""
rfk = get_rfkill(dev[0])
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:
logger.info("rfkill block")
@ -182,7 +182,7 @@ def test_rfkill_p2p_discovery_p2p_dev(dev, apdev):
def test_rfkill_hostapd(dev, apdev):
"""rfkill block/unblock during and prior to hostapd operations"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
rfk = get_rfkill(hapd)
@ -211,7 +211,7 @@ def test_rfkill_hostapd(dev, apdev):
hglobal.flush()
hglobal.remove(apdev[0]['ifname'])
hapd = hostapd.add_ap(apdev[0], { "ssid": "open2" },
hapd = hostapd.add_ap(apdev[0], {"ssid": "open2"},
no_enable=True)
if "FAIL" not in hapd.request("ENABLE"):
raise Exception("ENABLE succeeded unexpectedly (rfkill)")

View File

@ -31,13 +31,13 @@ def check_tx_power_support(dev):
if rrm & 0x8 != 0x8:
raise HwsimSkip("Required RRM capabilities are not supported")
nr="00112233445500000000510107"
lci="01000800101298c0b512926666f6c2f1001c00004104050000c00012"
civic="01000b0011223344556677889900998877665544332211aabbccddeeff"
nr = "00112233445500000000510107"
lci = "01000800101298c0b512926666f6c2f1001c00004104050000c00012"
civic = "01000b0011223344556677889900998877665544332211aabbccddeeff"
def check_nr_results(dev, bssids=None, lci=False, civic=False):
if bssids is None:
ev = dev.wait_event(["RRM-NEIGHBOR-REP-REQUEST-FAILED" ], timeout=10)
ev = dev.wait_event(["RRM-NEIGHBOR-REP-REQUEST-FAILED"], timeout=10)
if ev is None:
raise Exception("RRM neighbor report failure not received")
return
@ -65,7 +65,7 @@ def check_nr_results(dev, bssids=None, lci=False, civic=False):
def test_rrm_neighbor_db(dev, apdev):
"""hostapd ctrl_iface SET_NEIGHBOR"""
params = { "ssid": "test", "rrm_neighbor_report": "1" }
params = {"ssid": "test", "rrm_neighbor_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
# Bad BSSID
@ -164,13 +164,13 @@ def test_rrm_neighbor_rep_req(dev, apdev):
"""wpa_supplicant ctrl_iface NEIGHBOR_REP_REQUEST"""
check_rrm_support(dev[0])
nr1="00112233445500000000510107"
nr2="00112233445600000000510107"
nr3="dd112233445500000000510107"
nr1 = "00112233445500000000510107"
nr2 = "00112233445600000000510107"
nr3 = "dd112233445500000000510107"
params = { "ssid": "test" }
params = {"ssid": "test"}
hostapd.add_ap(apdev[0]['ifname'], params)
params = { "ssid": "test2", "rrm_neighbor_report": "1" }
params = {"ssid": "test2", "rrm_neighbor_report": "1"}
hapd = hostapd.add_ap(apdev[1]['ifname'], params)
bssid1 = apdev[1]['bssid']
@ -268,11 +268,11 @@ def test_rrm_neighbor_rep_oom(dev, apdev):
"""hostapd neighbor report OOM"""
check_rrm_support(dev[0])
nr1="00112233445500000000510107"
nr2="00112233445600000000510107"
nr3="dd112233445500000000510107"
nr1 = "00112233445500000000510107"
nr2 = "00112233445600000000510107"
nr3 = "dd112233445500000000510107"
params = { "ssid": "test", "rrm_neighbor_report": "1" }
params = {"ssid": "test", "rrm_neighbor_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect("test", key_mgmt="NONE", scan_freq="2412")
@ -288,7 +288,7 @@ def test_rrm_lci_req(dev, apdev):
"""hostapd lci request"""
check_rrm_support(dev[0])
params = { "ssid": "rrm", "rrm_neighbor_report": "1" }
params = {"ssid": "rrm", "rrm_neighbor_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
# station not specified
@ -321,7 +321,7 @@ def test_rrm_lci_req_timeout(dev, apdev):
"""hostapd lci request timeout"""
check_rrm_support(dev[0])
params = { "ssid": "rrm", "rrm_neighbor_report": "1" }
params = {"ssid": "rrm", "rrm_neighbor_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].request("SET LCI " + lci)
@ -352,7 +352,7 @@ def test_rrm_lci_req_oom(dev, apdev):
"""LCI report generation OOM"""
check_rrm_support(dev[0])
params = { "ssid": "rrm", "rrm_neighbor_report": "1" }
params = {"ssid": "rrm", "rrm_neighbor_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].request("SET LCI " + lci)
@ -375,7 +375,7 @@ def test_rrm_lci_req_ap_oom(dev, apdev):
"""LCI report generation AP OOM and failure"""
check_rrm_support(dev[0])
params = { "ssid": "rrm", "rrm_neighbor_report": "1" }
params = {"ssid": "rrm", "rrm_neighbor_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].request("SET LCI " + lci)
@ -393,7 +393,7 @@ def test_rrm_lci_req_get_reltime_failure(dev, apdev):
"""LCI report generation and os_get_reltime() failure"""
check_rrm_support(dev[0])
params = { "ssid": "rrm", "rrm_neighbor_report": "1" }
params = {"ssid": "rrm", "rrm_neighbor_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].request("SET LCI " + lci)
@ -408,8 +408,8 @@ def test_rrm_neighbor_rep_req_from_conf(dev, apdev):
"""wpa_supplicant ctrl_iface NEIGHBOR_REP_REQUEST and hostapd config"""
check_rrm_support(dev[0])
params = { "ssid": "test2", "rrm_neighbor_report": "1",
"stationary_ap": "1", "lci": lci, "civic": civic }
params = {"ssid": "test2", "rrm_neighbor_report": "1",
"stationary_ap": "1", "lci": lci, "civic": civic}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = apdev[0]['bssid']
@ -424,8 +424,8 @@ def test_rrm_neighbor_rep_req_timeout(dev, apdev):
"""wpa_supplicant behavior on NEIGHBOR_REP_REQUEST response timeout"""
check_rrm_support(dev[0])
params = { "ssid": "test2", "rrm_neighbor_report": "1",
"stationary_ap": "1", "lci": lci, "civic": civic }
params = {"ssid": "test2", "rrm_neighbor_report": "1",
"stationary_ap": "1", "lci": lci, "civic": civic}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect("test2", key_mgmt="NONE", scan_freq="2412")
@ -443,8 +443,8 @@ def test_rrm_neighbor_rep_req_oom(dev, apdev):
"""wpa_supplicant ctrl_iface NEIGHBOR_REP_REQUEST OOM"""
check_rrm_support(dev[0])
params = { "ssid": "test2", "rrm_neighbor_report": "1",
"stationary_ap": "1", "lci": lci, "civic": civic }
params = {"ssid": "test2", "rrm_neighbor_report": "1",
"stationary_ap": "1", "lci": lci, "civic": civic}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect("test2", key_mgmt="NONE", scan_freq="2412")
@ -468,8 +468,8 @@ def test_rrm_neighbor_rep_req_disconnect(dev, apdev):
"""wpa_supplicant behavior on disconnection during NEIGHBOR_REP_REQUEST"""
check_rrm_support(dev[0])
params = { "ssid": "test2", "rrm_neighbor_report": "1",
"stationary_ap": "1", "lci": lci, "civic": civic }
params = {"ssid": "test2", "rrm_neighbor_report": "1",
"stationary_ap": "1", "lci": lci, "civic": civic}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
if "FAIL" not in dev[0].request("NEIGHBOR_REP_REQUEST"):
@ -491,7 +491,7 @@ def test_rrm_neighbor_rep_req_not_supported(dev, apdev):
"""NEIGHBOR_REP_REQUEST for AP not supporting neighbor report"""
check_rrm_support(dev[0])
params = { "ssid": "test2", "rrm_beacon_report": "1" }
params = {"ssid": "test2", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect("test2", key_mgmt="NONE", scan_freq="2412")
@ -503,8 +503,8 @@ def test_rrm_neighbor_rep_req_busy(dev, apdev):
"""wpa_supplicant and concurrent NEIGHBOR_REP_REQUEST commands"""
check_rrm_support(dev[0])
params = { "ssid": "test2", "rrm_neighbor_report": "1",
"stationary_ap": "1", "lci": lci, "civic": civic }
params = {"ssid": "test2", "rrm_neighbor_report": "1",
"stationary_ap": "1", "lci": lci, "civic": civic}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect("test2", key_mgmt="NONE", scan_freq="2412")
@ -529,7 +529,7 @@ def test_rrm_ftm_range_req(dev, apdev):
dev[1].request("VENDOR_ELEM_REMOVE 13 *")
def run_rrm_ftm_range_req(dev, apdev):
params = { "ssid": "rrm", "rrm_neighbor_report": "1" }
params = {"ssid": "rrm", "rrm_neighbor_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()
@ -615,7 +615,7 @@ def test_rrm_ftm_range_req_timeout(dev, apdev):
dev[1].request("VENDOR_ELEM_REMOVE 13 *")
def run_rrm_ftm_range_req_timeout(dev, apdev):
params = { "ssid": "rrm", "rrm_neighbor_report": "1" }
params = {"ssid": "rrm", "rrm_neighbor_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()
@ -655,7 +655,7 @@ def test_rrm_ftm_range_req_failure(dev, apdev):
dev[1].request("VENDOR_ELEM_REMOVE 13 *")
def run_rrm_ftm_range_req_failure(dev, apdev):
params = { "ssid": "rrm", "rrm_neighbor_report": "1" }
params = {"ssid": "rrm", "rrm_neighbor_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()
@ -683,9 +683,9 @@ def test_rrm_ftm_capa_indication(dev, apdev):
dev[0].request("SET ftm_responder 0")
def _test_rrm_ftm_capa_indication(dev, apdev):
params = { "ssid": "ftm",
params = {"ssid": "ftm",
"ftm_responder": "1",
"ftm_initiator": "1", }
"ftm_initiator": "1",}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
if "OK" not in dev[0].request("SET ftm_initiator 1"):
@ -708,7 +708,7 @@ class BeaconReport:
self.frame_body_fragment_id = None
self.last_indication = None
while len(report) >= 2:
eid,elen = struct.unpack('BB', report[0:2])
eid, elen = struct.unpack('BB', report[0:2])
report = report[2:]
if len(report) < elen:
raise Exception("Invalid subelement in beacon report")
@ -757,15 +757,15 @@ def run_req_beacon(hapd, addr, request):
@remote_compatible
def test_rrm_beacon_req_table(dev, apdev):
"""Beacon request - beacon table mode"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another"})
tests = [ "REQ_BEACON ",
tests = ["REQ_BEACON ",
"REQ_BEACON q",
"REQ_BEACON 11:22:33:44:55:66 1",
"REQ_BEACON 11:22:33:44:55:66 1q",
"REQ_BEACON 11:22:33:44:55:66 11223344556677889900aabbccddeeff" ]
"REQ_BEACON 11:22:33:44:55:66 11223344556677889900aabbccddeeff"]
for t in tests:
if "FAIL" not in hapd.request(t):
raise Exception("Invalid command accepted: " + t)
@ -799,7 +799,7 @@ def test_rrm_beacon_req_table(dev, apdev):
def test_rrm_beacon_req_frame_body_fragmentation(dev, apdev):
"""Beacon request - beacon table mode - frame body fragmentation"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd.set('vendor_elements', ("dd051122330203dd0400137400dd04001374ffdd0511"
@ -845,10 +845,10 @@ def test_rrm_beacon_req_frame_body_fragmentation(dev, apdev):
def test_rrm_beacon_req_last_frame_indication(dev, apdev):
"""Beacon request - beacon table mode - last frame indication"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another"})
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -902,7 +902,7 @@ def test_rrm_beacon_req_last_frame_indication(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_table_detail(dev, apdev):
"""Beacon request - beacon table mode - reporting detail"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
@ -965,7 +965,7 @@ def test_rrm_beacon_req_table_detail(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_table_request(dev, apdev):
"""Beacon request - beacon table mode - request element"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
@ -1008,7 +1008,7 @@ def test_rrm_beacon_req_table_request(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_table_request_oom(dev, apdev):
"""Beacon request - beacon table mode - request element OOM"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
@ -1051,9 +1051,9 @@ def test_rrm_beacon_req_table_request_oom(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_table_bssid(dev, apdev):
"""Beacon request - beacon table mode - specific BSSID"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another"})
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -1075,9 +1075,9 @@ def test_rrm_beacon_req_table_bssid(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_table_ssid(dev, apdev):
"""Beacon request - beacon table mode - specific SSID"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another"})
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -1118,7 +1118,7 @@ def test_rrm_beacon_req_table_ssid(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_table_info(dev, apdev):
"""Beacon request - beacon table mode - Reporting Information subelement"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
@ -1145,7 +1145,7 @@ def test_rrm_beacon_req_table_info(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_table_unknown_subelem(dev, apdev):
"""Beacon request - beacon table mode - unknown subelement"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
@ -1162,7 +1162,7 @@ def test_rrm_beacon_req_table_unknown_subelem(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_table_truncated_subelem(dev, apdev):
"""Beacon request - beacon table mode - Truncated subelement"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
@ -1203,7 +1203,7 @@ def test_rrm_beacon_req_table_vht(dev, apdev):
clear_scan_cache(apdev[0])
try:
hapd = None
params = { "ssid": "rrm-vht",
params = {"ssid": "rrm-vht",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
@ -1212,10 +1212,10 @@ def test_rrm_beacon_req_table_vht(dev, apdev):
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "42",
"rrm_beacon_report": "1" }
"rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
params = { "ssid": "test-vht40",
params = {"ssid": "test-vht40",
"country_code": "FI",
"hw_mode": "a",
"channel": "48",
@ -1262,9 +1262,9 @@ def test_rrm_beacon_req_table_vht(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_active(dev, apdev):
"""Beacon request - active scan mode"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another", "channel": "11" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another", "channel": "11"})
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -1288,11 +1288,11 @@ def test_rrm_beacon_req_active(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_active_ignore_old_result(dev, apdev):
"""Beacon request - active scan mode and old scan result"""
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another"})
dev[0].scan_for_bss(apdev[1]['bssid'], freq=2412)
hapd2.disable()
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
@ -1338,7 +1338,7 @@ def test_rrm_beacon_req_active_many(dev, apdev):
start_ap(dev[1])
start_ap(dev[2])
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
params['vendor_elements'] = "dd50" + 80*'aa'
hapd = hostapd.add_ap(apdev[1]['ifname'], params)
@ -1366,9 +1366,9 @@ def test_rrm_beacon_req_active_many(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_active_ap_channels(dev, apdev):
"""Beacon request - active scan mode with AP Channel Report subelement"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another", "channel": "11" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another", "channel": "11"})
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -1392,9 +1392,9 @@ def test_rrm_beacon_req_active_ap_channels(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_passive_ap_channels(dev, apdev):
"""Beacon request - passive scan mode with AP Channel Report subelement"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another", "channel": "11" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another", "channel": "11"})
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -1418,9 +1418,9 @@ def test_rrm_beacon_req_passive_ap_channels(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_active_single_channel(dev, apdev):
"""Beacon request - active scan mode with single channel"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another", "channel": "11" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another", "channel": "11"})
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -1437,9 +1437,9 @@ def test_rrm_beacon_req_active_single_channel(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_active_ap_channels_unknown_opclass(dev, apdev):
"""Beacon request - active scan mode with AP Channel Report subelement and unknown opclass"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another", "channel": "11" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another", "channel": "11"})
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -1457,9 +1457,9 @@ def test_rrm_beacon_req_active_ap_channels_unknown_opclass(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_active_ap_channel_oom(dev, apdev):
"""Beacon request - AP Channel Report subelement and OOM"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another", "channel": "11" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another", "channel": "11"})
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -1477,7 +1477,7 @@ def test_rrm_beacon_req_active_ap_channel_oom(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_active_scan_fail(dev, apdev):
"""Beacon request - Active scan failure"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
@ -1496,9 +1496,9 @@ def test_rrm_beacon_req_active_scan_fail(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_active_zero_duration(dev, apdev):
"""Beacon request - Action scan and zero duration"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another", "channel": "11" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another", "channel": "11"})
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -1511,7 +1511,7 @@ def test_rrm_beacon_req_active_zero_duration(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_active_fail_random(dev, apdev):
"""Beacon request - active scan mode os_get_random failure"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -1528,9 +1528,9 @@ def test_rrm_beacon_req_active_fail_random(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_passive(dev, apdev):
"""Beacon request - passive scan mode"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another", "channel": "11" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "another", "channel": "11"})
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -1554,7 +1554,7 @@ def test_rrm_beacon_req_passive(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_passive_no_match(dev, apdev):
"""Beacon request - passive scan mode and no matching BSS"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
@ -1571,7 +1571,7 @@ def test_rrm_beacon_req_passive_no_match(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_passive_no_match_oom(dev, apdev):
"""Beacon request - passive scan mode and no matching BSS (OOM)"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
@ -1596,7 +1596,7 @@ def test_rrm_beacon_req_passive_no_match_oom(dev, apdev):
@remote_compatible
def test_rrm_beacon_req_active_duration_mandatory(dev, apdev):
"""Beacon request - Action scan and duration mandatory"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412")
@ -1625,7 +1625,7 @@ def test_rrm_beacon_req_passive_scan_vht(dev, apdev):
clear_scan_cache(apdev[0])
try:
hapd = None
params = { "ssid": "rrm-vht",
params = {"ssid": "rrm-vht",
"country_code": "FI",
'ieee80211d': '1',
"hw_mode": "a",
@ -1635,7 +1635,7 @@ def test_rrm_beacon_req_passive_scan_vht(dev, apdev):
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "42",
"rrm_beacon_report": "1" }
"rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq=5180)
@ -1682,7 +1682,7 @@ def test_rrm_beacon_req_passive_scan_vht160(dev, apdev):
clear_scan_cache(apdev[0])
try:
hapd = None
params = { "ssid": "rrm-vht",
params = {"ssid": "rrm-vht",
"country_code": "ZA",
'ieee80211d': '1',
"hw_mode": "a",
@ -1692,7 +1692,7 @@ def test_rrm_beacon_req_passive_scan_vht160(dev, apdev):
"ieee80211ac": "1",
"vht_oper_chwidth": "2",
"vht_oper_centr_freq_seg0_idx": "114",
"rrm_beacon_report": "1" }
"rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], freq=5520)
@ -1734,7 +1734,7 @@ def test_rrm_beacon_req_ap_errors(dev, apdev):
dev[1].request("VENDOR_ELEM_REMOVE 13 *")
def run_rrm_beacon_req_ap_errors(dev, apdev):
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq=2412)
@ -1781,7 +1781,7 @@ def run_rrm_beacon_req_ap_errors(dev, apdev):
def test_rrm_req_reject_oom(dev, apdev):
"""Radio measurement request - OOM while rejecting a request"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()
@ -1804,7 +1804,7 @@ def test_rrm_req_reject_oom(dev, apdev):
def test_rrm_req_when_rrm_not_used(dev, apdev):
"""Radio/link measurement request for non-RRM association"""
params = { "ssid": "rrm" }
params = {"ssid": "rrm"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()
@ -1834,7 +1834,7 @@ def test_rrm_req_when_rrm_not_used(dev, apdev):
@remote_compatible
def test_rrm_req_proto(dev, apdev):
"""Radio measurement request - protocol testing"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -1849,34 +1849,34 @@ def test_rrm_req_proto(dev, apdev):
tests = []
# "RRM: Ignoring too short radio measurement request"
tests += [ "0500", "050001", "05000100" ]
tests += ["0500", "050001", "05000100"]
# No measurement request element at all
tests += [ "0500010000" ]
tests += ["0500010000"]
# "RRM: Truncated element"
tests += [ "050001000026" ]
tests += ["050001000026"]
# "RRM: Element length too short"
tests += [ "05000100002600", "0500010000260111", "050001000026021122" ]
tests += ["05000100002600", "0500010000260111", "050001000026021122"]
# "RRM: Element length too long"
tests += [ "05000100002603", "0500010000260311", "050001000026031122" ]
tests += ["05000100002603", "0500010000260311", "050001000026031122"]
# "RRM: Enable bit not supported, ignore"
tests += [ "05000100002603010200" ]
tests += ["05000100002603010200"]
# "RRM: Measurement report failed. TX power insertion not supported"
# OR
# "RRM: Link measurement report failed. Request too short"
tests += [ "0502" ]
tests += ["0502"]
# Too short LCI request
tests += [ "05000100002603010008" ]
tests += ["05000100002603010008"]
# Too short neighbor report response
tests += [ "0505" ]
tests += ["0505"]
# Unexpected neighbor report response
tests += [ "050500", "050501", "050502", "050503", "050504", "050505" ]
tests += ["050500", "050501", "050502", "050503", "050504", "050505"]
# Too short beacon request
tests += [ "05000100002603010005",
"0500010000260f010005112233445566778899aabbcc" ]
tests += ["05000100002603010005",
"0500010000260f010005112233445566778899aabbcc"]
# Unknown beacon report mode
tests += [ "05000100002610010005112233445566778899aabbccdd" ]
tests += ["05000100002610010005112233445566778899aabbccdd"]
# "RRM: Expected Measurement Request element, but EID is 0"
tests += [ "05000100000000" ]
tests += ["05000100000000"]
for t in tests:
if "OK" not in dev[0].request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + t):
raise Exception("MGMT_RX_PROCESS failed")
@ -1886,13 +1886,13 @@ def test_rrm_req_proto(dev, apdev):
tests = []
# "RRM: Parallel measurements are not supported, reject"
tests += [ "05000100002603010105" ]
tests += ["05000100002603010105"]
# "RRM: Unsupported radio measurement type 254"
tests += [ "050001000026030100fe" ]
tests += ["050001000026030100fe"]
# Reject LCI request
tests += [ "0500010000260701000811223344" ]
tests += ["0500010000260701000811223344"]
# Beacon report info subelement; no valid channels
tests += [ "05000100002614010005112233445566008899aabbccdd01020000" ]
tests += ["05000100002614010005112233445566008899aabbccdd01020000"]
for t in tests:
if "OK" not in dev[0].request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + t):
raise Exception("MGMT_RX_PROCESS failed")
@ -1904,7 +1904,7 @@ def test_rrm_req_proto(dev, apdev):
dev[0].request("SET LCI " + lci)
tests = []
# "Not building LCI report - bad location subject"
tests += [ "0500010000260701000811223344" ]
tests += ["0500010000260701000811223344"]
for t in tests:
if "OK" not in dev[0].request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + t):
raise Exception("MGMT_RX_PROCESS failed")
@ -1914,9 +1914,9 @@ def test_rrm_req_proto(dev, apdev):
tests = []
# LCI report or reject
tests += [ "0500010000260701000801223344",
tests += ["0500010000260701000801223344",
"05000100002607010008010402ff",
"05000100002608010008010402ffff" ]
"05000100002608010008010402ffff"]
for t in tests:
if "OK" not in dev[0].request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + t):
raise Exception("MGMT_RX_PROCESS failed")
@ -1943,7 +1943,7 @@ def test_rrm_req_proto(dev, apdev):
def test_rrm_link_measurement(dev, apdev):
"""Radio measurement request - link measurement"""
check_tx_power_support(dev[0])
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()
@ -1964,7 +1964,7 @@ def test_rrm_link_measurement(dev, apdev):
def test_rrm_link_measurement_oom(dev, apdev):
"""Radio measurement request - link measurement OOM"""
check_tx_power_support(dev[0])
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()
@ -1994,7 +1994,7 @@ def test_rrm_rep_parse_proto(dev, apdev):
"""hostapd rrm report parsing protocol testing"""
check_rrm_support(dev[0])
params = { "ssid": "rrm", "rrm_neighbor_report": "1" }
params = {"ssid": "rrm", "rrm_neighbor_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()
@ -2005,7 +2005,7 @@ def test_rrm_rep_parse_proto(dev, apdev):
hdr = "d0003a01" + bssid.replace(':', '') + addr.replace(':', '') + bssid.replace(':', '') + "1000"
hapd.set("ext_mgmt_frame_handling", "1")
tests = [ "0501",
tests = ["0501",
"05ff01",
"0501012703fffffe2700",
"0501012703ffff05",
@ -2015,7 +2015,7 @@ def test_rrm_rep_parse_proto(dev, apdev):
"0504012608ffff08ffffffffff",
"0504012608ffff08ff04021234",
"0504012608ffff08ff04020100",
"0504012608ffff08ff0402ffff" ]
"0504012608ffff08ff0402ffff"]
for t in tests:
if "OK" not in hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + t):
raise Exception("MGMT_RX_PROCESS failed for " + t)
@ -2029,7 +2029,7 @@ def test_rrm_unexpected(dev, apdev):
"""hostapd unexpected rrm"""
check_rrm_support(dev[0])
params = { "ssid": "rrm", "rrm_neighbor_report": "0" }
params = {"ssid": "rrm", "rrm_neighbor_report": "0"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()
@ -2039,7 +2039,7 @@ def test_rrm_unexpected(dev, apdev):
hdr = "d0003a01" + bssid.replace(':', '') + addr.replace(':', '') + bssid.replace(':', '') + "1000"
hapd.set("ext_mgmt_frame_handling", "1")
tests = [ "050401" ]
tests = ["050401"]
for t in tests:
if "OK" not in hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + t):
raise Exception("MGMT_RX_PROCESS failed for " + t)
@ -2055,7 +2055,7 @@ def check_beacon_req(hapd, addr, idx):
def test_rrm_reassociation(dev, apdev):
"""Radio measurement request - reassociation"""
params = { "ssid": "rrm", "rrm_beacon_report": "1" }
params = {"ssid": "rrm", "rrm_beacon_report": "1"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()

View File

@ -102,7 +102,7 @@ def test_sae_pmksa_caching(dev, apdev):
dev[0].request("SET sae_groups ")
dev[0].connect("test-sae", psk="12345678", key_mgmt="SAE",
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")
dev[0].request("DISCONNECT")
@ -126,7 +126,7 @@ def test_sae_pmksa_caching_disabled(dev, apdev):
dev[0].request("SET sae_groups ")
dev[0].connect("test-sae", psk="12345678", key_mgmt="SAE",
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")
dev[0].request("DISCONNECT")
@ -144,12 +144,12 @@ def test_sae_groups(dev, apdev):
# MODP) and group 21 (521-bit random ECP group) are a bit too slow on some
# VMs and can result in hitting the mac80211 authentication timeout, so
# allow them to fail and just report such failures in the debug log.
sae_groups = [ 19, 25, 26, 20, 21, 1, 2, 5, 14, 15, 16, 22, 23, 24 ]
sae_groups = [19, 25, 26, 20, 21, 1, 2, 5, 14, 15, 16, 22, 23, 24]
tls = dev[0].request("GET tls_library")
if tls.startswith("OpenSSL") and "run=OpenSSL 1." in tls:
logger.info("Add Brainpool EC groups since OpenSSL is new enough")
sae_groups += [ 27, 28, 29, 30 ]
heavy_groups = [ 14, 15, 16 ]
sae_groups += [27, 28, 29, 30]
heavy_groups = [14, 15, 16]
groups = [str(g) for g in sae_groups]
params = hostapd.wpa2_params(ssid="test-sae-groups",
passphrase="12345678")
@ -174,7 +174,7 @@ def test_sae_groups(dev, apdev):
else:
ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=10)
if ev is None:
if "BoringSSL" in tls and int(g) in [ 25 ]:
if "BoringSSL" in tls and int(g) in [25]:
logger.info("Ignore connection failure with group " + g + " with BoringSSL")
dev[0].remove_network(id)
dev[0].dump_monitor()
@ -217,7 +217,7 @@ def test_sae_group_nego_no_match(dev, apdev):
dev[0].request("SET sae_groups ")
dev[0].connect("test-sae-group-nego", psk="12345678", key_mgmt="SAE",
scan_freq="2412", wait_connect=False)
ev = dev[0].wait_event([ "CTRL-EVENT-SSID-TEMP-DISABLED" ], timeout=10)
ev = dev[0].wait_event(["CTRL-EVENT-SSID-TEMP-DISABLED"], timeout=10)
dev[0].request("REMOVE_NETWORK all")
if ev is None:
raise Exception("Network profile disabling not reported")
@ -550,7 +550,7 @@ def test_sae_proto_ecc(dev, apdev):
dev[0].request("SET sae_groups 19")
tests = [ ("Confirm mismatch",
tests = [("Confirm mismatch",
"1300" + "033d3635b39666ed427fd4a3e7d37acec2810afeaf1687f746a14163ff0e6d03" + "559cb8928db4ce4e3cbd6555e837591995e5ebe503ef36b503d9ca519d63728dd3c7c676b8e8081831b6bc3a64bdf136061a7de175e17d1965bfa41983ed02f8",
"0000800edebc3f260dc1fe7e0b20888af2b8a3316252ec37388a8504e25b73dc4240"),
("Commit without even full cyclic group field",
@ -649,7 +649,7 @@ def test_sae_proto_ffc(dev, apdev):
dev[0].request("SET sae_groups 2")
tests = [ ("Confirm mismatch",
tests = [("Confirm mismatch",
"0200" + "0c70519d874e3e4930a917cc5e17ea7a26028211159f217bab28b8d6c56691805e49f03249b2c6e22c7c9f86b30e04ccad2deedd5e5108ae07b737c00001c59cd0eb08b1dfc7f1b06a1542e2b6601a963c066e0c65940983a03917ae57a101ce84b5cbbc76ff33ebb990aac2e54aa0f0ab6ec0a58113d927683502b2cb2347d2" + "a8c00117493cdffa5dd671e934bc9cb1a69f39e25e9dd9cd9afd3aea2441a0f5491211c7ba50a753563f9ce943b043557cb71193b28e86ed9544f4289c471bf91b70af5c018cf4663e004165b0fd0bc1d8f3f78adf42eee92bcbc55246fd3ee9f107ab965dc7d4986f23eb71d616ebfe6bfe0a6c1ac5dc1718acee17c9a17486",
"0000f3116a9731f1259622e3eb55d4b3b50ba16f8c5f5565b28e609b180c51460251"),
("Too short commit",
@ -663,7 +663,7 @@ def test_sae_proto_ffc(dev, apdev):
None),
("Invalid element (> P) in commit",
"0200" + "0c70519d874e3e4930a917cc5e17ea7a26028211159f217bab28b8d6c56691805e49f03249b2c6e22c7c9f86b30e04ccad2deedd5e5108ae07b737c00001c59cd0eb08b1dfc7f1b06a1542e2b6601a963c066e0c65940983a03917ae57a101ce84b5cbbc76ff33ebb990aac2e54aa0f0ab6ec0a58113d927683502b2cb2347d2" + "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
None) ]
None)]
for (note, commit, confirm) in tests:
logger.info(note)
dev[0].scan_for_bss(bssid, freq=2412)
@ -1005,10 +1005,10 @@ def test_sae_no_random(dev, apdev):
hapd = hostapd.add_ap(apdev[0], params)
dev[0].request("SET sae_groups ")
tests = [ (1, "os_get_random;sae_get_rand"),
tests = [(1, "os_get_random;sae_get_rand"),
(1, "os_get_random;get_rand_1_to_p_1"),
(1, "os_get_random;get_random_qr_qnr"),
(1, "os_get_random;sae_derive_pwe_ecc") ]
(1, "os_get_random;sae_derive_pwe_ecc")]
for count, func in tests:
with fail_test(dev[0], count, func):
dev[0].connect("test-sae", psk="12345678", key_mgmt="SAE",
@ -1068,7 +1068,7 @@ def test_sae_bignum_failure(dev, apdev):
hapd = hostapd.add_ap(apdev[0], params)
dev[0].request("SET sae_groups 19")
tests = [ (1, "crypto_bignum_init_set;get_rand_1_to_p_1"),
tests = [(1, "crypto_bignum_init_set;get_rand_1_to_p_1"),
(1, "crypto_bignum_init;is_quadratic_residue_blind"),
(1, "crypto_bignum_mulmod;is_quadratic_residue_blind"),
(2, "crypto_bignum_mulmod;is_quadratic_residue_blind"),
@ -1094,7 +1094,7 @@ def test_sae_bignum_failure(dev, apdev):
(1, "crypto_bignum_init;sae_derive_keys"),
(1, "crypto_bignum_init_set;sae_parse_commit_scalar"),
(1, "crypto_bignum_to_bin;sae_parse_commit_element_ecc"),
(1, "crypto_ec_point_from_bin;sae_parse_commit_element_ecc") ]
(1, "crypto_ec_point_from_bin;sae_parse_commit_element_ecc")]
for count, func in tests:
with fail_test(dev[0], count, func):
hapd.request("NOTE STA failure testing %d:%s" % (count, func))
@ -1106,7 +1106,7 @@ def test_sae_bignum_failure(dev, apdev):
hapd.dump_monitor()
dev[0].request("SET sae_groups 5")
tests = [ (1, "crypto_bignum_init_set;sae_set_group"),
tests = [(1, "crypto_bignum_init_set;sae_set_group"),
(2, "crypto_bignum_init_set;sae_set_group"),
(1, "crypto_bignum_init_set;sae_get_rand"),
(1, "crypto_bignum_init_set;sae_test_pwd_seed_ffc"),
@ -1123,7 +1123,7 @@ def test_sae_bignum_failure(dev, apdev):
(1, "crypto_bignum_init_set;sae_parse_commit_element_ffc"),
(1, "crypto_bignum_init;sae_parse_commit_element_ffc"),
(2, "crypto_bignum_init_set;sae_parse_commit_element_ffc"),
(1, "crypto_bignum_exptmod;sae_parse_commit_element_ffc") ]
(1, "crypto_bignum_exptmod;sae_parse_commit_element_ffc")]
for count, func in tests:
with fail_test(dev[0], count, func):
hapd.request("NOTE STA failure testing %d:%s" % (count, func))
@ -1135,9 +1135,9 @@ def test_sae_bignum_failure(dev, apdev):
hapd.dump_monitor()
dev[0].request("SET sae_groups 22")
tests = [ (1, "crypto_bignum_init_set;sae_test_pwd_seed_ffc"),
tests = [(1, "crypto_bignum_init_set;sae_test_pwd_seed_ffc"),
(1, "crypto_bignum_sub;sae_test_pwd_seed_ffc"),
(1, "crypto_bignum_div;sae_test_pwd_seed_ffc") ]
(1, "crypto_bignum_div;sae_test_pwd_seed_ffc")]
for count, func in tests:
with fail_test(dev[0], count, func):
hapd.request("NOTE STA failure testing %d:%s" % (count, func))
@ -1306,9 +1306,9 @@ def run_sae_password_id(dev, apdev, groups=None):
params['sae_groups'] = groups
else:
groups = ""
params['sae_password'] = [ 'secret|mac=ff:ff:ff:ff:ff:ff|id=pw id',
params['sae_password'] = ['secret|mac=ff:ff:ff:ff:ff:ff|id=pw id',
'foo|mac=02:02:02:02:02:02',
'another secret|mac=ff:ff:ff:ff:ff:ff|id=' + 29*'A' ]
'another secret|mac=ff:ff:ff:ff:ff:ff|id=' + 29*'A']
hapd = hostapd.add_ap(apdev[0], params)
dev[0].request("SET sae_groups " + groups)
@ -1424,9 +1424,9 @@ def build_sae_commit(bssid, addr, group=21, token=None):
def sae_rx_commit_token_req(sock, radiotap, send_two=False):
msg = sock.recv(1500)
ver,pad,len,present = struct.unpack('<BBHL', msg[0:8])
ver, pad, len, present = struct.unpack('<BBHL', msg[0:8])
frame = msg[len:]
fc,duration = struct.unpack('<HH', frame[0:4])
fc, duration = struct.unpack('<HH', frame[0:4])
if fc != 0xb0:
return False
frame = frame[4:]
@ -1437,7 +1437,7 @@ def sae_rx_commit_token_req(sock, radiotap, send_two=False):
bssid = frame[12:18]
body = frame[20:]
alg,seq,status,group = struct.unpack('<HHHH', body[0:8])
alg, seq, status, group = struct.unpack('<HHHH', body[0:8])
if alg != 3 or seq != 1 or status != 76:
return False
token = body[8:]

View File

@ -69,7 +69,7 @@ def check_scan_retry(dev, params, bssid):
@remote_compatible
def test_scan(dev, apdev):
"""Control interface behavior on scan parameters"""
hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
logger.info("Full scan")
@ -94,12 +94,12 @@ def test_scan(dev, apdev):
@remote_compatible
def test_scan_tsf(dev, apdev):
"""Scan and TSF updates from Beacon/Probe Response frames"""
hostapd.add_ap(apdev[0], { "ssid": "test-scan",
'beacon_int': "100" })
hostapd.add_ap(apdev[0], {"ssid": "test-scan",
'beacon_int': "100"})
bssid = apdev[0]['bssid']
tsf = []
for passive in [ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1 ]:
for passive in [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1]:
check_scan(dev[0], "freq=2412 passive=%d use_id=1" % passive)
bss = dev[0].get_bss(bssid)
if bss:
@ -119,7 +119,7 @@ def test_scan_tsf(dev, apdev):
@remote_compatible
def test_scan_only(dev, apdev):
"""Control interface behavior on scan parameters with type=only"""
hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
logger.info("Full scan")
@ -144,7 +144,7 @@ def test_scan_only(dev, apdev):
@remote_compatible
def test_scan_external_trigger(dev, apdev):
"""Avoid operations during externally triggered scan"""
hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
dev[0].cmd_execute(['iw', dev[0].ifname, 'scan', 'trigger'])
check_scan(dev[0], "use_id=1", other_started=True)
@ -155,7 +155,7 @@ def test_scan_bss_expiration_count(dev, apdev):
raise Exception("Invalid BSS_EXPIRE_COUNT accepted")
if "OK" not in dev[0].request("BSS_EXPIRE_COUNT 2"):
raise Exception("BSS_EXPIRE_COUNT failed")
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
dev[0].scan(freq="2412", only_new=True)
if bssid not in dev[0].request("SCAN_RESULTS"):
@ -176,7 +176,7 @@ def test_scan_bss_expiration_age(dev, apdev):
raise Exception("Invalid BSS_EXPIRE_AGE accepted")
if "OK" not in dev[0].request("BSS_EXPIRE_AGE 10"):
raise Exception("BSS_EXPIRE_AGE failed")
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
# Allow couple more retries to avoid reporting errors during heavy load
for i in range(5):
@ -205,9 +205,9 @@ def test_scan_filter(dev, apdev):
if "OK" not in dev[0].request("SET filter_ssids 1"):
raise Exception("SET failed")
id = dev[0].connect("test-scan", key_mgmt="NONE", only_add_network=True)
hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
hostapd.add_ap(apdev[1], { "ssid": "test-scan2" })
hostapd.add_ap(apdev[1], {"ssid": "test-scan2"})
bssid2 = apdev[1]['bssid']
dev[0].scan(freq="2412", only_new=True)
if bssid not in dev[0].request("SCAN_RESULTS"):
@ -252,9 +252,9 @@ def test_scan_int(dev, apdev):
def test_scan_bss_operations(dev, apdev):
"""Control interface behavior on BSS parameters"""
hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
hostapd.add_ap(apdev[1], { "ssid": "test2-scan" })
hostapd.add_ap(apdev[1], {"ssid": "test2-scan"})
bssid2 = apdev[1]['bssid']
dev[0].scan(freq="2412")
@ -361,7 +361,7 @@ def test_scan_and_interface_disabled(dev, apdev):
@remote_compatible
def test_scan_for_auth(dev, apdev):
"""cfg80211 workaround with scan-for-auth"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
# Block sme-connect radio work with an external radio work item, so that
# SELECT_NETWORK can decide to use fast associate without a new scan while
@ -391,7 +391,7 @@ def test_scan_for_auth(dev, apdev):
@remote_compatible
def test_scan_for_auth_fail(dev, apdev):
"""cfg80211 workaround with scan-for-auth failing"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
# Block sme-connect radio work with an external radio work item, so that
# SELECT_NETWORK can decide to use fast associate without a new scan while
@ -430,8 +430,8 @@ def test_scan_for_auth_wep(dev, apdev):
"""cfg80211 scan-for-auth workaround with WEP keys"""
dev[0].flush_scan_cache()
hapd = hostapd.add_ap(apdev[0],
{ "ssid": "wep", "wep_key0": '"abcde"',
"auth_algs": "2" })
{"ssid": "wep", "wep_key0": '"abcde"',
"auth_algs": "2"})
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
# Block sme-connect radio work with an external radio work item, so that
# SELECT_NETWORK can decide to use fast associate without a new scan while
@ -461,8 +461,8 @@ def test_scan_for_auth_wep(dev, apdev):
@remote_compatible
def test_scan_hidden(dev, apdev):
"""Control interface behavior on scan parameters"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan",
"ignore_broadcast_ssid": "1" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan",
"ignore_broadcast_ssid": "1"})
bssid = apdev[0]['bssid']
check_scan(dev[0], "freq=2412 use_id=1")
@ -504,9 +504,9 @@ def test_scan_hidden(dev, apdev):
def test_scan_and_bss_entry_removed(dev, apdev):
"""Last scan result and connect work processing on BSS entry update"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "open",
hapd = hostapd.add_ap(apdev[0], {"ssid": "open",
"eap_server": "1",
"wps_state": "2" })
"wps_state": "2"})
bssid = apdev[0]['bssid']
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@ -632,16 +632,16 @@ def test_scan_setband(dev, apdev):
try:
hapd = None
hapd2 = None
params = { "ssid": "test-setband",
params = {"ssid": "test-setband",
"hw_mode": "a",
"channel": "36",
"country_code": "US" }
"country_code": "US"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
params = { "ssid": "test-setband",
params = {"ssid": "test-setband",
"hw_mode": "g",
"channel": "1" }
"channel": "1"}
hapd2 = hostapd.add_ap(apdev[1], params)
bssid2 = apdev[1]['bssid']
@ -706,8 +706,8 @@ def test_scan_hidden_many(dev, apdev):
dev[0].request("SCAN_INTERVAL 5")
def _test_scan_hidden_many(dev, apdev):
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan-ssid",
"ignore_broadcast_ssid": "1" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan-ssid",
"ignore_broadcast_ssid": "1"})
bssid = apdev[0]['bssid']
dev[0].request("SCAN_INTERVAL 1")
@ -747,10 +747,10 @@ def test_scan_random_mac(dev, apdev, params):
dev[0].request("MAC_RAND_SCAN all enable=0")
def _test_scan_random_mac(dev, apdev, params):
hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
tests = [ "",
tests = ["",
"addr=foo",
"mask=foo",
"enable=1",
@ -761,7 +761,7 @@ def _test_scan_random_mac(dev, apdev, params):
"enable=2 scan sched pno all",
"pno enable=1",
"all enable=2",
"foo" ]
"foo"]
for args in tests:
if "FAIL" not in dev[0].request("MAC_RAND_SCAN " + args):
raise Exception("Invalid MAC_RAND_SCAN accepted: " + args)
@ -769,15 +769,15 @@ def _test_scan_random_mac(dev, apdev, params):
if dev[0].get_driver_status_field('capa.mac_addr_rand_scan_supported') != '1':
raise HwsimSkip("Driver does not support random MAC address for scanning")
tests = [ "all enable=1",
tests = ["all enable=1",
"all enable=1 addr=f2:11:22:33:44:55 mask=ff:ff:ff:ff:ff:ff",
"all enable=1 addr=f2:11:33:00:00:00 mask=ff:ff:ff:00:00:00" ]
"all enable=1 addr=f2:11:33:00:00:00 mask=ff:ff:ff:00:00:00"]
for args in tests:
dev[0].request("MAC_RAND_SCAN " + args)
dev[0].scan_for_bss(bssid, freq=2412, force_scan=True)
out = run_tshark(os.path.join(params['logdir'], "hwsim0.pcapng"),
"wlan.fc.type_subtype == 4", ["wlan.ta" ])
"wlan.fc.type_subtype == 4", ["wlan.ta"])
if out is not None:
addr = out.splitlines()
logger.info("Probe Request frames seen from: " + str(addr))
@ -801,14 +801,14 @@ def test_scan_random_mac_connected(dev, apdev, params):
dev[0].request("MAC_RAND_SCAN all enable=0")
def _test_scan_random_mac_connected(dev, apdev, params):
hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
if dev[0].get_driver_status_field('capa.mac_addr_rand_scan_supported') != '1':
raise HwsimSkip("Driver does not support random MAC address for scanning")
dev[0].connect("test-scan", key_mgmt="NONE", scan_freq="2412")
hostapd.add_ap(apdev[1], { "ssid": "test-scan-2", "channel": "11" })
hostapd.add_ap(apdev[1], {"ssid": "test-scan-2", "channel": "11"})
bssid1 = apdev[1]['bssid']
# Verify that scanning can be completed while connected even if that means
@ -822,7 +822,7 @@ def test_scan_trigger_failure(dev, apdev):
if dev[0].get_status_field('wpa_state') == "SCANNING":
raise Exception("wpa_state was already SCANNING")
hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
if "OK" not in dev[0].request("SET test_failure 1"):
@ -867,8 +867,8 @@ def test_scan_trigger_failure(dev, apdev):
def test_scan_specify_ssid(dev, apdev):
"""Control interface behavior on scan SSID parameter"""
dev[0].flush_scan_cache()
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-hidden",
"ignore_broadcast_ssid": "1" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-hidden",
"ignore_broadcast_ssid": "1"})
bssid = apdev[0]['bssid']
check_scan(dev[0], "freq=2412 use_id=1 ssid 414243")
bss = dev[0].get_bss(bssid)
@ -943,12 +943,12 @@ def _test_scan_ap_scan_2_ap_mode(dev, apdev):
def test_scan_bss_expiration_on_ssid_change(dev, apdev):
"""BSS entry expiration when AP changes SSID"""
dev[0].flush_scan_cache()
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
hapd.request("DISABLE")
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
if "OK" not in dev[0].request("BSS_EXPIRE_COUNT 3"):
raise Exception("BSS_EXPIRE_COUNT failed")
dev[0].scan(freq="2412")
@ -1001,7 +1001,7 @@ def _test_scan_dfs(dev, apdev, params):
raise Exception("Scan did not complete")
out = run_tshark(os.path.join(params['logdir'], "hwsim0.pcapng"),
"wlan.fc.type_subtype == 4", [ "radiotap.channel.freq" ])
"wlan.fc.type_subtype == 4", ["radiotap.channel.freq"])
if out is not None:
freq = out.splitlines()
freq = [int(f) for f in freq]
@ -1011,7 +1011,7 @@ def _test_scan_dfs(dev, apdev, params):
for f in freq:
if (f >= 5260 and f <= 5320) or (f >= 5500 and f <= 5700):
raise Exception("Active scan on DFS channel: %d" % f)
if f in [ 2467, 2472 ]:
if f in [2467, 2472]:
raise Exception("Active scan on US-disallowed channel: %d" % f)
@remote_compatible
@ -1030,7 +1030,7 @@ def test_scan_abort(dev, apdev):
@remote_compatible
def test_scan_abort_on_connect(dev, apdev):
"""Aborting a full scan on connection request"""
hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
@ -1044,7 +1044,7 @@ def test_scan_abort_on_connect(dev, apdev):
@remote_compatible
def test_scan_ext(dev, apdev):
"""Custom IE in Probe Request frame"""
hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
try:
@ -1140,7 +1140,7 @@ def test_scan_fail(dev, apdev):
wpas.request("SET preassoc_mac_addr 0")
wpas.dump_monitor()
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
with alloc_fail(dev[0], 1, "wpa_bss_add"):
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
@ -1153,7 +1153,7 @@ def test_scan_fail_type_only(dev, apdev):
raise Exception("Scan trigger failure not reported")
# Verify that scan_only_handler() does not get left set as the
# wpa_s->scan_res_handler in failure case.
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")
@remote_compatible
@ -1166,7 +1166,7 @@ def test_scan_freq_list(dev, apdev):
finally:
dev[0].request("SET freq_list ")
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
dev[0].connect("test-scan", key_mgmt="NONE", scan_freq="2412")
try:
if "OK" not in dev[0].request("SET scan_cur_freq 1"):
@ -1191,10 +1191,10 @@ def _test_scan_bss_limit(dev, apdev):
# count to one so that the second AP would not fit in the BSS list and the
# first AP cannot be removed from the list since it is still in use.
dev[0].request("SET bss_max_count 1")
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
dev[0].connect("test-scan", key_mgmt="NONE", scan_freq="2412")
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "test-scan-2",
"channel": "6" })
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "test-scan-2",
"channel": "6"})
dev[0].scan_for_bss(apdev[1]['bssid'], freq=2437, force_scan=True)
def run_scan(dev, bssid, exp_freq):
@ -1218,7 +1218,7 @@ def test_scan_chan_switch(dev, apdev):
# has multiple (one for each frequency) BSS entries for the same BSS.
csa_supported(dev[0])
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan", "channel": "1" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan", "channel": "1"})
csa_supported(hapd)
bssid = hapd.own_addr()
@ -1255,7 +1255,7 @@ def test_scan_new_only(dev, apdev):
dev[0].set("ignore_old_scan_res", "0")
def _test_scan_new_only(dev, apdev):
dev[0].flush_scan_cache()
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
dev[0].set("ignore_old_scan_res", "1")
# Get the BSS added to cfg80211 BSS list
bssid = hapd.own_addr()
@ -1284,7 +1284,7 @@ def _test_scan_new_only(dev, apdev):
def test_scan_flush(dev, apdev):
"""Ongoing scan and FLUSH"""
dev[0].flush_scan_cache()
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
dev[0].dump_monitor()
dev[0].request("SCAN TYPE=ONLY freq=2412-2472 passive=1")
ev = dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"], timeout=10)
@ -1303,8 +1303,8 @@ def test_scan_flush(dev, apdev):
def test_scan_ies(dev, apdev):
"""Scan and both Beacon and Probe Response frame IEs"""
dev[0].flush_scan_cache()
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan",
"beacon_int": "20" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan",
"beacon_int": "20"})
bssid = hapd.own_addr()
dev[0].dump_monitor()
@ -1340,7 +1340,7 @@ def test_scan_parsing(dev, apdev):
if "FAIL" not in dev[0].request("DRIVER_EVENT SCAN_RES foo "):
raise Exception("Invalid DRIVER_EVENT SCAN_RES accepted")
tests = [ "",
tests = ["",
"flags=ffffffff",
"bssid=02:03:04:05:06:07",
"freq=1234",
@ -1376,7 +1376,7 @@ def test_scan_parsing(dev, apdev):
# Test BSS for updates
"bssid=02:ff:00:00:00:09 freq=2412 caps=0011 level=1 ie=0003757064010182",
# Minimal BSS data
"bssid=02:ff:00:00:00:00 ie=0000" ]
"bssid=02:ff:00:00:00:00 ie=0000"]
for t in tests:
if "OK" not in dev[0].request("DRIVER_EVENT SCAN_RES BSS " + t):
raise Exception("DRIVER_EVENT SCAN_RES BSS failed")
@ -1406,12 +1406,12 @@ def test_scan_parsing(dev, apdev):
res = dev[0].request("BSS NEXT-" + id)
logger.info("Discovered BSSs: " + str(bss))
invalid_bss = [ "02:03:04:05:06:07", "02:ff:00:00:00:01" ]
valid_bss = [ "02:ff:00:00:00:00", "02:ff:00:00:00:02",
invalid_bss = ["02:03:04:05:06:07", "02:ff:00:00:00:01"]
valid_bss = ["02:ff:00:00:00:00", "02:ff:00:00:00:02",
"02:ff:00:00:00:03", "02:ff:00:00:00:04",
"02:ff:00:00:00:05", "02:ff:00:00:00:06",
"02:ff:00:00:00:07", "02:ff:00:00:00:08",
"02:ff:00:00:00:09" ]
"02:ff:00:00:00:09"]
for bssid in invalid_bss:
if bssid in bss:
raise Exception("Invalid BSS included: " + bssid)
@ -1432,8 +1432,8 @@ def test_scan_parsing(dev, apdev):
def test_scan_specific_bssid(dev, apdev):
"""Scan for a specific BSSID"""
dev[0].flush_scan_cache()
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan",
"beacon_int": "1000" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan",
"beacon_int": "1000"})
bssid = hapd.own_addr()
time.sleep(0.1)
@ -1461,7 +1461,7 @@ def test_scan_specific_bssid(dev, apdev):
def test_scan_probe_req_events(dev, apdev):
"""Probe Request frame RX events from hostapd"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
hapd2 = hostapd.Hostapd(apdev[0]['ifname'])
if "OK" not in hapd2.mon.request("ATTACH probe_rx_events=1"):
raise Exception("Failed to register for events")
@ -1486,7 +1486,7 @@ def test_scan_probe_req_events(dev, apdev):
if ev is not None:
raise Exception("Unexpected RX-PROBE-REQUEST")
tests = [ "probe_rx_events", "probe_rx_events=-1", "probe_rx_events=2" ]
tests = ["probe_rx_events", "probe_rx_events=-1", "probe_rx_events=2"]
for val in tests:
if "FAIL" not in hapd2.mon.request("ATTACH " + val):
raise Exception("Invalid ATTACH command accepted")
@ -1538,12 +1538,12 @@ def test_scan_multi_bssid(dev, apdev):
check_multibss_sta_capa(dev[0])
dev[0].flush_scan_cache()
params = { "ssid": "test-scan" }
params = {"ssid": "test-scan"}
# Max BSSID Indicator 0 (max 1 BSSID) and no subelements
params['vendor_elements'] = elem_multibssid(b'', 0)
hostapd.add_ap(apdev[0], params)
params = { "ssid": "test-scan" }
params = {"ssid": "test-scan"}
elems = elem_capab(0x0401) + elem_ssid("1") + elem_bssid_index(1)
profile1 = struct.pack('BB', 0, len(elems)) + elems
params['vendor_elements'] = elem_multibssid(profile1, 1)
@ -1551,9 +1551,9 @@ def test_scan_multi_bssid(dev, apdev):
bssid0 = apdev[0]['bssid']
bssid1 = apdev[1]['bssid']
check = [ (bssid0, 'test-scan', 0x401),
check = [(bssid0, 'test-scan', 0x401),
(bssid1, 'test-scan', 0x401),
(bssid1[0:16] + '1', '1', 0x401) ]
(bssid1[0:16] + '1', '1', 0x401)]
run_scans(dev[0], check)
def test_scan_multi_bssid_2(dev, apdev):
@ -1561,7 +1561,7 @@ def test_scan_multi_bssid_2(dev, apdev):
check_multibss_sta_capa(dev[0])
dev[0].flush_scan_cache()
params = { "ssid": "transmitted" }
params = {"ssid": "transmitted"}
# Duplicated entry for the transmitted BSS (not a normal use case)
elems = elem_capab(1) + elem_ssid("transmitted") + elem_bssid_index(0)
@ -1578,9 +1578,9 @@ def test_scan_multi_bssid_2(dev, apdev):
hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
check = [ (bssid, 'transmitted', 0x401),
check = [(bssid, 'transmitted', 0x401),
(bssid[0:16] + '1', 'nontransmitted', 0x1),
(bssid[0:16] + '2', 'nontransmitted_2', 0x1) ]
(bssid[0:16] + '2', 'nontransmitted_2', 0x1)]
run_scans(dev[0], check)
def test_scan_multi_bssid_3(dev, apdev):
@ -1588,7 +1588,7 @@ def test_scan_multi_bssid_3(dev, apdev):
check_multibss_sta_capa(dev[0])
dev[0].flush_scan_cache()
params = { "ssid": "transmitted" }
params = {"ssid": "transmitted"}
# Duplicated nontransmitted BSS (not a normal use case)
elems = elem_capab(1) + elem_ssid("nontransmitted") + elem_bssid_index(1)
@ -1602,8 +1602,8 @@ def test_scan_multi_bssid_3(dev, apdev):
hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
check = [ (bssid, 'transmitted', 0x401),
(bssid[0:16] + '1', 'nontransmitted', 0x1) ]
check = [(bssid, 'transmitted', 0x401),
(bssid[0:16] + '1', 'nontransmitted', 0x1)]
run_scans(dev[0], check)
def test_scan_multi_bssid_4(dev, apdev):
@ -1615,7 +1615,7 @@ def test_scan_multi_bssid_4(dev, apdev):
bssid = apdev[0]['bssid']
hapd = None
try:
params = { "ssid": "transmitted",
params = {"ssid": "transmitted",
"bssid": bssid[0:16] + '1'}
elems = elem_capab(1) + elem_ssid("1") + elem_bssid_index(1)
@ -1631,10 +1631,10 @@ def test_scan_multi_bssid_4(dev, apdev):
params['vendor_elements'] = elem_multibssid(profiles, 2)
hapd = hostapd.add_ap(apdev[0], params)
check = [ (bssid[0:16] + '1', 'transmitted', 0x401),
check = [(bssid[0:16] + '1', 'transmitted', 0x401),
(bssid[0:16] + '2', '1', 0x1),
(bssid[0:16] + '3', '2', 0x1),
(bssid[0:16] + '0', '3', 0x1) ]
(bssid[0:16] + '0', '3', 0x1)]
run_scans(dev[0], check)
finally:
if hapd:
@ -1647,7 +1647,7 @@ def test_scan_multi_bssid_check_ie(dev, apdev):
check_multibss_sta_capa(dev[0])
dev[0].flush_scan_cache()
params = { "ssid": "transmitted" }
params = {"ssid": "transmitted"}
# Duplicated entry for the transmitted BSS (not a normal use case)
elems = elem_capab(1) + elem_ssid("transmitted") + elem_bssid_index(0)
@ -1720,7 +1720,7 @@ def test_scan_multi_bssid_fms(dev, apdev):
check_multibss_sta_capa(dev[0])
dev[0].flush_scan_cache()
params = { "ssid": "transmitted" }
params = {"ssid": "transmitted"}
# construct transmitting BSS Beacon with FMS IE
elems = elem_capab(1) + elem_ssid("transmitted") + elem_bssid_index(0) + elem_fms1()
@ -1785,8 +1785,8 @@ def test_scan_multiple_mbssid_ie(dev, apdev):
hapd = None
# construct 2 MBSSID IEs, each MBSSID IE contains 1 profile
params = { "ssid": "transmitted",
"bssid": bssid }
params = {"ssid": "transmitted",
"bssid": bssid}
elems = elem_capab(1) + elem_ssid("1") + elem_bssid_index(1)
profile1 = struct.pack('BB', 0, len(elems)) + elems
@ -1794,12 +1794,12 @@ def test_scan_multiple_mbssid_ie(dev, apdev):
elems = elem_capab(2) + elem_ssid("2") + elem_bssid_index(2)
profile2 = struct.pack('BB', 0, len(elems)) + elems
params['vendor_elements'] = elem_multibssid(profile1, 2) + elem_multibssid(profile2,2)
params['vendor_elements'] = elem_multibssid(profile1, 2) + elem_multibssid(profile2, 2)
hapd = hostapd.add_ap(apdev[0], params)
check = [ (bssid, 'transmitted', 0x401),
check = [(bssid, 'transmitted', 0x401),
(bssid[0:16] + '1', '1', 0x1),
(bssid[0:16] + '2', '2', 0x2) ]
(bssid[0:16] + '2', '2', 0x2)]
run_scans(dev[0], check)
def test_scan_mbssid_hidden_ssid(dev, apdev):
@ -1812,8 +1812,8 @@ def test_scan_mbssid_hidden_ssid(dev, apdev):
hapd = None
# construct 2 MBSSID IEs, each MBSSID IE contains 1 profile
params = { "ssid": "transmitted",
"bssid": bssid }
params = {"ssid": "transmitted",
"bssid": bssid}
elems = elem_capab(1) + elem_ssid("") + elem_bssid_index(1)
profile1 = struct.pack('BB', 0, len(elems)) + elems
@ -1825,9 +1825,9 @@ def test_scan_mbssid_hidden_ssid(dev, apdev):
params['vendor_elements'] = elem_multibssid(profiles, 2)
hapd = hostapd.add_ap(apdev[0], params)
check = [ (bssid, 'transmitted', 0x401),
check = [(bssid, 'transmitted', 0x401),
(bssid[0:16] + '1', '', 0x1),
(bssid[0:16] + '2', '2', 0x2) ]
(bssid[0:16] + '2', '2', 0x2)]
run_scans(dev[0], check)
def test_connect_mbssid_open_1(dev, apdev):
@ -1836,7 +1836,7 @@ def test_connect_mbssid_open_1(dev, apdev):
dev[0].flush_scan_cache()
bssid = apdev[0]['bssid']
params = { "ssid": "transmitted" }
params = {"ssid": "transmitted"}
elems = elem_capab(1) + elem_ssid("nontransmitted") + elem_bssid_index(1)
profile1 = struct.pack('BB', 0, len(elems)) + elems

View File

@ -73,21 +73,21 @@ def sigma_dut_cmd_check(cmd, port=9000, timeout=2):
def start_sigma_dut(ifname, debug=False, hostapd_logdir=None, cert_path=None,
bridge=None):
check_sigma_dut()
cmd = [ './sigma_dut',
cmd = ['./sigma_dut',
'-M', ifname,
'-S', ifname,
'-F', '../../hostapd/hostapd',
'-G',
'-w', '/var/run/wpa_supplicant/',
'-j', ifname ]
'-j', ifname]
if debug:
cmd += [ '-d' ]
cmd += ['-d']
if hostapd_logdir:
cmd += [ '-H', hostapd_logdir ]
cmd += ['-H', hostapd_logdir]
if cert_path:
cmd += [ '-C', cert_path ]
cmd += ['-C', cert_path]
if bridge:
cmd += [ '-b', bridge ]
cmd += ['-b', bridge]
sigma = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
for i in range(20):
@ -122,11 +122,11 @@ def test_sigma_dut_basic(dev, apdev):
if "status,INVALID,errorCode,Unknown command" not in res:
raise Exception("Unexpected sigma_dut response to unknown command")
tests = [ ("ca_get_version", "status,COMPLETE,version,1.0"),
tests = [("ca_get_version", "status,COMPLETE,version,1.0"),
("device_get_info", "status,COMPLETE,vendor"),
("device_list_interfaces,interfaceType,foo", "status,ERROR"),
("device_list_interfaces,interfaceType,802.11",
"status,COMPLETE,interfaceType,802.11,interfaceID," + dev[0].ifname) ]
"status,COMPLETE,interfaceType,802.11,interfaceID," + dev[0].ifname)]
for cmd, response in tests:
res = sigma_dut_cmd(cmd)
if response not in res:
@ -145,7 +145,7 @@ def run_sigma_dut_open(dev, apdev):
ifname = dev[0].ifname
sigma = start_sigma_dut(ifname)
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_set_encryption,interface,%s,ssid,%s,encpType,none" % (ifname, "open"))
@ -339,8 +339,8 @@ def run_sigma_dut_sta_override_rsne(dev, apdev):
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
tests = [ "30120100000fac040100000fac040100000fac02",
"30140100000fac040100000fac040100000fac02ffff" ]
tests = ["30120100000fac040100000fac040100000fac02",
"30140100000fac040100000fac040100000fac02ffff"]
for test in tests:
sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,type,PSK,passphrase,%s,EncpType,aes-ccmp,KeyMgmtType,wpa2" % (ifname, "test-psk", "12345678"))
sigma_dut_cmd_check("dev_configure_ie,interface,%s,IE_Name,RSNE,Contents,%s" % (ifname, test))
@ -440,7 +440,7 @@ def test_sigma_dut_suite_b(dev, apdev, params):
params['openssl_ciphers'] = 'SUITEB192'
hostapd.add_ap(apdev[1], params)
params = { "ssid": "test-suite-b",
params = {"ssid": "test-suite-b",
"wpa": "2",
"wpa_key_mgmt": "WPA-EAP-SUITE-B-192",
"rsn_pairwise": "GCMP-256",
@ -450,7 +450,7 @@ def test_sigma_dut_suite_b(dev, apdev, params):
'auth_server_addr': "127.0.0.1",
'auth_server_port': "18129",
'auth_server_shared_secret': "radius",
'nas_identifier': "nas.w1.fi" }
'nas_identifier': "nas.w1.fi"}
hapd = hostapd.add_ap(apdev[0], params)
ifname = dev[0].ifname
@ -491,9 +491,9 @@ def test_sigma_dut_suite_b_rsa(dev, apdev, params):
cmd = "sta_set_security,type,eaptls,interface,%s,ssid,%s,PairwiseCipher,AES-GCMP-256,GroupCipher,AES-GCMP-256,GroupMgntCipher,BIP-GMAC-256,keymgmttype,SuiteB,clientCertificate,suite_b_rsa.pem,trustedRootCA,suite_b_ca_rsa.pem,CertType,RSA" % (ifname, "test-suite-b")
tests = [ "",
tests = ["",
",TLSCipher,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
",TLSCipher,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" ]
",TLSCipher,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384"]
for extra in tests:
sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,PMF" % ifname)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
@ -749,11 +749,11 @@ def run_sigma_dut_owe(dev, apdev):
sigma = start_sigma_dut(ifname)
try:
params = { "ssid": "owe",
params = {"ssid": "owe",
"wpa": "2",
"wpa_key_mgmt": "OWE",
"ieee80211w": "2",
"rsn_pairwise": "CCMP" }
"rsn_pairwise": "CCMP"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -999,14 +999,14 @@ def test_sigma_dut_dpp_qr_init_enrollee(dev, apdev):
ap_connector = "eyJ0eXAiOiJkcHBDb24iLCJraWQiOiJwYWtZbXVzd1dCdWpSYTl5OEsweDViaTVrT3VNT3dzZHRlaml2UG55ZHZzIiwiYWxnIjoiRVMyNTYifQ.eyJncm91cHMiOlt7Imdyb3VwSWQiOiIqIiwibmV0Um9sZSI6ImFwIn1dLCJuZXRBY2Nlc3NLZXkiOnsia3R5IjoiRUMiLCJjcnYiOiJQLTI1NiIsIngiOiIybU5vNXZuRkI5bEw3d1VWb1hJbGVPYzBNSEE1QXZKbnpwZXZULVVTYzVNIiwieSI6IlhzS3dqVHJlLTg5WWdpU3pKaG9CN1haeUttTU05OTl3V2ZaSVl0bi01Q3MifX0.XhjFpZgcSa7G2lHy0OCYTvaZFRo5Hyx6b7g7oYyusLC7C_73AJ4_BxEZQVYJXAtDuGvb3dXSkHEKxREP9Q6Qeg"
ap_netaccesskey = "30770201010420ceba752db2ad5200fa7bc565b9c05c69b7eb006751b0b329b0279de1c19ca67ca00a06082a8648ce3d030107a14403420004da6368e6f9c507d94bef0515a1722578e73430703902f267ce97af4fe51273935ec2b08d3adefbcf588224b3261a01ed76722a630cf7df7059f64862d9fee42b"
params = { "ssid": "DPPNET01",
params = {"ssid": "DPPNET01",
"wpa": "2",
"ieee80211w": "2",
"wpa_key_mgmt": "DPP",
"rsn_pairwise": "CCMP",
"dpp_connector": ap_connector,
"dpp_csign": csign_pub,
"dpp_netaccesskey": ap_netaccesskey }
"dpp_netaccesskey": ap_netaccesskey}
try:
hapd = hostapd.add_ap(apdev[0], params)
except:
@ -1060,14 +1060,14 @@ def run_sigma_dut_dpp_qr_mutual_init_enrollee_check(dev, apdev, extra=''):
ap_connector = "eyJ0eXAiOiJkcHBDb24iLCJraWQiOiJwYWtZbXVzd1dCdWpSYTl5OEsweDViaTVrT3VNT3dzZHRlaml2UG55ZHZzIiwiYWxnIjoiRVMyNTYifQ.eyJncm91cHMiOlt7Imdyb3VwSWQiOiIqIiwibmV0Um9sZSI6ImFwIn1dLCJuZXRBY2Nlc3NLZXkiOnsia3R5IjoiRUMiLCJjcnYiOiJQLTI1NiIsIngiOiIybU5vNXZuRkI5bEw3d1VWb1hJbGVPYzBNSEE1QXZKbnpwZXZULVVTYzVNIiwieSI6IlhzS3dqVHJlLTg5WWdpU3pKaG9CN1haeUttTU05OTl3V2ZaSVl0bi01Q3MifX0.XhjFpZgcSa7G2lHy0OCYTvaZFRo5Hyx6b7g7oYyusLC7C_73AJ4_BxEZQVYJXAtDuGvb3dXSkHEKxREP9Q6Qeg"
ap_netaccesskey = "30770201010420ceba752db2ad5200fa7bc565b9c05c69b7eb006751b0b329b0279de1c19ca67ca00a06082a8648ce3d030107a14403420004da6368e6f9c507d94bef0515a1722578e73430703902f267ce97af4fe51273935ec2b08d3adefbcf588224b3261a01ed76722a630cf7df7059f64862d9fee42b"
params = { "ssid": "DPPNET01",
params = {"ssid": "DPPNET01",
"wpa": "2",
"ieee80211w": "2",
"wpa_key_mgmt": "DPP",
"rsn_pairwise": "CCMP",
"dpp_connector": ap_connector,
"dpp_csign": csign_pub,
"dpp_netaccesskey": ap_netaccesskey }
"dpp_netaccesskey": ap_netaccesskey}
try:
hapd = hostapd.add_ap(apdev[0], params)
except:
@ -1142,14 +1142,14 @@ def run_sigma_dut_dpp_qr_mutual_resp_enrollee(dev, apdev, extra=None):
ap_connector = "eyJ0eXAiOiJkcHBDb24iLCJraWQiOiJwYWtZbXVzd1dCdWpSYTl5OEsweDViaTVrT3VNT3dzZHRlaml2UG55ZHZzIiwiYWxnIjoiRVMyNTYifQ.eyJncm91cHMiOlt7Imdyb3VwSWQiOiIqIiwibmV0Um9sZSI6ImFwIn1dLCJuZXRBY2Nlc3NLZXkiOnsia3R5IjoiRUMiLCJjcnYiOiJQLTI1NiIsIngiOiIybU5vNXZuRkI5bEw3d1VWb1hJbGVPYzBNSEE1QXZKbnpwZXZULVVTYzVNIiwieSI6IlhzS3dqVHJlLTg5WWdpU3pKaG9CN1haeUttTU05OTl3V2ZaSVl0bi01Q3MifX0.XhjFpZgcSa7G2lHy0OCYTvaZFRo5Hyx6b7g7oYyusLC7C_73AJ4_BxEZQVYJXAtDuGvb3dXSkHEKxREP9Q6Qeg"
ap_netaccesskey = "30770201010420ceba752db2ad5200fa7bc565b9c05c69b7eb006751b0b329b0279de1c19ca67ca00a06082a8648ce3d030107a14403420004da6368e6f9c507d94bef0515a1722578e73430703902f267ce97af4fe51273935ec2b08d3adefbcf588224b3261a01ed76722a630cf7df7059f64862d9fee42b"
params = { "ssid": "DPPNET01",
params = {"ssid": "DPPNET01",
"wpa": "2",
"ieee80211w": "2",
"wpa_key_mgmt": "DPP",
"rsn_pairwise": "CCMP",
"dpp_connector": ap_connector,
"dpp_csign": csign_pub,
"dpp_netaccesskey": ap_netaccesskey }
"dpp_netaccesskey": ap_netaccesskey}
try:
hapd = hostapd.add_ap(apdev[0], params)
except:
@ -1231,14 +1231,14 @@ def run_sigma_dut_dpp_qr_mutual_init_enrollee(dev, apdev, resp_pending):
ap_connector = "eyJ0eXAiOiJkcHBDb24iLCJraWQiOiJwYWtZbXVzd1dCdWpSYTl5OEsweDViaTVrT3VNT3dzZHRlaml2UG55ZHZzIiwiYWxnIjoiRVMyNTYifQ.eyJncm91cHMiOlt7Imdyb3VwSWQiOiIqIiwibmV0Um9sZSI6ImFwIn1dLCJuZXRBY2Nlc3NLZXkiOnsia3R5IjoiRUMiLCJjcnYiOiJQLTI1NiIsIngiOiIybU5vNXZuRkI5bEw3d1VWb1hJbGVPYzBNSEE1QXZKbnpwZXZULVVTYzVNIiwieSI6IlhzS3dqVHJlLTg5WWdpU3pKaG9CN1haeUttTU05OTl3V2ZaSVl0bi01Q3MifX0.XhjFpZgcSa7G2lHy0OCYTvaZFRo5Hyx6b7g7oYyusLC7C_73AJ4_BxEZQVYJXAtDuGvb3dXSkHEKxREP9Q6Qeg"
ap_netaccesskey = "30770201010420ceba752db2ad5200fa7bc565b9c05c69b7eb006751b0b329b0279de1c19ca67ca00a06082a8648ce3d030107a14403420004da6368e6f9c507d94bef0515a1722578e73430703902f267ce97af4fe51273935ec2b08d3adefbcf588224b3261a01ed76722a630cf7df7059f64862d9fee42b"
params = { "ssid": "DPPNET01",
params = {"ssid": "DPPNET01",
"wpa": "2",
"ieee80211w": "2",
"wpa_key_mgmt": "DPP",
"rsn_pairwise": "CCMP",
"dpp_connector": ap_connector,
"dpp_csign": csign_pub,
"dpp_netaccesskey": ap_netaccesskey }
"dpp_netaccesskey": ap_netaccesskey}
try:
hapd = hostapd.add_ap(apdev[0], params)
except:
@ -1691,7 +1691,7 @@ def test_sigma_dut_dpp_proto_initiator(dev, apdev):
"""sigma_dut DPP protocol testing - Initiator"""
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
tests = [ ("InvalidValue", "AuthenticationRequest", "WrappedData",
tests = [("InvalidValue", "AuthenticationRequest", "WrappedData",
"BootstrapResult,OK,AuthResult,Errorsent",
None),
("InvalidValue", "AuthenticationConfirm", "WrappedData",
@ -1705,7 +1705,7 @@ def test_sigma_dut_dpp_proto_initiator(dev, apdev):
"Mismatching Initiator Authenticating Tag"),
("MissingAttribute", "ConfigurationResponse", "EnrolleeNonce",
"BootstrapResult,OK,AuthResult,OK,ConfResult,Errorsent",
"Missing or invalid Enrollee Nonce attribute") ]
"Missing or invalid Enrollee Nonce attribute")]
for step, frame, attr, result, fail in tests:
dev[0].request("FLUSH")
dev[1].request("FLUSH")
@ -1745,12 +1745,12 @@ def test_sigma_dut_dpp_proto_responder(dev, apdev):
"""sigma_dut DPP protocol testing - Responder"""
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
tests = [ ("MissingAttribute", "AuthenticationResponse", "DPPStatus",
tests = [("MissingAttribute", "AuthenticationResponse", "DPPStatus",
"BootstrapResult,OK,AuthResult,Errorsent",
"Missing or invalid required DPP Status attribute"),
("MissingAttribute", "ConfigurationRequest", "EnrolleeNonce",
"BootstrapResult,OK,AuthResult,OK,ConfResult,Errorsent",
"Missing or invalid Enrollee Nonce attribute") ]
"Missing or invalid Enrollee Nonce attribute")]
for step, frame, attr, result, fail in tests:
dev[0].request("FLUSH")
dev[1].request("FLUSH")
@ -1790,7 +1790,7 @@ def test_sigma_dut_dpp_proto_stop_at_initiator(dev, apdev):
"""sigma_dut DPP protocol testing - Stop at RX on Initiator"""
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
tests = [ ("AuthenticationResponse",
tests = [("AuthenticationResponse",
"BootstrapResult,OK,AuthResult,Errorsent",
None),
("ConfigurationRequest",
@ -1833,9 +1833,9 @@ def test_sigma_dut_dpp_proto_stop_at_initiator_enrollee(dev, apdev):
"""sigma_dut DPP protocol testing - Stop at TX on Initiator/Enrollee"""
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
tests = [ ("AuthenticationConfirm",
tests = [("AuthenticationConfirm",
"BootstrapResult,OK,AuthResult,Errorsent,LastFrameReceived,AuthenticationResponse",
None) ]
None)]
for frame, result, fail in tests:
dev[0].request("FLUSH")
dev[1].request("FLUSH")
@ -1875,12 +1875,12 @@ def test_sigma_dut_dpp_proto_stop_at_responder(dev, apdev):
"""sigma_dut DPP protocol testing - Stop at RX on Responder"""
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
tests = [ ("AuthenticationRequest",
tests = [("AuthenticationRequest",
"BootstrapResult,OK,AuthResult,Errorsent",
None),
("AuthenticationConfirm",
"BootstrapResult,OK,AuthResult,Errorsent",
None) ]
None)]
for frame, result, fail in tests:
dev[0].request("FLUSH")
dev[1].request("FLUSH")
@ -1934,7 +1934,7 @@ def test_sigma_dut_dpp_proto_initiator_pkex(dev, apdev):
"""sigma_dut DPP protocol testing - Initiator (PKEX)"""
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
tests = [ ("InvalidValue", "PKEXCRRequest", "WrappedData",
tests = [("InvalidValue", "PKEXCRRequest", "WrappedData",
"BootstrapResult,Errorsent",
None),
("MissingAttribute", "PKEXExchangeRequest", "FiniteCyclicGroup",
@ -1942,7 +1942,7 @@ def test_sigma_dut_dpp_proto_initiator_pkex(dev, apdev):
"Missing or invalid Finite Cyclic Group attribute"),
("MissingAttribute", "PKEXCRRequest", "BSKey",
"BootstrapResult,Errorsent",
"No valid peer bootstrapping key found") ]
"No valid peer bootstrapping key found")]
for step, frame, attr, result, fail in tests:
dev[0].request("FLUSH")
dev[1].request("FLUSH")
@ -1981,7 +1981,7 @@ def test_sigma_dut_dpp_proto_responder_pkex(dev, apdev):
"""sigma_dut DPP protocol testing - Responder (PKEX)"""
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
tests = [ ("InvalidValue", "PKEXCRResponse", "WrappedData",
tests = [("InvalidValue", "PKEXCRResponse", "WrappedData",
"BootstrapResult,Errorsent",
None),
("MissingAttribute", "PKEXExchangeResponse", "DPPStatus",
@ -1989,7 +1989,7 @@ def test_sigma_dut_dpp_proto_responder_pkex(dev, apdev):
"No DPP Status attribute"),
("MissingAttribute", "PKEXCRResponse", "BSKey",
"BootstrapResult,Errorsent",
"No valid peer bootstrapping key found") ]
"No valid peer bootstrapping key found")]
for step, frame, attr, result, fail in tests:
dev[0].request("FLUSH")
dev[1].request("FLUSH")
@ -2025,14 +2025,14 @@ def init_sigma_dut_dpp_proto_peer_disc_req(dev, apdev):
ap_connector = "eyJ0eXAiOiJkcHBDb24iLCJraWQiOiJwYWtZbXVzd1dCdWpSYTl5OEsweDViaTVrT3VNT3dzZHRlaml2UG55ZHZzIiwiYWxnIjoiRVMyNTYifQ.eyJncm91cHMiOlt7Imdyb3VwSWQiOiIqIiwibmV0Um9sZSI6ImFwIn1dLCJuZXRBY2Nlc3NLZXkiOnsia3R5IjoiRUMiLCJjcnYiOiJQLTI1NiIsIngiOiIybU5vNXZuRkI5bEw3d1VWb1hJbGVPYzBNSEE1QXZKbnpwZXZULVVTYzVNIiwieSI6IlhzS3dqVHJlLTg5WWdpU3pKaG9CN1haeUttTU05OTl3V2ZaSVl0bi01Q3MifX0.XhjFpZgcSa7G2lHy0OCYTvaZFRo5Hyx6b7g7oYyusLC7C_73AJ4_BxEZQVYJXAtDuGvb3dXSkHEKxREP9Q6Qeg"
ap_netaccesskey = "30770201010420ceba752db2ad5200fa7bc565b9c05c69b7eb006751b0b329b0279de1c19ca67ca00a06082a8648ce3d030107a14403420004da6368e6f9c507d94bef0515a1722578e73430703902f267ce97af4fe51273935ec2b08d3adefbcf588224b3261a01ed76722a630cf7df7059f64862d9fee42b"
params = { "ssid": "DPPNET01",
params = {"ssid": "DPPNET01",
"wpa": "2",
"ieee80211w": "2",
"wpa_key_mgmt": "DPP",
"rsn_pairwise": "CCMP",
"dpp_connector": ap_connector,
"dpp_csign": csign_pub,
"dpp_netaccesskey": ap_netaccesskey }
"dpp_netaccesskey": ap_netaccesskey}
try:
hapd = hostapd.add_ap(apdev[0], params)
except:
@ -2077,7 +2077,7 @@ def test_sigma_dut_dpp_self_config(dev, apdev):
"""sigma_dut DPP Configurator enrolling an AP and using self-configuration"""
check_dpp_capab(dev[0])
hapd = hostapd.add_ap(apdev[0], { "ssid": "unconfigured" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured"})
check_dpp_capab(hapd)
sigma = start_sigma_dut(dev[0].ifname)
@ -2179,9 +2179,9 @@ def test_sigma_dut_wps_pbc(dev, apdev):
def run_sigma_dut_wps_pbc(dev, apdev):
ssid = "test-wps-conf"
hapd = hostapd.add_ap(apdev[0],
{ "ssid": "wps", "eap_server": "1", "wps_state": "2",
{"ssid": "wps", "eap_server": "1", "wps_state": "2",
"wpa_passphrase": "12345678", "wpa": "2",
"wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP" })
"wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
hapd.request("WPS_PBC")
ifname = dev[0].ifname
@ -2200,7 +2200,7 @@ def run_sigma_dut_wps_pbc(dev, apdev):
def test_sigma_dut_sta_scan_bss(dev, apdev):
"""sigma_dut sta_scan_bss"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "test" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test"})
sigma = start_sigma_dut(dev[0].ifname)
try:
cmd = "sta_scan_bss,Interface,%s,BSSID,%s" % (dev[0].ifname, \
@ -2412,8 +2412,8 @@ def run_sigma_dut_venue_url(dev, apdev):
url2 = "https://example.org/venue-info/"
params["venue_group"] = str(venue_group)
params["venue_type"] = str(venue_type)
params["venue_name"] = [ lang1 + ":" + name1, lang2 + ":" + name2 ]
params["venue_url"] = [ "1:" + url1, "2:" + url2 ]
params["venue_name"] = [lang1 + ":" + name1, lang2 + ":" + name2]
params["venue_url"] = ["1:" + url1, "2:" + url2]
hapd = hostapd.add_ap(apdev[0], params)

View File

@ -14,13 +14,13 @@ import hostapd
@remote_compatible
def test_ssid_hex_encoded(dev, apdev):
"""SSID configuration using hex encoded version"""
hostapd.add_ap(apdev[0], { "ssid2": '68656c6c6f' })
hostapd.add_ap(apdev[0], {"ssid2": '68656c6c6f'})
dev[0].connect("hello", key_mgmt="NONE", scan_freq="2412")
dev[1].connect(ssid2="68656c6c6f", key_mgmt="NONE", scan_freq="2412")
def test_ssid_printf_encoded(dev, apdev):
"""SSID configuration using printf encoded version"""
hostapd.add_ap(apdev[0], { "ssid2": 'P"\\0hello\\nthere"' })
hostapd.add_ap(apdev[0], {"ssid2": 'P"\\0hello\\nthere"'})
dev[0].connect(ssid2="0068656c6c6f0a7468657265", key_mgmt="NONE",
scan_freq="2412")
dev[1].connect(ssid2='P"\\x00hello\\nthere"', key_mgmt="NONE",
@ -34,14 +34,14 @@ def test_ssid_printf_encoded(dev, apdev):
@remote_compatible
def test_ssid_1_octet(dev, apdev):
"""SSID with one octet"""
hostapd.add_ap(apdev[0], { "ssid": '1' })
hostapd.add_ap(apdev[0], {"ssid": '1'})
dev[0].connect("1", key_mgmt="NONE", scan_freq="2412")
@remote_compatible
def test_ssid_32_octets(dev, apdev):
"""SSID with 32 octets"""
hostapd.add_ap(apdev[0],
{ "ssid": '1234567890abcdef1234567890ABCDEF' })
{"ssid": '1234567890abcdef1234567890ABCDEF'})
dev[0].connect("1234567890abcdef1234567890ABCDEF", key_mgmt="NONE",
scan_freq="2412")
@ -49,19 +49,19 @@ def test_ssid_32_octets_nul_term(dev, apdev):
"""SSID with 32 octets with nul at the end"""
ssid = 'P"1234567890abcdef1234567890ABCDE\\x00"'
hostapd.add_ap(apdev[0],
{ "ssid2": ssid })
{"ssid2": ssid})
dev[0].connect(ssid2=ssid, key_mgmt="NONE", scan_freq="2412")
@remote_compatible
def test_ssid_utf8(dev, apdev):
"""SSID with UTF8 encoding"""
hapd = hostapd.add_ap(apdev[0], { "ssid": 'testi-åäöÅÄÖ-testi',
"utf8_ssid": "1" })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'testi-åäöÅÄÖ-testi',
"utf8_ssid": "1"})
dev[0].connect("testi-åäöÅÄÖ-testi", key_mgmt="NONE", scan_freq="2412")
dev[1].connect(ssid2="74657374692dc3a5c3a4c3b6c385c384c3962d7465737469",
key_mgmt="NONE", scan_freq="2412")
# verify ctrl_iface for coverage
addrs = [ dev[0].p2p_interface_addr(), dev[1].p2p_interface_addr() ]
addrs = [dev[0].p2p_interface_addr(), dev[1].p2p_interface_addr()]
sta = hapd.get_sta(None)
if sta['addr'] not in addrs:
raise Exception("Unexpected STA address")
@ -89,8 +89,8 @@ def clear_scan_cache(hapd, dev):
@remote_compatible
def test_ssid_hidden(dev, apdev):
"""Hidden SSID"""
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[1].connect("secret", key_mgmt="NONE", scan_freq="2412",
wait_connect=False)
dev[0].connect("secret", key_mgmt="NONE", scan_freq="2412", scan_ssid="1")
@ -102,8 +102,8 @@ def test_ssid_hidden(dev, apdev):
@remote_compatible
def test_ssid_hidden2(dev, apdev):
"""Hidden SSID using zero octets as payload"""
hapd = hostapd.add_ap(apdev[0], { "ssid": 'secret2',
"ignore_broadcast_ssid": "2" })
hapd = hostapd.add_ap(apdev[0], {"ssid": 'secret2',
"ignore_broadcast_ssid": "2"})
dev[1].connect("secret2", key_mgmt="NONE", scan_freq="2412",
wait_connect=False)
dev[0].connect("secret2", key_mgmt="NONE", scan_freq="2412", scan_ssid="1")

View File

@ -26,7 +26,7 @@ def test_sta_dynamic(dev, apdev):
def test_sta_ap_scan_0(dev, apdev):
"""Dynamically added wpa_supplicant interface with AP_SCAN 0 connection"""
hostapd.add_ap(apdev[0], { "ssid": "test" })
hostapd.add_ap(apdev[0], {"ssid": "test"})
bssid = apdev[0]['bssid']
logger.info("Create a dynamic wpa_supplicant interface and connect")
@ -48,7 +48,7 @@ def test_sta_ap_scan_0(dev, apdev):
def test_sta_ap_scan_2(dev, apdev):
"""Dynamically added wpa_supplicant interface with AP_SCAN 2 connection"""
hostapd.add_ap(apdev[0], { "ssid": "test" })
hostapd.add_ap(apdev[0], {"ssid": "test"})
bssid = apdev[0]['bssid']
logger.info("Create a dynamic wpa_supplicant interface and connect")
@ -80,7 +80,7 @@ def test_sta_ap_scan_2(dev, apdev):
def test_sta_ap_scan_2b(dev, apdev):
"""Dynamically added wpa_supplicant interface with AP_SCAN 2 operation"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "test" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test"})
bssid = apdev[0]['bssid']
logger.info("Create a dynamic wpa_supplicant interface and connect")

View File

@ -27,7 +27,7 @@ def check_suite_b_tls_lib(dev, dhe=False, level128=False):
if not tls.startswith("OpenSSL"):
raise HwsimSkip("TLS library not supported for Suite B: " + tls)
supported = False
for ver in [ '1.0.2', '1.1.0', '1.1.1' ]:
for ver in ['1.0.2', '1.1.0', '1.1.1']:
if "build=OpenSSL " + ver in tls and "run=OpenSSL " + ver in tls:
supported = True
break
@ -38,7 +38,7 @@ def check_suite_b_tls_lib(dev, dhe=False, level128=False):
raise HwsimSkip("OpenSSL version not supported for Suite B: " + tls)
def suite_b_ap_params():
params = { "ssid": "test-suite-b",
params = {"ssid": "test-suite-b",
"wpa": "2",
"wpa_key_mgmt": "WPA-EAP-SUITE-B",
"rsn_pairwise": "GCMP",
@ -51,7 +51,7 @@ def suite_b_ap_params():
"eap_user_file": "auth_serv/eap_user.conf",
"ca_cert": "auth_serv/ec-ca.pem",
"server_cert": "auth_serv/ec-server.pem",
"private_key": "auth_serv/ec-server.key" }
"private_key": "auth_serv/ec-server.key"}
return params
def test_suite_b(dev, apdev):
@ -126,7 +126,7 @@ def test_suite_b_radius(dev, apdev):
params = suite_b_as_params()
hostapd.add_ap(apdev[1], params)
params = { "ssid": "test-suite-b",
params = {"ssid": "test-suite-b",
"wpa": "2",
"wpa_key_mgmt": "WPA-EAP-SUITE-B",
"rsn_pairwise": "GCMP",
@ -136,7 +136,7 @@ def test_suite_b_radius(dev, apdev):
'auth_server_addr': "127.0.0.1",
'auth_server_port': "18129",
'auth_server_shared_secret': "radius",
'nas_identifier': "nas.w1.fi" }
'nas_identifier': "nas.w1.fi"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-suite-b", key_mgmt="WPA-EAP-SUITE-B", ieee80211w="2",
@ -157,7 +157,7 @@ def check_suite_b_192_capa(dev, dhe=False):
check_suite_b_tls_lib(dev, dhe=dhe)
def suite_b_192_ap_params():
params = { "ssid": "test-suite-b",
params = {"ssid": "test-suite-b",
"wpa": "2",
"wpa_key_mgmt": "WPA-EAP-SUITE-B-192",
"rsn_pairwise": "GCMP-256",
@ -169,7 +169,7 @@ def suite_b_192_ap_params():
"eap_user_file": "auth_serv/eap_user.conf",
"ca_cert": "auth_serv/ec2-ca.pem",
"server_cert": "auth_serv/ec2-server.pem",
"private_key": "auth_serv/ec2-server.key" }
"private_key": "auth_serv/ec2-server.key"}
return params
def test_suite_b_192(dev, apdev):
@ -238,7 +238,7 @@ def test_suite_b_192_radius(dev, apdev):
params['openssl_ciphers'] = 'SUITEB192'
hostapd.add_ap(apdev[1], params)
params = { "ssid": "test-suite-b",
params = {"ssid": "test-suite-b",
"wpa": "2",
"wpa_key_mgmt": "WPA-EAP-SUITE-B-192",
"rsn_pairwise": "GCMP-256",
@ -248,7 +248,7 @@ def test_suite_b_192_radius(dev, apdev):
'auth_server_addr': "127.0.0.1",
'auth_server_port': "18129",
'auth_server_shared_secret': "radius",
'nas_identifier': "nas.w1.fi" }
'nas_identifier': "nas.w1.fi"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-suite-b", key_mgmt="WPA-EAP-SUITE-B-192",
@ -271,7 +271,7 @@ def test_suite_b_192_radius_and_p256_cert(dev, apdev):
params['openssl_ciphers'] = 'SUITEB192'
hostapd.add_ap(apdev[1], params)
params = { "ssid": "test-suite-b",
params = {"ssid": "test-suite-b",
"wpa": "2",
"wpa_key_mgmt": "WPA-EAP-SUITE-B-192",
"rsn_pairwise": "GCMP-256",
@ -281,7 +281,7 @@ def test_suite_b_192_radius_and_p256_cert(dev, apdev):
'auth_server_addr': "127.0.0.1",
'auth_server_port': "18129",
'auth_server_shared_secret': "radius",
'nas_identifier': "nas.w1.fi" }
'nas_identifier': "nas.w1.fi"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-suite-b", key_mgmt="WPA-EAP-SUITE-B-192",
@ -375,7 +375,7 @@ def test_suite_b_192_mic_failure(dev, apdev):
dev[0].wait_disconnected()
def suite_b_192_rsa_ap_params():
params = { "ssid": "test-suite-b",
params = {"ssid": "test-suite-b",
"wpa": "2",
"wpa_key_mgmt": "WPA-EAP-SUITE-B-192",
"rsn_pairwise": "GCMP-256",
@ -388,7 +388,7 @@ def suite_b_192_rsa_ap_params():
"eap_user_file": "auth_serv/eap_user.conf",
"ca_cert": "auth_serv/rsa3072-ca.pem",
"server_cert": "auth_serv/rsa3072-server.pem",
"private_key": "auth_serv/rsa3072-server.key" }
"private_key": "auth_serv/rsa3072-server.key"}
return params
def test_suite_b_192_rsa(dev, apdev):
@ -523,7 +523,7 @@ def test_suite_b_192_rsa_radius(dev, apdev):
hostapd.add_ap(apdev[1], params)
params = { "ssid": "test-suite-b",
params = {"ssid": "test-suite-b",
"wpa": "2",
"wpa_key_mgmt": "WPA-EAP-SUITE-B-192",
"rsn_pairwise": "GCMP-256",
@ -533,7 +533,7 @@ def test_suite_b_192_rsa_radius(dev, apdev):
'auth_server_addr': "127.0.0.1",
'auth_server_port': "18129",
'auth_server_shared_secret': "radius",
'nas_identifier': "nas.w1.fi" }
'nas_identifier': "nas.w1.fi"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-suite-b", key_mgmt="WPA-EAP-SUITE-B-192",
@ -577,7 +577,7 @@ def run_suite_b_192_rsa_radius_rsa2048_client(dev, apdev, ecdhe):
hostapd.add_ap(apdev[1], params)
params = { "ssid": "test-suite-b",
params = {"ssid": "test-suite-b",
"wpa": "2",
"wpa_key_mgmt": "WPA-EAP-SUITE-B-192",
"rsn_pairwise": "GCMP-256",
@ -587,7 +587,7 @@ def run_suite_b_192_rsa_radius_rsa2048_client(dev, apdev, ecdhe):
'auth_server_addr': "127.0.0.1",
'auth_server_port': "18129",
'auth_server_shared_secret': "radius",
'nas_identifier': "nas.w1.fi" }
'nas_identifier': "nas.w1.fi"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-suite-b", key_mgmt="WPA-EAP-SUITE-B-192",

View File

@ -47,8 +47,8 @@ def test_tnc_peap_soh_errors(dev, apdev):
params["tnc"] = "1"
hostapd.add_ap(apdev[0], params)
tests = [ (1, "tncc_build_soh"),
(1, "eap_msg_alloc;=eap_peap_phase2_request") ]
tests = [(1, "tncc_build_soh"),
(1, "eap_msg_alloc;=eap_peap_phase2_request")]
for count, func in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
@ -121,7 +121,7 @@ def test_tnc_ttls_errors(dev, apdev):
params["fragment_size"] = "150"
hostapd.add_ap(apdev[0], params)
tests = [ (1, "eap_ttls_process_phase2_eap;eap_ttls_process_tnc_start",
tests = [(1, "eap_ttls_process_phase2_eap;eap_ttls_process_tnc_start",
"DOMAIN\mschapv2 user", "auth=MSCHAPV2"),
(1, "eap_ttls_process_phase2_eap;eap_ttls_process_tnc_start",
"mschap user", "auth=MSCHAP"),
@ -150,7 +150,7 @@ def test_tnc_ttls_errors(dev, apdev):
"pap user", "auth=PAP"),
(1, "=TNC_TNCC_SendMessage", "pap user", "auth=PAP"),
(1, "tncc_get_base64;tncc_process_if_tnccs",
"pap user", "auth=PAP") ]
"pap user", "auth=PAP")]
for count, func, identity, phase2 in tests:
with alloc_fail(dev[0], count, func):
dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP",
@ -174,7 +174,7 @@ def test_tnc_fast(dev, apdev):
check_eap_capa(dev[0], "FAST")
params = int_eap_server_params()
params["tnc"] = "1"
params["pac_opaque_encr_key"] ="000102030405060708090a0b0c0d0e00"
params["pac_opaque_encr_key"] = "000102030405060708090a0b0c0d0e00"
params["eap_fast_a_id"] = "101112131415161718191a1b1c1d1e00"
params["eap_fast_a_id_info"] = "test server2"

View File

@ -16,8 +16,8 @@ import hwsim_utils
def test_wep_open_auth(dev, apdev):
"""WEP Open System authentication"""
hapd = hostapd.add_ap(apdev[0],
{ "ssid": "wep-open",
"wep_key0": '"hello"' })
{"ssid": "wep-open",
"wep_key0": '"hello"'})
dev[0].flush_scan_cache()
dev[0].connect("wep-open", key_mgmt="NONE", wep_key0='"hello"',
scan_freq="2412")
@ -35,9 +35,9 @@ def test_wep_open_auth(dev, apdev):
def test_wep_shared_key_auth(dev, apdev):
"""WEP Shared Key authentication"""
hapd = hostapd.add_ap(apdev[0],
{ "ssid": "wep-shared-key",
{"ssid": "wep-shared-key",
"wep_key0": '"hello12345678"',
"auth_algs": "2" })
"auth_algs": "2"})
dev[0].connect("wep-shared-key", key_mgmt="NONE", auth_alg="SHARED",
wep_key0='"hello12345678"',
scan_freq="2412")
@ -50,9 +50,9 @@ def test_wep_shared_key_auth(dev, apdev):
def test_wep_shared_key_auth_not_allowed(dev, apdev):
"""WEP Shared Key authentication not allowed"""
hostapd.add_ap(apdev[0],
{ "ssid": "wep-shared-key",
{"ssid": "wep-shared-key",
"wep_key0": '"hello12345678"',
"auth_algs": "1" })
"auth_algs": "1"})
dev[0].connect("wep-shared-key", key_mgmt="NONE", auth_alg="SHARED",
wep_key0='"hello12345678"',
scan_freq="2412", wait_connect=False)
@ -63,10 +63,10 @@ def test_wep_shared_key_auth_not_allowed(dev, apdev):
def test_wep_shared_key_auth_multi_key(dev, apdev):
"""WEP Shared Key authentication with multiple keys"""
hapd = hostapd.add_ap(apdev[0],
{ "ssid": "wep-shared-key",
{"ssid": "wep-shared-key",
"wep_key0": '"hello12345678"',
"wep_key1": '"other12345678"',
"auth_algs": "2" })
"auth_algs": "2"})
dev[0].connect("wep-shared-key", key_mgmt="NONE", auth_alg="SHARED",
wep_key0='"hello12345678"',
scan_freq="2412")
@ -94,7 +94,7 @@ def test_wep_ht_vht(dev, apdev):
dev[0].flush_scan_cache()
try:
hapd = None
params = { "ssid": "test-vht40-wep",
params = {"ssid": "test-vht40-wep",
"country_code": "SE",
"hw_mode": "a",
"channel": "36",
@ -104,7 +104,7 @@ def test_wep_ht_vht(dev, apdev):
"vht_capab": "",
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "0",
"wep_key0": '"hello"' }
"wep_key0": '"hello"'}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-vht40-wep", scan_freq="5180", key_mgmt="NONE",
wep_key0='"hello"')
@ -127,8 +127,8 @@ def test_wep_ht_vht(dev, apdev):
def test_wep_ifdown(dev, apdev):
"""AP with WEP and external ifconfig down"""
hapd = hostapd.add_ap(apdev[0],
{ "ssid": "wep-open",
"wep_key0": '"hello"' })
{"ssid": "wep-open",
"wep_key0": '"hello"'})
dev[0].flush_scan_cache()
id = dev[0].connect("wep-open", key_mgmt="NONE", wep_key0='"hello"',
scan_freq="2412")

View File

@ -30,7 +30,7 @@ def test_wext_open(dev, apdev):
"""WEXT driver interface with open network"""
wpas = get_wext_interface()
params = { "ssid": "wext-open" }
params = {"ssid": "wext-open"}
hapd = hostapd.add_ap(apdev[0], params)
wpas.connect("wext-open", key_mgmt="NONE")
@ -151,8 +151,8 @@ def test_wext_wep_open_auth(dev, apdev):
wpas = get_wext_interface()
hapd = hostapd.add_ap(apdev[0],
{ "ssid": "wep-open",
"wep_key0": '"hello"' })
{"ssid": "wep-open",
"wep_key0": '"hello"'})
wpas.connect("wep-open", key_mgmt="NONE", wep_key0='"hello"',
scan_freq="2412")
hwsim_utils.test_connectivity(wpas, hapd)
@ -164,9 +164,9 @@ def test_wext_wep_shared_key_auth(dev, apdev):
wpas = get_wext_interface()
hapd = hostapd.add_ap(apdev[0],
{ "ssid": "wep-shared-key",
{"ssid": "wep-shared-key",
"wep_key0": '"hello12345678"',
"auth_algs": "2" })
"auth_algs": "2"})
wpas.connect("wep-shared-key", key_mgmt="NONE", auth_alg="SHARED",
wep_key0='"hello12345678"', scan_freq="2412")
hwsim_utils.test_connectivity(wpas, hapd)
@ -197,10 +197,10 @@ def test_wext_scan_hidden(dev, apdev):
"""WEXT with hidden SSID"""
wpas = get_wext_interface()
hapd = hostapd.add_ap(apdev[0], { "ssid": "test-scan",
"ignore_broadcast_ssid": "1" })
hapd2 = hostapd.add_ap(apdev[1], { "ssid": "test-scan2",
"ignore_broadcast_ssid": "1" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "test-scan",
"ignore_broadcast_ssid": "1"})
hapd2 = hostapd.add_ap(apdev[1], {"ssid": "test-scan2",
"ignore_broadcast_ssid": "1"})
id1 = wpas.connect("test-scan", key_mgmt="NONE", scan_ssid="1",
only_add_network=True)
@ -234,7 +234,7 @@ def test_wext_rfkill(dev, apdev):
wpas = get_wext_interface()
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
wpas.connect("open", key_mgmt="NONE", scan_freq="2412")
try:
logger.info("rfkill block")

View File

@ -19,7 +19,7 @@ class LocalVariables:
CFG = """
ifaces :
{
ids = ["%s", "%s" ]
ids = ["%s", "%s"]
links = (
(0, 1, 30)
)
@ -47,7 +47,7 @@ model:
CFG3 = """
ifaces :
{
ids = ["%s", "%s", "%s", "%s", "%s" ]
ids = ["%s", "%s", "%s", "%s", "%s"]
}
model:
@ -284,8 +284,8 @@ def _test_wmediumd_path_ttl(dev, ok):
raise Exception("Unexpected mode: " + mode)
# set mesh path request ttl
subprocess.check_call([ "iw", "dev", dev[0].ifname, "set", "mesh_param",
"mesh_element_ttl=" + ("4" if ok else "3") ])
subprocess.check_call(["iw", "dev", dev[0].ifname, "set", "mesh_param",
"mesh_element_ttl=" + ("4" if ok else "3")])
# Check for peer connected
for i in range(0, 5):
@ -350,7 +350,7 @@ def test_wmediumd_path_rann(dev, apdev, params):
filt = "wlan.fc.type_subtype == 0x000d && " + \
"wlan_mgt.fixed.mesh_action == 0x01 && " + \
"wlan_mgt.tag.number == 126"
out = run_tshark(capfile, filt, [ "wlan.rann.root_sta" ])
out = run_tshark(capfile, filt, ["wlan.rann.root_sta"])
if out is None:
raise Exception("No captured data found\n")
if out.find(dev[2].own_addr()) == -1 or \
@ -363,7 +363,7 @@ def test_wmediumd_path_rann(dev, apdev, params):
"wlan.fc.type_subtype == 0x000d && " + \
"wlan_mgt.fixed.mesh_action == 0x01 && " + \
"wlan_mgt.tag.number == 126"
out = run_tshark(capfile, filt, [ "frame.time_relative" ])
out = run_tshark(capfile, filt, ["frame.time_relative"])
if out is None:
raise Exception("No captured data found\n")
lines = out.splitlines()
@ -380,7 +380,7 @@ def test_wmediumd_path_rann(dev, apdev, params):
"wlan.fc.type_subtype == 0x000d && " + \
"wlan_mgt.fixed.mesh_action == 0x01 && " + \
"wlan_mgt.tag.number == 130"
out = run_tshark(capfile, filt, [ "wlan.sa", "wlan.da" ])
out = run_tshark(capfile, filt, ["wlan.sa", "wlan.da"])
if out is None:
raise Exception("No captured data found\n")
if len(out) > 0:

View File

@ -40,11 +40,11 @@ def clear_regdom_state(dev, hapd, hapd2):
@remote_compatible
def test_wnm_bss_transition_mgmt(dev, apdev):
"""WNM BSS Transition Management"""
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"time_advertisement": "2",
"time_zone": "EST5",
"wnm_sleep_mode": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
@ -52,7 +52,7 @@ def test_wnm_bss_transition_mgmt(dev, apdev):
def test_wnm_bss_transition_mgmt_oom(dev, apdev):
"""WNM BSS Transition Management OOM"""
params = { "ssid": "test-wnm", "bss_transition": "1" }
params = {"ssid": "test-wnm", "bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
@ -63,11 +63,11 @@ def test_wnm_bss_transition_mgmt_oom(dev, apdev):
@remote_compatible
def test_wnm_disassoc_imminent(dev, apdev):
"""WNM Disassociation Imminent"""
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"time_advertisement": "2",
"time_zone": "EST5",
"wnm_sleep_mode": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
@ -84,7 +84,7 @@ def test_wnm_disassoc_imminent(dev, apdev):
def test_wnm_disassoc_imminent_fail(dev, apdev):
"""WNM Disassociation Imminent failure"""
params = { "ssid": "test-wnm", "bss_transition": "1" }
params = {"ssid": "test-wnm", "bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
@ -96,11 +96,11 @@ def test_wnm_disassoc_imminent_fail(dev, apdev):
@remote_compatible
def test_wnm_ess_disassoc_imminent(dev, apdev):
"""WNM ESS Disassociation Imminent"""
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"time_advertisement": "2",
"time_zone": "EST5",
"wnm_sleep_mode": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
@ -117,7 +117,7 @@ def test_wnm_ess_disassoc_imminent(dev, apdev):
def test_wnm_ess_disassoc_imminent_fail(dev, apdev):
"""WNM ESS Disassociation Imminent failure"""
params = { "ssid": "test-wnm", "bss_transition": "1" }
params = {"ssid": "test-wnm", "bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
@ -130,8 +130,8 @@ def test_wnm_ess_disassoc_imminent_fail(dev, apdev):
def test_wnm_ess_disassoc_imminent_reject(dev, apdev):
"""WNM ESS Disassociation Imminent getting rejected"""
params = { "ssid": "test-wnm",
"bss_transition": "1" }
params = {"ssid": "test-wnm",
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
@ -209,31 +209,31 @@ def check_wnm_sleep_mode_enter_exit(hapd, dev, interval=None, tfs_req=None):
@remote_compatible
def test_wnm_sleep_mode_open(dev, apdev):
"""WNM Sleep Mode - open"""
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"time_advertisement": "2",
"time_zone": "EST5",
"wnm_sleep_mode": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm", 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")
check_wnm_sleep_mode_enter_exit(hapd, dev[0])
check_wnm_sleep_mode_enter_exit(hapd, dev[0], interval=100)
check_wnm_sleep_mode_enter_exit(hapd, dev[0], tfs_req="5b17010001130e110000071122334455661122334455661234")
cmds = [ "foo",
cmds = ["foo",
"exit tfs_req=123 interval=10",
"enter tfs_req=qq interval=10" ]
"enter tfs_req=qq interval=10"]
for cmd in cmds:
if "FAIL" not in dev[0].request("WNM_SLEEP " + cmd):
raise Exception("Invalid WNM_SLEEP accepted")
def test_wnm_sleep_mode_open_fail(dev, apdev):
"""WNM Sleep Mode - open (fail)"""
params = { "ssid": "test-wnm", "wnm_sleep_mode": "1" }
params = {"ssid": "test-wnm", "wnm_sleep_mode": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
@ -252,7 +252,7 @@ def test_wnm_sleep_mode_rsn(dev, apdev):
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm-rsn", psk="12345678", 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")
check_wnm_sleep_mode_enter_exit(hapd, dev[0])
@ -260,12 +260,12 @@ def test_wnm_sleep_mode_rsn(dev, apdev):
@remote_compatible
def test_wnm_sleep_mode_ap_oom(dev, apdev):
"""WNM Sleep Mode - AP side OOM"""
params = { "ssid": "test-wnm",
"wnm_sleep_mode": "1" }
params = {"ssid": "test-wnm",
"wnm_sleep_mode": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm", 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")
with alloc_fail(hapd, 1, "ieee802_11_send_wnmsleep_resp"):
@ -294,7 +294,7 @@ def test_wnm_sleep_mode_rsn_pmf(dev, apdev):
dev[0].connect("test-wnm-rsn", psk="12345678", ieee80211w="2",
key_mgmt="WPA-PSK-SHA256", proto="WPA2", 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")
check_wnm_sleep_mode_enter_exit(hapd, dev[0])
@ -324,13 +324,13 @@ def test_wnm_sleep_mode_rsn_ocv(dev, apdev):
dev[0].connect("test-wnm-rsn", psk="12345678", ieee80211w="2", ocv="1",
key_mgmt="WPA-PSK-SHA256", proto="WPA2", 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")
check_wnm_sleep_mode_enter_exit(hapd, dev[0])
# Check if OCV succeeded or failed
ev = dev[0].wait_event([ "OCV failed" ], timeout=1)
ev = dev[0].wait_event(["OCV failed"], timeout=1)
if ev is not None:
raise Exception("OCI verification failed: " + ev)
@ -355,10 +355,10 @@ def test_wnm_sleep_mode_rsn_badocv(dev, apdev):
dev[0].request("WNM_SLEEP enter")
time.sleep(0.1)
msg = { 'fc': MGMT_SUBTYPE_ACTION << 4,
msg = {'fc': MGMT_SUBTYPE_ACTION << 4,
'da': bssid,
'sa': dev[0].own_addr(),
'bssid': bssid }
'bssid': bssid}
logger.debug("WNM Sleep Mode Request - Missing OCI element")
msg['payload'] = struct.pack("<BBBBBBBHBB",
@ -367,7 +367,7 @@ def test_wnm_sleep_mode_rsn_badocv(dev, apdev):
WLAN_EID_TFS_REQ, 0)
mgmt_tx(dev[0], "MGMT_TX {} {} freq=2412 wait_time=200 no_cck=1 action={}".format(
msg['da'], msg['bssid'], binascii.hexlify(msg['payload']).decode()))
ev = hapd.wait_event([ "OCV failed" ], timeout=5)
ev = hapd.wait_event(["OCV failed"], timeout=5)
if ev is None:
raise Exception("AP did not report missing OCI element")
@ -381,15 +381,15 @@ def test_wnm_sleep_mode_rsn_badocv(dev, apdev):
msg['payload'] += struct.pack("<BBB", WLAN_EID_EXTENSION, 1 + len(oci_ie),
WLAN_EID_EXT_OCV_OCI) + oci_ie
mgmt_tx(dev[0], "MGMT_TX {} {} freq=2412 wait_time=200 no_cck=1 action={}".format(
msg['da'], msg['bssid'] , binascii.hexlify(msg['payload']).decode()))
ev = hapd.wait_event([ "OCV failed" ], timeout=5)
msg['da'], msg['bssid'], binascii.hexlify(msg['payload']).decode()))
ev = hapd.wait_event(["OCV failed"], timeout=5)
if ev is None:
raise Exception("AP did not report bad OCI element")
msg = { 'fc': MGMT_SUBTYPE_ACTION << 4,
msg = {'fc': MGMT_SUBTYPE_ACTION << 4,
'da': dev[0].own_addr(),
'sa': bssid,
'bssid': bssid }
'bssid': bssid}
hapd.set("ext_mgmt_frame_handling", "1")
logger.debug("WNM Sleep Mode Response - Missing OCI element")
@ -402,7 +402,7 @@ def test_wnm_sleep_mode_rsn_badocv(dev, apdev):
dev[0].request("WNM_SLEEP exit")
hapd.mgmt_tx(msg)
expect_ack(hapd)
ev = dev[0].wait_event([ "OCV failed" ], timeout=5)
ev = dev[0].wait_event(["OCV failed"], timeout=5)
if ev is None:
raise Exception("STA did not report missing OCI element")
@ -418,7 +418,7 @@ def test_wnm_sleep_mode_rsn_badocv(dev, apdev):
WLAN_EID_EXT_OCV_OCI) + oci_ie
hapd.mgmt_tx(msg)
expect_ack(hapd)
ev = dev[0].wait_event([ "OCV failed" ], timeout=5)
ev = dev[0].wait_event(["OCV failed"], timeout=5)
if ev is None:
raise Exception("STA did not report bad OCI element")
@ -441,14 +441,14 @@ def test_wnm_sleep_mode_rsn_pmf_key_workaround(dev, apdev):
dev[0].connect("test-wnm-rsn", psk="12345678", ieee80211w="2",
key_mgmt="WPA-PSK-SHA256", proto="WPA2", 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")
check_wnm_sleep_mode_enter_exit(hapd, dev[0])
def test_wnm_sleep_mode_proto(dev, apdev):
"""WNM Sleep Mode - protocol testing"""
params = { "ssid": "test-wnm", "wnm_sleep_mode": "1" }
params = {"ssid": "test-wnm", "wnm_sleep_mode": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
@ -456,13 +456,13 @@ def test_wnm_sleep_mode_proto(dev, apdev):
hdr = "d0003a01" + bssid.replace(':', '') + addr.replace(':', '') + bssid.replace(':', '') + "1000"
hapd.set("ext_mgmt_frame_handling", "1")
tests = [ "0a10",
tests = ["0a10",
"0a1001",
"0a10015d00",
"0a10015d01",
"0a10015d0400000000",
"0a1001" + 7*("5bff" + 255*"00") + "5d00",
"0a1001ff00" ]
"0a1001ff00"]
for t in tests:
if "OK" not in hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + t):
raise Exception("MGMT_RX_PROCESS failed")
@ -558,7 +558,7 @@ def mgmt_tx(dev, msg):
@remote_compatible
def test_wnm_bss_tm_req(dev, apdev):
"""BSS Transition Management Request"""
params = { "ssid": "test-wnm", "bss_transition": "1" }
params = {"ssid": "test-wnm", "bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -720,8 +720,8 @@ def test_wnm_bss_tm_req(dev, apdev):
@remote_compatible
def test_wnm_bss_keep_alive(dev, apdev):
"""WNM keep-alive"""
params = { "ssid": "test-wnm",
"ap_max_inactivity": "1" }
params = {"ssid": "test-wnm",
"ap_max_inactivity": "1"}
hapd = hostapd.add_ap(apdev[0], params)
addr = dev[0].p2p_interface_addr()
@ -755,23 +755,23 @@ def test_wnm_bss_tm(dev, apdev):
try:
hapd = None
hapd2 = None
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"country_code": "FI",
"ieee80211d": "1",
"hw_mode": "g",
"channel": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
id = dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
dev[0].set_network(id, "scan_freq", "")
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"country_code": "FI",
"ieee80211d": "1",
"hw_mode": "a",
"channel": "36",
"bss_transition": "1" }
"bss_transition": "1"}
hapd2 = hostapd.add_ap(apdev[1], params)
addr = dev[0].p2p_interface_addr()
@ -868,15 +868,15 @@ def test_wnm_bss_tm(dev, apdev):
def test_wnm_bss_tm_errors(dev, apdev):
"""WNM BSS Transition Management errors"""
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"hw_mode": "g",
"channel": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
id = dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
tests = [ "BSS_TM_REQ q",
tests = ["BSS_TM_REQ q",
"BSS_TM_REQ 22:22:22:22:22:22",
"BSS_TM_REQ %s disassoc_timer=-1" % addr,
"BSS_TM_REQ %s disassoc_timer=65536" % addr,
@ -892,7 +892,7 @@ def test_wnm_bss_tm_errors(dev, apdev):
"BSS_TM_REQ %s url=foo mbo=1:2" % addr,
"BSS_TM_REQ %s url=foo mbo=100000:0:0" % addr,
"BSS_TM_REQ %s url=foo mbo=0:0:254" % addr,
"BSS_TM_REQ %s url=foo mbo=0:100000:0" % addr ]
"BSS_TM_REQ %s url=foo mbo=0:100000:0" % addr]
for t in tests:
if "FAIL" not in hapd.request(t):
raise Exception("Invalid command accepted: %s" % t)
@ -911,10 +911,10 @@ def test_wnm_bss_tm_errors(dev, apdev):
def test_wnm_bss_tm_termination(dev, apdev):
"""WNM BSS Transition Management and BSS termination"""
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"hw_mode": "g",
"channel": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
id = dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
addr = dev[0].own_addr()
@ -959,20 +959,20 @@ def run_wnm_bss_tm_scan_not_needed(dev, apdev, ht=True, vht=False, hwmode='a',
try:
hapd = None
hapd2 = None
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"country_code": "FI",
"ieee80211d": "1",
"hw_mode": "g",
"channel": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"country_code": "FI",
"ieee80211d": "1",
"hw_mode": hwmode,
"channel": channel,
"bss_transition": "1" }
"bss_transition": "1"}
if not ht:
params['ieee80211n'] = '0'
if vht:
@ -1017,20 +1017,20 @@ def test_wnm_bss_tm_scan_needed(dev, apdev):
try:
hapd = None
hapd2 = None
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"country_code": "FI",
"ieee80211d": "1",
"hw_mode": "g",
"channel": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"country_code": "FI",
"ieee80211d": "1",
"hw_mode": "a",
"channel": "36",
"bss_transition": "1" }
"bss_transition": "1"}
hapd2 = hostapd.add_ap(apdev[1], params)
dev[0].scan_for_bss(apdev[1]['bssid'], 5180)
@ -1070,22 +1070,22 @@ def test_wnm_bss_tm_scan_needed_e4(dev, apdev):
try:
hapd = None
hapd2 = None
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"country_code": "FI",
"country3": "0x04",
"ieee80211d": "1",
"hw_mode": "g",
"channel": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"country_code": "FI",
"country3": "0x04",
"ieee80211d": "1",
"hw_mode": "a",
"channel": "36",
"bss_transition": "1" }
"bss_transition": "1"}
hapd2 = hostapd.add_ap(apdev[1], params)
id = dev[0].connect("test-wnm", key_mgmt="NONE",
@ -1118,12 +1118,12 @@ def test_wnm_bss_tm_scan_needed_e4(dev, apdev):
clear_regdom_state(dev, hapd, hapd2)
def start_wnm_tm(ap, country, dev, country3=None):
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"country_code": country,
"ieee80211d": "1",
"hw_mode": "g",
"channel": "1",
"bss_transition": "1" }
"bss_transition": "1"}
if country3 is not None:
params["country3"] = country3
hapd = hostapd.add_ap(ap, params)
@ -1332,7 +1332,7 @@ def test_wnm_bss_tm_rsn(dev, apdev):
def test_wnm_action_proto(dev, apdev):
"""WNM Action protocol testing"""
params = { "ssid": "test-wnm" }
params = {"ssid": "test-wnm"}
params['wnm_sleep_mode'] = '1'
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
@ -1746,10 +1746,10 @@ def test_wnm_bss_tm_req_with_mbo_ie(dev, apdev):
@remote_compatible
def test_wnm_bss_transition_mgmt_query(dev, apdev):
"""WNM BSS Transition Management query"""
params = { "ssid": "test-wnm",
"bss_transition": "1" }
params = {"ssid": "test-wnm",
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
params = { "ssid": "another" }
params = {"ssid": "another"}
hapd2 = hostapd.add_ap(apdev[1], params)
dev[0].scan_for_bss(apdev[1]['bssid'], 2412)
@ -1770,20 +1770,20 @@ def test_wnm_bss_transition_mgmt_query(dev, apdev):
@remote_compatible
def test_wnm_bss_tm_security_mismatch(dev, apdev):
"""WNM BSS Transition Management and security mismatch"""
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"wpa": "2",
"wpa_key_mgmt": "WPA-PSK",
"rsn_pairwise": "CCMP",
"wpa_passphrase": "12345678",
"hw_mode": "g",
"channel": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"hw_mode": "g",
"channel": "11",
"bss_transition": "1" }
"bss_transition": "1"}
hapd2 = hostapd.add_ap(apdev[1], params)
dev[0].scan_for_bss(apdev[1]['bssid'], 2462)
@ -1807,16 +1807,16 @@ def test_wnm_bss_tm_security_mismatch(dev, apdev):
def test_wnm_bss_tm_connect_cmd(dev, apdev):
"""WNM BSS Transition Management and cfg80211 connect command"""
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"hw_mode": "g",
"channel": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"hw_mode": "g",
"channel": "11",
"bss_transition": "1" }
"bss_transition": "1"}
hapd2 = hostapd.add_ap(apdev[1], params)
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@ -1855,12 +1855,12 @@ def test_wnm_bss_tm_reject(dev, apdev):
"""WNM BSS Transition Management request getting rejected"""
try:
hapd = None
params = { "ssid": "test-wnm",
params = {"ssid": "test-wnm",
"country_code": "FI",
"ieee80211d": "1",
"hw_mode": "g",
"channel": "1",
"bss_transition": "1" }
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
id = dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
@ -1895,7 +1895,7 @@ def test_wnm_bss_tm_reject(dev, apdev):
def test_wnm_bss_tm_ap_proto(dev, apdev):
"""WNM BSS TM - protocol testing for AP message parsing"""
params = { "ssid": "test-wnm", "bss_transition": "1" }
params = {"ssid": "test-wnm", "bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
@ -1903,7 +1903,7 @@ def test_wnm_bss_tm_ap_proto(dev, apdev):
hdr = "d0003a01" + bssid.replace(':', '') + addr.replace(':', '') + bssid.replace(':', '') + "1000"
hapd.set("ext_mgmt_frame_handling", "1")
tests = [ "0a",
tests = ["0a",
"0a06",
"0a0601",
"0a060100",
@ -1917,7 +1917,7 @@ def test_wnm_bss_tm_ap_proto(dev, apdev):
"0a1a",
"0a1a00",
"0a1a0000",
"0aff" ]
"0aff"]
for t in tests:
if "OK" not in hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + t):
raise Exception("MGMT_RX_PROCESS failed")
@ -1926,8 +1926,8 @@ def test_wnm_bss_tm_ap_proto(dev, apdev):
def test_wnm_bss_transition_mgmt_query_with_unknown_candidates(dev, apdev):
"""WNM BSS Transition Management query with unknown candidates"""
params = { "ssid": "test-wnm",
"bss_transition": "1" }
params = {"ssid": "test-wnm",
"bss_transition": "1"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].scan_for_bss(apdev[0]['bssid'], 2412)
@ -1946,16 +1946,16 @@ def test_wnm_bss_transition_mgmt_query_with_unknown_candidates(dev, apdev):
def test_wnm_time_adv_without_time_zone(dev, apdev):
"""WNM Time Advertisement without time zone configuration"""
params = { "ssid": "test-wnm",
"time_advertisement": "2" }
params = {"ssid": "test-wnm",
"time_advertisement": "2"}
hostapd.add_ap(apdev[0], params)
dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
def test_wnm_coloc_intf_reporting(dev, apdev):
"""WNM Collocated Interference Reporting"""
params = { "ssid": "test-wnm",
"coloc_intf_reporting": "1" }
params = {"ssid": "test-wnm",
"coloc_intf_reporting": "1"}
hapd = hostapd.add_ap(apdev[0], params)
no_intf = struct.pack("<BBBBBLLLLH", 96, 21, 0, 127, 0x0f, 0, 0, 0, 0, 0)

View File

@ -49,7 +49,7 @@ def test_wpas_ap_open(dev):
addr1 = dev[1].p2p_interface_addr()
addr2 = dev[2].p2p_interface_addr()
addrs = [ addr1, addr2 ]
addrs = [addr1, addr2]
sta = dev[0].get_sta(None)
if sta['addr'] not in addrs:
raise Exception("Unexpected STA address")
@ -497,7 +497,7 @@ def test_wpas_ap_failures(dev):
dev[0].set_network(id, "frequency", "2412")
dev[0].set_network(id, "scan_freq", "2412")
dev[0].select_network(id)
ev = dev[0].wait_event([ "CTRL-EVENT-CONNECTED" ], timeout=0.1)
ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=0.1)
if ev is not None:
raise Exception("Unexpected connection event")
dev[0].request("REMOVE_NETWORK all")
@ -512,8 +512,8 @@ def test_wpas_ap_failures(dev):
dev[0].set_network(id, "scan_freq", "2412")
dev[0].set_network(id, "pbss", "2")
dev[0].select_network(id)
ev = dev[0].wait_event([ "CTRL-EVENT-CONNECTED",
"CTRL-EVENT-DISCONNECTED" ], timeout=0.1)
ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
"CTRL-EVENT-DISCONNECTED"], timeout=0.1)
if ev is not None and "CTRL-EVENT-CONNECTED" in ev:
raise Exception("Unexpected connection event(2)")
dev[0].request("REMOVE_NETWORK all")
@ -573,8 +573,8 @@ def test_wpas_ap_oom(dev):
for i in range(5):
with alloc_fail(wpas, i, "=wpa_supplicant_conf_ap"):
wpas.select_network(id)
ev = dev[0].wait_event([ "CTRL-EVENT-CONNECTED",
"CTRL-EVENT-DISCONNECTED" ], timeout=1)
ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED",
"CTRL-EVENT-DISCONNECTED"], timeout=1)
wpas.request("DISCONNECT")
wpas.wait_disconnected()

View File

@ -11,7 +11,7 @@ import os
from wpasupplicant import WpaSupplicant
import hostapd
config_checks = [ ("ap_scan", "0"),
config_checks = [("ap_scan", "0"),
("update_config", "1"),
("device_name", "name"),
("eapol_version", "2"),
@ -128,14 +128,14 @@ config_checks = [ ("ap_scan", "0"),
("p2p_device_random_mac_addr", "1"),
("p2p_device_persistent_mac_addr", "02:12:34:56:78:9a"),
("p2p_interface_random_mac_addr", "1"),
("openssl_ciphers", "DEFAULT") ]
("openssl_ciphers", "DEFAULT")]
def supported_param(capa, field):
mesh_params = [ "user_mpm", "max_peer_links", "mesh_max_inactivity" ]
mesh_params = ["user_mpm", "max_peer_links", "mesh_max_inactivity"]
if field in mesh_params and not capa['mesh']:
return False
sae_params = [ "dot11RSNASAERetransPeriod" ]
sae_params = ["dot11RSNASAERetransPeriod"]
if field in sae_params and not capa['sae']:
return False
@ -293,8 +293,8 @@ def test_wpas_config_file_wps(dev, apdev):
if os.path.exists(config):
os.remove(config)
params = { "ssid": "test-wps", "eap_server": "1", "wps_state": "2",
"skip_cred_build": "1", "extra_cred": "wps-ctrl-cred" }
params = {"ssid": "test-wps", "eap_server": "1", "wps_state": "2",
"skip_cred_build": "1", "extra_cred": "wps-ctrl-cred"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@ -338,8 +338,8 @@ def test_wpas_config_file_wps2(dev, apdev):
if os.path.exists(config):
os.remove(config)
params = { "ssid": "test-wps", "eap_server": "1", "wps_state": "2",
"skip_cred_build": "1", "extra_cred": "wps-ctrl-cred2" }
params = {"ssid": "test-wps", "eap_server": "1", "wps_state": "2",
"skip_cred_build": "1", "extra_cred": "wps-ctrl-cred2"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
@ -443,8 +443,8 @@ def test_wpas_config_file_set_cred(dev):
id = wpas.add_cred()
wpas.set_cred_quoted(id, "username", "hello")
fields = [ "username", "milenage", "imsi", "password", "realm",
"phase1", "phase2", "provisioning_sp" ]
fields = ["username", "milenage", "imsi", "password", "realm",
"phase1", "phase2", "provisioning_sp"]
for field in fields:
if "FAIL" not in wpas.request('SET_CRED %d %s "hello"\n}\nmodel_name=foobar\ncred={\n#\"' % (id, field)):
raise Exception("Invalid %s value accepted" % field)
@ -489,14 +489,14 @@ def test_wpas_config_file_set_global(dev):
wpas.interface_add("wlan5", config=config)
fields = [ "model_name", "device_name", "ctrl_interface_group",
fields = ["model_name", "device_name", "ctrl_interface_group",
"opensc_engine_path", "pkcs11_engine_path",
"pkcs11_module_path", "openssl_ciphers", "pcsc_reader",
"pcsc_pin", "driver_param", "manufacturer", "model_name",
"model_number", "serial_number", "config_methods",
"p2p_ssid_postfix", "autoscan", "ext_password_backend",
"osu_dir", "wowlan_triggers", "fst_group_id",
"sched_scan_plans", "non_pref_chan" ]
"sched_scan_plans", "non_pref_chan"]
for field in fields:
if "FAIL" not in wpas.request('SET %s hello\nmodel_name=foobar' % field):
raise Exception("Invalid %s value accepted" % field)
@ -570,11 +570,11 @@ def test_wpas_config_file_key_mgmt(dev, apdev, params):
wpas.set_network_quoted(id, "psk", "12345678")
wpas.set_network(id, "ieee80211w", "0")
tests = [ "WPA-PSK", "WPA-EAP", "IEEE8021X", "NONE", "WPA-NONE", "FT-PSK",
tests = ["WPA-PSK", "WPA-EAP", "IEEE8021X", "NONE", "WPA-NONE", "FT-PSK",
"FT-EAP", "FT-EAP-SHA384", "WPA-PSK-SHA256", "WPA-EAP-SHA256",
"SAE", "FT-SAE", "OSEN", "WPA-EAP-SUITE-B",
"WPA-EAP-SUITE-B-192", "FILS-SHA256", "FILS-SHA384",
"FT-FILS-SHA256", "FT-FILS-SHA384", "OWE", "DPP" ]
"FT-FILS-SHA256", "FT-FILS-SHA384", "OWE", "DPP"]
supported_key_mgmts = dev[0].get_capability("key_mgmt")
for key_mgmt in tests:
if key_mgmt == "WPA-EAP-SUITE-B-192" and key_mgmt not in supported_key_mgmts:

View File

@ -255,13 +255,13 @@ def test_wpas_ctrl_network(dev):
if "FAIL" not in dev[0].request('BSSID ' + str(id)):
raise Exception("Unexpected BSSID success")
tests = [ "02:11:22:33:44:55",
tests = ["02:11:22:33:44:55",
"02:11:22:33:44:55 02:ae:be:ce:53:77",
"02:11:22:33:44:55/ff:00:ff:00:ff:00",
"02:11:22:33:44:55/ff:00:ff:00:ff:00 f2:99:88:77:66:55",
"f2:99:88:77:66:55 02:11:22:33:44:55/ff:00:ff:00:ff:00",
"f2:99:88:77:66:55 02:11:22:33:44:55/ff:00:ff:00:ff:00 12:34:56:78:90:ab",
"02:11:22:33:44:55/ff:ff:ff:00:00:00 02:ae:be:ce:53:77/00:00:00:00:00:ff" ]
"02:11:22:33:44:55/ff:ff:ff:00:00:00 02:ae:be:ce:53:77/00:00:00:00:00:ff"]
for val in tests:
dev[0].set_network(id, "bssid_blacklist", val)
res = dev[0].get_network(id, "bssid_blacklist")
@ -272,11 +272,11 @@ def test_wpas_ctrl_network(dev):
if res != val:
raise Exception("Unexpected bssid_whitelist value: %s != %s" % (res, val))
tests = [ "foo",
tests = ["foo",
"00:11:22:33:44:5",
"00:11:22:33:44:55q",
"00:11:22:33:44:55/",
"00:11:22:33:44:55/66:77:88:99:aa:b" ]
"00:11:22:33:44:55/66:77:88:99:aa:b"]
for val in tests:
if "FAIL" not in dev[0].request("SET_NETWORK %d bssid_blacklist %s" % (id, val)):
raise Exception("Invalid bssid_blacklist value accepted")
@ -286,11 +286,11 @@ def test_wpas_ctrl_network_oom(dev):
"""wpa_supplicant ctrl_iface network OOM in string parsing"""
id = dev[0].add_network()
tests = [ ('"foo"', 1, 'dup_binstr;wpa_config_set'),
tests = [('"foo"', 1, 'dup_binstr;wpa_config_set'),
('P"foo"', 1, 'dup_binstr;wpa_config_set'),
('P"foo"', 2, 'wpa_config_set'),
('112233', 1, 'wpa_config_set') ]
for val,count,func in tests:
('112233', 1, 'wpa_config_set')]
for val, count, func in tests:
with alloc_fail(dev[0], count, func):
if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + ' ssid ' + val):
raise Exception("Unexpected success for SET_NETWORK during OOM")
@ -323,7 +323,7 @@ def test_wpas_ctrl_dup_network(dev, apdev):
only_add_network=True)
id = dev[0].add_network()
dev[0].set_network_quoted(id, "ssid", ssid)
for f in [ "key_mgmt", "psk", "scan_freq" ]:
for f in ["key_mgmt", "psk", "scan_freq"]:
res = dev[0].request("DUP_NETWORK {} {} {}".format(src, id, f))
if "OK" not in res:
raise Exception("DUP_NETWORK failed")
@ -357,7 +357,7 @@ def test_wpas_ctrl_dup_network_global(dev, apdev):
only_add_network=True)
id = dev[0].add_network()
dev[0].set_network_quoted(id, "ssid", ssid)
for f in [ "key_mgmt", "psk", "scan_freq" ]:
for f in ["key_mgmt", "psk", "scan_freq"]:
res = dev[0].global_request("DUP_NETWORK {} {} {} {} {}".format(dev[0].ifname, dev[0].ifname, src, id, f))
if "OK" not in res:
raise Exception("DUP_NETWORK failed")
@ -463,7 +463,7 @@ def test_wpas_ctrl_cred(dev):
'roaming_partner "' + 200*'a' + '.example.org,"',
'roaming_partner "example.org,1"',
'roaming_partner "example.org,1,2"',
'roaming_partner "example.org,1,2,ABC"' ]
'roaming_partner "example.org,1,2,ABC"']
for t in tests:
if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " " + t):
raise Exception("Unexpected success on invalid SET_CRED value: " + t)
@ -484,7 +484,7 @@ def test_wpas_ctrl_cred(dev):
raise Exception("Unexpected LIST_CREDS result(2)")
id = add_cred(dev[0])
values = [ ("temporary", "1", False),
values = [("temporary", "1", False),
("temporary", "0", False),
("pcsc", "1", False),
("realm", "example.com", True),
@ -520,7 +520,7 @@ def test_wpas_ctrl_cred(dev):
("req_conn_capab", "6:22,80,443", False),
("req_conn_capab", "17:500", False, "6:22,80,443\n17:500"),
("req_conn_capab", "50", False, "6:22,80,443\n17:500\n50"),
("ocsp", "1", False) ]
("ocsp", "1", False)]
for v in values:
if v[2]:
set_cred_quoted(dev[0], id, v[0], v[1])
@ -655,13 +655,13 @@ def test_wpas_ctrl_tdls_discover(dev):
@remote_compatible
def test_wpas_ctrl_tdls_chan_switch(dev):
"""wpa_supplicant ctrl_iface tdls_chan_switch error cases"""
for args in [ '', '00:11:22:33:44:55' ]:
for args in ['', '00:11:22:33:44:55']:
if "FAIL" not in dev[0].request("TDLS_CANCEL_CHAN_SWITCH " + args):
raise Exception("Unexpected success on invalid TDLS_CANCEL_CHAN_SWITCH: " + args)
for args in [ '', 'foo ', '00:11:22:33:44:55 ', '00:11:22:33:44:55 q',
for args in ['', 'foo ', '00:11:22:33:44:55 ', '00:11:22:33:44:55 q',
'00:11:22:33:44:55 81', '00:11:22:33:44:55 81 1234',
'00:11:22:33:44:55 81 1234 center_freq1=234 center_freq2=345 bandwidth=456 sec_channel_offset=567 ht vht' ]:
'00:11:22:33:44:55 81 1234 center_freq1=234 center_freq2=345 bandwidth=456 sec_channel_offset=567 ht vht']:
if "FAIL" not in dev[0].request("TDLS_CHAN_SWITCH " + args):
raise Exception("Unexpected success on invalid TDLS_CHAN_SWITCH: " + args)
@ -766,15 +766,15 @@ def test_wpas_ctrl_set_wps_params(dev):
dev[2].request("SET config_methods ")
def _test_wpas_ctrl_set_wps_params(dev):
ts = [ "config_methods label virtual_display virtual_push_button keypad",
ts = ["config_methods label virtual_display virtual_push_button keypad",
"device_type 1-0050F204-1",
"os_version 01020300",
"uuid 12345678-9abc-def0-1234-56789abcdef0" ]
"uuid 12345678-9abc-def0-1234-56789abcdef0"]
for t in ts:
if "OK" not in dev[2].request("SET " + t):
raise Exception("SET failed for: " + t)
ts = [ "uuid 12345678+9abc-def0-1234-56789abcdef0",
ts = ["uuid 12345678+9abc-def0-1234-56789abcdef0",
"uuid 12345678-qabc-def0-1234-56789abcdef0",
"uuid 12345678-9abc+def0-1234-56789abcdef0",
"uuid 12345678-9abc-qef0-1234-56789abcdef0",
@ -782,7 +782,7 @@ def _test_wpas_ctrl_set_wps_params(dev):
"uuid 12345678-9abc-def0-q234-56789abcdef0",
"uuid 12345678-9abc-def0-1234+56789abcdef0",
"uuid 12345678-9abc-def0-1234-q6789abcdef0",
"uuid qwerty" ]
"uuid qwerty"]
for t in ts:
if "FAIL" not in dev[2].request("SET " + t):
raise Exception("SET succeeded for: " + t)
@ -807,7 +807,7 @@ def test_wpas_ctrl_bssid_filter(dev, apdev):
try:
if "OK" not in dev[2].request("SET bssid_filter " + apdev[0]['bssid']):
raise Exception("Failed to set bssid_filter")
params = { "ssid": "test" }
params = {"ssid": "test"}
hostapd.add_ap(apdev[0], params)
hostapd.add_ap(apdev[1], params)
dev[2].scan_for_bss(apdev[0]['bssid'], freq="2412")
@ -842,7 +842,7 @@ def test_wpas_ctrl_bssid_filter(dev, apdev):
@remote_compatible
def test_wpas_ctrl_disallow_aps(dev, apdev):
"""wpa_supplicant ctrl_iface disallow_aps"""
params = { "ssid": "test" }
params = {"ssid": "test"}
hostapd.add_ap(apdev[0], params)
if "FAIL" not in dev[0].request("SET disallow_aps bssid "):
@ -919,7 +919,7 @@ def test_wpas_ctrl_set_uapsd(dev):
def test_wpas_ctrl_set(dev):
"""wpa_supplicant ctrl_iface SET"""
vals = [ "foo",
vals = ["foo",
"ampdu 0",
"radio_disable 0",
"ps 10",
@ -934,11 +934,11 @@ def test_wpas_ctrl_set(dev):
if "FAIL" not in dev[0].request("SET " + val):
raise Exception("Unexpected SET success for " + val)
vals = [ "ps 1" ]
vals = ["ps 1"]
for val in vals:
dev[0].request("SET " + val)
vals = [ "EAPOL::heldPeriod 60",
vals = ["EAPOL::heldPeriod 60",
"EAPOL::authPeriod 30",
"EAPOL::startPeriod 30",
"EAPOL::maxStart 3",
@ -947,7 +947,7 @@ def test_wpas_ctrl_set(dev):
"ps 0",
"no_keep_alive 0",
"tdls_disabled 1",
"tdls_disabled 0" ]
"tdls_disabled 0"]
for val in vals:
if "OK" not in dev[0].request("SET " + val):
raise Exception("Unexpected SET failure for " + val)
@ -1016,7 +1016,7 @@ def test_wpas_ctrl_get_capability(dev):
@remote_compatible
def test_wpas_ctrl_nfc_report_handover(dev):
"""wpa_supplicant ctrl_iface NFC_REPORT_HANDOVER"""
vals = [ "FOO",
vals = ["FOO",
"ROLE freq=12345",
"ROLE TYPE",
"ROLE TYPE REQ",
@ -1024,7 +1024,7 @@ def test_wpas_ctrl_nfc_report_handover(dev):
"ROLE TYPE 0Q SEL",
"ROLE TYPE 00 SEL",
"ROLE TYPE 00 0Q",
"ROLE TYPE 00 00" ]
"ROLE TYPE 00 00"]
for v in vals:
if "FAIL" not in dev[0].request("NFC_REPORT_HANDOVER " + v):
raise Exception("Unexpected NFC_REPORT_HANDOVER success for " + v)
@ -1032,8 +1032,8 @@ def test_wpas_ctrl_nfc_report_handover(dev):
@remote_compatible
def test_wpas_ctrl_nfc_tag_read(dev):
"""wpa_supplicant ctrl_iface WPS_NFC_TAG_READ"""
vals = [ "FOO", "0Q", "00", "000000", "10000001", "10000000", "00000000",
"100e0000", "100e0001ff", "100e000411110000", "100e0004100e0001" ]
vals = ["FOO", "0Q", "00", "000000", "10000001", "10000000", "00000000",
"100e0000", "100e0001ff", "100e000411110000", "100e0004100e0001"]
for v in vals:
if "FAIL" not in dev[0].request("WPS_NFC_TAG_READ " + v):
raise Exception("Unexpected WPS_NFC_TAG_READ success for " + v)
@ -1041,24 +1041,24 @@ def test_wpas_ctrl_nfc_tag_read(dev):
@remote_compatible
def test_wpas_ctrl_nfc_get_handover(dev):
"""wpa_supplicant ctrl_iface NFC_GET_HANDOVER"""
vals = [ "FOO", "FOO BAR", "WPS WPS", "WPS WPS-CR", "WPS FOO", "NDEF P2P" ]
vals = ["FOO", "FOO BAR", "WPS WPS", "WPS WPS-CR", "WPS FOO", "NDEF P2P"]
for v in vals:
if "FAIL" not in dev[0].request("NFC_GET_HANDOVER_REQ " + v):
raise Exception("Unexpected NFC_GET_HANDOVER_REQ success for " + v)
vals = [ "NDEF WPS", "NDEF P2P-CR", "WPS P2P-CR" ]
vals = ["NDEF WPS", "NDEF P2P-CR", "WPS P2P-CR"]
for v in vals:
if "FAIL" in dev[0].request("NFC_GET_HANDOVER_REQ " + v):
raise Exception("Unexpected NFC_GET_HANDOVER_REQ failure for " + v)
vals = [ "FOO", "FOO BAR", "WPS WPS", "WPS WPS-CR", "WPS FOO", "NDEF P2P",
"NDEF WPS", "NDEF WPS uuid" ]
vals = ["FOO", "FOO BAR", "WPS WPS", "WPS WPS-CR", "WPS FOO", "NDEF P2P",
"NDEF WPS", "NDEF WPS uuid"]
for v in vals:
if "FAIL" not in dev[0].request("NFC_GET_HANDOVER_SEL " + v):
raise Exception("Unexpected NFC_GET_HANDOVER_SEL success for " + v)
vals = [ "NDEF P2P-CR", "WPS P2P-CR", "NDEF P2P-CR-TAG",
"WPS P2P-CR-TAG" ]
vals = ["NDEF P2P-CR", "WPS P2P-CR", "NDEF P2P-CR-TAG",
"WPS P2P-CR-TAG"]
for v in vals:
if "FAIL" in dev[0].request("NFC_GET_HANDOVER_SEL " + v):
raise Exception("Unexpected NFC_GET_HANDOVER_SEL failure for " + v)
@ -1129,7 +1129,7 @@ def test_wpas_ctrl_log_level(dev):
if "FAIL" not in dev[2].request("LOG_LEVEL FOO"):
raise Exception("Invalid LOG_LEVEL accepted")
for lev in [ "EXCESSIVE", "MSGDUMP", "DEBUG", "INFO", "WARNING", "ERROR" ]:
for lev in ["EXCESSIVE", "MSGDUMP", "DEBUG", "INFO", "WARNING", "ERROR"]:
if "OK" not in dev[2].request("LOG_LEVEL " + lev):
raise Exception("LOG_LEVEL failed for " + lev)
level = dev[2].request("LOG_LEVEL")
@ -1147,7 +1147,7 @@ def test_wpas_ctrl_log_level(dev):
@remote_compatible
def test_wpas_ctrl_enable_disable_network(dev, apdev):
"""wpa_supplicant ctrl_iface ENABLE/DISABLE_NETWORK"""
params = { "ssid": "test" }
params = {"ssid": "test"}
hostapd.add_ap(apdev[0], params)
id = dev[0].connect("test", key_mgmt="NONE", scan_freq="2412",
@ -1289,7 +1289,7 @@ def test_wpas_ctrl_roam(dev, apdev):
raise Exception("Unexpected success")
if "FAIL" not in dev[0].request("ROAM 00:11:22:33:44:55"):
raise Exception("Unexpected success")
params = { "ssid": "test" }
params = {"ssid": "test"}
hostapd.add_ap(apdev[0], params)
id = dev[0].connect("test", key_mgmt="NONE", scan_freq="2412")
if "FAIL" not in dev[0].request("ROAM 00:11:22:33:44:55"):
@ -1322,8 +1322,8 @@ def test_wpas_ctrl_rsp(dev, apdev):
id = dev[0].add_network()
if "FAIL" not in dev[0].request("CTRL-RSP-foo-%d:" % id):
raise Exception("Request succeeded unexpectedly")
for req in [ "IDENTITY", "PASSWORD", "NEW_PASSWORD", "PIN", "OTP",
"PASSPHRASE", "SIM" ]:
for req in ["IDENTITY", "PASSWORD", "NEW_PASSWORD", "PIN", "OTP",
"PASSPHRASE", "SIM"]:
if "OK" not in dev[0].request("CTRL-RSP-%s-%d:" % (req, id)):
raise Exception("Request failed unexpectedly")
if "OK" not in dev[0].request("CTRL-RSP-%s-%d:" % (req, id)):
@ -1332,11 +1332,11 @@ def test_wpas_ctrl_rsp(dev, apdev):
@remote_compatible
def test_wpas_ctrl_vendor(dev, apdev):
"""wpa_supplicant ctrl_iface VENDOR"""
cmds = [ "foo",
cmds = ["foo",
"1",
"1 foo",
"1 2foo",
"1 2 qq" ]
"1 2 qq"]
for cmd in cmds:
if "FAIL" not in dev[0].request("VENDOR " + cmd):
raise Exception("Invalid VENDOR command accepted: " + cmd)
@ -1344,11 +1344,11 @@ def test_wpas_ctrl_vendor(dev, apdev):
@remote_compatible
def test_wpas_ctrl_mgmt_tx(dev, apdev):
"""wpa_supplicant ctrl_iface MGMT_TX"""
cmds = [ "foo",
cmds = ["foo",
"00:11:22:33:44:55 foo",
"00:11:22:33:44:55 11:22:33:44:55:66",
"00:11:22:33:44:55 11:22:33:44:55:66 freq=0 no_cck=0 wait_time=0 action=123",
"00:11:22:33:44:55 11:22:33:44:55:66 action=12qq" ]
"00:11:22:33:44:55 11:22:33:44:55:66 action=12qq"]
for cmd in cmds:
if "FAIL" not in dev[0].request("MGMT_TX " + cmd):
raise Exception("Invalid MGMT_TX command accepted: " + cmd)
@ -1365,9 +1365,9 @@ def test_wpas_ctrl_driver_event(dev, apdev):
@remote_compatible
def test_wpas_ctrl_eapol_rx(dev, apdev):
"""wpa_supplicant ctrl_iface EAPOL_RX"""
cmds = [ "foo",
cmds = ["foo",
"00:11:22:33:44:55 123",
"00:11:22:33:44:55 12qq" ]
"00:11:22:33:44:55 12qq"]
for cmd in cmds:
if "FAIL" not in dev[0].request("EAPOL_RX " + cmd):
raise Exception("Invalid EAPOL_RX command accepted: " + cmd)
@ -1384,10 +1384,10 @@ def test_wpas_ctrl_data_test(dev, apdev):
raise Exception("DATA_TEST_CONFIG failed")
if "OK" not in dev[0].request("DATA_TEST_CONFIG 1"):
raise Exception("DATA_TEST_CONFIG failed")
cmds = [ "foo",
cmds = ["foo",
"00:11:22:33:44:55 foo",
"00:11:22:33:44:55 00:11:22:33:44:55 -1",
"00:11:22:33:44:55 00:11:22:33:44:55 256" ]
"00:11:22:33:44:55 00:11:22:33:44:55 256"]
for cmd in cmds:
if "FAIL" not in dev[0].request("DATA_TEST_TX " + cmd):
raise Exception("Invalid DATA_TEST_TX command accepted: " + cmd)
@ -1396,10 +1396,10 @@ def test_wpas_ctrl_data_test(dev, apdev):
finally:
dev[0].request("DATA_TEST_CONFIG 0")
cmds = [ "",
cmds = ["",
"00",
"00112233445566778899aabbccdde",
"00112233445566778899aabbccdq" ]
"00112233445566778899aabbccdq"]
for cmd in cmds:
if "FAIL" not in dev[0].request("DATA_TEST_FRAME " + cmd):
raise Exception("Invalid DATA_TEST_FRAME command accepted: " + cmd)
@ -1412,30 +1412,30 @@ def test_wpas_ctrl_vendor_elem(dev, apdev):
"""wpa_supplicant ctrl_iface VENDOR_ELEM"""
if "OK" not in dev[0].request("VENDOR_ELEM_ADD 1 "):
raise Exception("VENDOR_ELEM_ADD failed")
cmds = [ "-1 ",
cmds = ["-1 ",
"255 ",
"1",
"1 123",
"1 12qq34" ]
"1 12qq34"]
for cmd in cmds:
if "FAIL" not in dev[0].request("VENDOR_ELEM_ADD " + cmd):
raise Exception("Invalid VENDOR_ELEM_ADD command accepted: " + cmd)
cmds = [ "-1 ",
"255 " ]
cmds = ["-1 ",
"255 "]
for cmd in cmds:
if "FAIL" not in dev[0].request("VENDOR_ELEM_GET " + cmd):
raise Exception("Invalid VENDOR_ELEM_GET command accepted: " + cmd)
dev[0].request("VENDOR_ELEM_REMOVE 1 *")
cmds = [ "-1 ",
cmds = ["-1 ",
"255 ",
"1",
"1",
"1 123",
"1 12qq34",
"1 12",
"1 0000" ]
"1 0000"]
for cmd in cmds:
if "FAIL" not in dev[0].request("VENDOR_ELEM_REMOVE " + cmd):
raise Exception("Invalid VENDOR_ELEM_REMOVE command accepted: " + cmd)
@ -1443,13 +1443,13 @@ def test_wpas_ctrl_vendor_elem(dev, apdev):
dev[0].request("VENDOR_ELEM_ADD 1 000100")
if "OK" not in dev[0].request("VENDOR_ELEM_REMOVE 1 "):
raise Exception("VENDOR_ELEM_REMOVE failed")
cmds = [ "-1 ",
cmds = ["-1 ",
"255 ",
"1",
"1 123",
"1 12qq34",
"1 12",
"1 0000" ]
"1 0000"]
for cmd in cmds:
if "FAIL" not in dev[0].request("VENDOR_ELEM_REMOVE " + cmd):
raise Exception("Invalid VENDOR_ELEM_REMOVE command accepted: " + cmd)
@ -1493,7 +1493,7 @@ def test_wpas_ctrl_dump(dev, apdev):
def test_wpas_ctrl_interface_add(dev, apdev):
"""wpa_supplicant INTERFACE_ADD/REMOVE with vif creation/removal"""
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")
hwsim_utils.test_connectivity(dev[0], hapd)
@ -1508,7 +1508,7 @@ def test_wpas_ctrl_interface_add(dev, apdev):
def test_wpas_ctrl_interface_add_sta(dev, apdev):
"""wpa_supplicant INTERFACE_ADD/REMOVE with STA vif creation/removal"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
ifname = "test-" + dev[0].ifname
dev[0].interface_add(ifname, create=True, if_type='sta')
wpas = WpaSupplicant(ifname=ifname)
@ -1558,7 +1558,7 @@ def test_wpas_ctrl_interface_add_many(dev, apdev):
dev[0].global_request("INTERFACE_REMOVE " + ifname)
def _test_wpas_ctrl_interface_add_many(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")
hwsim_utils.test_connectivity(dev[0], hapd)
dev[0].dump_monitor()
@ -1587,7 +1587,7 @@ def test_wpas_ctrl_interface_add2(dev, apdev):
subprocess.call(['iw', 'dev', ifname, 'del'])
def _test_wpas_ctrl_interface_add2(dev, apdev, ifname):
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")
hwsim_utils.test_connectivity(dev[0], hapd)
@ -1616,17 +1616,17 @@ def test_wpas_ctrl_wait(dev, apdev, test_params):
'alt-wpa_supplicant/wpa_supplicant/wpa_supplicant')
if not os.path.exists(prg):
prg = '../../wpa_supplicant/wpa_supplicant'
arg = [ prg ]
arg = [prg]
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE)
out = cmd.communicate()[0].decode()
cmd.wait()
tracing = "Linux tracing" in out
with HWSimRadio() as (radio, iface):
arg = [ prg, '-BdddW', '-P', pidfile, '-f', logfile,
'-Dnl80211', '-c', conffile, '-i', iface ]
arg = [prg, '-BdddW', '-P', pidfile, '-f', logfile,
'-Dnl80211', '-c', conffile, '-i', iface]
if tracing:
arg += [ '-T' ]
arg += ['-T']
logger.info("Start wpa_supplicant: " + str(arg))
subprocess.call(arg)
wpas = WpaSupplicant(ifname=iface)
@ -1636,7 +1636,7 @@ def test_wpas_ctrl_wait(dev, apdev, test_params):
raise Exception("PID file not created")
if "OK" not in wpas.request("TERMINATE"):
raise Exception("Could not TERMINATE")
ev = wpas.wait_event([ "CTRL-EVENT-TERMINATING" ], timeout=2)
ev = wpas.wait_event(["CTRL-EVENT-TERMINATING"], timeout=2)
if ev is None:
raise Exception("No termination event received")
for i in range(20):
@ -1658,7 +1658,7 @@ def test_wpas_ctrl_oom(dev):
def _test_wpas_ctrl_oom(dev):
dev[0].request('VENDOR_ELEM_ADD 2 000100')
tests = [ ('DRIVER_EVENT AVOID_FREQUENCIES 2412', 'FAIL',
tests = [('DRIVER_EVENT AVOID_FREQUENCIES 2412', 'FAIL',
1, 'freq_range_list_parse'),
('P2P_SET disallow_freq 2412', 'FAIL',
1, 'freq_range_list_parse'),
@ -1773,22 +1773,22 @@ def _test_wpas_ctrl_oom(dev):
('AUTOSCAN periodic:1', 'FAIL',
1, 'wpa_supplicant_ctrl_iface_autoscan'),
('PING', None,
1, 'wpa_supplicant_ctrl_iface_process') ]
1, 'wpa_supplicant_ctrl_iface_process')]
tls = dev[0].request("GET tls_library")
if not tls.startswith("internal"):
tests.append(('NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG', 'FAIL',
4, 'wpas_ctrl_nfc_get_handover_sel_p2p'))
for cmd,exp,count,func in tests:
for cmd, exp, count, func in tests:
with alloc_fail(dev[0], count, func):
res = dev[0].request(cmd)
if exp and exp not in res:
raise Exception("Unexpected success for '%s' during OOM (%d:%s)" % (cmd, count, func))
tests = [ ('FOO', None,
tests = [('FOO', None,
1, 'wpa_supplicant_global_ctrl_iface_process'),
('IFNAME=notfound PING', 'FAIL\n',
1, 'wpas_global_ctrl_iface_ifname') ]
for cmd,exp,count,func in tests:
1, 'wpas_global_ctrl_iface_ifname')]
for cmd, exp, count, func in tests:
with alloc_fail(dev[0], count, func):
res = dev[0].global_request(cmd)
if exp and exp not in res:
@ -1797,15 +1797,15 @@ def _test_wpas_ctrl_oom(dev):
@remote_compatible
def test_wpas_ctrl_error(dev):
"""Various wpa_supplicant ctrl_iface error cases"""
tests = [ ('WPS_NFC_TOKEN NDEF', 'FAIL',
tests = [('WPS_NFC_TOKEN NDEF', 'FAIL',
1, 'wpa_supplicant_ctrl_iface_wps_nfc_token'),
('WPS_NFC_TOKEN NDEF', 'FAIL',
2, 'wpa_supplicant_ctrl_iface_wps_nfc_token'),
('NFC_GET_HANDOVER_REQ NDEF P2P-CR', None,
1, 'wpas_p2p_nfc_handover'),
('NFC_GET_HANDOVER_REQ NDEF P2P-CR', None,
1, 'wps_build_nfc_handover_req_p2p') ]
for cmd,exp,count,func in tests:
1, 'wps_build_nfc_handover_req_p2p')]
for cmd, exp, count, func in tests:
with fail_test(dev[0], count, func):
res = dev[0].request(cmd)
if exp and exp not in res:
@ -1904,7 +1904,7 @@ def test_wpas_ctrl_event_burst(dev, apdev):
total_i = 0
total_g = 0
for i in range(100):
(i,g) = dev[0].dump_monitor()
(i, g) = dev[0].dump_monitor()
total_i += i
total_g += g
logger.info("Received i=%d g=%d" % (i, g))
@ -1936,13 +1936,13 @@ def test_wpas_ctrl_sched_scan_plans(dev, apdev):
def test_wpas_ctrl_signal_monitor(dev, apdev):
"""wpa_supplicant SIGNAL_MONITOR 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")
dev[1].connect("open", key_mgmt="NONE", scan_freq="2412",
bgscan="simple:1:-45:2")
dev[2].connect("open", key_mgmt="NONE", scan_freq="2412")
tests = [ " THRESHOLD=-45", " THRESHOLD=-44 HYSTERESIS=5", "" ]
tests = [" THRESHOLD=-45", " THRESHOLD=-44 HYSTERESIS=5", ""]
try:
if "FAIL" in dev[2].request("SIGNAL_MONITOR THRESHOLD=-1 HYSTERESIS=5"):
raise Exception("SIGNAL_MONITOR command failed")
@ -1990,7 +1990,7 @@ def test_wpas_ctrl_driver_flags(dev, apdev):
def test_wpas_ctrl_bss_current(dev, apdev):
"""wpa_supplicant BSS CURRENT command"""
hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
bssid = hapd.own_addr()
res = dev[0].request("BSS CURRENT")
if res != '':
@ -2025,17 +2025,17 @@ def test_wpas_ctrl_set_tdls_trigger_control(dev):
def test_wpas_ctrl_set_sched_scan_relative_rssi(dev):
"""wpa_supplicant SET relative RSSI"""
tests = [ "relative_rssi -1",
tests = ["relative_rssi -1",
"relative_rssi 101",
"relative_band_adjust 2G",
"relative_band_adjust 2G:-101",
"relative_band_adjust 2G:101",
"relative_band_adjust 3G:1" ]
"relative_band_adjust 3G:1"]
for t in tests:
if "FAIL" not in dev[0].request("SET " + t):
raise Exception("No failure reported for SET " + t)
tests = [ "relative_rssi 0",
tests = ["relative_rssi 0",
"relative_rssi 10",
"relative_rssi disable",
"relative_band_adjust 2G:-1",
@ -2043,7 +2043,7 @@ def test_wpas_ctrl_set_sched_scan_relative_rssi(dev):
"relative_band_adjust 2G:1",
"relative_band_adjust 5G:-1",
"relative_band_adjust 5G:1",
"relative_band_adjust 5G:0" ]
"relative_band_adjust 5G:0"]
for t in tests:
if "OK" not in dev[0].request("SET " + t):
raise Exception("Failed to SET " + t)

View File

@ -273,8 +273,8 @@ def _test_mesh_open_rssi_threshold(dev, apdev, value, expected):
dev[0].mesh_group_add(id)
check_mesh_group_added(dev[0])
cmd = subprocess.Popen([ "iw", "dev", dev[0].ifname, "get", "mesh_param",
"mesh_rssi_threshold" ], stdout=subprocess.PIPE)
cmd = subprocess.Popen(["iw", "dev", dev[0].ifname, "get", "mesh_param",
"mesh_rssi_threshold"], stdout=subprocess.PIPE)
mesh_rssi_threshold = int(cmd.stdout.read().decode().split(" ")[0])
dev[0].mesh_group_remove()
@ -837,10 +837,10 @@ def test_wpas_mesh_max_peering(dev, apdev, params):
capfile = os.path.join(params['logdir'], "hwsim0.pcapng")
filt = "wlan.fc.type_subtype == 8"
out = run_tshark(capfile, filt, [ "wlan.sa", "wlan.mesh.config.cap" ])
out = run_tshark(capfile, filt, ["wlan.sa", "wlan.mesh.config.cap"])
pkts = out.splitlines()
one = [ 0, 0, 0 ]
zero = [ 0, 0, 0 ]
one = [0, 0, 0]
zero = [0, 0, 0]
all_cap_one = True
for pkt in pkts:
addr, cap = pkt.split('\t')
@ -869,9 +869,9 @@ def test_wpas_mesh_max_peering(dev, apdev, params):
#
# For now, assume the capability field ends up being the last octet of
# the frame.
one = [ 0, 0, 0 ]
zero = [ 0, 0, 0 ]
addrs = [ addr0, addr1, addr2 ]
one = [0, 0, 0]
zero = [0, 0, 0]
addrs = [addr0, addr1, addr2]
for idx in range(3):
addr = addrs[idx]
out = run_tshark_json(capfile, filt + " && wlan.sa == " + addr)
@ -941,10 +941,10 @@ def _test_wpas_mesh_open_5ghz_coex(dev, apdev):
# Start a 20 MHz BSS on channel 40 that would be the secondary channel of
# HT40+ mesh on channel 36.
params = { "ssid": "test-ht40",
params = {"ssid": "test-ht40",
"hw_mode": "a",
"channel": "40",
"country_code": "US" }
"country_code": "US"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
@ -1413,7 +1413,7 @@ def test_wpas_mesh_gate_forwarding(dev, apdev, p):
filt = "wlan.sa==%s && wlan_mgt.fixed.mesh_addr5==%s" % (addr2,
external_sta)
for i in range(15):
da = run_tshark(capfile, filt, [ "wlan.da" ])
da = run_tshark(capfile, filt, ["wlan.da"])
if addr0 in da and addr1 in da:
logger.debug("Frames seen in tshark iteration %d" % i)
break
@ -1679,13 +1679,13 @@ def test_wpas_mesh_pmksa_caching_ext(dev, apdev):
if "FAIL" not in res:
raise Exception("MESH_PMKSA_GET accepted when not in mesh")
tests = [ "foo",
tests = ["foo",
"02:02:02:02:02:02",
"02:02:02:02:02:02 q",
"02:02:02:02:02:02 c3d51a7ccfca0c6d5287291a7169d79b",
"02:02:02:02:02:02 c3d51a7ccfca0c6d5287291a7169d79b q",
"02:02:02:02:02:02 c3d51a7ccfca0c6d5287291a7169d79b 1bed4fa22ece7997ca1bdc8b829019fe63acac91cba3405522c24c91f7cfb49f",
"02:02:02:02:02:02 c3d51a7ccfca0c6d5287291a7169d79b 1bed4fa22ece7997ca1bdc8b829019fe63acac91cba3405522c24c91f7cfb49f q" ]
"02:02:02:02:02:02 c3d51a7ccfca0c6d5287291a7169d79b 1bed4fa22ece7997ca1bdc8b829019fe63acac91cba3405522c24c91f7cfb49f q"]
for t in tests:
if "FAIL" not in dev[1].request("MESH_PMKSA_ADD " + t):
raise Exception("Invalid MESH_PMKSA_ADD accepted")
@ -1845,14 +1845,14 @@ def test_mesh_sae_failure(dev, apdev):
dev[0].request("SET sae_groups ")
dev[1].request("SET sae_groups ")
funcs = [ (1, "=mesh_rsn_auth_sae_sta", True),
funcs = [(1, "=mesh_rsn_auth_sae_sta", True),
(1, "mesh_rsn_build_sae_commit;mesh_rsn_auth_sae_sta", False),
(1, "auth_sae_init_committed;mesh_rsn_auth_sae_sta", True),
(1, "=mesh_rsn_protect_frame", True),
(2, "=mesh_rsn_protect_frame", True),
(1, "aes_siv_encrypt;mesh_rsn_protect_frame", True),
(1, "=mesh_rsn_process_ampe", True),
(1, "aes_siv_decrypt;mesh_rsn_process_ampe", True) ]
(1, "aes_siv_decrypt;mesh_rsn_process_ampe", True)]
for count, func, success in funcs:
id = add_mesh_secure_net(dev[0])
dev[0].mesh_group_add(id)
@ -1875,8 +1875,8 @@ def test_mesh_failure(dev, apdev):
"""Mesh and local failures"""
check_mesh_support(dev[0])
funcs = [ (1, "ap_sta_add;mesh_mpm_add_peer", True),
(1, "wpabuf_alloc;mesh_mpm_send_plink_action", True) ]
funcs = [(1, "ap_sta_add;mesh_mpm_add_peer", True),
(1, "wpabuf_alloc;mesh_mpm_send_plink_action", True)]
for count, func, success in funcs:
add_open_mesh_network(dev[0])
@ -1893,7 +1893,7 @@ def test_mesh_failure(dev, apdev):
check_mesh_group_removed(dev[0])
check_mesh_group_removed(dev[1])
funcs = [ (1, "mesh_mpm_init_link", True) ]
funcs = [(1, "mesh_mpm_init_link", True)]
for count, func, success in funcs:
add_open_mesh_network(dev[0])
@ -1939,8 +1939,8 @@ def test_mesh_default_beacon_int(dev, apdev):
def test_mesh_scan_parse_error(dev, apdev):
"""Mesh scan element parse error"""
check_mesh_support(dev[0])
params = { "ssid": "open",
"beacon_int": "2000" }
params = {"ssid": "open",
"beacon_int": "2000"}
hapd = hostapd.add_ap(apdev[0], params)
bssid = apdev[0]['bssid']
hapd.set('vendor_elements', 'dd0201')

View File

@ -15,10 +15,10 @@ import hostapd
from utils import fail_test
def add_wmm_ap(apdev, acm_list):
params = { "ssid": "wmm_ac",
params = {"ssid": "wmm_ac",
"hw_mode": "g",
"channel": "11",
"wmm_enabled" : "1"}
"wmm_enabled": "1"}
for ac in acm_list:
params["wmm_ac_%s_acm" % (ac.lower())] = "1"
@ -220,10 +220,10 @@ def test_tspec_protocol(dev, apdev):
@remote_compatible
def test_tspec_not_enabled(dev, apdev):
"""addts failing if AP does not support WMM"""
params = { "ssid": "wmm_no_ac",
params = {"ssid": "wmm_no_ac",
"hw_mode": "g",
"channel": "11",
"wmm_enabled" : "0" }
"wmm_enabled": "0"}
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect("wmm_no_ac", key_mgmt="NONE", scan_freq="2462")
status = dev[0].request("WMM_AC_STATUS")
@ -298,7 +298,7 @@ def test_wmm_element(dev, apdev):
dev[0].request("VENDOR_ELEM_REMOVE 13 *")
def run_wmm_element(dev, apdev):
params = { "ssid": "wmm" }
params = {"ssid": "wmm"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()
@ -349,10 +349,10 @@ def test_tspec_ap_parsing(dev, apdev):
dev[0].connect("wmm_ac", key_mgmt="NONE", scan_freq="2462")
addr = dev[0].own_addr()
tests = [ "WMM_AC_ADDTS downlink tsid=5 up=6 nominal_msdu_size=1500 sba=9000 mean_data_rate=1500 min_phy_rate=600000",
tests = ["WMM_AC_ADDTS downlink tsid=5 up=6 nominal_msdu_size=1500 sba=9000 mean_data_rate=1500 min_phy_rate=600000",
"WMM_AC_ADDTS downlink tsid=5 up=6 nominal_msdu_size=1500 sba=8192 mean_data_rate=1500 min_phy_rate=6000000",
"WMM_AC_ADDTS downlink tsid=5 up=6 nominal_msdu_size=32767 sba=65535 mean_data_rate=1500 min_phy_rate=1000000",
"WMM_AC_ADDTS downlink tsid=5 up=6 nominal_msdu_size=10000 sba=65535 mean_data_rate=2147483647 min_phy_rate=1000000" ]
"WMM_AC_ADDTS downlink tsid=5 up=6 nominal_msdu_size=10000 sba=65535 mean_data_rate=2147483647 min_phy_rate=1000000"]
for t in tests:
if "OK" not in dev[0].request(t):
raise Exception("WMM_AC_ADDTS failed")
@ -362,13 +362,13 @@ def test_tspec_ap_parsing(dev, apdev):
tests = []
# WMM: Invalid Nominal MSDU Size (0)
tests += [ "11000400dd3d0050f2020201aa300000000000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000040420f00ffff0000" ]
tests += ["11000400dd3d0050f2020201aa300000000000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000040420f00ffff0000"]
# hostapd_wmm_action - missing or wrong length tspec
tests += [ "11000400dd3e0050f2020201aa300010270000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000040420f00ffff000000" ]
tests += ["11000400dd3e0050f2020201aa300010270000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000040420f00ffff000000"]
# hostapd_wmm_action - could not parse wmm action
tests += [ "11000400dd3d0050f2020201aa300010270000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000040420f00ffff00" ]
tests += ["11000400dd3d0050f2020201aa300010270000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000040420f00ffff00"]
# valid form
tests += [ "11000400dd3d0050f2020201aa300010270000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000040420f00ffff0000" ]
tests += ["11000400dd3d0050f2020201aa300010270000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000040420f00ffff0000"]
hdr = "d0003a01" + bssid.replace(':', '') + addr.replace(':', '') + bssid.replace(':', '') + "1000"
hapd.set("ext_mgmt_frame_handling", "1")
@ -380,7 +380,7 @@ def test_tspec_ap_parsing(dev, apdev):
def test_wmm_disabled(dev, apdev):
"""WMM disabled and unexpected TSPEC"""
params = { "ssid": "no-wmm", "ieee80211n": "0", "wmm_enabled": "0" }
params = {"ssid": "no-wmm", "ieee80211n": "0", "wmm_enabled": "0"}
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = hapd.own_addr()
dev[0].connect("no-wmm", key_mgmt="NONE", scan_freq="2412")

View File

@ -28,8 +28,8 @@ def _run_tshark(filename, filter, display=None, wait=True):
time.sleep(0.1)
try:
arg = [ "tshark", "-r", filename,
_tshark_filter_arg, filter ]
arg = ["tshark", "-r", filename,
_tshark_filter_arg, filter]
if display:
arg.append('-Tfields')
for d in display:
@ -102,8 +102,8 @@ def run_tshark(filename, filter, display=None, wait=True):
wait)
def run_tshark_json(filename, filter):
arg = [ "tshark", "-r", filename,
_tshark_filter_arg, filter ]
arg = ["tshark", "-r", filename,
_tshark_filter_arg, filter]
arg.append('-Tjson')
arg.append('-x')
try:

View File

@ -112,7 +112,7 @@ def parse_ie(buf):
ret = {}
data = binascii.unhexlify(buf)
while len(data) >= 2:
ie,elen = struct.unpack('BB', data[0:2])
ie, elen = struct.unpack('BB', data[0:2])
data = data[2:]
if elen > len(data):
break

View File

@ -19,7 +19,7 @@ import errno
logger = logging.getLogger()
# Test cases that take significantly longer time to execute than average.
long_tests = [ "ap_roam_open",
long_tests = ["ap_roam_open",
"wpas_mesh_password_mismatch_retry",
"wpas_mesh_password_mismatch",
"hostapd_oom_wpa2_psk_connect",
@ -77,7 +77,7 @@ long_tests = [ "ap_roam_open",
"p2p_go_move_scm",
"p2p_go_move_scm_peer_supports",
"p2p_go_move_scm_peer_does_not_support",
"p2p_go_move_scm_multi" ]
"p2p_go_move_scm_multi"]
def get_failed(vm):
failed = []
@ -389,9 +389,9 @@ def main():
debug_level = logging.DEBUG
extra_args = []
if args.valgrind:
extra_args += [ '--valgrind' ]
extra_args += ['--valgrind']
if args.long:
extra_args += [ '--long' ]
extra_args += ['--long']
if args.codecov:
print("Code coverage - build separate binaries")
logdir = os.path.join(dir, str(timestamp))
@ -409,10 +409,9 @@ def main():
tests = args.params
else:
tests = []
cmd = [ os.path.join(os.path.dirname(scriptsdir), 'run-tests.py'),
'-L' ]
cmd = [os.path.join(os.path.dirname(scriptsdir), 'run-tests.py'), '-L']
if args.testmodules:
cmd += [ "-f" ]
cmd += ["-f"]
cmd += args.testmodules
lst = subprocess.Popen(cmd, stdout=subprocess.PIPE)
for l in lst.stdout.readlines():
@ -454,7 +453,7 @@ def main():
'--ext', 'srv.%d' % (i + 1),
'-i'] + codecov_args + extra_args
if args.telnet:
cmd += [ '--telnet', str(args.telnet + i) ]
cmd += ['--telnet', str(args.telnet + i)]
vm[i] = {}
vm[i]['first_run_done'] = False
vm[i]['proc'] = subprocess.Popen(cmd,
@ -466,7 +465,7 @@ def main():
vm[i]['err'] = ""
vm[i]['failed'] = []
vm[i]['fail_seq'] = []
for stream in [ vm[i]['proc'].stdout, vm[i]['proc'].stderr ]:
for stream in [vm[i]['proc'].stdout, vm[i]['proc'].stderr]:
fd = stream.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)

View File

@ -241,4 +241,4 @@ class Wlantest:
for tid in range(0, 17):
tx[tid] = self.get_tx_tid(bssid, addr, tid)
rx[tid] = self.get_rx_tid(bssid, addr, tid)
return [ tx, rx ]
return [tx, rx]

View File

@ -323,7 +323,7 @@ class WpaSupplicant:
for l in lines:
if "network id" in l:
continue
[id,ssid,bssid,flags] = l.split('\t')
[id, ssid, bssid, flags] = l.split('\t')
network = {}
network['id'] = id
network['ssid'] = ssid
@ -376,20 +376,20 @@ class WpaSupplicant:
def add_cred_values(self, params):
id = self.add_cred()
quoted = [ "realm", "username", "password", "domain", "imsi",
quoted = ["realm", "username", "password", "domain", "imsi",
"excluded_ssid", "milenage", "ca_cert", "client_cert",
"private_key", "domain_suffix_match", "provisioning_sp",
"roaming_partner", "phase1", "phase2", "private_key_passwd",
"roaming_consortiums" ]
"roaming_consortiums"]
for field in quoted:
if field in params:
self.set_cred_quoted(id, field, params[field])
not_quoted = [ "eap", "roaming_consortium", "priority",
not_quoted = ["eap", "roaming_consortium", "priority",
"required_roaming_consortium", "sp_priority",
"max_bss_load", "update_identifier", "req_conn_capab",
"min_dl_bandwidth_home", "min_ul_bandwidth_home",
"min_dl_bandwidth_roaming", "min_ul_bandwidth_roaming" ]
"min_dl_bandwidth_roaming", "min_ul_bandwidth_roaming"]
for field in not_quoted:
if field in params:
self.set_cred(id, field, params[field])
@ -436,7 +436,7 @@ class WpaSupplicant:
vals = dict()
for l in lines:
try:
[name,value] = l.split('=', 1)
[name, value] = l.split('=', 1)
vals[name] = value
except ValueError as e:
logger.info(self.ifname + ": Ignore unexpected STATUS line: " + l)
@ -458,7 +458,7 @@ class WpaSupplicant:
vals = dict()
for l in lines:
try:
[name,value] = l.split('=', 1)
[name, value] = l.split('=', 1)
except ValueError:
logger.info(self.ifname + ": Ignore unexpected status line: " + l)
continue
@ -482,7 +482,7 @@ class WpaSupplicant:
vals = dict()
for l in lines:
try:
[name,value] = l.split('=', 1)
[name, value] = l.split('=', 1)
except ValueError:
logger.info(self.ifname + ": Ignore unexpected status-driver line: " + l)
continue
@ -505,7 +505,7 @@ class WpaSupplicant:
vals = dict()
for l in lines:
try:
[name,value] = l.split('=', 1)
[name, value] = l.split('=', 1)
vals[name] = value
except ValueError as e:
logger.info(self.ifname + ": Ignore unexpected MIB line: " + l)
@ -589,7 +589,7 @@ class WpaSupplicant:
vals = dict()
for l in lines:
if '=' in l:
[name,value] = l.split('=', 1)
[name, value] = l.split('=', 1)
vals[name] = value
return vals
@ -994,19 +994,19 @@ class WpaSupplicant:
elif ssid2:
self.set_network(id, "ssid", ssid2)
quoted = [ "psk", "identity", "anonymous_identity", "password",
quoted = ["psk", "identity", "anonymous_identity", "password",
"ca_cert", "client_cert", "private_key",
"private_key_passwd", "ca_cert2", "client_cert2",
"private_key2", "phase1", "phase2", "domain_suffix_match",
"altsubject_match", "subject_match", "pac_file", "dh_file",
"bgscan", "ht_mcs", "id_str", "openssl_ciphers",
"domain_match", "dpp_connector", "sae_password",
"sae_password_id", "check_cert_subject" ]
"sae_password_id", "check_cert_subject"]
for field in quoted:
if field in kwargs and kwargs[field]:
self.set_network_quoted(id, field, kwargs[field])
not_quoted = [ "proto", "key_mgmt", "ieee80211w", "pairwise",
not_quoted = ["proto", "key_mgmt", "ieee80211w", "pairwise",
"group", "wep_key0", "wep_key1", "wep_key2", "wep_key3",
"wep_tx_keyidx", "scan_freq", "freq_list", "eap",
"eapol_flags", "fragment_size", "scan_ssid", "auth_alg",
@ -1021,7 +1021,7 @@ class WpaSupplicant:
"dpp_netaccesskey", "dpp_netaccesskey_expiry",
"group_mgmt", "owe_group",
"roaming_consortium_selection", "ocv",
"multi_ap_backhaul_sta", "rx_stbc", "tx_stbc" ]
"multi_ap_backhaul_sta", "rx_stbc", "tx_stbc"]
for field in not_quoted:
if field in kwargs and kwargs[field]:
self.set_network(id, field, kwargs[field])
@ -1191,7 +1191,7 @@ class WpaSupplicant:
lines = res.splitlines()
vals = dict()
for l in lines:
[name,value] = l.split('=', 1)
[name, value] = l.split('=', 1)
vals[name] = value
if len(vals) == 0:
return None
@ -1205,10 +1205,10 @@ class WpaSupplicant:
continue
vals = dict()
try:
[index,aa,pmkid,expiration,opportunistic] = l.split(' ')
[index, aa, pmkid, expiration, opportunistic] = l.split(' ')
cache_id = None
except ValueError:
[index,aa,pmkid,expiration,opportunistic,cache_id] = l.split(' ')
[index, aa, pmkid, expiration, opportunistic, cache_id] = l.split(' ')
vals['index'] = index
vals['pmkid'] = pmkid
vals['expiration'] = expiration
@ -1234,7 +1234,7 @@ class WpaSupplicant:
vals['addr'] = l
first = False
else:
[name,value] = l.split('=', 1)
[name, value] = l.split('=', 1)
vals[name] = value
return vals
@ -1244,17 +1244,17 @@ class WpaSupplicant:
return None
msg = {}
items = ev.split(' ')
field,val = items[1].split('=')
field, val = items[1].split('=')
if field != "freq":
raise Exception("Unexpected MGMT-RX event format: " + ev)
msg['freq'] = val
field,val = items[2].split('=')
field, val = items[2].split('=')
if field != "datarate":
raise Exception("Unexpected MGMT-RX event format: " + ev)
msg['datarate'] = val
field,val = items[3].split('=')
field, val = items[3].split('=')
if field != "ssi_signal":
raise Exception("Unexpected MGMT-RX event format: " + ev)
msg['ssi_signal'] = val
@ -1303,7 +1303,7 @@ class WpaSupplicant:
lines = res.splitlines()
vals = dict()
for l in lines:
[name,value] = l.split('=', 1)
[name, value] = l.split('=', 1)
vals[name] = value
return vals

View File

@ -16,7 +16,7 @@ logger = logging.getLogger()
# You can put your settings in cfg.py file with setup_params, devices
# definitions in the format as below. In other case HWSIM cfg will be used.
#
setup_params = { "setup_hw" : "./tests/setup_hw.sh",
setup_params = {"setup_hw" : "./tests/setup_hw.sh",
"hostapd" : "./tests/hostapd",
"wpa_supplicant" : "./tests/wpa_supplicant",
"iperf" : "iperf",
@ -28,7 +28,7 @@ setup_params = { "setup_hw" : "./tests/setup_hw.sh",
"trace_start" : "./tests/trace_start.sh",
"trace_stop" : "./tests/trace_stop.sh",
"perf_start" : "./tests/perf_start.sh",
"perf_stop" : "./tests/perf_stop.sh" }
"perf_stop" : "./tests/perf_stop.sh"}
#
#devices = [{"hostname": "192.168.254.58", "ifname" : "wlan0", "port": "9877", "name" : "t2-ath9k", "flags" : "AP_HT40 STA_HT40"},

View File

@ -30,10 +30,10 @@ def create(devices, setup_params, refs, duts, monitors):
if dev is None:
continue
host = Host(host = dev['hostname'],
ifname = dev['ifname'],
port = dev['port'],
name = dev['name'])
host = Host(host=dev['hostname'],
ifname=dev['ifname'],
port=dev['port'],
name=dev['name'])
try:
host.execute(["iw", "reg", "set", setup_params['country']])
@ -145,8 +145,8 @@ def get_monitor_params(wpa, is_p2p=False):
get_status_field_f = wpa.get_status_field
freq = get_status_field_f("freq")
bw = "20"
center_freq1=""
center_freq2=""
center_freq1 = ""
center_freq2 = ""
vht_oper_chwidth = get_status_field_f("vht_oper_chwidth")
secondary_channel = get_status_field_f("secondary_channel")
@ -173,9 +173,9 @@ def get_monitor_params(wpa, is_p2p=False):
else:
pass
monitor_params = { "freq" : freq,
monitor_params = {"freq" : freq,
"bw" : bw,
"center_freq1" : center_freq1,
"center_freq2" : center_freq2 }
"center_freq2" : center_freq2}
return monitor_params

View File

@ -161,7 +161,7 @@ def main():
if m:
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]))
@ -173,7 +173,7 @@ def main():
if m:
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_"):
hwsim_tests.append(val)

Some files were not shown because too many files have changed in this diff Show More