[RFC 07/34] wpa_supplicant: Add control interface commands for NAN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ilan Peer <ilan.peer@xxxxxxxxx>

- Add control interface commands to start/stop NAN operation. All
  the NAN commands should be handled only on the control interface
  associated with the NAN Device interface.
- Add indication for NAN support when querying for capabilities.

Signed-off-by: Ilan Peer <ilan.peer@xxxxxxxxx>
---
 wpa_supplicant/ctrl_iface.c | 32 ++++++++++++++++++++++++++++----
 wpa_supplicant/wpa_cli.c    |  6 ++++++
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 72510f0f9a..47a956af4b 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -60,6 +60,7 @@
 #include "dpp_supplicant.h"
 #include "sme.h"
 #include "nan_usd.h"
+#include "nan_supplicant.h"
 
 #ifdef __NetBSD__
 #include <net/if_ether.h>
@@ -4912,14 +4913,29 @@ static int wpa_supplicant_ctrl_iface_get_capability(
 	}
 #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, " NAN");
+			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 &&
@@ -14033,6 +14049,14 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
 		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;
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 031460ae89..efdf35499c 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -4144,6 +4144,12 @@ static const struct wpa_cli_cmd wpa_cli_commands[] = {
 	{ "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 */
 	{ NULL, NULL, NULL, cli_cmd_flag_none, NULL }
 };
 
-- 
2.49.0


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux