aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2016-11-29 14:07:25 (GMT)
committerJouni Malinen <j@w1.fi>2016-11-29 14:26:00 (GMT)
commit86f938ddeae611afb2bb6f8d487c371d5fe36b8d (patch)
tree79caa6a2ea3cdc0997748fd141d889556219e052 /tests
parent47d74bf010dff9e96748b777edc9f700451e5860 (diff)
downloadhostap-86f938ddeae611afb2bb6f8d487c371d5fe36b8d.zip
hostap-86f938ddeae611afb2bb6f8d487c371d5fe36b8d.tar.gz
hostap-86f938ddeae611afb2bb6f8d487c371d5fe36b8d.tar.bz2
tests: PMF and Authentication frame injection
Verify that AP does not break PMF-enabled connection due to injected Authentication frame. This is a regression test for NL80211_FEATURE_FULL_AP_CLIENT_STATE changes resulting in dropping the key in such a case. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_ap_pmf.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/hwsim/test_ap_pmf.py b/tests/hwsim/test_ap_pmf.py
index fa47e20..435d6ac 100644
--- a/tests/hwsim/test_ap_pmf.py
+++ b/tests/hwsim/test_ap_pmf.py
@@ -469,3 +469,30 @@ def test_ap_pmf_required_sta_no_pmf(dev, apdev):
if "CTRL-EVENT-ASSOC-REJECT" in ev:
raise Exception("Tried to connect to PMF required AP without PMF enabled")
dev[0].request("REMOVE_NETWORK all")
+
+def test_ap_pmf_inject_auth(dev, apdev):
+ """WPA2-PSK AP with PMF and Authentication frame injection"""
+ ssid = "test-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)
+ dev[0].connect(ssid, psk="12345678", ieee80211w="2",
+ key_mgmt="WPA-PSK-SHA256", proto="WPA2",
+ scan_freq="2412")
+ hwsim_utils.test_connectivity(dev[0], hapd)
+
+ bssid = hapd.own_addr().replace(':', '')
+ addr = dev[0].own_addr().replace(':', '')
+
+ # Inject an unprotected Authentication frame claiming to be from the
+ # associated STA.
+ auth = "b0003a01" + bssid + addr + bssid + '1000000001000000'
+ hapd.request("SET ext_mgmt_frame_handling 1")
+ res = hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=%s" % auth)
+ hapd.request("SET ext_mgmt_frame_handling 0")
+ if "OK" not in res:
+ raise Exception("MGMT_RX_PROCESS failed")
+
+ # Verify that original association is still functional.
+ hwsim_utils.test_connectivity(dev[0], hapd)