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>
This commit is contained in:
parent
69aa33411e
commit
9be371437e
1 changed files with 33 additions and 0 deletions
|
@ -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)
|
static void try_connection(void *eloop_ctx, void *timeout_ctx)
|
||||||
{
|
{
|
||||||
if (ctrl_ifname == NULL)
|
if (ctrl_ifname == NULL)
|
||||||
|
@ -3304,6 +3335,8 @@ static void try_connection(void *eloop_ctx, void *timeout_ctx)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_bssid_list(ctrl_conn);
|
||||||
|
|
||||||
if (warning_displayed)
|
if (warning_displayed)
|
||||||
printf("Connection established.\n");
|
printf("Connection established.\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue