[PATCH 2/2] Add wpa_cli command for list of roaming candidates

Gery Kahn geryk
Thu Jul 28 06:40:45 PDT 2011


Introduce new wpa_cli command list_candidates which gets list of
roaming candidates.

Signed-off-by: Gery Kahn <geryk at ti.com>
---
 wpa_supplicant/ctrl_iface.c |    9 +++++++++
 wpa_supplicant/wpa_cli.c    |   10 ++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 730e607..990c4ca 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -38,6 +38,7 @@
 #include "bss.h"
 #include "scan.h"
 #include "ctrl_iface.h"
+#include "bgscan.h"
 
 extern struct wpa_driver_ops *wpa_drivers[];
 
@@ -2103,6 +2104,11 @@ static int wpa_supplicant_ctrl_iface_roam(struct wpa_supplicant *wpa_s,
 	return 0;
 }
 
+static int wpa_supplicant_ctrl_iface_list_candidates(
+	struct wpa_supplicant *wpa_s, char *buf, size_t buflen)
+{
+	return bgscan_list_candidates(wpa_s, buf, buflen);
+}
 
 #ifdef CONFIG_P2P
 static int p2p_ctrl_find(struct wpa_supplicant *wpa_s, char *cmd)
@@ -3270,6 +3276,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
 	} else if (os_strncmp(buf, "ROAM ", 5) == 0) {
 		if (wpa_supplicant_ctrl_iface_roam(wpa_s, buf + 5))
 			reply_len = -1;
+	} else if (os_strcmp(buf, "LIST_CANDIDATES") == 0) {
+		reply_len = wpa_supplicant_ctrl_iface_list_candidates(
+			wpa_s, reply, reply_size);
 	} else if (os_strncmp(buf, "STA_AUTOCONNECT ", 16) == 0) {
 		if (wpa_supplicant_ctrl_iface_sta_autoconnect(wpa_s, buf + 16))
 			reply_len = -1;
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 9439856..7b84b7d 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -1678,6 +1678,13 @@ static int wpa_cli_cmd_roam(struct wpa_ctrl *ctrl, int argc, char *argv[])
 }
 
 
+static int wpa_cli_cmd_list_candidates(struct wpa_ctrl *ctrl,
+				       int argc, char *argv[])
+{
+	return wpa_ctrl_command(ctrl, "LIST_CANDIDATES");
+}
+
+
 #ifdef CONFIG_P2P
 
 static int wpa_cli_cmd_p2p_find(struct wpa_ctrl *ctrl, int argc, char *argv[])
@@ -2540,6 +2547,9 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
 	{ "roam", wpa_cli_cmd_roam,
 	  cli_cmd_flag_none,
 	  "<addr> = roam to the specified BSS" },
+	{ "list_candidates", wpa_cli_cmd_list_candidates,
+	  cli_cmd_flag_none,
+	  "= list candidates for roaming" },
 #ifdef CONFIG_P2P
 	{ "p2p_find", wpa_cli_cmd_p2p_find, cli_cmd_flag_none,
 	  "[timeout] [type=*] = find P2P Devices for up-to timeout seconds" },
-- 
1.7.0.4




More information about the Hostap mailing list