wpa_supplicant/wpa_supplicant-0.5.7-sigusr1-changes-debuglevel.patch
Daniel Williams 48fea13d20 - Make SIGUSR1 change debug level on-the-fly; useful in combination with
the -f switch to log output to /var/log/wpa_supplicant.log
- Stop stripping binaries on install so we get debuginfo packages
2007-08-24 17:13:12 +00:00

35 lines
1.2 KiB
Diff

--- wpa_supplicant-0.5.7/wpa_supplicant.c.sigusr1 2007-08-24 11:24:51.000000000 -0400
+++ wpa_supplicant-0.5.7/wpa_supplicant.c 2007-08-24 11:43:08.000000000 -0400
@@ -930,6 +930,22 @@ static void wpa_supplicant_reconfig(int
}
}
+static void wpa_supplicant_handle_sigusr1(int sig, void *eloop_ctx,
+ void *signal_ctx)
+{
+ /* Increase verbosity (by decreasing the debug level) and wrap back
+ * to MSG_INFO when needed.
+ */
+ if (wpa_debug_level)
+ wpa_debug_level--;
+ else
+ wpa_debug_level = MSG_INFO;
+
+ wpa_printf(MSG_INFO, "Signal %d received - changing debug level to %s", sig,
+ (wpa_debug_level == MSG_INFO) ? "INFO" :
+ ((wpa_debug_level == MSG_DEBUG) ? "DEBUG" :
+ ((wpa_debug_level == MSG_MSGDUMP) ? "MSGDUMP" : "UNKNOWN")));
+}
static void wpa_supplicant_gen_assoc_event(struct wpa_supplicant *wpa_s)
{
@@ -2561,6 +2577,8 @@ int wpa_supplicant_run(struct wpa_global
eloop_register_signal_terminate(wpa_supplicant_terminate, NULL);
eloop_register_signal_reconfig(wpa_supplicant_reconfig, NULL);
+ eloop_register_signal(SIGUSR1, wpa_supplicant_handle_sigusr1, NULL);
+
eloop_run();
return 0;