tests: FT PTK rekeying triggered by AP/station after roam

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-12-10 00:05:10 +02:00 committed by Jouni Malinen
parent 9257610a6e
commit 1025603b3f

View file

@ -93,14 +93,15 @@ def ft_params2_r0kh_mismatch(rsn=True, ssid=None, passphrase=None):
def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False, def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False,
sae=False, eap=False, fail_test=False, roams=1, sae=False, eap=False, fail_test=False, roams=1,
pairwise_cipher="CCMP", group_cipher="TKIP CCMP"): pairwise_cipher="CCMP", group_cipher="TKIP CCMP", ptk_rekey="0"):
logger.info("Connect to first AP") logger.info("Connect to first AP")
if eap: if eap:
dev.connect(ssid, key_mgmt="FT-EAP", proto="WPA2", ieee80211w="1", dev.connect(ssid, key_mgmt="FT-EAP", proto="WPA2", ieee80211w="1",
eap="GPSK", identity="gpsk user", eap="GPSK", identity="gpsk user",
password="abcdefghijklmnop0123456789abcdef", password="abcdefghijklmnop0123456789abcdef",
scan_freq="2412", scan_freq="2412",
pairwise=pairwise_cipher, group=group_cipher) pairwise=pairwise_cipher, group=group_cipher,
wpa_ptk_rekey=ptk_rekey)
else: else:
if sae: if sae:
key_mgmt="FT-SAE" key_mgmt="FT-SAE"
@ -108,7 +109,8 @@ def run_roams(dev, apdev, hapd0, hapd1, ssid, passphrase, over_ds=False,
key_mgmt="FT-PSK" key_mgmt="FT-PSK"
dev.connect(ssid, psk=passphrase, key_mgmt=key_mgmt, proto="WPA2", dev.connect(ssid, psk=passphrase, key_mgmt=key_mgmt, proto="WPA2",
ieee80211w="1", scan_freq="2412", ieee80211w="1", scan_freq="2412",
pairwise=pairwise_cipher, group=group_cipher) pairwise=pairwise_cipher, group=group_cipher,
wpa_ptk_rekey=ptk_rekey)
if dev.get_status_field('bssid') == apdev[0]['bssid']: if dev.get_status_field('bssid') == apdev[0]['bssid']:
ap1 = apdev[0] ap1 = apdev[0]
ap2 = apdev[1] ap2 = apdev[1]
@ -997,3 +999,55 @@ def test_rsn_ie_proto_ft_psk_sta(dev, apdev):
if ev is not None: if ev is not None:
raise Exception("Unexpected connection") raise Exception("Unexpected connection")
dev[0].request("DISCONNECT") dev[0].request("DISCONNECT")
def test_ap_ft_ptk_rekey(dev, apdev):
"""WPA2-PSK-FT PTK rekeying triggered by station after roam"""
ssid = "test-ft"
passphrase="12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
hapd0 = hostapd.add_ap(apdev[0]['ifname'], params)
params = ft_params2(ssid=ssid, passphrase=passphrase)
hapd1 = hostapd.add_ap(apdev[1]['ifname'], params)
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, ptk_rekey="1")
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED",
"WPA: Key negotiation completed"], timeout=5)
if ev is None:
raise Exception("No event received after roam")
if "CTRL-EVENT-DISCONNECTED" in ev:
raise Exception("Unexpected disconnection after roam")
if dev[0].get_status_field('bssid') == apdev[0]['bssid']:
hapd = hapd0
else:
hapd = hapd1
hwsim_utils.test_connectivity(dev[0], hapd)
def test_ap_ft_ptk_rekey_ap(dev, apdev):
"""WPA2-PSK-FT PTK rekeying triggered by AP after roam"""
ssid = "test-ft"
passphrase="12345678"
params = ft_params1(ssid=ssid, passphrase=passphrase)
params['wpa_ptk_rekey'] = '2'
hapd0 = hostapd.add_ap(apdev[0]['ifname'], params)
params = ft_params2(ssid=ssid, passphrase=passphrase)
params['wpa_ptk_rekey'] = '2'
hapd1 = hostapd.add_ap(apdev[1]['ifname'], params)
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase)
ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED",
"WPA: Key negotiation completed"], timeout=5)
if ev is None:
raise Exception("No event received after roam")
if "CTRL-EVENT-DISCONNECTED" in ev:
raise Exception("Unexpected disconnection after roam")
if dev[0].get_status_field('bssid') == apdev[0]['bssid']:
hapd = hapd0
else:
hapd = hapd1
hwsim_utils.test_connectivity(dev[0], hapd)