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>
This commit is contained in:
Jouni Malinen 2020-08-25 16:00:56 +03:00 committed by Jouni Malinen
parent 4ecb6dd16b
commit c043b1e000
5 changed files with 4 additions and 9 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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);
};

View File

@ -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;

View File

@ -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);