From 538da4f4d243164bccf0b8086199fe24d30b2090 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 5 Apr 2014 18:53:12 +0300 Subject: [PATCH] tests: TDLS setup failure due to BSSID mismatch Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_tdls.py | 28 +++++++++++++++++++++++++++- tests/hwsim/wpasupplicant.py | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py index c4d6dbc2f..a38536373 100644 --- a/tests/hwsim/test_ap_tdls.py +++ b/tests/hwsim/test_ap_tdls.py @@ -1,5 +1,5 @@ # TDLS tests -# Copyright (c) 2013, Jouni Malinen +# Copyright (c) 2013-2014, Jouni Malinen # # This software may be distributed under the terms of the BSD license. # See README for more details. @@ -7,6 +7,7 @@ import time import logging logger = logging.getLogger() +import subprocess import hwsim_utils from hostapd import HostapdGlobal @@ -264,3 +265,28 @@ def test_ap_open_tdls(dev, apdev): setup_tdls(dev[0], dev[1], apdev[0]) teardown_tdls(dev[0], dev[1], apdev[0]) setup_tdls(dev[1], dev[0], apdev[0]) + +def test_ap_wpa2_tdls_bssid_mismatch(dev, apdev): + """TDLS failure due to BSSID mismatch""" + try: + ssid = "test-wpa2-psk" + passphrase = "12345678" + params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase) + params['bridge'] = 'ap-br0' + hostapd.add_ap(apdev[0]['ifname'], params) + hostapd.add_ap(apdev[1]['ifname'], params) + wlantest_setup() + subprocess.call(['sudo', 'brctl', 'setfd', 'ap-br0', '0']) + subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'ap-br0', 'up']) + dev[0].connect(ssid, psk=passphrase, scan_freq="2412", + bssid=apdev[0]['bssid']) + dev[1].connect(ssid, psk=passphrase, scan_freq="2412", + bssid=apdev[1]['bssid']) + connectivity(dev, "ap-br0") + addr0 = dev[0].p2p_interface_addr() + dev[1].tdls_setup(addr0) + time.sleep(1) + hwsim_utils.test_connectivity_sta(dev[0], dev[1]) + finally: + subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'ap-br0', 'down']) + subprocess.call(['sudo', 'brctl', 'delbr', 'ap-br0']) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index cd64b147b..cb3d7cf43 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -638,7 +638,7 @@ class WpaSupplicant: not_quoted = [ "proto", "key_mgmt", "ieee80211w", "pairwise", "group", "wep_key0", "scan_freq", "eap", "eapol_flags", "fragment_size", "scan_ssid", "auth_alg", - "wpa_ptk_rekey", "disable_ht", "disable_vht" ] + "wpa_ptk_rekey", "disable_ht", "disable_vht", "bssid" ] for field in not_quoted: if field in kwargs and kwargs[field]: self.set_network(id, field, kwargs[field])