[PATCH v3 1/3] DPP2: Presence Announcement notification

Andrew Beltrano anbeltra at microsoft.com
Mon Sep 21 09:48:32 EDT 2020


Define a control event with bootstrap id, frame source, frequency, and
chirp hash for receipt of presence announcement (chirp) frames.

Signed-off-by: Andrew Beltrano <anbeltra at microsoft.com>
---
 src/common/dpp.c      |  7 +++++++
 src/common/dpp.h      | 13 +++++++++++++
 src/common/wpa_ctrl.h |  1 +
 3 files changed, 21 insertions(+)

diff --git a/src/common/dpp.c b/src/common/dpp.c
index 3922edb63..c080bb4da 100644
--- a/src/common/dpp.c
+++ b/src/common/dpp.c
@@ -4333,4 +4333,11 @@ 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, int id, const u8 *src,
+				unsigned int freq, const u8 *hash)
+{
+	wpa_msg(msg_ctx, MSG_INFO, DPP_EVENT_CHIRP_RX "id=%d src=" MACSTR " freq=%u hash="
+		DPP_CHIRPHASHSTR, id, MAC2STR(src), freq, DPP_CHIRPHASH2STR(hash));
+}
 #endif /* CONFIG_DPP2 */
diff --git a/src/common/dpp.h b/src/common/dpp.h
index 2213593a3..7a365693d 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,8 @@ 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, int id, const u8 *src,
+				unsigned int freq, 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 "
-- 
2.25.1


More information about the Hostap mailing list