]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Testing functionality to discard DPP Public Action frames
authorJouni Malinen <quic_jouni@quicinc.com>
Tue, 24 May 2022 20:30:39 +0000 (23:30 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 24 May 2022 20:30:39 +0000 (23:30 +0300)
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>
tests/hwsim/test_dpp.py
wpa_supplicant/ctrl_iface.c
wpa_supplicant/dpp_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index f9aebd7544bbd502038080b1bdc13f3f62068d9f..ba94d9d7ab237163e124e9d7294313b5ed651ed5 100644 (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)
index ac337e0f58b2110bf94080533cd5916cc6ba129c..606c79bc2cc9f27fc8884942c59a2aa2c634ae0b 100644 (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 */
index ca40620f64d6126869137e8ba54cfa420c87426a..caf3af800db888dc40fe10e91a6cc3aa03c2c67f 100644 (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;
index b4af76ed8d14a41dc8dbb8d09def380cadc32a54..ec0360e7056775a4acf79dfe4aeff931d9da4492 100644 (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 */