aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2016-03-24 10:17:46 (GMT)
committerJouni Malinen <j@w1.fi>2016-03-25 10:11:59 (GMT)
commitfb915d50fddc0d66834030734425bd5e93c67ce1 (patch)
treee39b4c1d1861664c5f9cfc72ee21bd45a3243d73
parentb495500fb14d8f47f2b5c8ec46579f7f44593c7f (diff)
downloadhostap-fb915d50fddc0d66834030734425bd5e93c67ce1.zip
hostap-fb915d50fddc0d66834030734425bd5e93c67ce1.tar.gz
hostap-fb915d50fddc0d66834030734425bd5e93c67ce1.tar.bz2
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 <jouni@qca.qualcomm.com>
-rw-r--r--tests/hwsim/test_wnm.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/hwsim/test_wnm.py b/tests/hwsim/test_wnm.py
index 216066b..ba9bea8 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)