From: Jouni Malinen Date: Thu, 24 Mar 2016 10:17:46 +0000 (+0200) Subject: tests: WNM BSS Transition Management and cfg80211 connect command X-Git-Tag: hostap_2_6~678 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb915d50fddc0d66834030734425bd5e93c67ce1;p=thirdparty%2Fhostap.git tests: WNM BSS Transition Management and cfg80211 connect command For now, this is not enforcing cfg80211 reassociation since the needed changes do not yet exist in the upstream kernel. Once those changes are accepted, the TODO note in the test case can be addressed. Signed-off-by: Jouni Malinen --- diff --git a/tests/hwsim/test_wnm.py b/tests/hwsim/test_wnm.py index 216066bd2..ba9bea8b5 100644 --- a/tests/hwsim/test_wnm.py +++ b/tests/hwsim/test_wnm.py @@ -12,6 +12,7 @@ logger = logging.getLogger() import subprocess import hostapd +from wpasupplicant import WpaSupplicant from utils import alloc_fail, wait_fail_trigger from wlantest import Wlantest @@ -1290,3 +1291,55 @@ def test_wnm_bss_tm_security_mismatch(dev, apdev): raise Exception("No BSS Transition Management Response") if "status_code=7" not in ev: raise Exception("Unexpected BSS transition request response: " + ev) + +def test_wnm_bss_tm_connect_cmd(dev, apdev): + """WNM BSS Transition Management and cfg80211 connect command""" + params = { "ssid": "test-wnm", + "hw_mode": "g", + "channel": "1", + "bss_transition": "1" } + hapd = hostapd.add_ap(apdev[0]['ifname'], params) + + params = { "ssid": "test-wnm", + "hw_mode": "g", + "channel": "11", + "bss_transition": "1" } + hapd2 = hostapd.add_ap(apdev[1]['ifname'], params) + + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add("wlan5", drv_params="force_connect_cmd=1") + + wpas.scan_for_bss(apdev[1]['bssid'], 2462) + + id = wpas.connect("test-wnm", key_mgmt="NONE", + bssid=apdev[0]['bssid'], scan_freq="2412") + wpas.set_network(id, "scan_freq", "") + wpas.set_network(id, "bssid", "") + + addr = wpas.own_addr() + wpas.dump_monitor() + + logger.info("Preferred Candidate List (matching neighbor for another BSS) without Disassociation Imminent") + if "OK" not in hapd.request("BSS_TM_REQ " + addr + " pref=1 abridged=1 valid_int=255 neighbor=" + apdev[1]['bssid'] + ",0x0000,115,36,7,0301ff"): + raise Exception("BSS_TM_REQ command failed") + ev = hapd.wait_event(['BSS-TM-RESP'], timeout=10) + if ev is None: + raise Exception("No BSS Transition Management Response") + if "status_code=0" not in ev: + raise Exception("BSS transition request was not accepted: " + ev) + if "target_bssid=" + apdev[1]['bssid'] not in ev: + raise Exception("Unexpected target BSS: " + ev) + ev = wpas.wait_event(["CTRL-EVENT-CONNECTED", + "CTRL-EVENT-DISCONNECTED"], timeout=10) + if ev is None: + raise Exception("No reassociation seen") + if "CTRL-EVENT-DISCONNECTED" in ev: + #TODO: Uncomment this once kernel side changes for Connect command + #reassociation are in upstream. + #raise Exception("Unexpected disconnection reported") + logger.info("Unexpected disconnection reported") + ev = wpas.wait_event(["CTRL-EVENT-CONNECTED"], timeout=10) + if ev is None: + raise Exception("No reassociation seen") + if apdev[1]['bssid'] not in ev: + raise Exception("Unexpected reassociation target: " + ev)