TDLS: Add TDLS_LINK_STATUS command to the control interface

Add the TDLS_LINK_STATUS command to the control interface. This command
shows what is the status of our current TDLS connection with the given
peer. Also, add the TDLS_LINK_STATUS command to wpa_cli.

Signed-off-by: Oren Givon <oren.givon@intel.com>
This commit is contained in:
Oren Givon 2015-04-28 14:00:50 +03:00 committed by Jouni Malinen
parent c53a3f29cd
commit 4504621f9c
2 changed files with 40 additions and 0 deletions

View File

@ -760,6 +760,33 @@ static int wpa_supplicant_ctrl_iface_tdls_cancel_chan_switch(
return wpa_tdls_disable_chan_switch(wpa_s->wpa, peer);
}
static int wpa_supplicant_ctrl_iface_tdls_link_status(
struct wpa_supplicant *wpa_s, const char *addr,
char *buf, size_t buflen)
{
u8 peer[ETH_ALEN];
const char *tdls_status;
int ret;
if (hwaddr_aton(addr, peer)) {
wpa_printf(MSG_DEBUG,
"CTRL_IFACE TDLS_LINK_STATUS: Invalid address '%s'",
addr);
return -1;
}
wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_LINK_STATUS " MACSTR,
MAC2STR(peer));
tdls_status = wpa_tdls_get_link_status(wpa_s->wpa, peer);
wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_LINK_STATUS: %s", tdls_status);
ret = os_snprintf(buf, buflen, "TDLS link status: %s\n", tdls_status);
if (os_snprintf_error(buflen, ret))
return -1;
return ret;
}
#endif /* CONFIG_TDLS */
@ -8415,6 +8442,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
if (wpa_supplicant_ctrl_iface_tdls_cancel_chan_switch(wpa_s,
buf + 24))
reply_len = -1;
} else if (os_strncmp(buf, "TDLS_LINK_STATUS ", 17) == 0) {
reply_len = wpa_supplicant_ctrl_iface_tdls_link_status(
wpa_s, buf + 17, reply, reply_size);
#endif /* CONFIG_TDLS */
} else if (os_strcmp(buf, "WMM_AC_STATUS") == 0) {
reply_len = wpas_wmm_ac_status(wpa_s, reply, reply_size);

View File

@ -2653,6 +2653,13 @@ static int wpa_cli_cmd_tdls_teardown(struct wpa_ctrl *ctrl, int argc,
}
static int wpa_cli_cmd_tdls_link_status(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
return wpa_cli_cmd(ctrl, "TDLS_LINK_STATUS", 1, argc, argv);
}
static int wpa_cli_cmd_wmm_ac_addts(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
@ -3280,6 +3287,9 @@ static const struct wpa_cli_cmd wpa_cli_commands[] = {
{ "tdls_teardown", wpa_cli_cmd_tdls_teardown, NULL,
cli_cmd_flag_none,
"<addr> = tear down TDLS with <addr>" },
{ "tdls_link_status", wpa_cli_cmd_tdls_link_status, NULL,
cli_cmd_flag_none,
"<addr> = TDLS link status with <addr>" },
{ "wmm_ac_addts", wpa_cli_cmd_wmm_ac_addts, NULL,
cli_cmd_flag_none,
"<uplink/downlink/bidi> <tsid=0..7> <up=0..7> [nominal_msdu_size=#] "