diff --git a/tests/hwsim/test_dpp.py b/tests/hwsim/test_dpp.py index f9aebd754..ba94d9d7a 100644 --- a/tests/hwsim/test_dpp.py +++ b/tests/hwsim/test_dpp.py @@ -7348,3 +7348,18 @@ def test_dpp_qr_code_config_event_responder(dev, apdev): time.sleep(0.01) dev[0].dump_monitor() dev[1].dump_monitor() + +def test_dpp_discard_public_action(dev, apdev): + """DPP and discarding Public Action frames""" + check_dpp_capab(dev[0]) + check_dpp_capab(dev[1]) + id0 = dev[0].dpp_bootstrap_gen(chan="81/1") + uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0) + dev[0].dpp_listen(2412) + dev[1].set("dpp_discard_public_action", "1") + dev[1].dpp_auth_init(uri=uri0) + ev = dev[0].wait_event(["DPP-FAIL"], timeout=5) + if ev is None: + raise Exception("Failure not reported") + if "No Auth Confirm received" not in ev: + raise Exception("Unexpected failure reason: " + ev) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index ac337e0f5..606c79bc2 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -864,6 +864,8 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s, } else if (os_strcasecmp(cmd, "dpp_ignore_netaccesskey_mismatch") == 0) { wpa_s->dpp_ignore_netaccesskey_mismatch = atoi(value); + } else if (os_strcasecmp(cmd, "dpp_discard_public_action") == 0) { + wpa_s->dpp_discard_public_action = atoi(value); } else if (os_strcasecmp(cmd, "dpp_test") == 0) { dpp_test = atoi(value); #endif /* CONFIG_DPP */ @@ -8554,6 +8556,8 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) wpa_s->dpp_discovery_override = NULL; os_free(wpa_s->dpp_groups_override); wpa_s->dpp_groups_override = NULL; + wpa_s->dpp_ignore_netaccesskey_mismatch = 0; + wpa_s->dpp_discard_public_action = 0; dpp_test = DPP_TEST_DISABLED; #endif /* CONFIG_DPP */ #endif /* CONFIG_TESTING_OPTIONS */ diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c index ca40620f6..caf3af800 100644 --- a/wpa_supplicant/dpp_supplicant.c +++ b/wpa_supplicant/dpp_supplicant.c @@ -3130,6 +3130,13 @@ void wpas_dpp_rx_action(struct wpa_supplicant *wpa_s, const u8 *src, return; if (WPA_GET_BE24(buf) != OUI_WFA || buf[3] != DPP_OUI_TYPE) return; +#ifdef CONFIG_TESTING_OPTIONS + if (wpa_s->dpp_discard_public_action) { + wpa_printf(MSG_DEBUG, + "TESTING: Discard received DPP Public Action frame"); + return; + } +#endif /* CONFIG_TESTING_OPTIONS */ hdr = buf; buf += 4; len -= 4; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index b4af76ed8..ec0360e70 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1497,6 +1497,7 @@ struct wpa_supplicant { char *dpp_discovery_override; char *dpp_groups_override; unsigned int dpp_ignore_netaccesskey_mismatch:1; + unsigned int dpp_discard_public_action:1; #endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_DPP */