tests: AP and STA tracking with passive scan

Verify that Public Action frame from a STA is used to add a tracking
entry.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-09-05 20:29:01 +03:00
parent b308a304d4
commit 5c92d474e6

View file

@ -159,6 +159,63 @@ def _test_ap_track_sta_no_auth(dev, apdev):
raise Exception("No Neighbor Report element: " + ev)
dev[0].request("DISCONNECT")
def test_ap_track_sta_no_auth_passive(dev, apdev):
"""AP rejecting authentication from dualband STA on 2.4 GHz (passive)"""
try:
_test_ap_track_sta_no_auth_passive(dev, apdev)
finally:
subprocess.call(['iw', 'reg', 'set', '00'])
def _test_ap_track_sta_no_auth_passive(dev, apdev):
dev[0].flush_scan_cache()
params = { "ssid": "track",
"country_code": "US",
"hw_mode": "g",
"channel": "6",
"no_auth_if_seen_on": apdev[1]['ifname'] }
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
bssid = apdev[0]['bssid']
params = { "ssid": "track",
"country_code": "US",
"hw_mode": "a",
"channel": "40",
"interworking": "1",
"venue_name": "eng:Venue",
"track_sta_max_num": "100" }
hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
bssid2 = apdev[1]['bssid']
dev[0].scan_for_bss(bssid, freq=2437, force_scan=True)
for i in range(10):
dev[0].request("SCAN freq=5200 passive=1")
ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], timeout=5)
if ev is None:
raise Exception("Scan did not complete")
if dev[0].get_bss(bssid2):
break
if i == 9:
raise Exception("AP not found with passive scans")
if "OK" not in dev[0].request("ANQP_GET " + bssid2 + " 258"):
raise Exception("ANQP_GET command failed")
ev = dev[0].wait_event(["RX-ANQP"], timeout=1)
if ev is None or "Venue Name" not in ev:
raise Exception("Did not receive Venue Name")
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)
if ev is None:
raise Exception("Unknown connection result")
if "CTRL-EVENT-CONNECTED" in ev:
raise Exception("Unexpected connection")
if "status_code=82" not in ev:
raise Exception("Unexpected rejection reason: " + ev)
dev[0].request("DISCONNECT")
def test_ap_track_sta_force_5ghz(dev, apdev):
"""Dualband AP forcing dualband STA to connect on 5 GHz"""
try: