~ubuntu-branches/ubuntu/precise/wpasupplicant/precise-security

« back to all changes in this revision

Viewing changes to debian/patches/12_no_syslog_flood.patch

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2010-03-05 12:45:09 UTC
  • Revision ID: james.westby@ubuntu.com-20100305124509-yr9bh9l979f305ty
Tags: 0.6.9-3ubuntu2
* debian/patches/12_no_syslog_flood.patch:
  - Upstream GIT change to not flood syslog with CTRL-EVENT-SCAN-RESULTS
    messages (LP: #352118)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
6
 
 
7
Add wpa_msg_ctrl() for ctrl_interface-only messages
 
8
 
 
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.
 
12
 
 
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.
 
17
---
 
18
 
 
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
 
23
@@ -335,6 +335,30 @@
 
24
                wpa_msg_cb(ctx, level, buf, len);
 
25
        os_free(buf);
 
26
 }
 
27
+
 
28
+
 
29
+void wpa_msg_ctrl(void *ctx, int level, char *fmt, ...)
 
30
+{
 
31
+       va_list ap;
 
32
+       char *buf;
 
33
+       const int buflen = 2048;
 
34
+       int len;
 
35
+
 
36
+       if (!wpa_msg_cb)
 
37
+               return;
 
38
+
 
39
+       buf = os_malloc(buflen);
 
40
+       if (buf == NULL) {
 
41
+               wpa_printf(MSG_ERROR, "wpa_msg_ctrl: Failed to allocate "
 
42
+                          "message buffer");
 
43
+               return;
 
44
+       }
 
45
+       va_start(ap, fmt);
 
46
+       len = vsnprintf(buf, buflen, fmt, ap);
 
47
+       va_end(ap);
 
48
+       wpa_msg_cb(ctx, level, buf, len);
 
49
+       os_free(buf);
 
50
+}
 
51
 #endif /* CONFIG_NO_WPA_MSG */
 
52
 
 
53
 
 
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
 
58
@@ -141,6 +141,7 @@
 
59
 
 
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 */
 
65
 /**
 
66
@@ -159,6 +160,20 @@
 
67
  */
 
68
 void wpa_msg(void *ctx, int level, char *fmt, ...) PRINTF_FORMAT(3, 4);
 
69
 
 
70
+/**
 
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
 
76
+ *
 
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.
 
81
+ */
 
82
+void wpa_msg_ctrl(void *ctx, int level, char *fmt, ...) PRINTF_FORMAT(3, 4);
 
83
+
 
84
 typedef void (*wpa_msg_cb_func)(void *ctx, int level, const char *txt,
 
85
                                size_t len);
 
86
 
 
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
 
91
@@ -631,7 +631,8 @@
 
92
                wpa_msg(wpa_s, MSG_DEBUG, "Cached scan results are "
 
93
                        "empty - not posting");
 
94
        } else {
 
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);
 
100
        }