tests: TDLS with SAE
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
a86078c876
commit
3b89dbaa7d
1 changed files with 36 additions and 15 deletions
|
@ -26,9 +26,13 @@ def connectivity(dev, hapd):
|
|||
hwsim_utils.test_connectivity(dev[0], hapd)
|
||||
hwsim_utils.test_connectivity(dev[1], hapd)
|
||||
|
||||
def connect_2sta(dev, ssid, hapd):
|
||||
dev[0].connect(ssid, psk="12345678", scan_freq="2412")
|
||||
dev[1].connect(ssid, psk="12345678", scan_freq="2412")
|
||||
def connect_2sta(dev, ssid, hapd, sae=False):
|
||||
key_mgmt = "SAE" if sae else "WPA-PSK"
|
||||
ieee80211w = "2" if sae else "1"
|
||||
dev[0].connect(ssid, key_mgmt=key_mgmt, psk="12345678",
|
||||
ieee80211w=ieee80211w, scan_freq="2412")
|
||||
dev[1].connect(ssid, key_mgmt=key_mgmt, psk="12345678",
|
||||
ieee80211w=ieee80211w, scan_freq="2412")
|
||||
hapd.wait_sta()
|
||||
hapd.wait_sta()
|
||||
connectivity(dev, hapd)
|
||||
|
@ -112,7 +116,7 @@ def check_connectivity(sta0, sta1, hapd):
|
|||
hwsim_utils.test_connectivity(sta0, hapd)
|
||||
hwsim_utils.test_connectivity(sta1, hapd)
|
||||
|
||||
def setup_tdls(sta0, sta1, hapd, reverse=False, expect_fail=False):
|
||||
def setup_tdls(sta0, sta1, hapd, reverse=False, expect_fail=False, sae=False):
|
||||
logger.info("Setup TDLS")
|
||||
check_connectivity(sta0, sta1, hapd)
|
||||
bssid = hapd.own_addr()
|
||||
|
@ -124,18 +128,20 @@ def setup_tdls(sta0, sta1, hapd, reverse=False, expect_fail=False):
|
|||
sta0.tdls_setup(addr1)
|
||||
time.sleep(1)
|
||||
if expect_fail:
|
||||
tdls_check_ap(sta0, sta1, bssid, addr0, addr1)
|
||||
if not sae:
|
||||
tdls_check_ap(sta0, sta1, bssid, addr0, addr1)
|
||||
return
|
||||
if reverse:
|
||||
addr1 = sta0.p2p_interface_addr()
|
||||
addr0 = sta1.p2p_interface_addr()
|
||||
conf = wt.get_tdls_counter("setup_conf_ok", bssid, addr0, addr1)
|
||||
if conf == 0:
|
||||
raise Exception("No TDLS Setup Confirm (success) seen")
|
||||
tdls_check_dl(sta0, sta1, bssid, addr0, addr1)
|
||||
if not sae:
|
||||
conf = wt.get_tdls_counter("setup_conf_ok", bssid, addr0, addr1)
|
||||
if conf == 0:
|
||||
raise Exception("No TDLS Setup Confirm (success) seen")
|
||||
tdls_check_dl(sta0, sta1, bssid, addr0, addr1)
|
||||
check_connectivity(sta0, sta1, hapd)
|
||||
|
||||
def teardown_tdls(sta0, sta1, hapd, responder=False, wildcard=False):
|
||||
def teardown_tdls(sta0, sta1, hapd, responder=False, wildcard=False, sae=False):
|
||||
logger.info("Teardown TDLS")
|
||||
check_connectivity(sta0, sta1, hapd)
|
||||
bssid = hapd.own_addr()
|
||||
|
@ -148,11 +154,12 @@ def teardown_tdls(sta0, sta1, hapd, responder=False, wildcard=False):
|
|||
else:
|
||||
sta0.tdls_teardown(addr1)
|
||||
time.sleep(1)
|
||||
wt = Wlantest()
|
||||
teardown = wt.get_tdls_counter("teardown", bssid, addr0, addr1)
|
||||
if teardown == 0:
|
||||
raise Exception("No TDLS Setup Teardown seen")
|
||||
tdls_check_ap(sta0, sta1, bssid, addr0, addr1)
|
||||
if not sae:
|
||||
wt = Wlantest()
|
||||
teardown = wt.get_tdls_counter("teardown", bssid, addr0, addr1)
|
||||
if teardown == 0:
|
||||
raise Exception("No TDLS Setup Teardown seen")
|
||||
tdls_check_ap(sta0, sta1, bssid, addr0, addr1)
|
||||
check_connectivity(sta0, sta1, hapd)
|
||||
|
||||
def check_tdls_link(sta0, sta1, connected=True):
|
||||
|
@ -627,3 +634,17 @@ def _test_ap_open_tdls_external_control(dev, apdev):
|
|||
time.sleep(0.1)
|
||||
if connected:
|
||||
raise Exception("TDLS teardown did not complete")
|
||||
|
||||
def test_ap_sae_tdls(dev, apdev):
|
||||
"""SAE AP and two stations using TDLS"""
|
||||
check_sae_capab(dev[0])
|
||||
check_sae_capab(dev[1])
|
||||
params = hostapd.wpa2_params(ssid="test-wpa2-psk", passphrase="12345678")
|
||||
params['wpa_key_mgmt'] = 'SAE'
|
||||
params["ieee80211w"] = "2"
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
wlantest_setup(hapd)
|
||||
connect_2sta(dev, "test-wpa2-psk", hapd, sae=True)
|
||||
setup_tdls(dev[0], dev[1], hapd, sae=True)
|
||||
teardown_tdls(dev[0], dev[1], hapd, sae=True)
|
||||
setup_tdls(dev[1], dev[0], hapd, sae=True)
|
||||
|
|
Loading…
Reference in a new issue