[RFC 11/13] TDLS: support mgmt-frame Tx fallback for ctrl-iface operations

Arik Nemtsov arik at wizery.com
Thu Sep 15 06:22:29 EDT 2011


When the driver does not implement a given operation internally
(discovery request, link setup/teardown), fallback to sending explicit
TDLS mgmt frames to accomplish the same goal.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 wpa_supplicant/ctrl_iface.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index a55a528..c975ed8 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -204,6 +204,7 @@ static int wpa_supplicant_ctrl_iface_tdls_discover(
 	struct wpa_supplicant *wpa_s, char *addr)
 {
 	u8 peer[ETH_ALEN];
+	int ret;
 
 	if (hwaddr_aton(addr, peer)) {
 		wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_DISCOVER: invalid "
@@ -214,7 +215,11 @@ static int wpa_supplicant_ctrl_iface_tdls_discover(
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_DISCOVER " MACSTR,
 		   MAC2STR(peer));
 
-	return wpa_drv_tdls_oper(wpa_s, TDLS_DISCOVERY_REQ, peer);
+	ret = wpa_drv_tdls_oper(wpa_s, TDLS_DISCOVERY_REQ, peer);
+	if (ret)
+		ret = wpa_tdls_send_discovery_request(wpa_s->wpa, peer);
+
+	return ret;
 }
 
 
@@ -236,6 +241,9 @@ static int wpa_supplicant_ctrl_iface_tdls_setup(
 	ret = wpa_tdls_reneg(wpa_s->wpa, peer);
 	if (ret)
 		ret = wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, peer);
+	if (ret)
+		ret = wpa_tdls_start(wpa_s->wpa, peer);
+
 	return ret;
 }
 
@@ -254,7 +262,8 @@ static int wpa_supplicant_ctrl_iface_tdls_teardown(
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_TEARDOWN " MACSTR,
 		   MAC2STR(peer));
 
-	return wpa_drv_tdls_oper(wpa_s, TDLS_TEARDOWN, peer);
+	return wpa_tdls_teardown_link(wpa_s->wpa, peer,
+				      WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
 }
 
 #endif /* CONFIG_TDLS */
-- 
1.7.4.1



More information about the HostAP mailing list