TDLS: Allow wpa_cli tdls_setup to start renegotiation

If there is already a link the requested peer, request start of
renegotiation instead of completely new link. This seems to be needed
to allow some driver to accept the trigger for a new negotiation.
This commit is contained in:
Jouni Malinen 2011-01-28 01:24:24 +02:00 committed by Jouni Malinen
parent ad79dba127
commit 94377fbc52
3 changed files with 22 additions and 1 deletions

View file

@ -1825,6 +1825,22 @@ int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr)
} }
int wpa_tdls_reneg(struct wpa_sm *sm, const u8 *addr)
{
struct wpa_tdls_peer *peer;
for (peer = sm->tdls; peer; peer = peer->next) {
if (os_memcmp(peer->addr, addr, ETH_ALEN) == 0)
break;
}
if (peer == NULL || !peer->tpk_success)
return -1;
return wpa_tdls_start(sm, addr);
}
/** /**
* wpa_supplicant_rx_tdls - Receive TDLS data frame * wpa_supplicant_rx_tdls - Receive TDLS data frame
* *

View file

@ -339,6 +339,7 @@ wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
/* tdls.c */ /* tdls.c */
int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr); int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr);
int wpa_tdls_reneg(struct wpa_sm *sm, const u8 *addr);
int wpa_tdls_recv_teardown_notify(struct wpa_sm *sm, const u8 *addr, int wpa_tdls_recv_teardown_notify(struct wpa_sm *sm, const u8 *addr,
u16 reason_code); u16 reason_code);
int wpa_tdls_init(struct wpa_sm *sm); int wpa_tdls_init(struct wpa_sm *sm);

View file

@ -211,6 +211,7 @@ static int wpa_supplicant_ctrl_iface_tdls_setup(
struct wpa_supplicant *wpa_s, char *addr) struct wpa_supplicant *wpa_s, char *addr)
{ {
u8 peer[ETH_ALEN]; u8 peer[ETH_ALEN];
int ret;
if (hwaddr_aton(addr, peer)) { if (hwaddr_aton(addr, peer)) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_SETUP: invalid " wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_SETUP: invalid "
@ -221,7 +222,10 @@ static int wpa_supplicant_ctrl_iface_tdls_setup(
wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_SETUP " MACSTR, wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_SETUP " MACSTR,
MAC2STR(peer)); MAC2STR(peer));
return wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, peer); ret = wpa_tdls_reneg(wpa_s->wpa, peer);
if (ret)
ret = wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, peer);
return ret;
} }