From fb5c8cea957baa49c8e50b253f9710f90388ef82 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 16 Mar 2014 00:13:23 +0200 Subject: [PATCH] tests: Supplicant-enforced PTK rekey Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_psk.py | 13 +++++++++++++ tests/hwsim/wpasupplicant.py | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py index ddef32aaf..508007663 100644 --- a/tests/hwsim/test_ap_psk.py +++ b/tests/hwsim/test_ap_psk.py @@ -8,6 +8,7 @@ import logging logger = logging.getLogger() import hostapd +import hwsim_utils def test_ap_wpa2_psk(dev, apdev): """WPA2-PSK AP with PSK instead of passphrase""" @@ -39,3 +40,15 @@ def test_ap_wpa2_psk_file(dev, apdev): if ev is None: raise Exception("Timed out while waiting for failure report") dev[1].request("REMOVE_NETWORK all") + +def test_ap_wpa_ptk_rekey(dev, apdev): + """WPA-PSK/TKIP AP and PTK rekey enforced by station""" + ssid = "test-wpa-psk" + passphrase = 'qwertyuiop' + params = hostapd.wpa_params(ssid=ssid, passphrase=passphrase) + hostapd.add_ap(apdev[0]['ifname'], params) + dev[0].connect(ssid, psk=passphrase, wpa_ptk_rekey="1", scan_freq="2412") + ev = dev[0].wait_event(["WPA: Key negotiation completed"]) + if ev is None: + raise Exception("PTK rekey timed out") + hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index e8eeba31f..0e745a3f3 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -618,7 +618,8 @@ class WpaSupplicant: not_quoted = [ "proto", "key_mgmt", "ieee80211w", "pairwise", "group", "wep_key0", "scan_freq", "eap", - "eapol_flags", "fragment_size", "scan_ssid", "auth_alg" ] + "eapol_flags", "fragment_size", "scan_ssid", "auth_alg", + "wpa_ptk_rekey" ] for field in not_quoted: if field in kwargs and kwargs[field]: self.set_network(id, field, kwargs[field])