]> err.no Git - linux-2.6/blobdiff - net/netfilter/nf_conntrack_helper.c
[NETFILTER]: Kconfig: improve conntrack selection
[linux-2.6] / net / netfilter / nf_conntrack_helper.c
index ca044875a561ae66deb9e94e89d9d9a8382fdf0c..81542dc7506960472468126a3200b69d0ec0fb51 100644 (file)
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
 
-#define ASSERT_READ_LOCK(x)
-#define ASSERT_WRITE_LOCK(x)
-
 #include <net/netfilter/nf_conntrack.h>
 #include <net/netfilter/nf_conntrack_l3proto.h>
-#include <net/netfilter/nf_conntrack_protocol.h>
+#include <net/netfilter/nf_conntrack_l4proto.h>
 #include <net/netfilter/nf_conntrack_helper.h>
 #include <net/netfilter/nf_conntrack_core.h>
 
-static LIST_HEAD(helpers);
+static __read_mostly LIST_HEAD(helpers);
 
 struct nf_conntrack_helper *
 __nf_ct_helper_find(const struct nf_conntrack_tuple *tuple)
@@ -100,13 +97,14 @@ static inline int unhelp(struct nf_conntrack_tuple_hash *i,
 
 int nf_conntrack_helper_register(struct nf_conntrack_helper *me)
 {
-       int ret;
+       int size, ret;
+
        BUG_ON(me->timeout == 0);
 
+       size = ALIGN(sizeof(struct nf_conn), __alignof__(struct nf_conn_help)) +
+              sizeof(struct nf_conn_help);
        ret = nf_conntrack_register_cache(NF_CT_F_HELP, "nf_conntrack:help",
-                                         sizeof(struct nf_conn)
-                                         + sizeof(struct nf_conn_help)
-                                         + __alignof__(struct nf_conn_help));
+                                         size);
        if (ret < 0) {
                printk(KERN_ERR "nf_conntrack_helper_register: Unable to create slab cache for conntracks\n");
                return ret;
@@ -131,7 +129,8 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
        /* Get rid of expectations */
        list_for_each_entry_safe(exp, tmp, &nf_conntrack_expect_list, list) {
                struct nf_conn_help *help = nfct_help(exp->master);
-               if (help->helper == me && del_timer(&exp->timeout)) {
+               if ((help->helper == me || exp->helper == me) &&
+                   del_timer(&exp->timeout)) {
                        nf_ct_unlink_expect(exp);
                        nf_conntrack_expect_put(exp);
                }