From 5a0718a19c58af1a6a072b6325c4fdde57ebd967 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 4 May 2020 15:31:14 +0300 Subject: [PATCH] DPP2: Report MUD URL and bandSupport in control interface events Report MUD URL and bandSupport from config request if those optional nodes are included. For now, these are mainly for testing purposes since there is no mechanism to delay sending of config response. Signed-off-by: Jouni Malinen --- src/common/dpp.c | 31 ++++++++++++++++++++++++++++--- src/common/wpa_ctrl.h | 2 ++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/common/dpp.c b/src/common/dpp.c index 0d6dcd1fb..49f638099 100644 --- a/src/common/dpp.c +++ b/src/common/dpp.c @@ -6081,23 +6081,48 @@ dpp_conf_req_rx(struct dpp_authentication *auth, const u8 *attr_start, } token = json_get_member(root, "mudurl"); - if (token && token->type == JSON_STRING) + if (token && token->type == JSON_STRING) { wpa_printf(MSG_DEBUG, "DPP: mudurl = '%s'", token->string); + wpa_msg(auth->msg_ctx, MSG_INFO, DPP_EVENT_MUD_URL "%s", + token->string); + } token = json_get_member(root, "bandSupport"); if (token && token->type == JSON_ARRAY) { + int *opclass = NULL; + char txt[200], *pos, *end; + int i, res; + wpa_printf(MSG_DEBUG, "DPP: bandSupport"); token = token->child; while (token) { - if (token->type != JSON_NUMBER) + if (token->type != JSON_NUMBER) { wpa_printf(MSG_DEBUG, "DPP: Invalid bandSupport array member type"); - else + } else { wpa_printf(MSG_DEBUG, "DPP: Supported global operating class: %d", token->number); + int_array_add_unique(&opclass, token->number); + } token = token->sibling; } + + txt[0] = '\0'; + pos = txt; + end = txt + sizeof(txt); + for (i = 0; opclass && opclass[i]; i++) { + res = os_snprintf(pos, end - pos, "%s%d", + pos == txt ? "" : ",", opclass[i]); + if (os_snprintf_error(end - pos, res)) { + *pos = '\0'; + break; + } + pos += res; + } + os_free(opclass); + wpa_msg(auth->msg_ctx, MSG_INFO, DPP_EVENT_BAND_SUPPORT "%s", + txt); } resp = dpp_build_conf_resp(auth, e_nonce, e_nonce_len, netrole); diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h index ca1c35f85..354de2854 100644 --- a/src/common/wpa_ctrl.h +++ b/src/common/wpa_ctrl.h @@ -190,6 +190,8 @@ extern "C" { #define DPP_EVENT_INTRO "DPP-INTRO " #define DPP_EVENT_CONF_REQ_RX "DPP-CONF-REQ-RX " #define DPP_EVENT_CHIRP_STOPPED "DPP-CHIRP-STOPPED " +#define DPP_EVENT_MUD_URL "DPP-MUD-URL " +#define DPP_EVENT_BAND_SUPPORT "DPP-BAND-SUPPORT " /* MESH events */ #define MESH_GROUP_STARTED "MESH-GROUP-STARTED "