diff mbox series

Change logging level for CTRL-EVENT-SIGNAL-CHANGE to MSG_DEBUG

Message ID ea6cc1a5-40d3-444b-b9a4-2b460acb08f8@app.fastmail.com
State Changes Requested
Headers show
Series Change logging level for CTRL-EVENT-SIGNAL-CHANGE to MSG_DEBUG | expand

Commit Message

Kan-Ru Chen Nov. 27, 2024, 3:18 p.m. UTC
The default logging level for the CTRL-EVENT-SIGNAL-CHANGE message
may be repeated many times and fill the log file or journal.

For example https://bugzilla.redhat.com/show_bug.cgi?id=2309148 and
the first few results from searching CTRL-EVENT-SIGNAL-CHANGE on the
web contain various complaints and workarounds.

Changing the logging level to MSG_DEBUG would allow the message to
be still useful for debugging.

Signed-off-by: Kan-Ru Chen <kanru@kanru.info>
---
 wpa_supplicant/events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jouni Malinen Dec. 22, 2024, 10:21 p.m. UTC | #1
On Thu, Nov 28, 2024 at 12:18:37AM +0900, Kan-Ru Chen wrote:
> The default logging level for the CTRL-EVENT-SIGNAL-CHANGE message
> may be repeated many times and fill the log file or journal.
> 
> For example https://bugzilla.redhat.com/show_bug.cgi?id=2309148 and
> the first few results from searching CTRL-EVENT-SIGNAL-CHANGE on the
> web contain various complaints and workarounds.
> 
> Changing the logging level to MSG_DEBUG would allow the message to
> be still useful for debugging.

This event is not really for debugging purposes, but for providing it to
any upper layer component that is listening to event message in the
wpa_supplicant control interface.

> diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
> @@ -6755,7 +6755,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
>  	case EVENT_SIGNAL_CHANGE:
> -		wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SIGNAL_CHANGE
> +		wpa_msg(wpa_s, MSG_DEBUG, WPA_EVENT_SIGNAL_CHANGE
>  			"above=%d signal=%d noise=%d txrate=%lu",

This would break existing uses for the wpa_supplicant control interface.
I'm not completely sure how those system log messages get collected, but
a more appropriate change might be to replace this wpa_msg() call with a
call to wpa_msg_ctrl() with the exact same set of parameters. That would
remove the print from stdout and hopefully from the undesired system log
mechanisms.
Kan-Ru Chen Dec. 22, 2024, 11:26 p.m. UTC | #2
On Mon, Dec 23, 2024, at 7:21 AM, Jouni Malinen wrote:
> On Thu, Nov 28, 2024 at 12:18:37AM +0900, Kan-Ru Chen wrote:
>> The default logging level for the CTRL-EVENT-SIGNAL-CHANGE message
>> may be repeated many times and fill the log file or journal.
>> 
>> For example https://bugzilla.redhat.com/show_bug.cgi?id=2309148 and
>> the first few results from searching CTRL-EVENT-SIGNAL-CHANGE on the
>> web contain various complaints and workarounds.
>> 
>> Changing the logging level to MSG_DEBUG would allow the message to
>> be still useful for debugging.
>
> This event is not really for debugging purposes, but for providing it to
> any upper layer component that is listening to event message in the
> wpa_supplicant control interface.
>
>> diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
>> @@ -6755,7 +6755,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
>>  	case EVENT_SIGNAL_CHANGE:
>> -		wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SIGNAL_CHANGE
>> +		wpa_msg(wpa_s, MSG_DEBUG, WPA_EVENT_SIGNAL_CHANGE
>>  			"above=%d signal=%d noise=%d txrate=%lu",
>
> This would break existing uses for the wpa_supplicant control interface.
> I'm not completely sure how those system log messages get collected, but
> a more appropriate change might be to replace this wpa_msg() call with a
> call to wpa_msg_ctrl() with the exact same set of parameters. That would
> remove the print from stdout and hopefully from the undesired system log
> mechanisms.

Thanks for pointing me to wpa_msg_ctrl(). The comment for wpa_msg_ctrl()
also mentioned it can be used for frequent events that do not need to be
sent to syslog. I'll send an updated patch.

Kan-Ru
diff mbox series

Patch

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index a7c56f771..c411f5faf 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -6755,7 +6755,7 @@  void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 					data->eapol_rx.encrypted);
 		break;
 	case EVENT_SIGNAL_CHANGE:
-		wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SIGNAL_CHANGE
+		wpa_msg(wpa_s, MSG_DEBUG, WPA_EVENT_SIGNAL_CHANGE
 			"above=%d signal=%d noise=%d txrate=%lu",
 			data->signal_change.above_threshold,
 			data->signal_change.data.signal,