From a03ac74abde5fb2236d9d9aa57a3ba10f8e7bdc4 Mon Sep 17 00:00:00 2001 From: Pierre Chifflier Date: Thu, 16 Apr 2009 14:20:40 +0200 Subject: ulogd: configure all plugins before resolving keys. Split the 'resolve keys' step in two parts: first call the configure fonction for all plugins (in reverse order), then loop again to resolve the keys. This allows dynamic construction of the input and output keys, even for filter plugins. Signed-off-by: Pierre Chifflier --- src/ulogd.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ulogd.c b/src/ulogd.c index 1428373..dc0407e 100644 --- a/src/ulogd.c +++ b/src/ulogd.c @@ -640,14 +640,8 @@ create_stack_resolve_keys(struct ulogd_pluginstance_stack *stack) int i = 0; struct ulogd_pluginstance *pi_cur; - /* PASS 2: */ - ulogd_log(ULOGD_DEBUG, "connecting input/output keys of stack:\n"); + /* pre-configuration pass */ llist_for_each_entry_reverse(pi_cur, &stack->list, list) { - struct ulogd_pluginstance *pi_prev = - llist_entry(pi_cur->list.prev, - struct ulogd_pluginstance, - list); - i++; ulogd_log(ULOGD_DEBUG, "traversing plugin `%s'\n", pi_cur->plugin->name); /* call plugin to tell us which keys it requires in @@ -662,6 +656,18 @@ create_stack_resolve_keys(struct ulogd_pluginstance_stack *stack) return ret; } } + } + + /* PASS 2: */ + ulogd_log(ULOGD_DEBUG, "connecting input/output keys of stack:\n"); + llist_for_each_entry_reverse(pi_cur, &stack->list, list) { + struct ulogd_pluginstance *pi_prev = + llist_entry(pi_cur->list.prev, + struct ulogd_pluginstance, + list); + i++; + ulogd_log(ULOGD_DEBUG, "traversing plugin `%s'\n", + pi_cur->plugin->name); if (i == 1) { /* first round: output plugin */ -- cgit v1.2.3