1
From: Jouni Malinen <jouni.malinen@atheros.com>
2
Date: Tue, 10 Nov 2009 13:59:41 +0000 (+0200)
3
Subject: Add wpa_msg_ctrl() for ctrl_interface-only messages
4
X-Git-Tag: hostap_0_7_0~85
5
X-Git-Url: http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff_plain;h=69856fadf77e680d01cac09da37e6bb3643ca427;hp=c2e3f9df6f4413897c5a16507743b401cd6a7532
7
Add wpa_msg_ctrl() for ctrl_interface-only messages
9
This is like wpa_msg(), but the output is directed only to
10
ctrl_interface listeners. In other words, the output will not be
11
shown on stdout or in syslog.
13
Change scan result reporting to use wpa_msg_ctrl() for
14
CTRL-EVENT-SCAN-RESULTS message at info level and wpa_printf() at
15
debug level to avoid showing scan result events in syslog in the
16
common configuration used with NetworkManager.
19
Index: wpasupplicant-0.6.9/src/utils/wpa_debug.c
20
===================================================================
21
--- wpasupplicant-0.6.9.orig/src/utils/wpa_debug.c 2010-03-05 12:55:24.023215355 +0000
22
+++ wpasupplicant-0.6.9/src/utils/wpa_debug.c 2010-03-05 12:55:24.053195283 +0000
24
wpa_msg_cb(ctx, level, buf, len);
29
+void wpa_msg_ctrl(void *ctx, int level, char *fmt, ...)
33
+ const int buflen = 2048;
39
+ buf = os_malloc(buflen);
41
+ wpa_printf(MSG_ERROR, "wpa_msg_ctrl: Failed to allocate "
46
+ len = vsnprintf(buf, buflen, fmt, ap);
48
+ wpa_msg_cb(ctx, level, buf, len);
51
#endif /* CONFIG_NO_WPA_MSG */
54
Index: wpasupplicant-0.6.9/src/utils/wpa_debug.h
55
===================================================================
56
--- wpasupplicant-0.6.9.orig/src/utils/wpa_debug.h 2010-03-05 12:55:24.023215355 +0000
57
+++ wpasupplicant-0.6.9/src/utils/wpa_debug.h 2010-03-05 12:55:24.053195283 +0000
60
#ifdef CONFIG_NO_WPA_MSG
61
#define wpa_msg(args...) do { } while (0)
62
+#define wpa_msg_ctrl(args...) do { } while (0)
63
#define wpa_msg_register_cb(f) do { } while (0)
64
#else /* CONFIG_NO_WPA_MSG */
68
void wpa_msg(void *ctx, int level, char *fmt, ...) PRINTF_FORMAT(3, 4);
71
+ * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
72
+ * @ctx: Pointer to context data; this is the ctx variable registered
73
+ * with struct wpa_driver_ops::init()
74
+ * @level: priority level (MSG_*) of the message
75
+ * @fmt: printf format string, followed by optional arguments
77
+ * This function is used to print conditional debugging and error messages.
78
+ * This function is like wpa_msg(), but it sends the output only to the
79
+ * attached ctrl_iface monitors. In other words, it can be used for frequent
80
+ * events that do not need to be sent to syslog.
82
+void wpa_msg_ctrl(void *ctx, int level, char *fmt, ...) PRINTF_FORMAT(3, 4);
84
typedef void (*wpa_msg_cb_func)(void *ctx, int level, const char *txt,
87
Index: wpasupplicant-0.6.9/wpa_supplicant/events.c
88
===================================================================
89
--- wpasupplicant-0.6.9.orig/wpa_supplicant/events.c 2010-03-05 12:55:29.530701711 +0000
90
+++ wpasupplicant-0.6.9/wpa_supplicant/events.c 2010-03-05 12:55:44.540704728 +0000
92
wpa_msg(wpa_s, MSG_DEBUG, "Cached scan results are "
93
"empty - not posting");
95
- wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
96
+ wpa_printf(MSG_DEBUG, "New scan results available");
97
+ wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
98
wpa_supplicant_dbus_notify_scan_results(wpa_s);
99
wpas_wps_notify_scan_results(wpa_s);