tests: Random MAC address with PMKSA caching
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
parent
9ff778fa4b
commit
252729d902
1 changed files with 52 additions and 0 deletions
|
@ -12,6 +12,7 @@ import time
|
|||
import hwsim_utils
|
||||
import hostapd
|
||||
from wpasupplicant import WpaSupplicant
|
||||
from utils import *
|
||||
|
||||
def test_sta_dynamic(dev, apdev):
|
||||
"""Dynamically added wpa_supplicant interface"""
|
||||
|
@ -327,3 +328,54 @@ def test_sta_dynamic_random_mac_addr_scan_keep_oui(dev, apdev):
|
|||
|
||||
if addr0 != addr1:
|
||||
raise Exception("Random MAC address used unexpectedly")
|
||||
|
||||
def test_sta_dynamic_random_mac_addr_pmksa_cache(dev, apdev):
|
||||
"""Dynamically added wpa_supplicant interface and random MAC address with PMKSA caching"""
|
||||
params = hostapd.wpa2_params(ssid="sta-dynamic", passphrase="12345678")
|
||||
params['wpa_key_mgmt'] = 'SAE'
|
||||
params['ieee80211w'] = '2'
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
|
||||
params = hostapd.wpa2_params(ssid="another", passphrase="12345678")
|
||||
hapd2 = hostapd.add_ap(apdev[1], params)
|
||||
|
||||
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
|
||||
wpas.interface_add("wlan5")
|
||||
check_sae_capab(wpas)
|
||||
addr0 = wpas.get_driver_status_field("addr")
|
||||
wpas.request("SET preassoc_mac_addr 1")
|
||||
wpas.request("SET rand_addr_lifetime 0")
|
||||
|
||||
wpas.set("sae_groups", "")
|
||||
id = wpas.connect("sta-dynamic", key_mgmt="SAE", psk="12345678",
|
||||
ieee80211w="2",
|
||||
mac_addr="1", scan_freq="2412")
|
||||
addr1 = wpas.get_driver_status_field("addr")
|
||||
|
||||
if addr0 == addr1:
|
||||
raise Exception("Random MAC address not used")
|
||||
|
||||
sta = hapd.get_sta(addr0)
|
||||
if sta['addr'] != "FAIL":
|
||||
raise Exception("Unexpected STA association with permanent address")
|
||||
sta = hapd.get_sta(addr1)
|
||||
if sta['addr'] != addr1:
|
||||
raise Exception("STA association with random address not found")
|
||||
|
||||
wpas.request("DISCONNECT")
|
||||
wpas.wait_disconnected()
|
||||
|
||||
wpas.connect("another", psk="12345678", mac_addr="1", scan_freq="2412")
|
||||
wpas.request("DISCONNECT")
|
||||
wpas.wait_disconnected()
|
||||
|
||||
wpas.connect_network(id)
|
||||
|
||||
wpas.remove_network(id)
|
||||
wpas.wait_disconnected()
|
||||
id = wpas.connect("sta-dynamic", key_mgmt="SAE", psk="12345678",
|
||||
ieee80211w="2",
|
||||
mac_addr="1", scan_freq="2412")
|
||||
addr2 = wpas.get_driver_status_field("addr")
|
||||
if addr1 == addr2:
|
||||
raise Exception("Random MAC address did not change")
|
||||
|
|
Loading…
Add table
Reference in a new issue