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>
This commit is contained in:
parent
617d155547
commit
01a569e8a1
3 changed files with 54 additions and 0 deletions
|
@ -604,6 +604,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,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
|
||||
|
@ -278,6 +281,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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue