]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Make DPP version number support available over control interface
authorJouni Malinen <jouni@codeaurora.org>
Thu, 14 Mar 2019 18:45:36 +0000 (20:45 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 14 Mar 2019 22:31:09 +0000 (00:31 +0200)
"GET_CAPABILITY dpp" can now be used to determine which version number
of DPP is supported in the build.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
hostapd/ctrl_iface.c
wpa_supplicant/ctrl_iface.c

index df2524a35b808935cf82afc6de067bf316adf0b6..3a3105073acda9543dd8753b8f4346b35d003d10 100644 (file)
@@ -2883,6 +2883,34 @@ static int hostapd_ctrl_iface_acl_add_mac(struct mac_acl_entry **acl, int *num,
 }
 
 
+static int hostapd_ctrl_iface_get_capability(struct hostapd_data *hapd,
+                                            const char *field, char *buf,
+                                            size_t buflen)
+{
+       wpa_printf(MSG_DEBUG, "CTRL_IFACE: GET_CAPABILITY '%s'", field);
+
+#ifdef CONFIG_DPP
+       if (os_strcmp(field, "dpp") == 0) {
+               int res;
+
+#ifdef CONFIG_DPP2
+               res = os_snprintf(buf, buflen, "DPP=2");
+#else /* CONFIG_DPP2 */
+               res = os_snprintf(buf, buflen, "DPP=1");
+#endif /* CONFIG_DPP2 */
+               if (os_snprintf_error(buflen, res))
+                       return -1;
+               return res;
+       }
+#endif /* CONFIG_DPP */
+
+       wpa_printf(MSG_DEBUG, "CTRL_IFACE: Unknown GET_CAPABILITY field '%s'",
+                  field);
+
+       return -1;
+}
+
+
 static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
                                              char *buf, char *reply,
                                              int reply_size,
@@ -3313,6 +3341,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
                if (radius_server_dac_request(hapd->radius_srv, buf + 12) < 0)
                        reply_len = -1;
 #endif /* RADIUS_SERVER */
+       } else if (os_strncmp(buf, "GET_CAPABILITY ", 15) == 0) {
+               reply_len = hostapd_ctrl_iface_get_capability(
+                       hapd, buf + 15, reply, reply_size);
        } else {
                os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
                reply_len = 16;
index c627443a8d63e25f1475598fcd64098a687bc19d..e8f38752bc30a31b42ca72d6a0d66b5a8b16c699 100644 (file)
@@ -4443,6 +4443,19 @@ static int wpa_supplicant_ctrl_iface_get_capability(
                return res;
        }
 
+#ifdef CONFIG_DPP
+       if (os_strcmp(field, "dpp") == 0) {
+#ifdef CONFIG_DPP2
+               res = os_snprintf(buf, buflen, "DPP=2");
+#else /* CONFIG_DPP2 */
+               res = os_snprintf(buf, buflen, "DPP=1");
+#endif /* CONFIG_DPP2 */
+               if (os_snprintf_error(buflen, res))
+                       return -1;
+               return res;
+       }
+#endif /* CONFIG_DPP */
+
        wpa_printf(MSG_DEBUG, "CTRL_IFACE: Unknown GET_CAPABILITY field '%s'",
                   field);