[2/2] TDLS: Added dbus method to disable channel switching with TDLS peer

Submitted by Nishant Chaprana on April 13, 2017, 12:09 p.m.

Details

Message ID 1492085341-7930-2-git-send-email-n.chaprana@samsung.com
State New
Headers show

Commit Message

Nishant Chaprana April 13, 2017, 12:09 p.m.
Description: This patch adds "TDLSCancelChannelSwitch" dbus method
             on "fi.w1.wpa_supplicant1.Interface" interface
             to enable channel switching with TDLS peer.

Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
---
 wpa_supplicant/dbus/dbus_new.c          |  7 +++++++
 wpa_supplicant/dbus/dbus_new_handlers.c | 29 +++++++++++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new_handlers.h |  2 ++
 3 files changed, 38 insertions(+)

Patch hide | download patch | download mbox

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 0dce09e..a234a9a 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3093,6 +3093,13 @@  static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = {
 		  END_ARGS
 	  }
 	},
+	{ "TDLSCancelChannelSwitch", WPAS_DBUS_NEW_IFACE_INTERFACE,
+	  (WPADBusMethodHandler) wpas_dbus_handler_tdls_cancel_channel_switch,
+	  {
+		  { "peer_address", "s", ARG_IN },
+		  END_ARGS
+	  }
+	},
 #endif /* CONFIG_TDLS */
 	{ "VendorElemAdd", WPAS_DBUS_NEW_IFACE_INTERFACE,
 	  (WPADBusMethodHandler) wpas_dbus_handler_vendor_elem_add,
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index 9092e7a..74f0fbe 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -2422,6 +2422,35 @@  DBusMessage * wpas_dbus_handler_tdls_channel_switch(DBusMessage *message,
 	return NULL;
 }
 
+/*
+ * wpas_dbus_handler_tdls_cancel_channel_switch - Disable channel switching with TDLS peer
+ * @message: Pointer to incoming dbus message
+ * @wpa_s: wpa_supplicant structure for a network interface
+ * Returns: NULL indicating success or DBus error message on failure
+ *
+ * Handler function for "TDLSCancelChannelSwitch" method call of network interface.
+ */
+DBusMessage * wpas_dbus_handler_tdls_cancel_channel_switch(DBusMessage *message,
+							   struct wpa_supplicant *wpa_s)
+{
+	u8 peer[ETH_ALEN];
+	DBusMessage *error_reply;
+	int ret;
+
+	if (get_peer_hwaddr_helper(message, __func__, peer, &error_reply) < 0)
+		return error_reply;
+
+	wpa_printf(MSG_DEBUG, "DBUS TDLS_CANCEL_CHAN_SWITCH " MACSTR,
+		   MAC2STR(peer));
+
+	ret = wpa_tdls_disable_chan_switch(wpa_s->wpa, peer);
+	if (ret)
+		return wpas_dbus_error_unknown_error(
+			message, "error canceling TDLS channel switch");
+
+	return NULL;
+}
+
 #endif /* CONFIG_TDLS */
 
 
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h
index 3987c07..cc5f19a 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers.h
@@ -215,6 +215,8 @@  DBusMessage * wpas_dbus_handler_tdls_teardown(DBusMessage *message,
 					      struct wpa_supplicant *wpa_s);
 DBusMessage * wpas_dbus_handler_tdls_channel_switch(DBusMessage *message,
 						    struct wpa_supplicant *wpa_s);
+DBusMessage * wpas_dbus_handler_tdls_cancel_channel_switch(DBusMessage *message,
+							   struct wpa_supplicant *wpa_s);
 
 DBusMessage * wpas_dbus_handler_vendor_elem_add(DBusMessage *message,
 						struct wpa_supplicant *wpa_s);