]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - hostapd/ctrl_iface.c
Fix hostapd BSS_TM_REQ handling of bss_term parameter
[thirdparty/hostap.git] / hostapd / ctrl_iface.c
index 3a3105073acda9543dd8753b8f4346b35d003d10..e4b16e61af0ecc6042a1432593d52b59f760bd34 100644 (file)
@@ -883,7 +883,7 @@ static int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
                /* TODO: TSF configurable/learnable */
                bss_term_dur[0] = 4; /* Subelement ID */
                bss_term_dur[1] = 10; /* Length */
-               os_memset(bss_term_dur, 2, 8);
+               os_memset(&bss_term_dur[2], 0, 8);
                end = os_strchr(pos, ',');
                if (end == NULL) {
                        wpa_printf(MSG_DEBUG, "Invalid bss_term data");
@@ -3270,7 +3270,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
                                reply_len = -1;
                }
        } else if (os_strncmp(buf, "DPP_BOOTSTRAP_GEN ", 18) == 0) {
-               res = hostapd_dpp_bootstrap_gen(hapd, buf + 18);
+               res = dpp_bootstrap_gen(hapd->iface->interfaces->dpp, buf + 18);
                if (res < 0) {
                        reply_len = -1;
                } else {
@@ -3279,12 +3279,14 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
                                reply_len = -1;
                }
        } else if (os_strncmp(buf, "DPP_BOOTSTRAP_REMOVE ", 21) == 0) {
-               if (hostapd_dpp_bootstrap_remove(hapd, buf + 21) < 0)
+               if (dpp_bootstrap_remove(hapd->iface->interfaces->dpp,
+                                        buf + 21) < 0)
                        reply_len = -1;
        } else if (os_strncmp(buf, "DPP_BOOTSTRAP_GET_URI ", 22) == 0) {
                const char *uri;
 
-               uri = hostapd_dpp_bootstrap_get_uri(hapd, atoi(buf + 22));
+               uri = dpp_bootstrap_get_uri(hapd->iface->interfaces->dpp,
+                                           atoi(buf + 22));
                if (!uri) {
                        reply_len = -1;
                } else {
@@ -3293,8 +3295,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
                                reply_len = -1;
                }
        } else if (os_strncmp(buf, "DPP_BOOTSTRAP_INFO ", 19) == 0) {
-               reply_len = hostapd_dpp_bootstrap_info(hapd, atoi(buf + 19),
-                                                      reply, reply_size);
+               reply_len = dpp_bootstrap_info(hapd->iface->interfaces->dpp,
+                                              atoi(buf + 19),
+                       reply, reply_size);
        } else if (os_strncmp(buf, "DPP_AUTH_INIT ", 14) == 0) {
                if (hostapd_dpp_auth_init(hapd, buf + 13) < 0)
                        reply_len = -1;
@@ -3305,7 +3308,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
                hostapd_dpp_stop(hapd);
                hostapd_dpp_listen_stop(hapd);
        } else if (os_strncmp(buf, "DPP_CONFIGURATOR_ADD", 20) == 0) {
-               res = hostapd_dpp_configurator_add(hapd, buf + 20);
+               res = dpp_configurator_add(hapd->iface->interfaces->dpp,
+                                          buf + 20);
                if (res < 0) {
                        reply_len = -1;
                } else {
@@ -3314,15 +3318,17 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
                                reply_len = -1;
                }
        } else if (os_strncmp(buf, "DPP_CONFIGURATOR_REMOVE ", 24) == 0) {
-               if (hostapd_dpp_configurator_remove(hapd, buf + 24) < 0)
+               if (dpp_configurator_remove(hapd->iface->interfaces->dpp,
+                                           buf + 24) < 0)
                        reply_len = -1;
        } else if (os_strncmp(buf, "DPP_CONFIGURATOR_SIGN ", 22) == 0) {
                if (hostapd_dpp_configurator_sign(hapd, buf + 21) < 0)
                        reply_len = -1;
        } else if (os_strncmp(buf, "DPP_CONFIGURATOR_GET_KEY ", 25) == 0) {
-               reply_len = hostapd_dpp_configurator_get_key(hapd,
-                                                            atoi(buf + 25),
-                                                            reply, reply_size);
+               reply_len = dpp_configurator_get_key_id(
+                       hapd->iface->interfaces->dpp,
+                       atoi(buf + 25),
+                       reply, reply_size);
        } else if (os_strncmp(buf, "DPP_PKEX_ADD ", 13) == 0) {
                res = hostapd_dpp_pkex_add(hapd, buf + 12);
                if (res < 0) {
@@ -3824,7 +3830,7 @@ static void hostapd_ctrl_iface_flush(struct hapd_interfaces *interfaces)
 #endif /* CONFIG_TESTING_OPTIONS */
 
 #ifdef CONFIG_DPP
-       hostapd_dpp_deinit_global(interfaces);
+       dpp_global_clear(interfaces->dpp);
 #endif /* CONFIG_DPP */
 }