[PATCH 2/2] wpa_supplicant: Allow re-open of log files with SIGHUP
Thu Nov 18 09:48:34 PST 2010
On 11/18/2010 03:10 AM, Jouni Malinen wrote:
> On Wed, Nov 17, 2010 at 04:58:06PM -0800, Ben Greear wrote:
>> With this, one can cause wpa_supplicant log files to
>> mv log.txt log.txt.old
>> kill -HUP<wpa_supplicant-pid>
> With the potential of getting configuration changes since SIGHUP is also
> requesting wpa_supplicant to re-read configuration file.
I can change it to SIGUSR2 or something like that easily enough.
I grepped for SIGHUP in wpa_supplicant and didn't find anything,
so I didn't notice that the signal was already used.
>> diff --git a/wpa_supplicant/main.c b/wpa_supplicant/main.c
>> +void handle_sighup(int sig, void *signal_ctx)
>> + wpa_printf(MSG_INFO, "SIGHUP received - reopening log-file");
>> + wpa_debug_close_file();
>> + wpa_debug_open_file(params.wpa_debug_file_path);
>> + wpa_printf(MSG_INFO, "SIGHUP received - reopened log-file");
> why would this be in main.c and not in wpa_supplicant.c where all builds
> can use it? Please also note that there is already a SIGHUP handler in
> wpa_supplicant.c (wpa_supplicant_reconfig) that should be used instead
> of adding a new one.
No big reason...except that is where I made params a static global.
Is there a more proper way to get access to the wpa_debug_file_path?
>> diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
>> @@ -2420,6 +2421,10 @@ struct wpa_global * wpa_supplicant_init(struct wpa_params *params)
>> +#ifndef CONFIG_NATIVE_WINDOWS
>> + eloop_register_signal(SIGHUP, handle_sighup, NULL);
>> +#endif /* CONFIG_NATIVE_WINDOWS */
> Proper way of registering eloop handler for SIGHUP is to call
> eloop_register_signal_reconfig(). Anyway, this is already done in
> wpa_supplicant, so there is no need to add new registration. Please also
> note that this would break builds that use other main*.c file than
Since SIGHUP seems a bad idea, should I just leave the eloop_register_signal call in
place but use a different signal?
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc http://www.candelatech.com
More information about the Hostap