]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Reconfiguration support in Controller
authorJouni Malinen <jouni@codeaurora.org>
Mon, 11 May 2020 13:04:46 +0000 (16:04 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 11 May 2020 14:26:11 +0000 (17:26 +0300)
Add handling of Reconfiguration messages in Controller.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/common/dpp_reconfig.c
src/common/dpp_tcp.c

index 355114cbc2d4a6d1360663a596bc81e90c104e08..0bb00cc1d10c3861f4b4d6c73cbf649411e09f25 100644 (file)
@@ -188,7 +188,7 @@ dpp_reconfig_init(struct dpp_global *dpp, void *msg_ctx,
        auth->configurator = 1;
        auth->curve = conf->curve;
        auth->transaction_id = 1;
-       if (dpp_prepare_channel_list(auth, freq, NULL, 0) < 0)
+       if (freq && dpp_prepare_channel_list(auth, freq, NULL, 0) < 0)
                goto fail;
 
        if (dpp_configurator_build_own_connector(conf) < 0)
index bfac377bb7cb6514c0809347d0499a3f141801ed..f58093f0d93d533738ec924e2b6f6714b7bcc3e4 100644 (file)
@@ -824,6 +824,7 @@ static int dpp_controller_rx_reconfig_announcement(struct dpp_connection *conn,
        u16 csign_hash_len;
        struct dpp_configurator *conf;
        struct dpp_global *dpp = conn->ctrl->global;
+       struct dpp_authentication *auth;
 
        if (conn->auth) {
                wpa_printf(MSG_DEBUG,
@@ -849,8 +850,42 @@ static int dpp_controller_rx_reconfig_announcement(struct dpp_connection *conn,
                return -1;
        }
 
-       /* TODO: Initiate Reconfig Authentication */
-       return -1;
+       auth = dpp_reconfig_init(dpp, dpp->msg_ctx, conf, 0);
+       if (!auth)
+               return -1;
+       if (dpp_set_configurator(auth, conn->ctrl->configurator_params) < 0) {
+               dpp_auth_deinit(auth);
+               return -1;
+       }
+
+       conn->auth = auth;
+       return dpp_tcp_send_msg(conn, auth->reconfig_req_msg);
+}
+
+
+static int dpp_controller_rx_reconfig_auth_resp(struct dpp_connection *conn,
+                                               const u8 *hdr, const u8 *buf,
+                                               size_t len)
+{
+       struct dpp_authentication *auth = conn->auth;
+       struct wpabuf *conf;
+       int res;
+
+       wpa_printf(MSG_DEBUG, "DPP: Reconfig Authentication Response");
+
+       if (!auth || !auth->reconfig || !auth->configurator) {
+               wpa_printf(MSG_DEBUG,
+                          "DPP: No DPP Reconfig Authentication in progress - drop");
+               return -1;
+       }
+
+       conf = dpp_reconfig_auth_resp_rx(auth, hdr, buf, len);
+       if (!conf)
+               return -1;
+
+       res = dpp_tcp_send_msg(conn, conf);
+       wpabuf_free(conf);
+       return res;
 }
 
 
@@ -910,6 +945,9 @@ static int dpp_controller_rx_action(struct dpp_connection *conn, const u8 *msg,
        case DPP_PA_RECONFIG_ANNOUNCEMENT:
                return dpp_controller_rx_reconfig_announcement(conn, msg, pos,
                                                               end - pos);
+       case DPP_PA_RECONFIG_AUTH_RESP:
+               return dpp_controller_rx_reconfig_auth_resp(conn, msg, pos,
+                                                           end - pos);
        default:
                /* TODO: missing messages types */
                wpa_printf(MSG_DEBUG,
@@ -935,7 +973,8 @@ static int dpp_controller_rx_gas_req(struct dpp_connection *conn, const u8 *msg,
        wpa_printf(MSG_DEBUG,
                   "DPP: Received DPP Configuration Request over TCP");
 
-       if (!conn->ctrl || !auth || !auth->auth_success) {
+       if (!conn->ctrl || !auth ||
+           (!auth->auth_success && !auth->reconfig_success)) {
                wpa_printf(MSG_DEBUG, "DPP: No matching exchange in progress");
                return -1;
        }