]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Extend connector matching for reconfiguration
authorJouni Malinen <jouni@codeaurora.org>
Sat, 9 May 2020 13:42:37 +0000 (16:42 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 11 May 2020 13:41:33 +0000 (16:41 +0300)
Allow the same helper functions to be used with reconfiguration
connector.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/common/dpp.c
src/common/dpp_i.h

index 4b34b4f0582ef641203f1a6f514842a91baad214..938e9624828ad931c5c7d5db04384c8715f133b1 100644 (file)
@@ -6415,7 +6415,8 @@ static int dpp_compatible_netrole(const char *role1, const char *role2)
 
 static int dpp_connector_compatible_group(struct json_token *root,
                                          const char *group_id,
-                                         const char *net_role)
+                                         const char *net_role,
+                                         bool reconfig)
 {
        struct json_token *groups, *token;
 
@@ -6439,7 +6440,9 @@ static int dpp_connector_compatible_group(struct json_token *root,
                    os_strcmp(id->string, group_id) != 0)
                        continue;
 
-               if (dpp_compatible_netrole(role->string, net_role))
+               if (reconfig && os_strcmp(net_role, "configurator") == 0)
+                       return 1;
+               if (!reconfig && dpp_compatible_netrole(role->string, net_role))
                        return 1;
        }
 
@@ -6447,8 +6450,8 @@ static int dpp_connector_compatible_group(struct json_token *root,
 }
 
 
-static int dpp_connector_match_groups(struct json_token *own_root,
-                                     struct json_token *peer_root)
+int dpp_connector_match_groups(struct json_token *own_root,
+                              struct json_token *peer_root, bool reconfig)
 {
        struct json_token *groups, *token;
 
@@ -6478,7 +6481,7 @@ static int dpp_connector_match_groups(struct json_token *own_root,
                           "DPP: peer connector group: groupId='%s' netRole='%s'",
                           id->string, role->string);
                if (dpp_connector_compatible_group(own_root, id->string,
-                                                  role->string)) {
+                                                  role->string, reconfig)) {
                        wpa_printf(MSG_DEBUG,
                                   "DPP: Compatible group/netRole in own connector");
                        return 1;
@@ -6570,7 +6573,7 @@ dpp_peer_intro(struct dpp_introduction *intro, const char *own_connector,
                goto fail;
        }
 
-       if (!dpp_connector_match_groups(own_root, root)) {
+       if (!dpp_connector_match_groups(own_root, root, false)) {
                wpa_printf(MSG_DEBUG,
                           "DPP: Peer connector does not include compatible group netrole with own connector");
                ret = DPP_STATUS_NO_MATCH;
index 402b7cbfeacb9ed5a7dacbaa3f1f73306054ae99..dd66617fd7c13a12769fbed50c84007f0b4d275e 100644 (file)
@@ -34,6 +34,8 @@ struct wpabuf * dpp_build_conn_status(enum dpp_status_error result,
                                      const u8 *ssid, size_t ssid_len,
                                      const char *channel_list);
 struct json_token * dpp_parse_own_connector(const char *own_connector);
+int dpp_connector_match_groups(struct json_token *own_root,
+                              struct json_token *peer_root, bool reconfig);
 
 /* dpp_crypto.c */