aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wpa_cli.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-05-05 09:38:55 (GMT)
committerJouni Malinen <j@w1.fi>2013-05-05 09:38:55 (GMT)
commit9be371437ed1f2122ad8efd2b1da6761ced33476 (patch)
tree83659f3382553100f3cfd45e3eaa33a7aea6c120 /wpa_supplicant/wpa_cli.c
parent69aa33411e1664ee292960688407f35a0f584e5e (diff)
downloadhostap-9be371437ed1f2122ad8efd2b1da6761ced33476.zip
hostap-9be371437ed1f2122ad8efd2b1da6761ced33476.tar.gz
hostap-9be371437ed1f2122ad8efd2b1da6761ced33476.tar.bz2
wpa_cli: Fetch the current BSSID list when starting interactive mode
This makes tab completion work better in cases where wpa_cli is started after wpa_supplicant has already discovered BSSes. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/wpa_cli.c')
-rw-r--r--wpa_supplicant/wpa_cli.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 47a596e..d2d5dd9 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -3289,6 +3289,37 @@ static void start_edit(void)
}
+static void update_bssid_list(struct wpa_ctrl *ctrl)
+{
+ char buf[4096];
+ size_t len = sizeof(buf);
+ int ret;
+ char *cmd = "BSS RANGE=ALL MASK=0x2";
+ char *pos, *end;
+
+ if (ctrl == NULL)
+ return;
+ ret = wpa_ctrl_request(ctrl, cmd, os_strlen(cmd), buf, &len, NULL);
+ if (ret < 0)
+ return;
+ buf[len] = '\0';
+
+ pos = buf;
+ while (pos) {
+ pos = os_strstr(pos, "bssid=");
+ if (pos == NULL)
+ break;
+ pos += 6;
+ end = os_strchr(pos, '\n');
+ if (end == NULL)
+ break;
+ *end = '\0';
+ cli_txt_list_add(&bsses, pos);
+ pos = end + 1;
+ }
+}
+
+
static void try_connection(void *eloop_ctx, void *timeout_ctx)
{
if (ctrl_ifname == NULL)
@@ -3304,6 +3335,8 @@ static void try_connection(void *eloop_ctx, void *timeout_ctx)
return;
}
+ update_bssid_list(ctrl_conn);
+
if (warning_displayed)
printf("Connection established.\n");