[netfilter-cvslog] r7411 - branches/ulog/ulogd2/src
pablo at netfilter.org
pablo at netfilter.org
Tue Mar 25 09:56:08 CET 2008
Author: pablo at netfilter.org
Date: 2008-03-25 09:56:08 +0100 (Tue, 25 Mar 2008)
New Revision: 7411
Modified:
branches/ulog/ulogd2/src/ulogd.c
Log:
When a plugin instance is used in multiple stack it is not necessary to
call the start function for each stack.
Signed-off-by: Eric Leblond <eric at inl.fr>
Modified: branches/ulog/ulogd2/src/ulogd.c
===================================================================
--- branches/ulog/ulogd2/src/ulogd.c 2008-03-25 08:50:57 UTC (rev 7410)
+++ branches/ulog/ulogd2/src/ulogd.c 2008-03-25 08:56:08 UTC (rev 7411)
@@ -710,6 +710,24 @@
return 0;
}
+/* iterate on already defined stack to find a plugininstance matching */
+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);
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
static int create_stack_start_instances(struct ulogd_pluginstance_stack *stack)
{
int ret;
@@ -720,11 +738,15 @@
if (!pi->plugin->start)
continue;
- ret = pi->plugin->start(pi);
- if (ret < 0) {
- ulogd_log(ULOGD_ERROR, "error during start of `%s'\n",
- pi->id);
- return ret;
+ /* only call start if a plugin with same ID was not started */
+ if (!pluginstance_started(pi)) {
+ ret = pi->plugin->start(pi);
+ if (ret < 0) {
+ ulogd_log(ULOGD_ERROR,
+ "error starting `%s'\n",
+ pi->id);
+ return ret;
+ }
}
}
return 0;
More information about the netfilter-cvslog
mailing list