From 34a9cd8ffa70c482c43d31ebd5932134244d07b3 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 11 Oct 2019 17:53:04 +0300 Subject: [PATCH] tests: WPA2-PSK PMF AP dropping SA Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_pmf.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/hwsim/test_ap_pmf.py b/tests/hwsim/test_ap_pmf.py index 59bbb1384..2cf2e3d1d 100644 --- a/tests/hwsim/test_ap_pmf.py +++ b/tests/hwsim/test_ap_pmf.py @@ -247,6 +247,38 @@ def test_ap_pmf_assoc_comeback2(dev, apdev): dev[0].p2p_interface_addr()) < 1: raise Exception("AP did not use reassociation comeback request") +def test_ap_pmf_ap_dropping_sa(dev, apdev): + """WPA2-PSK PMF AP dropping SA""" + ssid = "pmf" + params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678") + params["wpa_key_mgmt"] = "WPA-PSK-SHA256" + params["ieee80211w"] = "2" + hapd = hostapd.add_ap(apdev[0], params) + bssid = hapd.own_addr() + Wlantest.setup(hapd) + wt = Wlantest() + wt.flush() + wt.add_passphrase("12345678") + dev[0].connect(ssid, psk="12345678", ieee80211w="2", + key_mgmt="WPA-PSK-SHA256", proto="WPA2", scan_freq="2412") + addr0 = dev[0].own_addr() + dev[0].dump_monitor() + hapd.wait_sta() + # Drop SA and association at the AP locally without notifying the STA. This + # results in the STA getting unprotected Deauthentication frames when trying + # to transmit the next Class 3 frame. + if "OK" not in hapd.request("DEAUTHENTICATE " + addr0 + " tx=0"): + raise Exception("DEAUTHENTICATE command failed") + ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1) + if ev is not None: + raise Exception("Unexpected disconnection event after DEAUTHENTICATE tx=0: " + ev) + dev[0].request("DATA_TEST_CONFIG 1") + dev[0].request("DATA_TEST_TX " + bssid + " " + addr0) + ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=5) + dev[0].request("DATA_TEST_CONFIG 0") + if ev is None or "locally_generated=1" not in ev: + raise Exception("Locally generated disconnection not reported") + def start_wpas_ap(ssid): wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') wpas.interface_add("wlan5", drv_params="use_monitor=1")