Skip to contentSkip to conversation

Fix multiple usage of DB output plugin.

PATCH In review Eric Leblond 2 participants 2 messages Apr 20, 2008 – Apr 21, 2008 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix multiple usage of DB output plugin.

Hello,

Due to the modifications done to be able to use multiple time the SOURCE plugin, a single instance of database output plugin could not anymore be used in separate stack. This patch fixes this by limiting the effect of the previous modification on SOURCE plugin.

BR,

---
 src/ulogd.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
src/ulogd.c +11 -7
index 249bde3..3a1e3d9 100644
@@ -717,13 +717,17 @@ static int pluginstance_started(struct ulogd_pluginstance *npi)
 	struct ulogd_pluginstance_stack *stack;
 	struct ulogd_pluginstance *pi;
 
-	llist_for_each_entry(stack, &ulogd_pi_stacks, stack_list) {
-		llist_for_each_entry(pi, &stack->list, list) {
-			if (!strcmp(pi->id, npi->id)) {
-				ulogd_log(ULOGD_INFO, "%s instance already "
-						      "loaded\n", pi->id);
-				llist_add(&pi->plist, &npi->plist);
-				return 1;
+	/* Only SOURCE plugin need to be started once */
+	if (npi->plugin->input.type == ULOGD_DTYPE_SOURCE) {
+		llist_for_each_entry(stack, &ulogd_pi_stacks, stack_list) {
+			llist_for_each_entry(pi, &stack->list, list) {
+				if (!strcmp(pi->id, npi->id)) {
+					ulogd_log(ULOGD_INFO,
+							"%s instance already "
+							"loaded\n", pi->id);
+					llist_add(&pi->plist, &npi->plist);
+					return 1;
+				}
 			}
 		}
 	}
Signature · 1 line
1.5.2.5
#1 lore raw
Quoted 6 lines · Eric Leblond

Hello,

Due to the modifications done to be able to use multiple time the SOURCE plugin, a single instance of database output plugin could not anymore be used in separate stack. This patch fixes this by limiting the effect of the previous modification on SOURCE plugin.

This seem to fix a crash I was getting with the latest SVN version. Applied, thanks.