From 9f49474669e17cddcce9cfd7d962c950008872bc Mon Sep 17 00:00:00 2001 From: Nishant Chaprana Date: Thu, 13 Apr 2017 17:39:01 +0530 Subject: [PATCH] dbus: Add method to disable channel switching with a TDLS peer This patch adds "TDLSCancelChannelSwitch" dbus method on "fi.w1.wpa_supplicant1.Interface" interface to disable channel switching with a TDLS peer. Signed-off-by: Nishant Chaprana --- doc/dbus.doxygen | 9 +++++++ wpa_supplicant/dbus/dbus_new.c | 7 ++++++ wpa_supplicant/dbus/dbus_new_handlers.c | 31 +++++++++++++++++++++++++ wpa_supplicant/dbus/dbus_new_handlers.h | 3 +++ 4 files changed, 50 insertions(+) diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen index 7590c9ed5..a0e8fe43e 100644 --- a/doc/dbus.doxygen +++ b/doc/dbus.doxygen @@ -464,6 +464,15 @@ fi.w1.wpa_supplicant1.CreateInterface.
A dictionary with arguments identifying the peer and channel switching behavior.
+
  • +

    TDLSCancelChannelSwitch ( s : peer_address ) --> nothing

    +

    Disable channel switching for a TDLS session with a peer.

    +

    Arguments

    +
    +
    s : peer_address
    +
    MAC address for the peer.
    +
    +
  • VendorElemAdd ( i: frame_id, ay: ielems ) --> nothing

    Add Vendor Elements to corresponding frame ID.

    diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index 242098462..393cdd401 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 65a6a0fd9..63f787a85 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.c +++ b/wpa_supplicant/dbus/dbus_new_handlers.c @@ -2432,6 +2432,37 @@ 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 8ce289f7e..7d3c3b144 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.h +++ b/wpa_supplicant/dbus/dbus_new_handlers.h @@ -219,6 +219,9 @@ DBusMessage * wpas_dbus_handler_tdls_teardown(DBusMessage *message, 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);