]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Report MUD URL and bandSupport in control interface events
authorJouni Malinen <jouni@codeaurora.org>
Mon, 4 May 2020 12:31:14 +0000 (15:31 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 4 May 2020 12:33:03 +0000 (15:33 +0300)
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 <jouni@codeaurora.org>
src/common/dpp.c
src/common/wpa_ctrl.h

index 0d6dcd1fb541e3a3caa79c58e3d17693f14e8761..49f6380999bf842826ff6895ce9a3d84f2114f35 100644 (file)
@@ -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);
index ca1c35f8523289d64df2fbc08d7aeaf566795576..354de2854c328b43b981df2f3e499739ef67c652 100644 (file)
@@ -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 "