Add wpa_msg_ctrl() for ctrl_interface-only messages

This is like wpa_msg(), but the output is directed only to
ctrl_interface listeners. In other words, the output will not be
shown on stdout or in syslog.

Change scan result reporting to use wpa_msg_ctrl() for
CTRL-EVENT-SCAN-RESULTS message at info level and wpa_printf() at
debug level to avoid showing scan result events in syslog in the
common configuration used with NetworkManager.
This commit is contained in:
Jouni Malinen 2009-11-10 15:59:41 +02:00 committed by Jouni Malinen
parent c2e3f9df6f
commit 69856fadf7
3 changed files with 41 additions and 1 deletions

View file

@ -335,6 +335,30 @@ void wpa_msg(void *ctx, int level, char *fmt, ...)
wpa_msg_cb(ctx, level, buf, len);
os_free(buf);
}
void wpa_msg_ctrl(void *ctx, int level, char *fmt, ...)
{
va_list ap;
char *buf;
const int buflen = 2048;
int len;
if (!wpa_msg_cb)
return;
buf = os_malloc(buflen);
if (buf == NULL) {
wpa_printf(MSG_ERROR, "wpa_msg_ctrl: Failed to allocate "
"message buffer");
return;
}
va_start(ap, fmt);
len = vsnprintf(buf, buflen, fmt, ap);
va_end(ap);
wpa_msg_cb(ctx, level, buf, len);
os_free(buf);
}
#endif /* CONFIG_NO_WPA_MSG */