From 712896b182c1e62d5e49f5a6859832708d3dd0fe Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 17 Jun 2010 15:20:57 +0200 Subject: NFCT: fix plugin re-use in different stacks This patch fixes a problem in configurations that use the NFCT plugin as input in several stacks. The first plugin loaded contains the hashtable and other important NFCT private data. Other plugin instances of NFCT are dummies that are only used to store the output keys. Signed-off-by: Pablo Neira Ayuso --- input/flow/ulogd_inpflow_NFCT.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'input') diff --git a/input/flow/ulogd_inpflow_NFCT.c b/input/flow/ulogd_inpflow_NFCT.c index 3978f2f..4376a06 100644 --- a/input/flow/ulogd_inpflow_NFCT.c +++ b/input/flow/ulogd_inpflow_NFCT.c @@ -454,14 +454,16 @@ static int compare(const void *data1, const void *data2) return nfct_cmp(u1->ct, ct, NFCT_CMP_ORIG | NFCT_CMP_REPL); } -static int propagate_ct(struct ulogd_pluginstance *upi, +/* only the main_upi plugin instance contains the correct private data. */ +static int propagate_ct(struct ulogd_pluginstance *main_upi, + struct ulogd_pluginstance *upi, struct nf_conntrack *ct, int type, struct ct_timestamp *ts) { struct ulogd_key *ret = upi->output.keys; struct nfct_pluginstance *cpi = - (struct nfct_pluginstance *) upi->private; + (struct nfct_pluginstance *) main_upi->private; okey_set_u32(&ret[NFCT_CT_EVENT], type); okey_set_u8(&ret[NFCT_OOB_FAMILY], nfct_get_attr_u8(ct, ATTR_L3PROTO)); @@ -574,11 +576,11 @@ do_propagate_ct(struct ulogd_pluginstance *upi, * several different stacks, we duplicate the message * to let them know */ llist_for_each_entry(npi, &upi->plist, plist) { - if (propagate_ct(npi, ct, type, ts) != 0) + if (propagate_ct(upi, npi, ct, type, ts) != 0) break; } - propagate_ct(upi, ct, type, ts); + propagate_ct(upi, upi, ct, type, ts); } static int -- cgit v1.2.3