]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Add configuration structure to dpp_global_init()
authorJouni Malinen <jouni@codeaurora.org>
Sun, 21 Apr 2019 18:18:24 +0000 (21:18 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 21 Apr 2019 18:35:32 +0000 (21:35 +0300)
This can be used to provide configurable parameter to the global DPP
context. This initial commit introduces the msg_ctx context pointer for
wpa_msg().

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
hostapd/main.c
src/common/dpp.c
src/common/dpp.h
wpa_supplicant/dpp_supplicant.c

index 93d2dd34c08e5acea2d8b8a4d994b8cd6f9eb35b..08896ffe2a79d4fdc89a993363885397bd69c880 100644 (file)
@@ -653,6 +653,9 @@ int main(int argc, char *argv[])
        int start_ifaces_in_sync = 0;
        char **if_names = NULL;
        size_t if_names_size = 0;
+#ifdef CONFIG_DPP
+       struct dpp_global_config dpp_conf;
+#endif /* CONFIG_DPP */
 
        if (os_program_init())
                return -1;
@@ -672,7 +675,9 @@ int main(int argc, char *argv[])
        dl_list_init(&interfaces.eth_p_oui);
 #endif /* CONFIG_ETH_P_OUI */
 #ifdef CONFIG_DPP
-       interfaces.dpp = dpp_global_init();
+       os_memset(&dpp_conf, 0, sizeof(dpp_conf));
+       /* TODO: dpp_conf.msg_ctx? */
+       interfaces.dpp = dpp_global_init(&dpp_conf);
        if (!interfaces.dpp)
                return -1;
 #endif /* CONFIG_DPP */
index 49de476973846797f81332f38ceba7457e20cb2a..6f0d91dcd9933db6be782376198cfcde90e28f27 100644 (file)
@@ -71,6 +71,7 @@ static void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr,
 
 
 struct dpp_global {
+       void *msg_ctx;
        struct dl_list bootstrap; /* struct dpp_bootstrap_info */
        struct dl_list configurator; /* struct dpp_configurator */
 };
@@ -8689,13 +8690,14 @@ int dpp_configurator_get_key_id(struct dpp_global *dpp, unsigned int id,
 }
 
 
-struct dpp_global * dpp_global_init(void)
+struct dpp_global * dpp_global_init(struct dpp_global_config *config)
 {
        struct dpp_global *dpp;
 
        dpp = os_zalloc(sizeof(*dpp));
        if (!dpp)
                return NULL;
+       dpp->msg_ctx = config->msg_ctx;
 
        dl_list_init(&dpp->bootstrap);
        dl_list_init(&dpp->configurator);
index 5a6d8cc79c2cf9ee33ff0e67fdb996544c6943b9..42c70b115d32d40dad4515962c6672862dc0403d 100644 (file)
@@ -497,7 +497,12 @@ int dpp_configurator_add(struct dpp_global *dpp, const char *cmd);
 int dpp_configurator_remove(struct dpp_global *dpp, const char *id);
 int dpp_configurator_get_key_id(struct dpp_global *dpp, unsigned int id,
                                char *buf, size_t buflen);
-struct dpp_global * dpp_global_init(void);
+
+struct dpp_global_config {
+       void *msg_ctx;
+};
+
+struct dpp_global * dpp_global_init(struct dpp_global_config *config);
 void dpp_global_clear(struct dpp_global *dpp);
 void dpp_global_deinit(struct dpp_global *dpp);
 
index e003a8514edb8868e95aaf59099652314bbe0ffa..4cfbbcba7a0ae6aa828ae43365e021337d296075 100644 (file)
@@ -2196,6 +2196,7 @@ void wpas_dpp_stop(struct wpa_supplicant *wpa_s)
 
 int wpas_dpp_init(struct wpa_supplicant *wpa_s)
 {
+       struct dpp_global_config config;
        u8 adv_proto_id[7];
 
        adv_proto_id[0] = WLAN_EID_VENDOR_SPECIFIC;
@@ -2208,7 +2209,10 @@ int wpas_dpp_init(struct wpa_supplicant *wpa_s)
                                sizeof(adv_proto_id), wpas_dpp_gas_req_handler,
                                wpas_dpp_gas_status_handler, wpa_s) < 0)
                return -1;
-       wpa_s->dpp = dpp_global_init();
+
+       os_memset(&config, 0, sizeof(config));
+       config.msg_ctx = wpa_s;
+       wpa_s->dpp = dpp_global_init(&config);
        return wpa_s->dpp ? 0 : -1;
 }