summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/syslog-ng
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2015-10-08 22:51:41 +0200
committerTudor Florea <tudor.florea@enea.com>2015-10-08 22:51:41 +0200
commit1219bf8a90a7bf8cd3a5363551ef635d51e8fc8e (patch)
treea21a5fc103bb3bd65ecd85ed22be5228fc54e447 /meta-oe/recipes-support/syslog-ng
downloadmeta-openembedded-1219bf8a90a7bf8cd3a5363551ef635d51e8fc8e.tar.gz
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-oe/recipes-support/syslog-ng')
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/Fix-the-memory-leak-problem-for-mutex.patch58
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/Fix-the-memory-leak-problem-when-HAVE_ENVIRON-defined.patch27
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/afsql-afsql_dd_insert_db-refactor.patch494
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/configure.ac-add-option-enable-thread-tls-to-manage-.patch50
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/configure.patch23
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/dbifix.patch20
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/deinit-the-new-config-when-reverting-to-the.patch36
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/fix-a-memory-leak-in-log_driver_free.patch33
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/fix-config-libnet.patch66
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/fix-invalid-ownership.patch28
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/free-global-LogTemplateOptions.patch30
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/initscript62
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/logwriter-dont-allocate-a-new-buffer.patch26
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/rewrite-expr-grammar.ym-Free-up-token.patch17
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/still-free-the-unconsumed-item.patch90
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/syslog-ng-verify-the-list-before-del.patch38
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/syslog-ng.conf155
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/volatiles.03_syslog-ng1
-rw-r--r--meta-oe/recipes-support/syslog-ng/syslog-ng.inc106
-rw-r--r--meta-oe/recipes-support/syslog-ng/syslog-ng_3.5.4.1.bb21
20 files changed, 1381 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/syslog-ng/files/Fix-the-memory-leak-problem-for-mutex.patch b/meta-oe/recipes-support/syslog-ng/files/Fix-the-memory-leak-problem-for-mutex.patch
new file mode 100644
index 000000000..89022aaf0
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/Fix-the-memory-leak-problem-for-mutex.patch
@@ -0,0 +1,58 @@
1Fix the memory leak problem for mutex
2
3Upstream-Status: Pending
4
5Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
6---
7 lib/logqueue.c | 1 +
8 modules/affile/affile-dest.c | 2 ++
9 modules/dbparser/dbparser.c | 1 +
10 3 files changed, 4 insertions(+), 0 deletions(-)
11
12diff --git a/lib/logqueue.c b/lib/logqueue.c
13index 337a3c1..10edcf0 100644
14--- a/lib/logqueue.c
15+++ b/lib/logqueue.c
16@@ -188,6 +188,7 @@ log_queue_init_instance(LogQueue *self, const gchar *persist_name)
17 void
18 log_queue_free_method(LogQueue *self)
19 {
20+ g_static_mutex_free(&self->lock);
21 g_free(self->persist_name);
22 g_free(self);
23 }
24diff --git a/modules/affile/affile-dest.c b/modules/affile/affile-dest.c
25index a2bcdad..ce79f6f 100644
26--- a/modules/affile/affile-dest.c
27+++ b/modules/affile/affile-dest.c
28@@ -305,6 +305,7 @@ affile_dw_free(LogPipe *s)
29 {
30 AFFileDestWriter *self = (AFFileDestWriter *) s;
31
32+ g_static_mutex_free(&self->lock);
33 log_pipe_unref((LogPipe *) self->writer);
34 self->writer = NULL;
35 g_free(self->filename);
36@@ -687,6 +688,7 @@ affile_dd_free(LogPipe *s)
37 /* NOTE: this must be NULL as deinit has freed it, otherwise we'd have circular references */
38 g_assert(self->single_writer == NULL && self->writer_hash == NULL);
39
40+ g_static_mutex_free(&self->lock);
41 log_template_unref(self->filename_template);
42 log_writer_options_destroy(&self->writer_options);
43 log_dest_driver_free(s);
44diff --git a/modules/dbparser/dbparser.c b/modules/dbparser/dbparser.c
45index f1248b5..9775701 100644
46--- a/modules/dbparser/dbparser.c
47+++ b/modules/dbparser/dbparser.c
48@@ -284,6 +284,7 @@ log_db_parser_free(LogPipe *s)
49 {
50 LogDBParser *self = (LogDBParser *) s;
51
52+ g_static_mutex_free(&self->lock);
53 if (self->db)
54 pattern_db_free(self->db);
55
56--
571.7.1
58
diff --git a/meta-oe/recipes-support/syslog-ng/files/Fix-the-memory-leak-problem-when-HAVE_ENVIRON-defined.patch b/meta-oe/recipes-support/syslog-ng/files/Fix-the-memory-leak-problem-when-HAVE_ENVIRON-defined.patch
new file mode 100644
index 000000000..2ac9c0be0
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/Fix-the-memory-leak-problem-when-HAVE_ENVIRON-defined.patch
@@ -0,0 +1,27 @@
1Fix the memory leak problem when HAVE_ENVIRON is defined
2
3Upstream-Status: Pending
4
5Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
6---
7--- a/lib/gprocess.c
8+++ b/lib/gprocess.c
9@@ -1421,6 +1421,18 @@
10 void
11 g_process_finish(void)
12 {
13+#ifdef HAVE_ENVIRON
14+ int i = 0;
15+
16+ while (environ[i]) {
17+ g_free(environ[i]);
18+ ++i;
19+ }
20+ if (environ)
21+ g_free(environ);
22+ if (process_opts.argv_orig)
23+ free(process_opts.argv_orig);
24+#endif
25 g_process_remove_pidfile();
26 }
27
diff --git a/meta-oe/recipes-support/syslog-ng/files/afsql-afsql_dd_insert_db-refactor.patch b/meta-oe/recipes-support/syslog-ng/files/afsql-afsql_dd_insert_db-refactor.patch
new file mode 100644
index 000000000..42e181bb1
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/afsql-afsql_dd_insert_db-refactor.patch
@@ -0,0 +1,494 @@
1From 23e80b75508187baaa823a68ea019b72e0b2305c Mon Sep 17 00:00:00 2001
2From: Budai Laszlo <lbudai@balabit.hu>
3Date: Tue, 12 Nov 2013 13:19:04 +0100
4Subject: [PATCH] afsql: afsql_dd_insert_db() refactor
5
6Upstream-Status: Backport
7
8A lot of the code that was previously in afsql_dd_insert_db() have been
9extracted to smaller functions, and afsql_dd_insert_db() was rebuilt on
10top of these. At the same time, memory leaks were plugged, and in case
11of a transaction error, backlog rewinding has been fixed too, to not
12loose messages since the last BEGIN command.
13
14Signed-off-by: Juhasz Viktor <jviktor@balabit.hu>
15Signed-off-by: Laszlo Budai <lbudai@balabit.hu>
16---
17 modules/afsql/afsql.c | 301 ++++++++++++++++++++++++++++++++------------------
18 1 file changed, 192 insertions(+), 109 deletions(-)
19
20diff --git a/modules/afsql/afsql.c b/modules/afsql/afsql.c
21index 12f6aab..a6a8190 100644
22--- a/modules/afsql/afsql.c
23+++ b/modules/afsql/afsql.c
24@@ -456,24 +456,21 @@ afsql_dd_create_index(AFSqlDestDriver *s
25 *
26 * NOTE: This function can only be called from the database thread.
27 **/
28-static GString *
29-afsql_dd_validate_table(AFSqlDestDriver *self, LogMessage *msg)
30+static gboolean
31+afsql_dd_validate_table(AFSqlDestDriver *self, GString *table)
32 {
33- GString *query_string, *table;
34+ GString *query_string;
35 dbi_result db_res;
36 gboolean success = FALSE;
37 gint i;
38
39- table = g_string_sized_new(32);
40- log_template_format(self->table, msg, &self->template_options, LTZ_LOCAL, 0, NULL, table);
41-
42 if (self->flags & AFSQL_DDF_DONT_CREATE_TABLES)
43- return table;
44+ return TRUE;
45
46 afsql_dd_check_sql_identifier(table->str, TRUE);
47
48 if (g_hash_table_lookup(self->validated_tables, table->str))
49- return table;
50+ return TRUE;
51
52 query_string = g_string_sized_new(32);
53 g_string_printf(query_string, "SELECT * FROM %s WHERE 0=1", table->str);
54@@ -544,14 +541,9 @@ afsql_dd_validate_table(AFSqlDestDriver
55 /* we have successfully created/altered the destination table, record this information */
56 g_hash_table_insert(self->validated_tables, g_strdup(table->str), GUINT_TO_POINTER(TRUE));
57 }
58- else
59- {
60- g_string_free(table, TRUE);
61- table = NULL;
62- }
63 g_string_free(query_string, TRUE);
64
65- return table;
66+ return success;
67 }
68
69 /**
70@@ -581,6 +573,20 @@ afsql_dd_begin_txn(AFSqlDestDriver *self
71 }
72
73 /**
74+ * afsql_dd_handle_transaction_error:
75+ *
76+ * Handle errors inside during a SQL transaction (e.g. INSERT or COMMIT failures).
77+ *
78+ * NOTE: This function can only be called from the database thread.
79+ **/
80+static void
81+afsql_dd_handle_transaction_error(AFSqlDestDriver *self)
82+{
83+ log_queue_rewind_backlog(self->queue);
84+ self->flush_lines_queued = 0;
85+}
86+
87+/**
88 * afsql_dd_begin_txn:
89 *
90 * Commit SQL transaction.
91@@ -596,14 +602,14 @@ afsql_dd_commit_txn(AFSqlDestDriver *sel
92 if (success)
93 {
94 log_queue_ack_backlog(self->queue, self->flush_lines_queued);
95+ self->flush_lines_queued = 0;
96 }
97 else
98 {
99- msg_notice("SQL transaction commit failed, rewinding backlog and starting again",
100- NULL);
101- log_queue_rewind_backlog(self->queue);
102+ msg_error("SQL transaction commit failed, rewinding backlog and starting again",
103+ NULL);
104+ afsql_dd_handle_transaction_error(self);
105 }
106- self->flush_lines_queued = 0;
107 return success;
108 }
109
110@@ -644,12 +650,13 @@ afsql_dd_set_dbd_opt_numeric(gpointer ke
111 }
112
113 static gboolean
114-afsql_dd_connect(AFSqlDestDriver *self)
115+afsql_dd_ensure_initialized_connection(AFSqlDestDriver *self)
116 {
117 if (self->dbi_ctx)
118 return TRUE;
119
120 self->dbi_ctx = dbi_conn_new(self->type);
121+
122 if (!self->dbi_ctx)
123 {
124 msg_error("No such DBI driver",
125@@ -659,10 +666,12 @@ afsql_dd_connect(AFSqlDestDriver *self)
126 }
127
128 dbi_conn_set_option(self->dbi_ctx, "host", self->host);
129+
130 if (strcmp(self->type, "mysql"))
131 dbi_conn_set_option(self->dbi_ctx, "port", self->port);
132 else
133 dbi_conn_set_option_numeric(self->dbi_ctx, "port", atoi(self->port));
134+
135 dbi_conn_set_option(self->dbi_ctx, "username", self->user);
136 dbi_conn_set_option(self->dbi_ctx, "password", self->password);
137 dbi_conn_set_option(self->dbi_ctx, "dbname", self->database);
138@@ -691,6 +700,7 @@ afsql_dd_connect(AFSqlDestDriver *self)
139 evt_tag_str("database", self->database),
140 evt_tag_str("error", dbi_error),
141 NULL);
142+
143 return FALSE;
144 }
145
146@@ -713,104 +723,145 @@ afsql_dd_connect(AFSqlDestDriver *self)
147 return TRUE;
148 }
149
150-static gboolean
151-afsql_dd_insert_fail_handler(AFSqlDestDriver *self, LogMessage *msg,
152- LogPathOptions *path_options)
153+static GString *
154+afsql_dd_ensure_accessible_database_table(AFSqlDestDriver *self, LogMessage *msg)
155 {
156- if (self->failed_message_counter < self->num_retries - 1)
157- {
158- log_queue_push_head(self->queue, msg, path_options);
159-
160- /* database connection status sanity check after failed query */
161- if (dbi_conn_ping(self->dbi_ctx) != 1)
162- {
163- const gchar *dbi_error;
164-
165- dbi_conn_error(self->dbi_ctx, &dbi_error);
166- msg_error("Error, no SQL connection after failed query attempt",
167- evt_tag_str("type", self->type),
168- evt_tag_str("host", self->host),
169- evt_tag_str("port", self->port),
170- evt_tag_str("username", self->user),
171- evt_tag_str("database", self->database),
172- evt_tag_str("error", dbi_error),
173- NULL);
174- return FALSE;
175- }
176+ GString *table = g_string_sized_new(32);
177+ log_template_format(self->table, msg, &self->template_options, LTZ_LOCAL, 0, NULL, table);
178
179- self->failed_message_counter++;
180- return FALSE;
181+ if (!afsql_dd_validate_table(self, table))
182+ {
183+ /* If validate table is FALSE then close the connection and wait time_reopen time (next call) */
184+ msg_error("Error checking table, disconnecting from database, trying again shortly",
185+ evt_tag_int("time_reopen", self->time_reopen),
186+ NULL);
187+ g_string_free(table, TRUE);
188+ return NULL;
189 }
190
191- msg_error("Multiple failures while inserting this record into the database, message dropped",
192- evt_tag_int("attempts", self->num_retries),
193- NULL);
194- stats_counter_inc(self->dropped_messages);
195- log_msg_drop(msg, path_options);
196- self->failed_message_counter = 0;
197- return TRUE;
198+ return table;
199 }
200
201 static GString *
202-afsql_dd_construct_query(AFSqlDestDriver *self, GString *table,
203- LogMessage *msg)
204+afsql_dd_build_insert_command(AFSqlDestDriver *self, LogMessage *msg, GString *table)
205 {
206- GString *value;
207- GString *query_string;
208- gint i;
209+ GString *insert_command = g_string_sized_new(256);
210+ GString *value = g_string_sized_new(512);
211+ gint i, j;
212
213- value = g_string_sized_new(256);
214- query_string = g_string_sized_new(512);
215+ g_string_printf(insert_command, "INSERT INTO %s (", table->str);
216
217- g_string_printf(query_string, "INSERT INTO %s (", table->str);
218 for (i = 0; i < self->fields_len; i++)
219 {
220- g_string_append(query_string, self->fields[i].name);
221- if (i != self->fields_len - 1)
222- g_string_append(query_string, ", ");
223+ if ((self->fields[i].flags & AFSQL_FF_DEFAULT) == 0 && self->fields[i].value != NULL)
224+ {
225+ g_string_append(insert_command, self->fields[i].name);
226+
227+ j = i + 1;
228+ while (j < self->fields_len && (self->fields[j].flags & AFSQL_FF_DEFAULT) == AFSQL_FF_DEFAULT)
229+ j++;
230+
231+ if (j < self->fields_len)
232+ g_string_append(insert_command, ", ");
233+ }
234 }
235- g_string_append(query_string, ") VALUES (");
236+
237+ g_string_append(insert_command, ") VALUES (");
238
239 for (i = 0; i < self->fields_len; i++)
240 {
241 gchar *quoted;
242
243- if (self->fields[i].value == NULL)
244- {
245- /* the config used the 'default' value for this column -> the fields[i].value is NULL, use SQL default */
246- g_string_append(query_string, "DEFAULT");
247- }
248- else
249+ if ((self->fields[i].flags & AFSQL_FF_DEFAULT) == 0 && self->fields[i].value != NULL)
250 {
251 log_template_format(self->fields[i].value, msg, &self->template_options, LTZ_SEND, self->seq_num, NULL, value);
252-
253 if (self->null_value && strcmp(self->null_value, value->str) == 0)
254 {
255- g_string_append(query_string, "NULL");
256+ g_string_append(insert_command, "NULL");
257 }
258 else
259 {
260 dbi_conn_quote_string_copy(self->dbi_ctx, value->str, &quoted);
261 if (quoted)
262 {
263- g_string_append(query_string, quoted);
264+ g_string_append(insert_command, quoted);
265 free(quoted);
266 }
267 else
268 {
269- g_string_append(query_string, "''");
270+ g_string_append(insert_command, "''");
271 }
272 }
273- }
274
275- if (i != self->fields_len - 1)
276- g_string_append(query_string, ", ");
277+ j = i + 1;
278+ while (j < self->fields_len && (self->fields[j].flags & AFSQL_FF_DEFAULT) == AFSQL_FF_DEFAULT)
279+ j++;
280+ if (j < self->fields_len)
281+ g_string_append(insert_command, ", ");
282+ }
283 }
284- g_string_append(query_string, ")");
285+
286+ g_string_append(insert_command, ")");
287
288 g_string_free(value, TRUE);
289
290- return query_string;
291+ return insert_command;
292+}
293+
294+static inline gboolean
295+afsql_dd_is_transaction_handling_enabled(const AFSqlDestDriver *self)
296+{
297+ return self->flush_lines_queued != -1;
298+}
299+
300+static inline gboolean
301+afsql_dd_should_start_new_transaction(const AFSqlDestDriver *self)
302+{
303+ return self->flush_lines_queued == 0;
304+}
305+
306+static inline gboolean
307+afsql_dd_should_commit_transaction(const AFSqlDestDriver *self)
308+{
309+ return afsql_dd_is_transaction_handling_enabled(self) && self->flush_lines_queued == self->flush_lines;
310+}
311+
312+static inline gboolean
313+afsql_dd_handle_insert_row_error_depending_on_connection_availability(AFSqlDestDriver *self,
314+ LogMessage *msg,
315+ LogPathOptions *path_options)
316+{
317+ const gchar *dbi_error, *error_message;
318+
319+ if (dbi_conn_ping(self->dbi_ctx) == 1)
320+ {
321+ log_queue_push_head(self->queue, msg, path_options);
322+ return TRUE;
323+ }
324+
325+ if (afsql_dd_is_transaction_handling_enabled(self))
326+ {
327+ error_message = "SQL connection lost in the middle of a transaction,"
328+ " rewinding backlog and starting again";
329+ afsql_dd_handle_transaction_error(self);
330+ }
331+ else
332+ {
333+ error_message = "Error, no SQL connection after failed query attempt";
334+ log_queue_push_head(self->queue, msg, path_options);
335+ }
336+
337+ dbi_conn_error(self->dbi_ctx, &dbi_error);
338+ msg_error(error_message,
339+ evt_tag_str("type", self->type),
340+ evt_tag_str("host", self->host),
341+ evt_tag_str("port", self->port),
342+ evt_tag_str("username", self->user),
343+ evt_tag_str("database", self->database),
344+ evt_tag_str("error", dbi_error),
345+ NULL);
346+
347+ return FALSE;
348 }
349
350 /**
351@@ -824,61 +875,93 @@ afsql_dd_construct_query(AFSqlDestDriver
352 static gboolean
353 afsql_dd_insert_db(AFSqlDestDriver *self)
354 {
355- GString *table, *query_string;
356+ GString *table = NULL;
357+ GString *insert_command = NULL;
358 LogMessage *msg;
359 gboolean success;
360 LogPathOptions path_options = LOG_PATH_OPTIONS_INIT;
361
362- afsql_dd_connect(self);
363+ if (!afsql_dd_ensure_initialized_connection(self))
364+ return FALSE;
365
366- success = log_queue_pop_head(self->queue, &msg, &path_options, (self->flags & AFSQL_DDF_EXPLICIT_COMMITS), FALSE);
367+ /* connection established, try to insert a message */
368+ success = log_queue_pop_head(self->queue, &msg, &path_options, FALSE, self->flags & AFSQL_DDF_EXPLICIT_COMMITS);
369 if (!success)
370 return TRUE;
371
372 msg_set_context(msg);
373
374- table = afsql_dd_validate_table(self, msg);
375+ table = afsql_dd_ensure_accessible_database_table(self, msg);
376+
377 if (!table)
378 {
379- /* If validate table is FALSE then close the connection and wait time_reopen time (next call) */
380- msg_error("Error checking table, disconnecting from database, trying again shortly",
381- evt_tag_int("time_reopen", self->time_reopen),
382- NULL);
383- msg_set_context(NULL);
384- g_string_free(table, TRUE);
385- return afsql_dd_insert_fail_handler(self, msg, &path_options);
386+ success = FALSE;
387+ goto out;
388 }
389
390- query_string = afsql_dd_construct_query(self, table, msg);
391+ if (afsql_dd_should_start_new_transaction(self) && !afsql_dd_begin_txn(self))
392+ {
393+ success = FALSE;
394+ goto out;
395+ }
396
397- if (self->flush_lines_queued == 0 && !afsql_dd_begin_txn(self))
398- return FALSE;
399+ insert_command = afsql_dd_build_insert_command(self, msg, table);
400+ success = afsql_dd_run_query(self, insert_command->str, FALSE, NULL);
401
402- success = afsql_dd_run_query(self, query_string->str, FALSE, NULL);
403 if (success && self->flush_lines_queued != -1)
404 {
405 self->flush_lines_queued++;
406
407- if (self->flush_lines && self->flush_lines_queued == self->flush_lines && !afsql_dd_commit_txn(self))
408- return FALSE;
409+ if (afsql_dd_should_commit_transaction(self) && !afsql_dd_commit_txn(self))
410+ {
411+ /* Assuming that in case of error, the queue is rewound by afsql_dd_commit_txn() */
412+
413+ g_string_free(insert_command, TRUE);
414+ msg_set_context(NULL);
415+
416+ return FALSE;
417+ }
418 }
419
420- g_string_free(table, TRUE);
421- g_string_free(query_string, TRUE);
422+ out:
423+
424+ if (table != NULL)
425+ g_string_free(table, TRUE);
426+
427+ if (insert_command != NULL)
428+ g_string_free(insert_command, TRUE);
429
430 msg_set_context(NULL);
431
432- if (!success)
433- return afsql_dd_insert_fail_handler(self, msg, &path_options);
434+ if (success)
435+ {
436+ log_msg_ack(msg, &path_options);
437+ log_msg_unref(msg);
438+ step_sequence_number(&self->seq_num);
439+ self->failed_message_counter = 0;
440+ }
441+ else
442+ {
443+ if (self->failed_message_counter < self->num_retries - 1)
444+ {
445+ if (!afsql_dd_handle_insert_row_error_depending_on_connection_availability(self, msg, &path_options))
446+ return FALSE;
447
448- /* we only ACK if each INSERT is a separate transaction */
449- if ((self->flags & AFSQL_DDF_EXPLICIT_COMMITS) == 0)
450- log_msg_ack(msg, &path_options);
451- log_msg_unref(msg);
452- step_sequence_number(&self->seq_num);
453- self->failed_message_counter = 0;
454+ self->failed_message_counter++;
455+ }
456+ else
457+ {
458+ msg_error("Multiple failures while inserting this record into the database, message dropped",
459+ evt_tag_int("attempts", self->num_retries),
460+ NULL);
461+ stats_counter_inc(self->dropped_messages);
462+ log_msg_drop(msg, &path_options);
463+ self->failed_message_counter = 0;
464+ success = TRUE;
465+ }
466+ }
467
468- return TRUE;
469+ return success;
470 }
471
472 static void
473@@ -895,7 +978,7 @@ afsql_dd_message_became_available_in_the
474 static void
475 afsql_dd_wait_for_suspension_wakeup(AFSqlDestDriver *self)
476 {
477- /* we got suspended, probably because of a connection error,
478+ /* we got suspended, probably because of a connection error,
479 * during this time we only get wakeups if we need to be
480 * terminated. */
481 if (!self->db_thread_terminate)
482@@ -974,8 +1057,7 @@ afsql_dd_database_thread(gpointer arg)
483
484 afsql_dd_commit_txn(self);
485 }
486-
487- exit:
488+exit:
489 afsql_dd_disconnect(self);
490
491 msg_verbose("Database thread finished",
492--
4931.8.4.1
494
diff --git a/meta-oe/recipes-support/syslog-ng/files/configure.ac-add-option-enable-thread-tls-to-manage-.patch b/meta-oe/recipes-support/syslog-ng/files/configure.ac-add-option-enable-thread-tls-to-manage-.patch
new file mode 100644
index 000000000..cc8d11044
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/configure.ac-add-option-enable-thread-tls-to-manage-.patch
@@ -0,0 +1,50 @@
1configure.ac: add option --enable-thread-tls to manage thread ssl support
2
3Add option --enable-thread-tls to manage the including of thread
4local storage, so we could explicitly disable it.
5
6Upstream-Status: Pending
7
8Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
9---
10 configure.ac | 17 +++++++++++------
11 1 file changed, 11 insertions(+), 6 deletions(-)
12
13diff --git a/configure.ac b/configure.ac
14index 474e094..cedca54 100644
15--- a/configure.ac
16+++ b/configure.ac
17@@ -120,6 +120,9 @@ AC_ARG_ENABLE(memtrace,
18 AC_ARG_ENABLE(ssl,
19 [ --enable-ssl Enable SSL support.],,enable_ssl="auto")
20
21+AC_ARG_ENABLE(thread-tls,
22+ [ --enable-thread-tls Enable Thread Transport Layer Security support.],,enable_thread_tls="no")
23+
24 AC_ARG_ENABLE(dynamic-linking,
25 [ --enable-dynamic-linking Link everything dynamically.],,enable_dynamic_linking="auto")
26
27@@ -381,12 +384,14 @@ dnl ***************************************************************************
28 dnl Is the __thread keyword available?
29 dnl ***************************************************************************
30
31-AC_LINK_IFELSE([AC_LANG_PROGRAM(
32-[[#include <pthread.h>
33-__thread int a;
34-]],
35-[a=0;])],
36-[ac_cv_have_tls=yes; AC_DEFINE_UNQUOTED(HAVE_THREAD_KEYWORD, 1, "Whether Transport Layer Security is supported by the system")])
37+if test "x$enable_thread_tls" != "xno"; then
38+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
39+ [[#include <pthread.h>
40+ __thread int a;
41+ ]],
42+ [a=0;])],
43+ [ac_cv_have_tls=yes; AC_DEFINE_UNQUOTED(HAVE_THREAD_KEYWORD, 1, "Whether Transport Layer Security is supported by the system")])
44+fi
45
46 dnl ***************************************************************************
47 dnl How to do static linking?
48--
491.9.1
50
diff --git a/meta-oe/recipes-support/syslog-ng/files/configure.patch b/meta-oe/recipes-support/syslog-ng/files/configure.patch
new file mode 100644
index 000000000..109f58cf7
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/configure.patch
@@ -0,0 +1,23 @@
1Index: syslog-ng-3.5.4.1/configure.ac
2===================================================================
3--- syslog-ng-3.5.4.1.orig/configure.ac 2014-07-18 13:49:36.794141441 +0000
4+++ syslog-ng-3.5.4.1/configure.ac 2014-07-18 14:23:57.738197606 +0000
5@@ -8,7 +8,8 @@ dnl SNAPSHOT_VERSION - snapshot version to add to version number
6 dnl BINARY_BRANCH - the value is added to all source/binary packages
7 dnl SOURCE_REVISION - Revision of the source-tree, will added to the version string
8 dnl
9-AC_INIT(syslog-ng/main.c)
10+AC_INIT(syslog-ng, 3.5.4.1)
11+AC_CONFIG_SRCDIR(syslog-ng/main.c)
12 AC_CONFIG_MACRO_DIR([m4])
13 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
14
15@@ -53,7 +54,7 @@ else
16 CURRDATE=`date +"%a, %d %b %Y %H:%M:%S %Z"`
17 fi
18
19-AM_INIT_AUTOMAKE($PACKAGE, $VERSION, [foreign no-define subdir-objects])
20+AM_INIT_AUTOMAKE([foreign no-define subdir-objects])
21 _AM_PROG_TAR([ustar])
22 if test -n "$SNAPSHOT_VERSION"; then
23 VERSION=$VERSION+$SNAPSHOT_VERSION
diff --git a/meta-oe/recipes-support/syslog-ng/files/dbifix.patch b/meta-oe/recipes-support/syslog-ng/files/dbifix.patch
new file mode 100644
index 000000000..15dfb6885
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/dbifix.patch
@@ -0,0 +1,20 @@
1Index: syslog-ng-3.5.4.1/configure.ac
2===================================================================
3--- syslog-ng-3.5.4.1.orig/configure.ac 2014-07-18 14:35:03.134215740 +0000
4+++ syslog-ng-3.5.4.1/configure.ac 2014-07-18 15:31:52.510308653 +0000
5@@ -576,13 +576,14 @@
6 dnl ***************************************************************************
7
8 AC_CHECK_LIB(dl, dlsym, DL_LIBS="-ldl")
9+if test "x$enable_sql" != "xno"; then
10 PKG_CHECK_MODULES(LIBDBI, dbi >= $LIBDBI_MIN_VERSION, libdbi_pkgconfig_not_found="0", libdbi_pkgconfig_not_found="1")
11
12 if test "$libdbi_pkgconfig_not_found" -eq 1; then
13 dnl if libdbi has no .pc file, try it without one
14 AC_CHECK_LIB(dbi, dbi_initialize, LIBDBI_LIBS="-ldbi"; LIBDBI_CFLAGS="-I/usr/include")
15 fi
16-
17+fi
18 if test "x$enable_sql" = "xauto"; then
19 AC_MSG_CHECKING(whether to enable SQL support)
20 if test "x$LIBDBI_LIBS" != "x"; then
diff --git a/meta-oe/recipes-support/syslog-ng/files/deinit-the-new-config-when-reverting-to-the.patch b/meta-oe/recipes-support/syslog-ng/files/deinit-the-new-config-when-reverting-to-the.patch
new file mode 100644
index 000000000..484af7e2e
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/deinit-the-new-config-when-reverting-to-the.patch
@@ -0,0 +1,36 @@
1From 86842df8bff5c97e44fc55d2fb7fc6c10f56ab84 Mon Sep 17 00:00:00 2001
2From: Gergely Nagy <algernon@balabit.hu>
3Date: Fri, 13 Dec 2013 13:46:15 +0100
4Subject: [PATCH] mainloop: Deinit the new config when reverting to the old one
5
6Upstream-Status: Backport
7
8When reloading, and the new config fails, deinit it before initializing
9the old config. This is so that conflicting things do not remain held by
10the half-initialized new config, while the old tries to take it
11over. (It also removed a couple of memory leaks, most likely.)
12
13The reason we can do this, is because cfg_tree_stop() (called by
14cfg_deinit()) goes over all the known nodes, and log_pipe_deinit() is
15also smart enough to not deinit a node that has not been inited before.
16
17Signed-off-by: Gergely Nagy <algernon@balabit.hu>
18---
19 lib/mainloop.c | 1 +
20 1 file changed, 1 insertion(+)
21
22diff --git a/lib/mainloop.c b/lib/mainloop.c
23index 34655fa..e6fbb59 100644
24--- a/lib/mainloop.c
25+++ b/lib/mainloop.c
26@@ -510,6 +510,7 @@ main_loop_reload_config_apply(void)
27 {
28 msg_error("Error initializing new configuration, reverting to old config", NULL);
29 cfg_persist_config_move(main_loop_new_config, main_loop_old_config);
30+ cfg_deinit(main_loop_new_config);
31 if (!cfg_init(main_loop_old_config))
32 {
33 /* hmm. hmmm, error reinitializing old configuration, we're hosed.
34--
351.8.4.1
36
diff --git a/meta-oe/recipes-support/syslog-ng/files/fix-a-memory-leak-in-log_driver_free.patch b/meta-oe/recipes-support/syslog-ng/files/fix-a-memory-leak-in-log_driver_free.patch
new file mode 100644
index 000000000..260347413
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/fix-a-memory-leak-in-log_driver_free.patch
@@ -0,0 +1,33 @@
1From a269669ba3cb6d1c06a3322b4a6a035cb787d085 Mon Sep 17 00:00:00 2001
2From: Gergely Nagy <algernon@balabit.hu>
3Date: Tue, 14 Jan 2014 13:58:05 +0100
4Subject: [PATCH] driver: Fix a memory leak in log_driver_free()
5
6Upstream-Status: Backport
7
8After freeing up the members of self->plugins, free self->plugins itself
9too.
10
11Signed-off-by: Gergely Nagy <algernon@balabit.hu>
12---
13 lib/driver.c | 4 ++++
14 1 file changed, 4 insertions(+)
15
16diff --git a/lib/driver.c b/lib/driver.c
17index d77fe57..a6867b9 100644
18--- a/lib/driver.c
19+++ b/lib/driver.c
20@@ -91,6 +91,10 @@ log_driver_free(LogPipe *s)
21 {
22 log_driver_plugin_free((LogDriverPlugin *) l->data);
23 }
24+ if (self->plugins)
25+ {
26+ g_list_free(self->plugins);
27+ }
28 if (self->group)
29 g_free(self->group);
30 if (self->id)
31--
321.8.4.1
33
diff --git a/meta-oe/recipes-support/syslog-ng/files/fix-config-libnet.patch b/meta-oe/recipes-support/syslog-ng/files/fix-config-libnet.patch
new file mode 100644
index 000000000..755803c21
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/fix-config-libnet.patch
@@ -0,0 +1,66 @@
1Subject: [PATCH] add libnet enable option
2
3Upstream-Status: Pending
4
5This would avoid a implicit auto-detecting result.
6
7Signed-off-by: Ming Liu <ming.liu@windriver.com>
8Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
9---
10 configure.ac | 27 +++++++++++++++++----------
11 1 files changed, 17 insertions(+), 10 deletions(-)
12
13diff --git a/configure.ac b/configure.ac
14index b1e18b4..8e13025 100644
15--- a/configure.ac
16+++ b/configure.ac
17@@ -73,6 +73,9 @@ AC_CONFIG_HEADERS(config.h)
18 dnl ***************************************************************************
19 dnl Arguments
20
21+AC_ARG_ENABLE(libnet,
22+ [ --enable-libnet Enable libnet support.],, enable_libnet="no")
23+
24 AC_ARG_WITH(libnet,
25 [ --with-libnet=path use path to libnet-config script],
26 ,
27@@ -768,22 +771,26 @@ dnl ***************************************************************************
28 dnl libnet headers/libraries
29 dnl ***************************************************************************
30 AC_MSG_CHECKING(for LIBNET)
31-if test "x$with_libnet" = "x"; then
32- LIBNET_CONFIG="`which libnet-config`"
33-else
34- LIBNET_CONFIG="$with_libnet/libnet-config"
35-fi
36+if test "x$enable_libnet" = xyes; then
37+ if test "x$with_libnet" = "x"; then
38+ LIBNET_CONFIG="`which libnet-config`"
39+ else
40+ LIBNET_CONFIG="$with_libnet/libnet-config"
41+ fi
42+
43+ if test -n "$LIBNET_CONFIG" -a -x "$LIBNET_CONFIG"; then
44+ LIBNET_CFLAGS="`$LIBNET_CONFIG --defines`"
45+ LIBNET_LIBS="`$LIBNET_CONFIG --libs`"
46+ AC_MSG_RESULT(yes)
47+ else
48+ AC_MSG_ERROR([Could not find libnet, and libnet support was explicitly enabled.])
49+ fi
50
51-if test -n "$LIBNET_CONFIG" -a -x "$LIBNET_CONFIG"; then
52- LIBNET_CFLAGS="`$LIBNET_CONFIG --defines`"
53- LIBNET_LIBS="`$LIBNET_CONFIG --libs`"
54- AC_MSG_RESULT(yes)
55 else
56 LIBNET_LIBS=
57 AC_MSG_RESULT(no)
58 fi
59
60-
61 if test "x$enable_spoof_source" = "xauto"; then
62 AC_MSG_CHECKING(whether to enable spoof source support)
63 if test "x$LIBNET_LIBS" != "x"; then
64--
651.7.1
66
diff --git a/meta-oe/recipes-support/syslog-ng/files/fix-invalid-ownership.patch b/meta-oe/recipes-support/syslog-ng/files/fix-invalid-ownership.patch
new file mode 100644
index 000000000..faf967247
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/fix-invalid-ownership.patch
@@ -0,0 +1,28 @@
1syslog-ng: fix wrong ownership issue
2
3Upstream-Status: Pending
4
5The ownership of build user is preserved for some target files, fixed it by
6adding --no-same-owner option to tar when extracting files.
7
8Signed-off-by: Ming Liu <ming.liu@windriver.com>
9---
10 scl/Makefile.am | 2 +-
11 1 files changed, 1 insertions(+), 1 deletions(-)
12
13diff --git a/scl/Makefile.am b/scl/Makefile.am
14index 57fad5d..2a29ca5 100644
15--- a/scl/Makefile.am
16+++ b/scl/Makefile.am
17@@ -14,7 +14,7 @@ scl-install-data-local:
18 fi; \
19 done
20 $(mkinstalldirs) $(DESTDIR)/$(scldir)
21- (cd $(srcdir)/scl; tar cf - $(SCL_SUBDIRS)) | (cd $(DESTDIR)/$(scldir) && tar xf -)
22+ (cd $(srcdir)/scl; tar cf - $(SCL_SUBDIRS)) | (cd $(DESTDIR)/$(scldir) && tar xf - --no-same-owner)
23 chmod -R u+rwX $(DESTDIR)/$(scldir)
24
25 scl-uninstall-local:
26--
271.7.1
28
diff --git a/meta-oe/recipes-support/syslog-ng/files/free-global-LogTemplateOptions.patch b/meta-oe/recipes-support/syslog-ng/files/free-global-LogTemplateOptions.patch
new file mode 100644
index 000000000..d439a2607
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/free-global-LogTemplateOptions.patch
@@ -0,0 +1,30 @@
1From 3ef6ca8044260c77118edca6dead807a2edcb5ef Mon Sep 17 00:00:00 2001
2From: Balazs Scheidler <bazsi@balabit.hu>
3Date: Thu, 31 Oct 2013 13:20:12 +0100
4Subject: [PATCH] cfg: free global LogTemplateOptions
5
6Upstream-Status: Backport
7
8This fixes a potential memory leak when global template specific
9options were specified, such as local-time-zone(), send-time-zone() etc.
10
11Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
12---
13 lib/cfg.c | 1 +
14 1 file changed, 1 insertion(+)
15
16diff --git a/lib/cfg.c b/lib/cfg.c
17index 7f040b8..adeaaf8 100644
18--- a/lib/cfg.c
19+++ b/lib/cfg.c
20@@ -411,6 +411,7 @@ cfg_free(GlobalConfig *self)
21 g_free(self->proto_template_name);
22 log_template_unref(self->file_template);
23 log_template_unref(self->proto_template);
24+ log_template_options_destroy(&self->template_options);
25
26 if (self->bad_hostname_compiled)
27 regfree(&self->bad_hostname);
28--
291.8.4.1
30
diff --git a/meta-oe/recipes-support/syslog-ng/files/initscript b/meta-oe/recipes-support/syslog-ng/files/initscript
new file mode 100644
index 000000000..910030f41
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/initscript
@@ -0,0 +1,62 @@
1#! /bin/sh
2#
3# This is an init script for openembedded
4# Copy it to /etc/init.d/syslog-ng and type
5# > update-rc.d syslog-ng defaults 5
6#
7
8# Source function library
9. /etc/init.d/functions
10
11syslog_ng=/usr/sbin/syslog-ng
12test -x "$syslog_ng" || exit 0
13
14PIDFILE=/var/run/syslog-ng/syslog-ng.pid
15
16create_xconsole() {
17 test -e /dev/xconsole || mknod -m 640 /dev/xconsole p
18 test -x /sbin/restorecon && /sbin/restorecon /dev/xconsole
19}
20
21RETVAL=0
22
23case "$1" in
24 start)
25 [ "${VERBOSE}" != "no" ] && echo -n "Starting syslog-ng:"
26 create_xconsole
27 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $syslog_ng
28 [ "${VERBOSE}" != "no" ] && echo "."
29 ;;
30 stop)
31 [ "${VERBOSE}" != "no" ] && echo -n "Stopping syslog-ng:"
32 start-stop-daemon --stop --quiet --pidfile $PIDFILE
33 [ "${VERBOSE}" != "no" ] && echo "."
34 ;;
35 reload|force-reload)
36 start-stop-daemon --stop --quiet --signal 1 --exec $syslog_ng
37 ;;
38 restart)
39 echo "Stopping syslog-ng:"
40 start-stop-daemon --stop --quiet --pidfile $PIDFILE
41 echo -n "Waiting for syslog-ng to die off"
42 for i in 1 2 3 ;
43 do
44 sleep 1
45 echo -n "."
46 done
47 echo ""
48 echo -n "Starting syslog-ng:"
49 create_xconsole
50 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $syslog_ng
51 echo "."
52 ;;
53 status)
54 status $syslog_ng
55 RETVAL=$?
56 ;;
57 *)
58 echo "Usage: $0 {start|stop|reload|restart|force-reload|status}"
59 exit 1
60esac
61
62exit $RETVAL
diff --git a/meta-oe/recipes-support/syslog-ng/files/logwriter-dont-allocate-a-new-buffer.patch b/meta-oe/recipes-support/syslog-ng/files/logwriter-dont-allocate-a-new-buffer.patch
new file mode 100644
index 000000000..9e3d64bbf
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/logwriter-dont-allocate-a-new-buffer.patch
@@ -0,0 +1,26 @@
1logwriter: Don't allocate a new buffer if fails to consume current item
2
3Upstream-Status: Pending
4
5Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
6---
7--- a/lib/logwriter.c
8+++ b/lib/logwriter.c
9@@ -1010,7 +1010,7 @@
10 {
11 status = log_proto_client_post(proto, (guchar *) self->line_buffer->str, self->line_buffer->len, &consumed);
12
13- if (consumed)
14+ if (consumed && status != LPS_ERROR)
15 log_writer_realloc_line_buffer(self);
16
17 if (status == LPS_ERROR)
18@@ -1028,7 +1028,7 @@
19 NULL);
20 consumed = TRUE;
21 }
22- if (consumed)
23+ if (consumed && status != LPS_ERROR)
24 {
25 if (lm->flags & LF_LOCAL)
26 step_sequence_number(&self->seq_num);
diff --git a/meta-oe/recipes-support/syslog-ng/files/rewrite-expr-grammar.ym-Free-up-token.patch b/meta-oe/recipes-support/syslog-ng/files/rewrite-expr-grammar.ym-Free-up-token.patch
new file mode 100644
index 000000000..1951af9fc
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/rewrite-expr-grammar.ym-Free-up-token.patch
@@ -0,0 +1,17 @@
1rewrite-expr-grammar.ym: Free up token.
2
3Upsteam-Status: Backport
4
5Reported-by: Xufeng Zhang <xufeng.zhang@windriver.com>
6Signed-off-by: Viktor Tusa <tusavik@gmail.com>
7---
8--- a/lib/rewrite/rewrite-expr-grammar.ym
9+++ b/lib/rewrite/rewrite-expr-grammar.ym
10@@ -78,6 +78,7 @@
11
12 $$ = log_template_new(configuration, $1);
13 CHECK_ERROR(log_template_compile($$, $1, &error), @1, "Error compiling template (%s)", error->message);
14+ free($1);
15 }
16 ;
17
diff --git a/meta-oe/recipes-support/syslog-ng/files/still-free-the-unconsumed-item.patch b/meta-oe/recipes-support/syslog-ng/files/still-free-the-unconsumed-item.patch
new file mode 100644
index 000000000..ea1868230
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/still-free-the-unconsumed-item.patch
@@ -0,0 +1,90 @@
1From 365020c5c0823c91a8011e34597f970a7cfb4fb3 Mon Sep 17 00:00:00 2001
2From: Tusa Viktor <tusavik@gmail.com>
3Date: Wed, 23 Apr 2014 17:10:58 +0000
4Subject: [PATCH] logwriter: still free the unconsumed item during reloading
5 configuration
6
7Upstream-Status: Backport
8
9Otherwise we have no chance to free this stuff.
10
11Reported-by: Xufeng Zhang <xufeng.zhang@windriver.com>
12Signed-off-by: Tusa Viktor <tusavik@gmail.com>
13Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
14---
15 lib/logproto/logproto-client.h | 2 +-
16 lib/logproto/logproto-text-client.c | 11 +++++++++++
17 lib/logwriter.c | 9 +++++++--
18 3 files changed, 19 insertions(+), 3 deletions(-)
19
20diff --git a/lib/logproto/logproto-client.h b/lib/logproto/logproto-client.h
21index 254ecf9..5adc917 100644
22--- a/lib/logproto/logproto-client.h
23+++ b/lib/logproto/logproto-client.h
24@@ -47,7 +47,6 @@ void log_proto_client_options_defaults(LogProtoClientOptions *options);
25 void log_proto_client_options_init(LogProtoClientOptions *options, GlobalConfig *cfg);
26 void log_proto_client_options_destroy(LogProtoClientOptions *options);
27
28-
29 struct _LogProtoClient
30 {
31 LogProtoStatus status;
32@@ -107,6 +106,7 @@ log_proto_client_reset_error(LogProtoClient *s)
33 gboolean log_proto_client_validate_options(LogProtoClient *self);
34 void log_proto_client_init(LogProtoClient *s, LogTransport *transport, const LogProtoClientOptions *options);
35 void log_proto_client_free(LogProtoClient *s);
36+void log_proto_client_free_method(LogProtoClient *s);
37
38 #define DEFINE_LOG_PROTO_CLIENT(prefix) \
39 static gpointer \
40diff --git a/lib/logproto/logproto-text-client.c b/lib/logproto/logproto-text-client.c
41index 3248759..a5100f3 100644
42--- a/lib/logproto/logproto-text-client.c
43+++ b/lib/logproto/logproto-text-client.c
44@@ -146,12 +146,23 @@ log_proto_text_client_post(LogProtoClient *s, guchar *msg, gsize msg_len, gboole
45 }
46
47 void
48+log_proto_text_client_free(LogProtoClient *s)
49+{
50+ LogProtoTextClient *self = (LogProtoTextClient *)s;
51+ if (self->partial_free)
52+ self->partial_free(self->partial);
53+ self->partial = NULL;
54+ log_proto_client_free_method(s);
55+};
56+
57+void
58 log_proto_text_client_init(LogProtoTextClient *self, LogTransport *transport, const LogProtoClientOptions *options)
59 {
60 log_proto_client_init(&self->super, transport, options);
61 self->super.prepare = log_proto_text_client_prepare;
62 self->super.flush = log_proto_text_client_flush;
63 self->super.post = log_proto_text_client_post;
64+ self->super.free_fn = log_proto_text_client_free;
65 self->super.transport = transport;
66 self->next_state = -1;
67 }
68diff --git a/lib/logwriter.c b/lib/logwriter.c
69index 3292e31..470bcdb 100644
70--- a/lib/logwriter.c
71+++ b/lib/logwriter.c
72@@ -1063,8 +1063,13 @@ log_writer_flush(LogWriter *self, LogWriterFlushMode flush_mode)
73 }
74 else
75 {
76- /* push back to the queue */
77- log_queue_push_head(self->queue, lm, &path_options);
78+ if (flush_mode == LW_FLUSH_QUEUE)
79+ log_msg_unref(lm);
80+ else
81+ {
82+ /* push back to the queue */
83+ log_queue_push_head(self->queue, lm, &path_options);
84+ }
85 msg_set_context(NULL);
86 log_msg_refcache_stop();
87 break;
88--
891.7.10.4
90
diff --git a/meta-oe/recipes-support/syslog-ng/files/syslog-ng-verify-the-list-before-del.patch b/meta-oe/recipes-support/syslog-ng/files/syslog-ng-verify-the-list-before-del.patch
new file mode 100644
index 000000000..e8119b84b
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/syslog-ng-verify-the-list-before-del.patch
@@ -0,0 +1,38 @@
1Verify the validity of the pointer before delete it
2
3Otherwise, we got a crash at logqueue-fifo.c:344
4 344 iv_list_del(&node->list);
5
6Upstream-Status: Pending
7
8Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
9---
10--- a/lib/logqueue-fifo.c
11+++ b/lib/logqueue-fifo.c
12@@ -339,15 +339,18 @@
13 *msg = node->msg;
14 path_options->ack_needed = node->ack_needed;
15 self->qoverflow_output_len--;
16- if (!push_to_backlog)
17+ if ((&node->list) && (&node->list)->next && (&node->list)->prev)
18 {
19- iv_list_del(&node->list);
20- log_msg_free_queue_node(node);
21- }
22- else
23- {
24- iv_list_del_init(&node->list);
25- }
26+ if (!push_to_backlog)
27+ {
28+ iv_list_del(&node->list);
29+ log_msg_free_queue_node(node);
30+ }
31+ else
32+ {
33+ iv_list_del_init(&node->list);
34+ }
35+ }
36 }
37 else
38 {
diff --git a/meta-oe/recipes-support/syslog-ng/files/syslog-ng.conf b/meta-oe/recipes-support/syslog-ng/files/syslog-ng.conf
new file mode 100644
index 000000000..f0da2b703
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/syslog-ng.conf
@@ -0,0 +1,155 @@
1@version: 3.5
2#
3# Syslog-ng configuration file, compatible with default Debian syslogd
4# installation. Originally written by anonymous (I can't find his name)
5# Revised, and rewrited by me (SZALAY Attila <sasa@debian.org>)
6
7# First, set some global options.
8options { chain_hostnames(off); flush_lines(0); use_dns(no); use_fqdn(no);
9 owner("root"); group("adm"); perm(0640); stats_freq(0);
10 bad_hostname("^gconfd$");
11};
12
13########################
14# Sources
15########################
16# This is the default behavior of sysklogd package
17# Logs may come from unix stream, but not from another machine.
18#
19source s_src { unix-dgram("/dev/log"); internal();
20 file("/proc/kmsg" program_override("kernel"));
21};
22
23# If you wish to get logs from remote machine you should uncomment
24# this and comment the above source line.
25#
26#source s_net { tcp(ip(127.0.0.1) port(1000) authentication(required) encrypt(allow)); };
27
28########################
29# Destinations
30########################
31# First some standard logfile
32#
33destination d_auth { file("/var/log/auth.log"); };
34destination d_cron { file("/var/log/cron.log"); };
35destination d_daemon { file("/var/log/daemon.log"); };
36destination d_kern { file("/var/log/kern.log"); };
37destination d_lpr { file("/var/log/lpr.log"); };
38destination d_mail { file("/var/log/mail.log"); };
39destination d_syslog { file("/var/log/syslog"); };
40destination d_user { file("/var/log/user.log"); };
41destination d_uucp { file("/var/log/uucp.log"); };
42
43# This files are the log come from the mail subsystem.
44#
45destination d_mailinfo { file("/var/log/mail/mail.info"); };
46destination d_mailwarn { file("/var/log/mail/mail.warn"); };
47destination d_mailerr { file("/var/log/mail/mail.err"); };
48
49# Logging for INN news system
50#
51destination d_newscrit { file("/var/log/news/news.crit"); };
52destination d_newserr { file("/var/log/news/news.err"); };
53destination d_newsnotice { file("/var/log/news/news.notice"); };
54
55# Some `catch-all' logfiles.
56#
57destination d_debug { file("/var/log/debug"); };
58destination d_error { file("/var/log/error"); };
59destination d_messages { file("/var/log/messages"); };
60
61# The root's console.
62#
63destination d_console { usertty("root"); };
64
65# Virtual console.
66#
67destination d_console_all { file("/dev/tty10"); };
68
69# The named pipe /dev/xconsole is for the nsole' utility. To use it,
70# you must invoke nsole' with the -file' option:
71#
72# $ xconsole -file /dev/xconsole [...]
73#
74destination d_xconsole { pipe("/dev/xconsole"); };
75
76# Send the messages to an other host
77#
78#destination d_net { tcp("127.0.0.1" port(1000) authentication(on) encrypt(on) log_fifo_size(1000)); };
79
80# Debian only
81destination d_ppp { file("/var/log/ppp.log"); };
82
83########################
84# Filters
85########################
86# Here's come the filter options. With this rules, we can set which
87# message go where.
88
89filter f_dbg { level(debug); };
90filter f_info { level(info); };
91filter f_notice { level(notice); };
92filter f_warn { level(warn); };
93filter f_err { level(err); };
94filter f_crit { level(crit .. emerg); };
95
96filter f_debug { level(debug) and not facility(auth, authpriv, news, mail); };
97filter f_error { level(err .. emerg) ; };
98filter f_messages { level(info,notice,warn) and
99 not facility(auth,authpriv,cron,daemon,mail,news); };
100
101filter f_auth { facility(auth, authpriv) and not filter(f_debug); };
102filter f_cron { facility(cron) and not filter(f_debug); };
103filter f_daemon { facility(daemon) and not filter(f_debug); };
104filter f_kern { facility(kern) and not filter(f_debug); };
105filter f_lpr { facility(lpr) and not filter(f_debug); };
106filter f_local { facility(local0, local1, local3, local4, local5,
107 local6, local7) and not filter(f_debug); };
108filter f_mail { facility(mail) and not filter(f_debug); };
109filter f_news { facility(news) and not filter(f_debug); };
110filter f_syslog3 { not facility(auth, authpriv, mail) and not filter(f_debug); };
111filter f_user { facility(user) and not filter(f_debug); };
112filter f_uucp { facility(uucp) and not filter(f_debug); };
113
114filter f_cnews { level(notice, err, crit) and facility(news); };
115filter f_cother { level(debug, info, notice, warn) or facility(daemon, mail); };
116
117filter f_ppp { facility(local2) and not filter(f_debug); };
118filter f_console { level(warn .. emerg); };
119
120########################
121# Log paths
122########################
123log { source(s_src); filter(f_auth); destination(d_auth); };
124log { source(s_src); filter(f_cron); destination(d_cron); };
125log { source(s_src); filter(f_daemon); destination(d_daemon); };
126log { source(s_src); filter(f_kern); destination(d_kern); };
127log { source(s_src); filter(f_lpr); destination(d_lpr); };
128log { source(s_src); filter(f_syslog3); destination(d_syslog); };
129log { source(s_src); filter(f_user); destination(d_user); };
130log { source(s_src); filter(f_uucp); destination(d_uucp); };
131
132log { source(s_src); filter(f_mail); destination(d_mail); };
133#log { source(s_src); filter(f_mail); filter(f_info); destination(d_mailinfo); };
134#log { source(s_src); filter(f_mail); filter(f_warn); destination(d_mailwarn); };
135#log { source(s_src); filter(f_mail); filter(f_err); destination(d_mailerr); };
136
137log { source(s_src); filter(f_news); filter(f_crit); destination(d_newscrit); };
138log { source(s_src); filter(f_news); filter(f_err); destination(d_newserr); };
139log { source(s_src); filter(f_news); filter(f_notice); destination(d_newsnotice); };
140#log { source(s_src); filter(f_cnews); destination(d_console_all); };
141#log { source(s_src); filter(f_cother); destination(d_console_all); };
142
143#log { source(s_src); filter(f_ppp); destination(d_ppp); };
144
145log { source(s_src); filter(f_debug); destination(d_debug); };
146log { source(s_src); filter(f_error); destination(d_error); };
147log { source(s_src); filter(f_messages); destination(d_messages); };
148
149log { source(s_src); filter(f_console); destination(d_console_all);
150 destination(d_xconsole); };
151log { source(s_src); filter(f_crit); destination(d_console); };
152
153# All messages send to a remote site
154#
155#log { source(s_src); destination(d_net); };
diff --git a/meta-oe/recipes-support/syslog-ng/files/volatiles.03_syslog-ng b/meta-oe/recipes-support/syslog-ng/files/volatiles.03_syslog-ng
new file mode 100644
index 000000000..3c4a50d54
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/volatiles.03_syslog-ng
@@ -0,0 +1 @@
d root root 0755 /var/run/syslog-ng none
diff --git a/meta-oe/recipes-support/syslog-ng/syslog-ng.inc b/meta-oe/recipes-support/syslog-ng/syslog-ng.inc
new file mode 100644
index 000000000..984af439a
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/syslog-ng.inc
@@ -0,0 +1,106 @@
1SUMMARY = "Alternative system logger daemon"
2DESCRIPTION = "syslog-ng, as the name shows, is a syslogd replacement, \
3but with new functionality for the new generation. The original syslogd \
4allows messages only to be sorted based on priority/facility pairs; \
5syslog-ng adds the possibility to filter based on message contents using \
6regular expressions. The new configuration scheme is intuitive and powerful. \
7Forwarding logs over TCP and remembering all forwarding hops makes it \
8ideal for firewalled environments. \
9"
10HOMEPAGE = "http://www.balabit.com/network-security/syslog-ng/opensource-logging-system"
11
12LICENSE = "GPLv2 & LGPLv2.1"
13LIC_FILES_CHKSUM = "file://COPYING;md5=e0e8658d9be248f01b7933df24dc1408"
14
15DEPENDS = "flex eventlog glib-2.0"
16
17SRC_URI = "http://www.balabit.com/downloads/files/syslog-ng/sources/${PV}/source/${BPN}_${PV}.tar.gz \
18 file://syslog-ng.conf \
19 file://initscript \
20 file://volatiles.03_syslog-ng \
21 file://configure.ac-add-option-enable-thread-tls-to-manage-.patch \
22"
23
24inherit autotools systemd pkgconfig update-rc.d update-alternatives
25
26EXTRA_OECONF = " \
27 --enable-dynamic-linking \
28 --disable-sub-streams \
29 --disable-pacct \
30 --localstatedir=${localstatedir}/run/${BPN} \
31 --sysconfdir=${sysconfdir}/${BPN} \
32 --with-module-dir=${libdir}/${BPN} \
33 --with-sysroot=${STAGING_DIR_HOST} \
34 --with-libmongo-client=no --disable-mongodb \
35 --with-librabbitmq-client=no \
36 ${CONFIG_TLS} \
37"
38
39CONFIG_TLS = "--enable-thread-tls"
40CONFIG_TLS_arm = "${@base_conditional( "DEBUG_BUILD", "1", " --disable-thread-tls", " --enable-thread-tls", d )}"
41
42PACKAGECONFIG ??= "openssl \
43 ${@base_contains('DISTRO_FEATURES', 'ipv6', 'ipv6', '', d)} \
44 ${@base_contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
45"
46PACKAGECONFIG[openssl] = "--enable-ssl,--disable-ssl,openssl,"
47PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,,"
48PACKAGECONFIG[systemd] = "--enable-systemd --with-systemdsystemunitdir=${systemd_unitdir}/system/,--disable-systemd --without-systemdsystemunitdir,systemd,"
49PACKAGECONFIG[linux-caps] = "--enable-linux-caps,--disable-linux-caps,libcap,"
50PACKAGECONFIG[pcre] = "--enable-pcre,--disable-pcre,libpcre,"
51PACKAGECONFIG[dbi] = "--enable-sql,--disable-sql,libdbi,"
52PACKAGECONFIG[libnet] = "--enable-libnet --with-libnet=${STAGING_BINDIR_CROSS},--disable-libnet,libnet,"
53PACKAGECONFIG[smtp] = "--enable-smtp --with-libesmtp=${STAGING_LIBDIR},--disable-smtp,libesmtp,"
54PACKAGECONFIG[json] = "--enable-json,--disable-json,json-c,"
55PACKAGECONFIG[tcp-wrapper] = "--enable-tcp-wrapper,--disable-tcp-wrapper,tcp-wrappers,"
56
57do_configure_prepend() {
58 eval "${@base_contains('DISTRO_FEATURES', 'largefile', '', 'sed -i -e "s/-D_LARGEFILE_SOURCE//" -e "s/-D_FILE_OFFSET_BITS=64//" ${S}/configure.in', d)}"
59}
60
61do_install_append() {
62 install -d ${D}/${sysconfdir}/${BPN}
63 install ${WORKDIR}/syslog-ng.conf ${D}${sysconfdir}/${BPN}/${BPN}.conf
64 install -d ${D}/${sysconfdir}/init.d
65 install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog.${BPN}
66 install -d ${D}/${sysconfdir}/default/volatiles/
67 install -m 755 ${WORKDIR}/volatiles.03_syslog-ng ${D}/${sysconfdir}/default/volatiles/03_syslog-ng
68
69 # Remove /var/run as it is created on startup
70 rm -rf ${D}${localstatedir}/run
71}
72
73FILES_${PN} += "${datadir}/include/scl/ ${datadir}/xsd ${datadir}/tools"
74RDEPENDS_${PN} += "gawk"
75
76# This overcomes the syslog-ng rdepends on syslog-ng-dev QA Error
77PACKAGES =+ "${PN}-libs ${PN}-libs-dev ${PN}-libs-dbg"
78FILES_${PN}-libs = "${libdir}/${BPN}/*.so ${libdir}/libsyslog-ng-*.so*"
79FILES_${PN}-libs-dev = "${libdir}/${BPN}/lib*.la"
80FILES_${PN}-libs-dbg = "${libdir}/${BPN}/.debug"
81INSANE_SKIP_${PN}-libs = "dev-so"
82RDEPENDS_${PN} += "${PN}-libs"
83
84CONFFILES_${PN} = "${sysconfdir}/${BPN}.conf ${sysconfdir}/scl.conf"
85
86# syslog initscript is handled explicitly because order of
87# update-rc.d and update-alternatives is important
88RDEPENDS_${PN} += " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}"
89
90RPROVIDES_${PN} += "${PN}-systemd"
91RREPLACES_${PN} += "${PN}-systemd"
92RCONFLICTS_${PN} += "${PN}-systemd"
93SYSTEMD_SERVICE_${PN} = "${BPN}.service"
94
95# no syslog-init for systemd
96python () {
97 if 'sysvinit' in d.getVar("DISTRO_FEATURES", True).split():
98 pn = d.getVar('PN', True)
99 sysconfdir = d.getVar('sysconfdir', True)
100 d.appendVar('ALTERNATIVE_%s' % (pn), ' syslog-init')
101 d.setVarFlag('ALTERNATIVE_PRIORITY', 'syslog-init', '200')
102 d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-init', '%s/init.d/syslog' % (sysconfdir))
103}
104
105INITSCRIPT_NAME = "syslog"
106INITSCRIPT_PARAMS = "start 20 2 3 4 5 . stop 90 0 1 6 ."
diff --git a/meta-oe/recipes-support/syslog-ng/syslog-ng_3.5.4.1.bb b/meta-oe/recipes-support/syslog-ng/syslog-ng_3.5.4.1.bb
new file mode 100644
index 000000000..b54842030
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/syslog-ng_3.5.4.1.bb
@@ -0,0 +1,21 @@
1require syslog-ng.inc
2
3SRC_URI += " \
4 file://afsql-afsql_dd_insert_db-refactor.patch \
5 file://deinit-the-new-config-when-reverting-to-the.patch \
6 file://fix-a-memory-leak-in-log_driver_free.patch \
7 file://fix-config-libnet.patch \
8 file://fix-invalid-ownership.patch \
9 file://Fix-the-memory-leak-problem-for-mutex.patch \
10 file://Fix-the-memory-leak-problem-when-HAVE_ENVIRON-defined.patch \
11 file://free-global-LogTemplateOptions.patch \
12 file://still-free-the-unconsumed-item.patch \
13 file://syslog-ng-verify-the-list-before-del.patch \
14 file://configure.patch \
15 file://dbifix.patch \
16 file://rewrite-expr-grammar.ym-Free-up-token.patch \
17 file://logwriter-dont-allocate-a-new-buffer.patch \
18"
19
20SRC_URI[md5sum] = "ff3bf223ebafbaa92b69a2d5b729f368"
21SRC_URI[sha256sum] = "92c6969e4172b4fd32390f80043b4de7b116f29989d8c2e5a8a687ee6dcd6f66"