tests: ctrl_iface STA-FIRST and STA-NEXT iteration
Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
cddc19e56b
commit
cce26eb411
2 changed files with 20 additions and 6 deletions
|
@ -200,11 +200,14 @@ class Hostapd:
|
||||||
hdr = struct.pack('<HH6B6B6BH', *t)
|
hdr = struct.pack('<HH6B6B6BH', *t)
|
||||||
self.request("MGMT_TX " + binascii.hexlify(hdr + msg['payload']))
|
self.request("MGMT_TX " + binascii.hexlify(hdr + msg['payload']))
|
||||||
|
|
||||||
def get_sta(self, addr, info=None):
|
def get_sta(self, addr, info=None, next=False):
|
||||||
if info:
|
cmd = "STA-NEXT " if next else "STA "
|
||||||
res = self.request("STA " + addr + " " + info)
|
if addr is None:
|
||||||
|
res = self.request("STA-FIRST")
|
||||||
|
elif info:
|
||||||
|
res = self.request(cmd + addr + " " + info)
|
||||||
else:
|
else:
|
||||||
res = self.request("STA " + addr)
|
res = self.request(cmd + addr)
|
||||||
lines = res.splitlines()
|
lines = res.splitlines()
|
||||||
vals = dict()
|
vals = dict()
|
||||||
first = True
|
first = True
|
||||||
|
|
|
@ -45,11 +45,22 @@ def test_ssid_32_octets(dev, apdev):
|
||||||
|
|
||||||
def test_ssid_utf8(dev, apdev):
|
def test_ssid_utf8(dev, apdev):
|
||||||
"""SSID with UTF8 encoding"""
|
"""SSID with UTF8 encoding"""
|
||||||
hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'testi-åäöÅÄÖ-testi',
|
hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'testi-åäöÅÄÖ-testi',
|
||||||
"utf8_ssid": "1" })
|
"utf8_ssid": "1" })
|
||||||
dev[0].connect("testi-åäöÅÄÖ-testi", key_mgmt="NONE", scan_freq="2412")
|
dev[0].connect("testi-åäöÅÄÖ-testi", key_mgmt="NONE", scan_freq="2412")
|
||||||
dev[1].connect(ssid2="74657374692dc3a5c3a4c3b6c385c384c3962d7465737469",
|
dev[1].connect(ssid2="74657374692dc3a5c3a4c3b6c385c384c3962d7465737469",
|
||||||
key_mgmt="NONE", scan_freq="2412")
|
key_mgmt="NONE", scan_freq="2412")
|
||||||
|
# verify ctrl_iface for coverage
|
||||||
|
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")
|
||||||
|
sta2 = hapd.get_sta(sta['addr'], next=True)
|
||||||
|
if sta2['addr'] not in addrs:
|
||||||
|
raise Exception("Unexpected STA2 address")
|
||||||
|
sta3 = hapd.get_sta(sta2['addr'], next=True)
|
||||||
|
if len(sta3) != 0:
|
||||||
|
raise Exception("Unexpected STA iteration result (did not stop)")
|
||||||
|
|
||||||
def test_ssid_hidden(dev, apdev):
|
def test_ssid_hidden(dev, apdev):
|
||||||
"""Hidden SSID"""
|
"""Hidden SSID"""
|
||||||
|
|
Loading…
Reference in a new issue