tests: GAS/ANQP and Venue URL (hostapd venue_url)
Test the hostapd venue_url configuration parameter. In addition, fix the previous defined gas_anqp_venue_url test case to use correct encoding of the Venue URL ANQP-element payload (URLs were missing and Venue Number was off-by-one). Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
7e1d3ee963
commit
f68caa35e3
1 changed files with 56 additions and 2 deletions
|
@ -1608,8 +1608,8 @@ def test_gas_anqp_venue_url(dev, apdev):
|
|||
|
||||
url1 = "http://example.com/venue"
|
||||
url2 = "https://example.org/venue-info/"
|
||||
duple1 = struct.pack('BB', 1 + len(url1), 0)
|
||||
duple2 = struct.pack('BB', 1 + len(url2), 1)
|
||||
duple1 = struct.pack('BB', 1 + len(url1), 1) + url1
|
||||
duple2 = struct.pack('BB', 1 + len(url2), 2) + url2
|
||||
venue_url = binascii.hexlify(duple1 + duple2)
|
||||
|
||||
params = { "ssid": "gas/anqp",
|
||||
|
@ -1646,6 +1646,60 @@ def test_gas_anqp_venue_url(dev, apdev):
|
|||
if not bss['anqp_capability_list'].startswith(binascii.hexlify(ids)):
|
||||
raise Exception("Unexpected Capability List ANQP-element value: " + bss['anqp_capability_list'])
|
||||
|
||||
def test_gas_anqp_venue_url2(dev, apdev):
|
||||
"""GAS/ANQP and Venue URL (hostapd venue_url)"""
|
||||
venue_group = 1
|
||||
venue_type = 13
|
||||
venue_info = struct.pack('BB', venue_group, venue_type)
|
||||
lang1 = "eng"
|
||||
name1= "Example venue"
|
||||
lang2 = "fin"
|
||||
name2 = "Esimerkkipaikka"
|
||||
venue1 = struct.pack('B', len(lang1 + name1)) + lang1 + name1
|
||||
venue2 = struct.pack('B', len(lang2 + name2)) + lang2 + name2
|
||||
venue_name = binascii.hexlify(venue_info + venue1 + venue2)
|
||||
|
||||
url1 = "http://example.com/venue"
|
||||
url2 = "https://example.org/venue-info/"
|
||||
duple1 = struct.pack('BB', 1 + len(url1), 1) + url1
|
||||
duple2 = struct.pack('BB', 1 + len(url2), 2) + url2
|
||||
venue_url = binascii.hexlify(duple1 + duple2)
|
||||
|
||||
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 ] }
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
bssid = apdev[0]['bssid']
|
||||
|
||||
dev[0].scan_for_bss(bssid, freq="2412", force_scan=True)
|
||||
if "OK" not in dev[0].request("ANQP_GET " + bssid + " 257,258,277"):
|
||||
raise Exception("ANQP_GET command failed")
|
||||
|
||||
ev = dev[0].wait_event(["GAS-QUERY-DONE"], timeout=10)
|
||||
if ev is None:
|
||||
raise Exception("GAS query timed out")
|
||||
|
||||
bss = dev[0].get_bss(bssid)
|
||||
|
||||
if 'anqp_venue_name' not in bss:
|
||||
raise Exception("Venue Name ANQP-element not seen")
|
||||
if bss['anqp_venue_name'] != venue_name:
|
||||
raise Exception("Unexpected Venue Name ANQP-element value: " + bss['anqp_venue_name'])
|
||||
if 'anqp[277]' not in bss:
|
||||
raise Exception("Venue URL ANQP-element not seen")
|
||||
if bss['anqp[277]'] != venue_url:
|
||||
print venue_url
|
||||
raise Exception("Unexpected Venue URL ANQP-element value: " + bss['anqp[277]'])
|
||||
|
||||
if 'anqp_capability_list' not in bss:
|
||||
raise Exception("Capability List ANQP-element not seen")
|
||||
ids = struct.pack('<HHH', 257, 258, 277)
|
||||
if not bss['anqp_capability_list'].startswith(binascii.hexlify(ids)):
|
||||
raise Exception("Unexpected Capability List ANQP-element value: " + bss['anqp_capability_list'])
|
||||
|
||||
def test_gas_anqp_capab_list(dev, apdev):
|
||||
"""GAS/ANQP and Capability List ANQP-element"""
|
||||
params = { "ssid": "gas/anqp",
|
||||
|
|
Loading…
Reference in a new issue