[PATCH] TDLS: Add get_capability tdls command
Dmitry Shmidt
dimitrysh
Thu Mar 13 14:03:28 PDT 2014
Command returns info in format:
TDLS supported = YES / NO
Driver uses INTERNAL / EXTERNAL link setup
Change-Id: I1c82e6bb4939c137dd3024531073af3ef2c9b862
Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
src/rsn_supp/tdls.c | 6 ++++++
src/rsn_supp/wpa.h | 1 +
wpa_supplicant/ctrl_iface.c | 21 +++++++++++++++++++++
3 files changed, 28 insertions(+)
diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 8a978f7..3146b37 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -2632,6 +2632,12 @@ void wpa_tdls_enable(struct wpa_sm *sm, int enabled)
}
+int wpa_tdls_is_supported(struct wpa_sm *sm)
+{
+ return sm->tdls_supported;
+}
+
+
int wpa_tdls_is_external_setup(struct wpa_sm *sm)
{
return sm->tdls_external_setup;
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index 20b3f62..0b05cdf 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -395,6 +395,7 @@ 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);
const char * wpa_tdls_get_link_status(struct wpa_sm *sm, const u8 *addr);
+int wpa_tdls_is_supported(struct wpa_sm *sm);
int wpa_tdls_is_external_setup(struct wpa_sm *sm);
int wpa_wnmsleep_install_key(struct wpa_sm *sm, u8 subelem_id, u8 *buf);
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 98c4b65..f054f12 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -538,6 +538,22 @@ 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, "TDLS supported = %s\n"
+ "Driver uses %s link setup\n",
+ wpa_tdls_is_supported(wpa_s->wpa) ? "YES" : "NO",
+ wpa_tdls_is_external_setup(wpa_s->wpa) ? "EXTERNAL" :
+ "INTERNAL");
+ if (ret < 0 || (size_t) ret > buflen)
+ return -1;
+ return ret;
+}
+
#endif /* CONFIG_TDLS */
@@ -3180,6 +3196,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);
--
1.9.0.279.gdc9e3eb
More information about the Hostap
mailing list