#include "sme.h"
#include "nan_usd.h"
#include "pr_supplicant.h"
+#include "nan_supplicant.h"
#ifdef __NetBSD__
#include <net/if_ether.h>
}
#endif /* CONFIG_DPP */
-#ifdef CONFIG_NAN_USD
if (os_strcmp(field, "nan") == 0) {
- res = os_snprintf(buf, buflen, "USD");
+ char *pos = buf;
+
+#ifdef CONFIG_NAN_USD
+ res = os_snprintf(pos, buflen, "USD");
if (os_snprintf_error(buflen, res))
return -1;
- return res;
- }
+
+ pos += res;
+ buflen -= res;
#endif /* CONFIG_NAN_USD */
+#ifdef CONFIG_NAN
+ if ((wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_SUPPORT_NAN)) {
+ res = os_snprintf(pos, buflen, "%sNAN",
+ pos == buf ? "" : " ");
+ if (os_snprintf_error(buflen, res))
+ return -1;
+
+ pos += res;
+ buflen -= res;
+ }
+#endif /* CONFIG_NAN */
+ return pos - buf;
+ }
#ifdef CONFIG_SAE
if (os_strcmp(field, "sae") == 0 &&
if (wpas_update_random_addr_disassoc(wpa_s) != 1)
reply_len = -1;
wpa_s->conf->preassoc_mac_addr = mac_addr_style;
+#ifdef CONFIG_NAN
+ } else if (os_strncmp(buf, "NAN_START", 9) == 0) {
+ if (wpas_nan_start(wpa_s) < 0)
+ reply_len = -1;
+ } else if (os_strncmp(buf, "NAN_STOP", 8) == 0) {
+ if (wpas_nan_stop(wpa_s) < 0)
+ reply_len = -1;
+#endif /* CONFIG_NAN */
} else {
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
#endif /* CONFIG_NAN_USD */
+#ifdef CONFIG_NAN
+
+static int wpa_cli_cmd_nan_start(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ return wpa_cli_cmd(ctrl, "NAN_START", 0, argc, argv);
+}
+
+
+static int wpa_cli_cmd_nan_stop(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ return wpa_cli_cmd(ctrl, "NAN_STOP", 0, argc, argv);
+}
+
+#endif /* CONFIG_NAN */
+
+
static int wpa_cli_cmd_generate_new_mac(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
{ "nan_flush", wpa_cli_cmd_nan_flush, NULL,
cli_cmd_flag_none, "= Flush all NAN USD services" },
#endif /* CONFIG_NAN_USD */
+#ifdef CONFIG_NAN
+ { "nan_start", wpa_cli_cmd_nan_start, NULL, cli_cmd_flag_none,
+ "= start/join NAN cluster with current configuration" },
+ { "nan_stop", wpa_cli_cmd_nan_stop, NULL, cli_cmd_flag_none,
+ "= stop NAN operation" },
+#endif /* CONFIG_NAN */
{ "new_random_mac_address", wpa_cli_cmd_generate_new_mac, NULL,
cli_cmd_flag_none, "= Generate new random MAC address" },
{ NULL, NULL, NULL, cli_cmd_flag_none, NULL }