How to teach wpa_supplicant about syslog?

Jouni Malinen j
Tue Apr 10 20:16:16 PDT 2007

On Mon, Apr 09, 2007 at 10:07:07AM -0400, Dan Williams wrote:

> I'd like to get wpa_supplicant speaking syslog for non-windows-based OSs
> (since syslog support in hostapd is apparently *NIX only).  I'd like the
> log facility to be configurable such that the caller may specify the
> appropriate facility, but the default is LOG_DAEMON.  hostapd already
> has some syslog support in git, but wpa_supplicant apparently has none
> at all.
> Jouni, what would you suggest?  I've got a patch (unsuitable for commit)
> that makes the wpa_print* functions do either syslog or printf based on
> a command line option.  But it's orthogonal to the hostapd syslog
> support, and that's probably not a good thing.  I'd probably use the
> hostapd_logger_cb stuff, but that involves fixing up wpa_printf and
> friends to use just _one_ instance of printf(), not 10.

Adding support for syslog is on my todo list somewhere.. Though, I would
like to clean up the debug printing code quite a bit more than just
adding yet another target option (please note that writing debug
messages to a file was added after 0.4.9, i.e., the version you were
diffing against).

Using syslog() from common.c is not acceptable, though, so this will
have to use either the hostapd_logger() function and the provided
callback or something similar for the cleaned up debug routines.

What I would like to eventually see is a mechanism for programs to
register debug targets (just like the hostapd_logger_cb is registered by
calling hostapd_logger_register_cb(), but maybe with support for
multiple target callbacks). The code in common.c would then just create
strings that are passed to these callback functions (one of which would
print to stdout, one could write to a file, one to syslog, and so on).

In addition, I would like to see wpa_msg() being used more to allow the
debug messages to be delivered properly to ctrl_iface monitors, too. The
main difference between wpa_printf() and wpa_msg() is in passing the
extra context pointer to allow ctrl_iface code to send messages to the
monitors controlling the matching interface.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list