tests: Testing functionality to discard DPP Public Action frames

This can be used to make sure wpa_supplicant does not process DPP
messages sent in Public Action frames when a test setup is targeting
DPP-over-TCP.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2022-05-24 23:30:39 +03:00 committed by Jouni Malinen
parent 3550696160
commit 1004fb7ee4
4 changed files with 27 additions and 0 deletions

View file

@ -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)

View file

@ -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 */

View file

@ -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;

View file

@ -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 */