]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/netfilter/nf_conntrack_helper.c
[NETFILTER]: nf_nat: kill global 'destroy' operation
[linux-2.6-omap-h63xx.git] / net / netfilter / nf_conntrack_helper.c
index 0743be4434b019d201a0caa4dc5826d7061d4f75..6d32399d64e14fa90bc5efd2bd7ab8139c05b3aa 100644 (file)
@@ -26,6 +26,7 @@
 #include <net/netfilter/nf_conntrack_l4proto.h>
 #include <net/netfilter/nf_conntrack_helper.h>
 #include <net/netfilter/nf_conntrack_core.h>
+#include <net/netfilter/nf_conntrack_extend.h>
 
 static __read_mostly LIST_HEAD(helpers);
 
@@ -93,25 +94,15 @@ static inline int unhelp(struct nf_conntrack_tuple_hash *i,
 
        if (help && help->helper == me) {
                nf_conntrack_event(IPCT_HELPER, ct);
-               help->helper = NULL;
+               rcu_assign_pointer(help->helper, NULL);
        }
        return 0;
 }
 
 int nf_conntrack_helper_register(struct nf_conntrack_helper *me)
 {
-       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",
-                                         size);
-       if (ret < 0) {
-               printk(KERN_ERR "nf_conntrack_helper_register: Unable to create slab cache for conntracks\n");
-               return ret;
-       }
        write_lock_bh(&nf_conntrack_lock);
        list_add(&me->list, &helpers);
        write_unlock_bh(&nf_conntrack_lock);
@@ -153,3 +144,19 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
        synchronize_net();
 }
 EXPORT_SYMBOL_GPL(nf_conntrack_helper_unregister);
+
+struct nf_ct_ext_type helper_extend = {
+       .len    = sizeof(struct nf_conn_help),
+       .align  = __alignof__(struct nf_conn_help),
+       .id     = NF_CT_EXT_HELPER,
+};
+
+int nf_conntrack_helper_init()
+{
+       return nf_ct_extend_register(&helper_extend);
+}
+
+void nf_conntrack_helper_fini()
+{
+       nf_ct_extend_unregister(&helper_extend);
+}