TDLS: Implement low-ack event for lost TDLS peers
authorArik Nemtsov <arik@wizery.com>
Mon, 26 Sep 2011 10:55:30 +0000 (13:55 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 23 Oct 2011 19:19:08 +0000 (22:19 +0300)
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>
src/rsn_supp/tdls.c
src/rsn_supp/wpa.h
wpa_supplicant/events.c

index 0c5335f..9fe247c 100644 (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,
                                  const u8 *buf, size_t len)
 {
index 20a3e4f..492fd34 100644 (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);
 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 */
index 4d9219e..8bf0ee3 100644 (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],
                                                  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