wpa_cli: Go through ifname determination on connection retries

This is needed to allow the default behavior (pick first interface) to
be used in cases where wpa_supplicant is not available when wpa_cli is
started in interactive mode.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2012-08-05 22:04:22 +03:00
parent db3a03222e
commit 8e897ae37b

View file

@ -95,6 +95,7 @@ static DEFINE_DL_LIST(p2p_groups); /* struct cli_txt_entry */
static void print_help(void); static void print_help(void);
static void wpa_cli_mon_receive(int sock, void *eloop_ctx, void *sock_ctx); static void wpa_cli_mon_receive(int sock, void *eloop_ctx, void *sock_ctx);
static void wpa_cli_close_connection(void); static void wpa_cli_close_connection(void);
static char * wpa_cli_get_default_ifname(void);
static void usage(void) static void usage(void)
@ -3834,6 +3835,9 @@ static void start_edit(void)
static void try_connection(void *eloop_ctx, void *timeout_ctx) static void try_connection(void *eloop_ctx, void *timeout_ctx)
{ {
if (ctrl_ifname == NULL)
ctrl_ifname = wpa_cli_get_default_ifname();
if (!wpa_cli_open_connection(ctrl_ifname, 1) == 0) { if (!wpa_cli_open_connection(ctrl_ifname, 1) == 0) {
if (!warning_displayed) { if (!warning_displayed) {
printf("Could not connect to wpa_supplicant: " printf("Could not connect to wpa_supplicant: "