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 <jouni@codeaurora.org>
master
Jouni Malinen 4 years ago committed by Jouni Malinen
parent 4ecb6dd16b
commit c043b1e000

@ -675,7 +675,6 @@ int main(int argc, char *argv[])
#ifdef CONFIG_DPP #ifdef CONFIG_DPP
os_memset(&dpp_conf, 0, sizeof(dpp_conf)); os_memset(&dpp_conf, 0, sizeof(dpp_conf));
dpp_conf.cb_ctx = &interfaces; dpp_conf.cb_ctx = &interfaces;
/* TODO: dpp_conf.msg_ctx? */
#ifdef CONFIG_DPP2 #ifdef CONFIG_DPP2
dpp_conf.remove_bi = hostapd_dpp_remove_bi; dpp_conf.remove_bi = hostapd_dpp_remove_bi;
#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP2 */

@ -4278,10 +4278,8 @@ struct dpp_global * dpp_global_init(struct dpp_global_config *config)
dpp = os_zalloc(sizeof(*dpp)); dpp = os_zalloc(sizeof(*dpp));
if (!dpp) if (!dpp)
return NULL; return NULL;
dpp->msg_ctx = config->msg_ctx;
#ifdef CONFIG_DPP2 #ifdef CONFIG_DPP2
dpp->cb_ctx = config->cb_ctx; dpp->cb_ctx = config->cb_ctx;
dpp->process_conf_obj = config->process_conf_obj;
dpp->remove_bi = config->remove_bi; dpp->remove_bi = config->remove_bi;
#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP2 */

@ -374,6 +374,7 @@ struct dpp_relay_config {
const struct hostapd_ip_addr *ipaddr; const struct hostapd_ip_addr *ipaddr;
const u8 *pkhash; const u8 *pkhash;
void *msg_ctx;
void *cb_ctx; void *cb_ctx;
void (*tx)(void *ctx, const u8 *addr, unsigned int freq, const u8 *msg, void (*tx)(void *ctx, const u8 *addr, unsigned int freq, const u8 *msg,
size_t len); 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 wpabuf * dpp_build_presence_announcement(struct dpp_bootstrap_info *bi);
struct dpp_global_config { struct dpp_global_config {
void *msg_ctx;
void *cb_ctx; void *cb_ctx;
int (*process_conf_obj)(void *ctx, struct dpp_authentication *auth);
void (*remove_bi)(void *ctx, struct dpp_bootstrap_info *bi); void (*remove_bi)(void *ctx, struct dpp_bootstrap_info *bi);
}; };

@ -53,6 +53,7 @@ struct dpp_relay_controller {
struct dpp_global *global; struct dpp_global *global;
u8 pkhash[SHA256_MAC_LEN]; u8 pkhash[SHA256_MAC_LEN];
struct hostapd_ip_addr ipaddr; struct hostapd_ip_addr ipaddr;
void *msg_ctx;
void *cb_ctx; void *cb_ctx;
void (*tx)(void *ctx, const u8 *addr, unsigned int freq, const u8 *msg, void (*tx)(void *ctx, const u8 *addr, unsigned int freq, const u8 *msg,
size_t len); size_t len);
@ -126,6 +127,7 @@ int dpp_relay_add_controller(struct dpp_global *dpp,
ctrl->global = dpp; ctrl->global = dpp;
os_memcpy(&ctrl->ipaddr, config->ipaddr, sizeof(*config->ipaddr)); os_memcpy(&ctrl->ipaddr, config->ipaddr, sizeof(*config->ipaddr));
os_memcpy(ctrl->pkhash, config->pkhash, SHA256_MAC_LEN); os_memcpy(ctrl->pkhash, config->pkhash, SHA256_MAC_LEN);
ctrl->msg_ctx = config->msg_ctx;
ctrl->cb_ctx = config->cb_ctx; ctrl->cb_ctx = config->cb_ctx;
ctrl->tx = config->tx; ctrl->tx = config->tx;
ctrl->gas_resp_tx = config->gas_resp_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->global = ctrl->global;
conn->relay = ctrl; conn->relay = ctrl;
conn->msg_ctx = ctrl->global->msg_ctx; conn->msg_ctx = ctrl->msg_ctx;
conn->cb_ctx = ctrl->global->cb_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); os_memcpy(conn->mac_addr, src, ETH_ALEN);
conn->freq = freq; conn->freq = freq;

@ -3275,10 +3275,8 @@ int wpas_dpp_init(struct wpa_supplicant *wpa_s)
return -1; return -1;
os_memset(&config, 0, sizeof(config)); os_memset(&config, 0, sizeof(config));
config.msg_ctx = wpa_s;
config.cb_ctx = wpa_s; config.cb_ctx = wpa_s;
#ifdef CONFIG_DPP2 #ifdef CONFIG_DPP2
config.process_conf_obj = wpas_dpp_process_conf_obj;
config.remove_bi = wpas_dpp_remove_bi; config.remove_bi = wpas_dpp_remove_bi;
#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP2 */
wpa_s->dpp = dpp_global_init(&config); wpa_s->dpp = dpp_global_init(&config);

Loading…
Cancel
Save