TDLS/nl80211: Support receiving TDLS discovery response frames
authorArik Nemtsov <arik@wizery.com>
Mon, 26 Sep 2011 10:55:27 +0000 (13:55 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 23 Oct 2011 19:18:35 +0000 (22:18 +0300)
Register for the TDLS discovery response public action frame in nl80211.
Print out a debug message when a Discovery Resp frame is received and
validated.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Cc: Kalyan C Gaddam <chakkal@iit.edu>
src/drivers/driver_nl80211.c
wpa_supplicant/events.c

index e977229..a818923 100644 (file)
@@ -2317,6 +2317,14 @@ static int nl80211_register_action_frames(struct wpa_driver_nl80211_data *drv)
        if (nl80211_register_action_frame(drv, (u8 *) "\x08\x01", 2) < 0)
                return -1;
 #endif /* CONFIG_IEEE80211W */
+#ifdef CONFIG_TDLS
+       if ((drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT)) {
+               /* TDLS Discovery Response */
+               if (nl80211_register_action_frame(drv, (u8 *) "\x04\x0e", 2) <
+                   0)
+                       return -1;
+       }
+#endif /* CONFIG_TDLS */
 
        /* FT Action frames */
        if (nl80211_register_action_frame(drv, (u8 *) "\x06", 1) < 0)
index 5831fbf..4a14be2 100644 (file)
@@ -2209,6 +2209,16 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                        wnm_action_rx(wpa_s, &data->rx_action);
                        break;
                }
+#ifdef CONFIG_TDLS
+               if (data->rx_action.category == WLAN_ACTION_PUBLIC &&
+                   data->rx_action.len >= 4 &&
+                   data->rx_action.data[0] == WLAN_TDLS_DISCOVERY_RESPONSE) {
+                       wpa_dbg(wpa_s, MSG_DEBUG, "TDLS: Received Discovery "
+                               "Response from " MACSTR,
+                               MAC2STR(data->rx_action.sa));
+                       break;
+               }
+#endif /* CONFIG_TDLS */
 #ifdef CONFIG_P2P
                wpas_p2p_rx_action(wpa_s, data->rx_action.da,
                                   data->rx_action.sa,