From c043b1e00069b7b340d3c2834e1df16958cee8d2 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 25 Aug 2020 16:00:56 +0300 Subject: [PATCH] DPP: Remove unnecessary dpp_global_config parameters These were not really used anymore since the AP/Relay case did not set msg_ctx or process_conf_obj in the global DPP context. Get the appropriate pointers more directly from the more specific data structures instead and remove these global values. Signed-off-by: Jouni Malinen --- hostapd/main.c | 1 - src/common/dpp.c | 2 -- src/common/dpp.h | 3 +-- src/common/dpp_tcp.c | 5 +++-- wpa_supplicant/dpp_supplicant.c | 2 -- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/hostapd/main.c b/hostapd/main.c index 353b20a80..4f2d1f216 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -675,7 +675,6 @@ int main(int argc, char *argv[]) #ifdef CONFIG_DPP os_memset(&dpp_conf, 0, sizeof(dpp_conf)); dpp_conf.cb_ctx = &interfaces; - /* TODO: dpp_conf.msg_ctx? */ #ifdef CONFIG_DPP2 dpp_conf.remove_bi = hostapd_dpp_remove_bi; #endif /* CONFIG_DPP2 */ diff --git a/src/common/dpp.c b/src/common/dpp.c index bc349229b..3922edb63 100644 --- a/src/common/dpp.c +++ b/src/common/dpp.c @@ -4278,10 +4278,8 @@ struct dpp_global * dpp_global_init(struct dpp_global_config *config) dpp = os_zalloc(sizeof(*dpp)); if (!dpp) return NULL; - dpp->msg_ctx = config->msg_ctx; #ifdef CONFIG_DPP2 dpp->cb_ctx = config->cb_ctx; - dpp->process_conf_obj = config->process_conf_obj; dpp->remove_bi = config->remove_bi; #endif /* CONFIG_DPP2 */ diff --git a/src/common/dpp.h b/src/common/dpp.h index ee88560c7..2213593a3 100644 --- a/src/common/dpp.h +++ b/src/common/dpp.h @@ -374,6 +374,7 @@ struct dpp_relay_config { const struct hostapd_ip_addr *ipaddr; const u8 *pkhash; + void *msg_ctx; void *cb_ctx; void (*tx)(void *ctx, const u8 *addr, unsigned int freq, const u8 *msg, size_t len); @@ -685,9 +686,7 @@ int dpp_tcp_init(struct dpp_global *dpp, struct dpp_authentication *auth, struct wpabuf * dpp_build_presence_announcement(struct dpp_bootstrap_info *bi); struct dpp_global_config { - void *msg_ctx; void *cb_ctx; - int (*process_conf_obj)(void *ctx, struct dpp_authentication *auth); void (*remove_bi)(void *ctx, struct dpp_bootstrap_info *bi); }; diff --git a/src/common/dpp_tcp.c b/src/common/dpp_tcp.c index 5bd17cdb0..7e330d689 100644 --- a/src/common/dpp_tcp.c +++ b/src/common/dpp_tcp.c @@ -53,6 +53,7 @@ struct dpp_relay_controller { struct dpp_global *global; u8 pkhash[SHA256_MAC_LEN]; struct hostapd_ip_addr ipaddr; + void *msg_ctx; void *cb_ctx; void (*tx)(void *ctx, const u8 *addr, unsigned int freq, const u8 *msg, size_t len); @@ -126,6 +127,7 @@ int dpp_relay_add_controller(struct dpp_global *dpp, ctrl->global = dpp; os_memcpy(&ctrl->ipaddr, config->ipaddr, sizeof(*config->ipaddr)); os_memcpy(ctrl->pkhash, config->pkhash, SHA256_MAC_LEN); + ctrl->msg_ctx = config->msg_ctx; ctrl->cb_ctx = config->cb_ctx; ctrl->tx = config->tx; ctrl->gas_resp_tx = config->gas_resp_tx; @@ -375,9 +377,8 @@ dpp_relay_new_conn(struct dpp_relay_controller *ctrl, const u8 *src, conn->global = ctrl->global; conn->relay = ctrl; - conn->msg_ctx = ctrl->global->msg_ctx; + conn->msg_ctx = ctrl->msg_ctx; conn->cb_ctx = ctrl->global->cb_ctx; - conn->process_conf_obj = ctrl->global->process_conf_obj; os_memcpy(conn->mac_addr, src, ETH_ALEN); conn->freq = freq; diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c index df6ddfc5b..28404b8d7 100644 --- a/wpa_supplicant/dpp_supplicant.c +++ b/wpa_supplicant/dpp_supplicant.c @@ -3275,10 +3275,8 @@ int wpas_dpp_init(struct wpa_supplicant *wpa_s) return -1; os_memset(&config, 0, sizeof(config)); - config.msg_ctx = wpa_s; config.cb_ctx = wpa_s; #ifdef CONFIG_DPP2 - config.process_conf_obj = wpas_dpp_process_conf_obj; config.remove_bi = wpas_dpp_remove_bi; #endif /* CONFIG_DPP2 */ wpa_s->dpp = dpp_global_init(&config);