diff options
author | Jouni Malinen <jouni@qca.qualcomm.com> | 2014-09-26 12:23:00 (GMT) |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2014-09-26 12:45:53 (GMT) |
commit | fa0e91767d5ce18eafc7efe00a7c4dabaffba118 (patch) | |
tree | c50db6f1aeadcc7cfd940297c5fc5206d97a3dd1 /wpa_supplicant/wpa_cli.c | |
parent | c53a9bf8180819c2e67be51c1e44b5d942cdc6f9 (diff) | |
download | hostap-fa0e91767d5ce18eafc7efe00a7c4dabaffba118.zip hostap-fa0e91767d5ce18eafc7efe00a7c4dabaffba118.tar.gz hostap-fa0e91767d5ce18eafc7efe00a7c4dabaffba118.tar.bz2 |
wpa_cli: Fix PING in interactive mode with ifname_prefix
The ifname_prefix string could change during line editing and the
periodic PING command running in the background ended up getting the
latest snapshot of the command line due to the pointer being left to
point to the edit buffer. This resulted in unexpected prefix strings
getting used with the periodic PING command. Fix this by temporarily
clearing the ifname_prefix whenever running such a periodic PING.
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/wpa_cli.c')
-rw-r--r-- | wpa_supplicant/wpa_cli.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c index 8811d6f..3b48c93 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -3449,10 +3449,18 @@ static int tokenize_cmd(char *cmd, char *argv[]) static void wpa_cli_ping(void *eloop_ctx, void *timeout_ctx) { - if (ctrl_conn && _wpa_ctrl_command(ctrl_conn, "PING", 0)) { - printf("Connection to wpa_supplicant lost - trying to " - "reconnect\n"); - wpa_cli_close_connection(); + if (ctrl_conn) { + int res; + char *prefix = ifname_prefix; + + ifname_prefix = NULL; + res = _wpa_ctrl_command(ctrl_conn, "PING", 0); + ifname_prefix = prefix; + if (res) { + printf("Connection to wpa_supplicant lost - trying to " + "reconnect\n"); + wpa_cli_close_connection(); + } } if (!ctrl_conn) wpa_cli_reconnect(); |