aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2017-01-08 15:12:55 (GMT)
committerJouni Malinen <j@w1.fi>2017-01-08 15:12:55 (GMT)
commitc1c938335e9b54d59212a55a350262bee175b0b3 (patch)
tree6f9ab56049931dd6096480813a6560a7d76a43bd /tests
parentb2442f2568f5bb881ff12e46c20cde53a15c0c8c (diff)
downloadhostap-c1c938335e9b54d59212a55a350262bee175b0b3.zip
hostap-c1c938335e9b54d59212a55a350262bee175b0b3.tar.gz
hostap-c1c938335e9b54d59212a55a350262bee175b0b3.tar.bz2
tests: TDLS and tdls_external_control
Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_ap_tdls.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py
index 4964dee..1213faa 100644
--- a/tests/hwsim/test_ap_tdls.py
+++ b/tests/hwsim/test_ap_tdls.py
@@ -569,3 +569,50 @@ def test_ap_tdls_chan_switch_prohibit(dev, apdev):
wlantest_setup(hapd)
connect_2sta_open(dev, hapd)
setup_tdls(dev[0], dev[1], hapd)
+
+def test_ap_open_tdls_external_control(dev, apdev):
+ """TDLS and tdls_external_control"""
+ try:
+ _test_ap_open_tdls_external_control(dev, apdev)
+ finally:
+ dev[0].set("tdls_external_control", "0")
+
+def _test_ap_open_tdls_external_control(dev, apdev):
+ hapd = hostapd.add_ap(apdev[0], { "ssid": "test-open" })
+ dev[0].connect("test-open", key_mgmt="NONE", scan_freq="2412")
+ dev[1].connect("test-open", key_mgmt="NONE", scan_freq="2412")
+ addr0 = dev[0].own_addr()
+ addr1 = dev[1].own_addr()
+
+ dev[0].set("tdls_external_control", "1")
+ if "FAIL" in dev[0].request("TDLS_SETUP " + addr1):
+ # tdls_external_control not supported; try without it
+ dev[0].set("tdls_external_control", "0")
+ if "FAIL" in dev[0].request("TDLS_SETUP " + addr1):
+ raise Exception("TDLS_SETUP failed")
+ connected = False
+ for i in range(50):
+ res0 = dev[0].request("TDLS_LINK_STATUS " + addr1)
+ res1 = dev[1].request("TDLS_LINK_STATUS " + addr0)
+ if "TDLS link status: connected" in res0 and "TDLS link status: connected" in res1:
+ connected = True
+ break
+ time.sleep(0.1)
+ if not connected:
+ raise Exception("TDLS setup did not complete")
+
+ dev[0].set("tdls_external_control", "1")
+ if "FAIL" in dev[0].request("TDLS_TEARDOWN " + addr1):
+ # tdls_external_control not supported; try without it
+ dev[0].set("tdls_external_control", "0")
+ if "FAIL" in dev[0].request("TDLS_TEARDOWN " + addr1):
+ raise Exception("TDLS_TEARDOWN failed")
+ for i in range(50):
+ res0 = dev[0].request("TDLS_LINK_STATUS " + addr1)
+ res1 = dev[1].request("TDLS_LINK_STATUS " + addr0)
+ if "TDLS link status: connected" not in res0 and "TDLS link status: connected" not in res1:
+ connected = False
+ break
+ time.sleep(0.1)
+ if connected:
+ raise Exception("TDLS teardown did not complete")