[PATCH 09/14] TDLS: implement low-ack event for lost TDLS peers
Arik Nemtsov
arik
Mon Sep 26 03:55:30 PDT 2011
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 at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
src/rsn_supp/tdls.c | 18 ++++++++++++++++++
src/rsn_supp/wpa.h | 1 +
wpa_supplicant/events.c | 4 ++++
3 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 0354731..8b3acf9 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -752,6 +752,24 @@ 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);
+
+ /* clear the Peerkey statemachine */
+ wpa_tdls_peer_free(sm, peer);
+ }
+}
+
+
static int wpa_tdls_recv_teardown(struct wpa_sm *sm, const u8 *src_addr,
const u8 *buf, size_t len)
{
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index 20a3e4f..492fd34 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -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);
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);
#endif /* WPA_H */
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index d552484..9054c18 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2221,6 +2221,10 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
hostapd_event_sta_low_ack(wpa_s->ap_iface->bss[0],
data->low_ack.addr);
#endif /* CONFIG_AP */
+#ifdef CONFIG_TDLS
+ if (data)
+ wpa_tdls_disable_link(wpa_s->wpa, data->low_ack.addr);
+#endif /* CONFIG_TDLS */
break;
case EVENT_IBSS_PEER_LOST:
#ifdef CONFIG_IBSS_RSN
--
1.7.4.1
More information about the Hostap
mailing list