TDLS: Implement low-ack event for lost TDLS peers

Disable the direct connection when a TDLS peer stops responding
to packets, as indicated by the "LOW ACK" event coming from a driver.

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:30 +03:00 committed by Jouni Malinen
parent 7a1486cd31
commit 8f15f711c5
3 changed files with 21 additions and 0 deletions

View file

@ -751,6 +751,22 @@ int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code)
} }
void wpa_tdls_disable_link(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) {
wpa_sm_tdls_oper(sm, TDLS_DISABLE_LINK, addr);
wpa_tdls_peer_free(sm, peer);
}
}
static int wpa_tdls_recv_teardown(struct wpa_sm *sm, const u8 *src_addr, static int wpa_tdls_recv_teardown(struct wpa_sm *sm, const u8 *src_addr,
const u8 *buf, size_t len) const u8 *buf, size_t len)
{ {

View file

@ -366,5 +366,6 @@ int wpa_tdls_send_discovery_request(struct wpa_sm *sm, const u8 *addr);
int wpa_tdls_init(struct wpa_sm *sm); int wpa_tdls_init(struct wpa_sm *sm);
void wpa_tdls_deinit(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_enable(struct wpa_sm *sm, int enabled);
void wpa_tdls_disable_link(struct wpa_sm *sm, const u8 *addr);
#endif /* WPA_H */ #endif /* WPA_H */

View file

@ -2410,6 +2410,10 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
hostapd_event_sta_low_ack(wpa_s->ap_iface->bss[0], hostapd_event_sta_low_ack(wpa_s->ap_iface->bss[0],
data->low_ack.addr); data->low_ack.addr);
#endif /* CONFIG_AP */ #endif /* CONFIG_AP */
#ifdef CONFIG_TDLS
if (data)
wpa_tdls_disable_link(wpa_s->wpa, data->low_ack.addr);
#endif /* CONFIG_TDLS */
break; break;
case EVENT_IBSS_PEER_LOST: case EVENT_IBSS_PEER_LOST:
#ifdef CONFIG_IBSS_RSN #ifdef CONFIG_IBSS_RSN