DPP2: Reconfiguration support in Controller
Add handling of Reconfiguration messages in Controller. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
6dcb8aaf13
commit
7f20a3ebda
2 changed files with 43 additions and 4 deletions
|
@ -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)
|
||||
|
|
|
@ -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 */
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue