[PATCH 4/4] tests: verify tdls responder teardown in encrypted network

Ilan Peer ilan.peer
Mon Sep 29 11:47:54 PDT 2014


From: Arik Nemtsov <arik at wizery.com>

Older mac80211 implementations did not set the link identifier
appropriately, resulting in an incorrect teardown packet being sent the
peer. wpa_s adds the FTE containing the MIC field calculated using
the correct link-identifier. This causes a MIC failure on the other side
and the teardown is discarded.
Verify this case is fixed by newer kernel and wpa_s code.

Signed-off-by: Arik Nemtsov <arikx.nemtsov at intel.com>
---
 tests/hwsim/test_ap_tdls.py |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py
index 7cbcca9..55f89f6 100644
--- a/tests/hwsim/test_ap_tdls.py
+++ b/tests/hwsim/test_ap_tdls.py
@@ -129,13 +129,16 @@ def setup_tdls(sta0, sta1, ap, reverse=False, expect_fail=False, allow_skip=Fals
     tdls_check_dl(sta0, sta1, bssid, addr0, addr1)
     check_connectivity(sta0, sta1, ap)
 
-def teardown_tdls(sta0, sta1, ap):
+def teardown_tdls(sta0, sta1, ap, responder=False):
     logger.info("Teardown TDLS")
     check_connectivity(sta0, sta1, ap)
     bssid = ap['bssid']
     addr0 = sta0.p2p_interface_addr()
     addr1 = sta1.p2p_interface_addr()
-    sta0.tdls_teardown(addr1)
+    if responder:
+        sta1.tdls_teardown(addr0)
+    else:
+        sta0.tdls_teardown(addr1)
     time.sleep(1)
     wt = Wlantest()
     teardown = wt.get_tdls_counter("teardown", bssid, addr0, addr1);
@@ -319,3 +322,11 @@ def test_ap_wpa2_tdls_bssid_mismatch(dev, apdev):
     finally:
         subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'ap-br0', 'down'])
         subprocess.call(['sudo', 'brctl', 'delbr', 'ap-br0'])
+
+def test_ap_wpa2_tdls_responder_teardown(dev, apdev):
+    """TDLS teardown from responder with WPA2-PSK AP"""
+    start_ap_wpa2_psk(apdev[0]['ifname'])
+    wlantest_setup()
+    connect_2sta_wpa2_psk(dev, apdev[0]['ifname'])
+    setup_tdls(dev[0], dev[1], apdev[0])
+    teardown_tdls(dev[0], dev[1], apdev[0], responder=True)
-- 
1.7.10.4




More information about the Hostap mailing list