diff mbox series

[v2,1/3] DPP2: Presence Announcement notification

Message ID MWHPR21MB0847E044AAA8E83251F1302AC2200@MWHPR21MB0847.namprd21.prod.outlook.com
State Superseded
Headers show
Series DPP2: Presence Announcement notification | expand

Commit Message

Andrew Beltrano Sept. 15, 2020, 5:52 p.m. UTC
Define a control event with frame source and chirp hash for receipt of
presence announcement (chirp) frames.

Signed-off-by: Andrew Beltrano <anbeltra@microsoft.com>
---
 src/common/dpp.c      |  6 ++++++
 src/common/dpp.h      | 12 ++++++++++++
 src/common/wpa_ctrl.h |  1 +
 3 files changed, 19 insertions(+)
diff mbox series

Patch

diff --git a/src/common/dpp.c b/src/common/dpp.c
index 3922edb63..7ddb75022 100644
--- a/src/common/dpp.c
+++ b/src/common/dpp.c
@@ -4333,4 +4333,10 @@  struct wpabuf * dpp_build_presence_announcement(struct dpp_bootstrap_info *bi)
 			"DPP: Presence Announcement frame attributes", msg);
 	return msg;
 }
+
+void dpp_notify_chirp_received(void *msg_ctx, const u8 *src, const u8 *hash)
+{
+	wpa_msg(msg_ctx, MSG_INFO, DPP_EVENT_CHIRP_RX "src=" MACSTR " hash="
+		DPP_CHIRPHASHSTR, MAC2STR(src), DPP_CHIRPHASH2STR(hash));
+}
 #endif /* CONFIG_DPP2 */
diff --git a/src/common/dpp.h b/src/common/dpp.h
index 2213593a3..2da38f5e4 100644
--- a/src/common/dpp.h
+++ b/src/common/dpp.h
@@ -125,6 +125,17 @@  enum dpp_connector_key {
 #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;
 	size_t hash_len;
@@ -684,6 +695,7 @@  int dpp_tcp_init(struct dpp_global *dpp, struct dpp_authentication *auth,
 					 struct dpp_authentication *auth));
 
 struct wpabuf * dpp_build_presence_announcement(struct dpp_bootstrap_info *bi);
+void dpp_notify_chirp_received(void *msg_ctx, const u8 *src, const u8 *hash);
 
 struct dpp_global_config {
 	void *cb_ctx;
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 "