tests: ctrl_iface STA-FIRST and STA-NEXT iteration

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-01-31 23:12:38 +02:00
parent cddc19e56b
commit cce26eb411
2 changed files with 20 additions and 6 deletions

View file

@ -200,11 +200,14 @@ class Hostapd:
hdr = struct.pack('<HH6B6B6BH', *t)
self.request("MGMT_TX " + binascii.hexlify(hdr + msg['payload']))
def get_sta(self, addr, info=None):
if info:
res = self.request("STA " + addr + " " + info)
def get_sta(self, addr, info=None, next=False):
cmd = "STA-NEXT " if next else "STA "
if addr is None:
res = self.request("STA-FIRST")
elif info:
res = self.request(cmd + addr + " " + info)
else:
res = self.request("STA " + addr)
res = self.request(cmd + addr)
lines = res.splitlines()
vals = dict()
first = True

View file

@ -45,11 +45,22 @@ def test_ssid_32_octets(dev, apdev):
def test_ssid_utf8(dev, apdev):
"""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" })
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() ]
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):
"""Hidden SSID"""