tests: Verify TDLS responder teardown in encrypted network
authorArik Nemtsov <arik@wizery.com>
Mon, 29 Sep 2014 18:47:54 +0000 (20:47 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 3 Oct 2014 08:53:31 +0000 (11:53 +0300)
Older mac80211 implementations did not set the link identifier
appropriately, resulting in an incorrect teardown packet being sent the
peer. wpa_supplicant 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_supplicant code.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
tests/hwsim/test_ap_tdls.py

index 7cbcca9..55f89f6 100644 (file)
@@ -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)