tests: Venue URL ANQP-element with PMF

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2018-09-13 01:58:50 +03:00
parent 3ecb8a5203
commit bb2c25d0dc

View file

@ -1629,6 +1629,10 @@ def test_gas_anqp_venue_url(dev, apdev):
if ev is None:
raise Exception("GAS query timed out")
ev = dev[0].wait_event(["RX-VENUE-URL"], timeout=0.1)
if ev is not None:
raise Exception("Unexpected Venue URL indication without PMF")
bss = dev[0].get_bss(bssid)
if 'anqp_venue_name' not in bss:
@ -1700,6 +1704,57 @@ def test_gas_anqp_venue_url2(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_url_pmf(dev, apdev):
"""GAS/ANQP and Venue URL with PMF"""
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/"
params = { "ssid": "gas/anqp/pmf",
"wpa": "2",
"wpa_key_mgmt": "WPA-PSK",
"rsn_pairwise": "CCMP",
"wpa_passphrase": "12345678",
"ieee80211w": "2",
"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].connect("gas/anqp/pmf", psk="12345678", ieee80211w="2",
scan_freq="2412")
if "OK" not in dev[0].request("ANQP_GET " + bssid + " 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")
ev = dev[0].wait_event(["RX-VENUE-URL"], timeout=5)
if ev is None:
raise Exception("No Venue URL indication seen")
if "1 " + url1 not in ev:
raise Exception("Unexpected Venue URL information: " + ev)
ev = dev[0].wait_event(["RX-VENUE-URL"], timeout=5)
if ev is None:
raise Exception("No Venue URL indication seen (2)")
if "2 " + url2 not in ev:
raise Exception("Unexpected Venue URL information (2): " + ev)
def test_gas_anqp_capab_list(dev, apdev):
"""GAS/ANQP and Capability List ANQP-element"""
params = { "ssid": "gas/anqp",