diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py index 1a3f337eb..70361c7a0 100644 --- a/tests/hwsim/test_ap_ft.py +++ b/tests/hwsim/test_ap_ft.py @@ -18,6 +18,7 @@ from tshark import run_tshark from utils import HwsimSkip, alloc_fail, fail_test, wait_fail_trigger, skip_with_fips, parse_ie from wlantest import Wlantest from test_ap_psk import check_mib, find_wpas_process, read_process_memory, verify_not_present, get_key_locations +from test_rrm import check_beacon_req def ft_base_rsn(): params = { "wpa": "2", @@ -2482,3 +2483,31 @@ def test_ap_ft_eap_sha384_over_ds(dev, apdev): run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True, eap=True, sha384=True) + +def test_ap_ft_roam_rrm(dev, apdev): + """WPA2-PSK-FT AP and radio measurement request""" + ssid = "test-ft" + passphrase="12345678" + + params = ft_params1(ssid=ssid, passphrase=passphrase) + params["rrm_beacon_report"] = "1" + hapd0 = hostapd.add_ap(apdev[0], params) + bssid0 = hapd0.own_addr() + + addr = dev[0].own_addr() + dev[0].connect(ssid, psk=passphrase, key_mgmt="FT-PSK", proto="WPA2", + scan_freq="2412") + check_beacon_req(hapd0, addr, 1) + + params = ft_params2(ssid=ssid, passphrase=passphrase) + params["rrm_beacon_report"] = "1" + hapd1 = hostapd.add_ap(apdev[1], params) + bssid1 = hapd1.own_addr() + + dev[0].scan_for_bss(bssid1, freq=2412) + dev[0].roam(bssid1) + check_beacon_req(hapd1, addr, 2) + + dev[0].scan_for_bss(bssid0, freq=2412) + dev[0].roam(bssid0) + check_beacon_req(hapd0, addr, 3) diff --git a/tests/hwsim/test_rrm.py b/tests/hwsim/test_rrm.py index eb1b67ba2..155ab32b7 100644 --- a/tests/hwsim/test_rrm.py +++ b/tests/hwsim/test_rrm.py @@ -1924,3 +1924,36 @@ def test_rrm_unexpected(dev, apdev): for t in tests: if "OK" not in hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr + t): raise Exception("MGMT_RX_PROCESS failed for " + t) + +def check_beacon_req(hapd, addr, idx): + request = "51000000000002ffffffffffff" + "020100" + token = hapd.request("REQ_BEACON " + addr + " " + request) + if "FAIL" in token: + raise Exception("REQ_BEACON failed (%d)" % idx) + ev = hapd.wait_event(["BEACON-RESP-RX"], timeout=10) + if ev is None: + raise Exception("Beacon report response not received (%d)" % idx) + +def test_rrm_reassociation(dev, apdev): + """Radio measurement request - reassociation""" + params = { "ssid": "rrm", "rrm_beacon_report": "1" } + hapd = hostapd.add_ap(apdev[0]['ifname'], params) + bssid = hapd.own_addr() + + addr = dev[0].own_addr() + dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412") + check_beacon_req(hapd, addr, 1) + + dev[0].request("REASSOCIATE") + dev[0].wait_connected() + check_beacon_req(hapd, addr, 1) + + hapd2 = hostapd.add_ap(apdev[1]['ifname'], params) + bssid2 = hapd2.own_addr() + dev[0].scan_for_bss(bssid2, freq=2412) + dev[0].roam(bssid2) + check_beacon_req(hapd2, addr, 2) + + dev[0].scan_for_bss(bssid, freq=2412) + dev[0].roam(bssid) + check_beacon_req(hapd, addr, 3)