[PATCH] DPP2: Presence Announcement notification in Configurator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Generate a control event with frame source and chirp hash upon receipt
of DPP presence announcement frames. This allows external programs to
instrument wpa_supplicant with bootstrapping information on-demand.

Signed-off-by: Andrew Beltrano <anbeltra@xxxxxxxxxxxxx>
---
 src/common/dpp.h                | 10 ++++++++++
 src/common/wpa_ctrl.h           |  1 +
 wpa_supplicant/dpp_supplicant.c |  1 +
 wpa_supplicant/notify.c         | 12 ++++++++++++
 wpa_supplicant/notify.h         |  2 ++
 5 files changed, 26 insertions(+)

diff --git a/src/common/dpp.h b/src/common/dpp.h
index 2213593a3..83ddd822f 100644
--- a/src/common/dpp.h
+++ b/src/common/dpp.h
@@ -124,6 +124,16 @@ enum dpp_connector_key {
 #define DPP_MAX_HASH_LEN 64
 #define DPP_MAX_SHARED_SECRET_LEN 66
 #define DPP_CP_LEN 64
+#define DPP_CHIRPHASHSTR \
+	"%02x%02x%02x%02x%02x%02x%02x%02x" \
+	"%02x%02x%02x%02x%02x%02x%02x%02x" \
+	"%02x%02x%02x%02x%02x%02x%02x%02x" \
+	"%02x%02x%02x%02x%02x%02x%02x%02x"
+#define DPP_CHIRPHASH2STR(a) \
+	a[ 0], a[ 1], a[ 2], a[ 3], a[ 4], a[ 5], a[ 6], a[ 7], \
+	a[ 8], a[ 9], a[10], a[11], a[12], a[13], a[14], a[15], \
+	a[16], a[17], a[18], a[19], a[20], a[21], a[22], a[23], \
+	a[24], a[25], a[26], a[27], a[28], a[29], a[30], a[31]
 
 struct dpp_curve_params {
 	const char *name;
diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h
index 4e42c890f..52888d730 100644
--- a/src/common/wpa_ctrl.h
+++ b/src/common/wpa_ctrl.h
@@ -202,6 +202,7 @@ extern "C" {
 #define DPP_EVENT_MUD_URL "DPP-MUD-URL "
 #define DPP_EVENT_BAND_SUPPORT "DPP-BAND-SUPPORT "
 #define DPP_EVENT_CSR "DPP-CSR "
+#define DPP_EVENT_CHIRP_RX "DPP-CHIRP-RX "
 
 /* MESH events */
 #define MESH_GROUP_STARTED "MESH-GROUP-STARTED "
diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c
index 28404b8d7..1628535ff 100644
--- a/wpa_supplicant/dpp_supplicant.c
+++ b/wpa_supplicant/dpp_supplicant.c
@@ -1975,6 +1975,7 @@ wpas_dpp_rx_presence_announcement(struct wpa_supplicant *wpa_s, const u8 *src,
 			"Missing or invalid required Responder Bootstrapping Key Hash attribute");
 		return;
 	}
+	wpas_notify_dpp_chirp_received(wpa_s, src, r_bootstrap);
 	wpa_hexdump(MSG_MSGDUMP, "DPP: Responder Bootstrapping Key Hash",
 		    r_bootstrap, r_bootstrap_len);
 	peer_bi = dpp_bootstrap_find_chirp(wpa_s->dpp, r_bootstrap);
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 0ba1e144c..b2c14a10b 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -24,6 +24,7 @@
 #include "p2p_supplicant.h"
 #include "sme.h"
 #include "notify.h"
+#include "common/dpp.h"
 
 int wpas_notify_supplicant_initialized(struct wpa_global *global)
 {
@@ -932,3 +933,14 @@ void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
 }
 
 #endif /* CONFIG_MESH */
+
+#ifdef CONFIG_DPP2
+
+void wpas_notify_dpp_chirp_received(struct wpa_supplicant *wpa_s,
+					const u8 *src, const u8 *hash)
+{
+	wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CHIRP_RX "src=" MACSTR " hash=" DPP_CHIRPHASHSTR,
+			MAC2STR(src), DPP_CHIRPHASH2STR(hash));
+}
+
+#endif /* CONFIG_DPP2 */
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index e843aa124..eb0586c8c 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -156,5 +156,7 @@ void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
 				     const u8 *peer_addr);
 void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
 					const u8 *peer_addr, u16 reason_code);
+void wpas_notify_dpp_chirp_received(struct wpa_supplicant *wpa_s,
+					const u8 *src, const u8 *hash);
 
 #endif /* NOTIFY_H */
-- 
2.25.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux