TDLS: Support mgmt-frame Tx for ctrl-iface operations

Use capability information to decide whether to perform a given TDLS
operation internally or through mgmt-frame Tx.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Cc: Kalyan C Gaddam <chakkal@iit.edu>
This commit is contained in:
Arik Nemtsov 2011-09-26 13:55:33 +03:00 committed by Jouni Malinen
parent 45b722f150
commit 2d565a61f2
3 changed files with 23 additions and 4 deletions

View file

@ -2302,3 +2302,9 @@ void wpa_tdls_enable(struct wpa_sm *sm, int enabled)
wpa_printf(MSG_DEBUG, "TDLS: %s", enabled ? "enabled" : "disabled");
sm->tdls_disabled = !enabled;
}
int wpa_tdls_is_external_setup(struct wpa_sm *sm)
{
return sm->tdls_external_setup;
}

View file

@ -370,5 +370,6 @@ int wpa_tdls_init(struct wpa_sm *sm);
void wpa_tdls_deinit(struct wpa_sm *sm);
void wpa_tdls_enable(struct wpa_sm *sm, int enabled);
void wpa_tdls_disable_link(struct wpa_sm *sm, const u8 *addr);
int wpa_tdls_is_external_setup(struct wpa_sm *sm);
#endif /* WPA_H */

View file

@ -206,6 +206,7 @@ static int wpa_supplicant_ctrl_iface_tdls_discover(
struct wpa_supplicant *wpa_s, char *addr)
{
u8 peer[ETH_ALEN];
int ret;
if (hwaddr_aton(addr, peer)) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_DISCOVER: invalid "
@ -216,7 +217,12 @@ static int wpa_supplicant_ctrl_iface_tdls_discover(
wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_DISCOVER " MACSTR,
MAC2STR(peer));
return wpa_drv_tdls_oper(wpa_s, TDLS_DISCOVERY_REQ, peer);
if (wpa_tdls_is_external_setup(wpa_s->wpa))
ret = wpa_tdls_send_discovery_request(wpa_s->wpa, peer);
else
ret = wpa_drv_tdls_oper(wpa_s, TDLS_DISCOVERY_REQ, peer);
return ret;
}
@ -236,8 +242,13 @@ static int wpa_supplicant_ctrl_iface_tdls_setup(
MAC2STR(peer));
ret = wpa_tdls_reneg(wpa_s->wpa, peer);
if (ret)
if (ret) {
if (wpa_tdls_is_external_setup(wpa_s->wpa))
ret = wpa_tdls_start(wpa_s->wpa, peer);
else
ret = wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, peer);
}
return ret;
}
@ -256,7 +267,8 @@ static int wpa_supplicant_ctrl_iface_tdls_teardown(
wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_TEARDOWN " MACSTR,
MAC2STR(peer));
return wpa_drv_tdls_oper(wpa_s, TDLS_TEARDOWN, peer);
return wpa_tdls_teardown_link(wpa_s->wpa, peer,
WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
}
#endif /* CONFIG_TDLS */