Patchwork TDLS: Add get_capability tdls command

login
register
mail settings
Submitter Dmitry Shmidt
Date March 13, 2014, 10:12 p.m.
Message ID <20140313221311.36BC113F8B1@ushik.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/330137/
State Accepted
Headers show

Comments

Dmitry Shmidt - March 13, 2014, 10:12 p.m.
Command returns info in format: UNSUPPORTED/INTERNAL/EXTERNAL

Change-Id: I3bc1cc02c03c5a8b7cbaeaef302e2860d1356950
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
---
 wpa_supplicant/ctrl_iface.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
Jouni Malinen - March 14, 2014, 10:22 p.m.
On Thu, Mar 13, 2014 at 03:12:38PM -0700, Dmitry Shmidt wrote:
> Command returns info in format: UNSUPPORTED/INTERNAL/EXTERNAL

Thanks, applied.

Patch

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 98c4b65..f215e3a 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -538,6 +538,21 @@  static int wpa_supplicant_ctrl_iface_tdls_teardown(
 	return ret;
 }
 
+
+static int ctrl_iface_get_capability_tdls(
+	struct wpa_supplicant *wpa_s, char *buf, size_t buflen)
+{
+	int ret;
+
+	ret = os_snprintf(buf, buflen, "%s\n",
+			  wpa_s->drv_flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT ?
+			  wpa_s->drv_flags & WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP ?
+			  "EXTERNAL" : "INTERNAL" : "UNSUPPORTED");
+	if (ret < 0 || (size_t) ret > buflen)
+		return -1;
+	return ret;
+}
+
 #endif /* CONFIG_TDLS */
 
 
@@ -3180,6 +3195,11 @@  static int wpa_supplicant_ctrl_iface_get_capability(
 	if (os_strcmp(field, "freq") == 0)
 		return ctrl_iface_get_capability_freq(wpa_s, buf, buflen);
 
+#ifdef CONFIG_TDLS
+	if (os_strcmp(field, "tdls") == 0)
+		return ctrl_iface_get_capability_tdls(wpa_s, buf, buflen);
+#endif
+
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE: Unknown GET_CAPABILITY field '%s'",
 		   field);