aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHelmut Schaa <helmut.schaa@googlemail.com>2009-05-06 08:54:00 (GMT)
committerJouni Malinen <j@w1.fi>2010-01-09 17:34:31 (GMT)
commite6e9da3a88481412300b64d16dda5ec4ba6696f1 (patch)
tree7fd7df2ec9bedd3f1b5370c7bbbcd73b313385bb
parentb99094dafb488e7c71739e47f52f54158ae4ff99 (diff)
downloadhostap-06-e6e9da3a88481412300b64d16dda5ec4ba6696f1.zip
hostap-06-e6e9da3a88481412300b64d16dda5ec4ba6696f1.tar.gz
hostap-06-e6e9da3a88481412300b64d16dda5ec4ba6696f1.tar.bz2
wpa_supplicant: add DBus method for changing debug parameters
Add a new DBus method "setDebugParams" which takes the parameters debug_level, debug_timestamp and show_keys as input and updates the internal debug variables accordingly. To change the debug level, enable/disable timestamps and enable/disable show_keys the following dbus-send command can be used: dbus-send --system --dest=fi.epitest.hostap.WPASupplicant --print-reply /fi/epitest/hostap/WPASupplicant fi.epitest.hostap.WPASupplicant.setDebugParams int32:0 boolean:false boolean:false Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> (cherry picked from commit 01a569e8a131cc6150210036ae171b8bfd418a3f)
-rw-r--r--wpa_supplicant/ctrl_iface_dbus.c3
-rw-r--r--wpa_supplicant/ctrl_iface_dbus_handlers.c48
-rw-r--r--wpa_supplicant/ctrl_iface_dbus_handlers.h3
3 files changed, 54 insertions, 0 deletions
diff --git a/wpa_supplicant/ctrl_iface_dbus.c b/wpa_supplicant/ctrl_iface_dbus.c
index dc4b3a9..8e69f4d 100644
--- a/wpa_supplicant/ctrl_iface_dbus.c
+++ b/wpa_supplicant/ctrl_iface_dbus.c
@@ -605,6 +605,9 @@ static DBusHandlerResult wpas_message_handler(DBusConnection *connection,
} else if (!strcmp(method, "getInterface")) {
reply = wpas_dbus_global_get_interface(
message, ctrl_iface->global);
+ } else if (!strcmp(method, "setDebugParams")) {
+ reply = wpas_dbus_global_set_debugparams(
+ message, ctrl_iface->global);
}
}
diff --git a/wpa_supplicant/ctrl_iface_dbus_handlers.c b/wpa_supplicant/ctrl_iface_dbus_handlers.c
index 88f05a1..1c3dcd6 100644
--- a/wpa_supplicant/ctrl_iface_dbus_handlers.c
+++ b/wpa_supplicant/ctrl_iface_dbus_handlers.c
@@ -25,6 +25,9 @@
#include "wpas_glue.h"
#include "eapol_supp/eapol_supp_sm.h"
+extern int wpa_debug_level;
+extern int wpa_debug_show_keys;
+extern int wpa_debug_timestamp;
/**
* wpas_dbus_new_invalid_opts_error - Return a new invalid options error message
@@ -277,6 +280,51 @@ out:
return reply;
}
+/**
+ * wpas_dbus_global_set_debugparams- Set the debug params
+ * @message: Pointer to incoming dbus message
+ * @global: %wpa_supplicant global data structure
+ * Returns: a dbus message containing a UINT32 indicating success (1) or
+ * failure (0), or returns a dbus error message with more information
+ *
+ * Handler function for "setDebugParams" method call. Handles requests
+ * by dbus clients for the object path of an specific network interface.
+ */
+DBusMessage * wpas_dbus_global_set_debugparams(DBusMessage *message,
+ struct wpa_global *global)
+{
+ DBusMessage *reply = NULL;
+ int debug_level;
+ dbus_bool_t debug_timestamp;
+ dbus_bool_t debug_show_keys;
+
+ if (!dbus_message_get_args(message, NULL,
+ DBUS_TYPE_INT32, &debug_level,
+ DBUS_TYPE_BOOLEAN, &debug_timestamp,
+ DBUS_TYPE_BOOLEAN, &debug_show_keys,
+ DBUS_TYPE_INVALID)) {
+ reply = wpas_dbus_new_invalid_opts_error(message, NULL);
+ goto out;
+ }
+
+ /* check for allowed debuglevels */
+ if (debug_level != MSG_MSGDUMP &&
+ debug_level != MSG_DEBUG &&
+ debug_level != MSG_INFO &&
+ debug_level != MSG_WARNING &&
+ debug_level != MSG_ERROR) {
+ reply = wpas_dbus_new_invalid_opts_error(message, NULL);
+ goto out;
+ }
+
+ wpa_debug_level = debug_level;
+ wpa_debug_timestamp = debug_timestamp ? 1 : 0;
+ wpa_debug_show_keys = debug_show_keys ? 1 : 0;
+ reply = wpas_dbus_new_success_reply(message);
+
+out:
+ return reply;
+}
/**
* wpas_dbus_iface_scan - Request a wireless scan on an interface
diff --git a/wpa_supplicant/ctrl_iface_dbus_handlers.h b/wpa_supplicant/ctrl_iface_dbus_handlers.h
index 7adfee9..376d835 100644
--- a/wpa_supplicant/ctrl_iface_dbus_handlers.h
+++ b/wpa_supplicant/ctrl_iface_dbus_handlers.h
@@ -28,6 +28,9 @@ DBusMessage * wpas_dbus_global_remove_interface(DBusMessage *message,
DBusMessage * wpas_dbus_global_get_interface(DBusMessage *message,
struct wpa_global *global);
+DBusMessage * wpas_dbus_global_set_debugparams(DBusMessage *message,
+ struct wpa_global *global);
+
DBusMessage * wpas_dbus_iface_scan(DBusMessage *message,
struct wpa_supplicant *wpa_s);