TDLS: Remove link, if any, on an implicit set up request

If an implicit TDLS set up request is obtained on an existing link or an
to be established link, the previous link was not removed. This commit
disables the existing link on a new set up request. Also,
wpa_tdls_reneg() function was invoking wpa_tdls_start() on an already
existing peer for the case of internal setup, which is incorrect. Thus
the invocation of wpa_tdls_start() is removed in wpa_tdls_reneg() and
also this function is renamed to wps_tdls_remove() as it does not
renegotiation rather shall remove the link (if any) for the case of
external setup.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Sunil Dutt 2013-02-05 13:27:56 +02:00 committed by Jouni Malinen
parent 283a26f358
commit 3887878e53
4 changed files with 15 additions and 14 deletions

View file

@ -2071,12 +2071,12 @@ int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr)
}
int wpa_tdls_reneg(struct wpa_sm *sm, const u8 *addr)
void wpa_tdls_remove(struct wpa_sm *sm, const u8 *addr)
{
struct wpa_tdls_peer *peer;
if (sm->tdls_disabled || !sm->tdls_supported)
return -1;
return;
for (peer = sm->tdls; peer; peer = peer->next) {
if (os_memcmp(peer->addr, addr, ETH_ALEN) == 0)
@ -2084,7 +2084,7 @@ int wpa_tdls_reneg(struct wpa_sm *sm, const u8 *addr)
}
if (peer == NULL || !peer->tpk_success)
return -1;
return;
if (sm->tdls_external_setup) {
/*
@ -2093,8 +2093,6 @@ int wpa_tdls_reneg(struct wpa_sm *sm, const u8 *addr)
*/
wpa_sm_tdls_oper(sm, TDLS_DISABLE_LINK, peer->addr);
}
return wpa_tdls_start(sm, addr);
}

View file

@ -355,7 +355,7 @@ wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
void wpa_tdls_ap_ies(struct wpa_sm *sm, const u8 *ies, size_t len);
void wpa_tdls_assoc_resp_ies(struct wpa_sm *sm, const u8 *ies, size_t len);
int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr);
int wpa_tdls_reneg(struct wpa_sm *sm, const u8 *addr);
void wpa_tdls_remove(struct wpa_sm *sm, const u8 *addr);
int wpa_tdls_send_teardown(struct wpa_sm *sm, const u8 *addr, u16 reason_code);
int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code);
int wpa_tdls_send_discovery_request(struct wpa_sm *sm, const u8 *addr);

View file

@ -554,13 +554,12 @@ static int wpa_supplicant_ctrl_iface_tdls_setup(
wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_SETUP " MACSTR,
MAC2STR(peer));
ret = wpa_tdls_reneg(wpa_s->wpa, peer);
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);
}
wpa_tdls_remove(wpa_s->wpa, peer);
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;
}

View file

@ -2157,7 +2157,11 @@ static void wpa_supplicant_event_tdls(struct wpa_supplicant *wpa_s,
return;
switch (data->tdls.oper) {
case TDLS_REQUEST_SETUP:
wpa_tdls_start(wpa_s->wpa, data->tdls.peer);
wpa_tdls_remove(wpa_s->wpa, data->tdls.peer);
if (wpa_tdls_is_external_setup(wpa_s->wpa))
wpa_tdls_start(wpa_s->wpa, data->tdls.peer);
else
wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, data->tdls.peer);
break;
case TDLS_REQUEST_TEARDOWN:
wpa_tdls_teardown_link(wpa_s->wpa, data->tdls.peer,