From 77835ae9dd309d84b697ecf05a5a5b530e8e077a Mon Sep 17 00:00:00 2001 From: Arik Nemtsov Date: Mon, 29 Sep 2014 20:47:54 +0200 Subject: [PATCH] tests: Verify TDLS responder teardown in encrypted network 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 --- 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 7cbcca921..55f89f6a1 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)