aboutsummaryrefslogtreecommitdiffstats
path: root/src/rsn_supp
diff options
context:
space:
mode:
authorPaul Stewart <pstew@chromium.org>2013-11-11 20:13:55 (GMT)
committerJouni Malinen <j@w1.fi>2013-11-17 14:47:32 (GMT)
commitcea97a04f9527f026c3c3570f2c071c459513393 (patch)
treeca21f88f5790e0f8f305e375138d511a39e038f5 /src/rsn_supp
parentcc4952ad633c0f86dad97b9845aa18f6162c0f3d (diff)
downloadhostap-cea97a04f9527f026c3c3570f2c071c459513393.zip
hostap-cea97a04f9527f026c3c3570f2c071c459513393.tar.gz
hostap-cea97a04f9527f026c3c3570f2c071c459513393.tar.bz2
dbus_new: Add DBus TDLS methods
Add DBus methods for TDLS operations similar to those available for the control interface. This includes Discover, Setup, and Teardown commands. While here, add a method to query the TDLS link status and add a DBus method for it. Tested with CONFIG_TDLS enabled, on a TDLS-enabled host and peer capable of TDLS: dbus-send --system --dest=fi.w1.wpa_supplicant1 --print-reply \ /fi/w1/wpa_supplicant1/Interfaces/0 \ fi.w1.wpa_supplicant1.Interface.TDLSStatus string:<peer-mac-address> yields: string "peer does not exist" dbus-send --system --dest=fi.w1.wpa_supplicant1 --print-reply \ /fi/w1/wpa_supplicant1/Interfaces/0 \ fi.w1.wpa_supplicant1.Interface.TDLSDiscover string:<peer-mac-address> yields no error dbus-send --system --dest=fi.w1.wpa_supplicant1 --print-reply \ /fi/w1/wpa_supplicant1/Interfaces/0 \ fi.w1.wpa_supplicant1.Interface.TDLSSetup string:<peer-mac-address> yields no error dbus-send --system --dest=fi.w1.wpa_supplicant1 --print-reply \ /fi/w1/wpa_supplicant1/Interfaces/0 \ fi.w1.wpa_supplicant1.Interface.TDLSStatus string:<peer-mac-address> yields: string "connected" after TDLS completes dbus-send --system --dest=fi.w1.wpa_supplicant1 --print-reply \ /fi/w1/wpa_supplicant1/Interfaces/0 \ fi.w1.wpa_supplicant1.Interface.TDLSTeardown string:<peer-mac-address> yields no error dbus-send --system --dest=fi.w1.wpa_supplicant1 --print-reply \ /fi/w1/wpa_supplicant1/Interfaces/0 \ fi.w1.wpa_supplicant1.Interface.TDLSStatus string:<peer-mac-address> yields: string "peer not connected" Signed-hostap: Paul Stewart <pstew@chromium.org>
Diffstat (limited to 'src/rsn_supp')
-rw-r--r--src/rsn_supp/tdls.c22
-rw-r--r--src/rsn_supp/wpa.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index e911ad0..616997f 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -797,6 +797,28 @@ 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)
+{
+ struct wpa_tdls_peer *peer;
+
+ if (sm->tdls_disabled || !sm->tdls_supported)
+ return "disabled";
+
+ for (peer = sm->tdls; peer; peer = peer->next) {
+ if (os_memcmp(peer->addr, addr, ETH_ALEN) == 0)
+ break;
+ }
+
+ if (peer == NULL)
+ return "peer does not exist";
+
+ if (!peer->tpk_success)
+ return "peer not connected";
+
+ return "connected";
+}
+
+
static int wpa_tdls_recv_teardown(struct wpa_sm *sm, const u8 *src_addr,
const u8 *buf, size_t len)
{
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index 26e9c6c..db7f0db 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -380,6 +380,7 @@ void wpa_tdls_teardown_peers(struct wpa_sm *sm);
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_external_setup(struct wpa_sm *sm);
int wpa_wnmsleep_install_key(struct wpa_sm *sm, u8 subelem_id, u8 *buf);