[PATCH 06/14] TDLS/nl80211: support receiving TDLS discovery response frames

Arik Nemtsov arik
Mon Sep 26 03:55:27 PDT 2011


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 at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/drivers/driver_nl80211.c |   10 ++++++++++
 wpa_supplicant/events.c      |    9 +++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 9c8c0e2..cc10331 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2283,6 +2283,16 @@ 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)) {
+		int ret;
+
+		/* TDLS Discovery Response */
+		ret = nl80211_register_action_frame(drv, (u8 *) "\x04\x0e", 2);
+		if (ret < 0)
+			return -1;
+	}
+#endif
 
 	/* FT Action frames */
 	if (nl80211_register_action_frame(drv, (u8 *) "\x06", 1) < 0)
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index a307eda..1856a63 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2030,6 +2030,15 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 				   data->rx_action.data,
 				   data->rx_action.len, data->rx_action.freq);
 #endif /* CONFIG_P2P */
+#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, "Received TDLS discovery "
+				"response from " MACSTR,
+				MAC2STR(data->rx_action.sa));
+		}
+#endif /* CONFIG_TDLS */
 		break;
 	case EVENT_RX_PROBE_REQ:
 		if (data->rx_probe_req.sa == NULL ||
-- 
1.7.4.1




More information about the Hostap mailing list