From d36ea63af6100e85ea144c6810391d242dbd4ca2 Mon Sep 17 00:00:00 2001 From: LGA1150 Date: Wed, 16 May 2018 16:09:03 +0800 Subject: Fix compile error when CONFIG_NF_CONNTRACK_CHAIN_EVENTS is set --- xt_FULLCONENAT.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/xt_FULLCONENAT.c b/xt_FULLCONENAT.c index d54395b..4595aa3 100644 --- a/xt_FULLCONENAT.c +++ b/xt_FULLCONENAT.c @@ -15,6 +15,9 @@ #include #include #include +#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS +#include +#endif #include #include #include @@ -78,7 +81,11 @@ struct tuple_list { struct list_head list; }; +#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS +struct notifier_block ct_event_notifier; +#else struct nf_ct_event_notifier ct_event_notifier; +#endif int tg_refer_count = 0; int ct_event_notifier_registered = 0; @@ -321,13 +328,17 @@ static void gc_worker(struct work_struct *work) { } /* conntrack destroy event callback function */ +#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS +static int ct_event_cb(struct notifier_block *this, unsigned long events, void *ptr) { + struct nf_ct_event *item = ptr; +#else static int ct_event_cb(unsigned int events, struct nf_ct_event *item) { +#endif struct nf_conn *ct; struct nf_conntrack_tuple *ct_tuple_reply, *ct_tuple_original; uint8_t protonum; struct tuple_list *dying_tuple_item; - ct = item->ct; /* we handle only conntrack destroy events */ if (ct == NULL || !(events & (1 << IPCT_DESTROY))) { @@ -614,7 +625,11 @@ static int fullconenat_tg_check(const struct xt_tgchk_param *par) if (tg_refer_count == 1) { nf_ct_netns_get(par->net, par->family); +#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS + ct_event_notifier.notifier_call = ct_event_cb; +#else ct_event_notifier.fcn = ct_event_cb; +#endif if (nf_conntrack_register_notifier(par->net, &ct_event_notifier) == 0) { ct_event_notifier_registered = 1; -- cgit v1.2.3