[NETFILTER]: nf_conntrack: remove ugly hack in l4proto registration
[powerpc.git] / net / netfilter / nf_conntrack_core.c
index b3a70eb..9858bcb 100644 (file)
@@ -768,7 +768,7 @@ resolve_normal_ct(struct sk_buff *skb,
        struct nf_conntrack_tuple_hash *h;
        struct nf_conn *ct;
 
-       if (!nf_ct_get_tuple(skb, (unsigned int)(skb->nh.raw - skb->data),
+       if (!nf_ct_get_tuple(skb, skb_network_offset(skb),
                             dataoff, l3num, protonum, &tuple, l3proto,
                             l4proto)) {
                DEBUGP("resolve_normal_ct: Can't get tuple\n");
@@ -960,7 +960,7 @@ void __nf_ct_refresh_acct(struct nf_conn *ct,
        if (do_acct) {
                ct->counters[CTINFO2DIR(ctinfo)].packets++;
                ct->counters[CTINFO2DIR(ctinfo)].bytes +=
-                       skb->len - (unsigned int)(skb->nh.raw - skb->data);
+                       skb->len - skb_network_offset(skb);
 
                if ((ct->counters[CTINFO2DIR(ctinfo)].packets & 0x80000000)
                    || (ct->counters[CTINFO2DIR(ctinfo)].bytes & 0x80000000))
@@ -1152,14 +1152,7 @@ void nf_conntrack_cleanup(void)
        free_conntrack_hash(nf_conntrack_hash, nf_conntrack_vmalloc,
                            nf_conntrack_htable_size);
 
-       nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_generic);
-
-       /* free l3proto protocol tables */
-       for (i = 0; i < PF_MAX; i++)
-               if (nf_ct_protos[i]) {
-                       kfree(nf_ct_protos[i]);
-                       nf_ct_protos[i] = NULL;
-               }
+       nf_conntrack_proto_fini();
 }
 
 static struct list_head *alloc_hashtable(int size, int *vmalloced)
@@ -1237,7 +1230,6 @@ module_param_call(hashsize, set_hashsize, param_get_uint,
 
 int __init nf_conntrack_init(void)
 {
-       unsigned int i;
        int ret;
 
        /* Idea from tcp.c: use 1/16384 of memory.  On i386: 32MB
@@ -1279,16 +1271,10 @@ int __init nf_conntrack_init(void)
                goto err_free_conntrack_slab;
        }
 
-       ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_generic);
+       ret = nf_conntrack_proto_init();
        if (ret < 0)
                goto out_free_expect_slab;
 
-       /* Don't NEED lock here, but good form anyway. */
-       write_lock_bh(&nf_conntrack_lock);
-       for (i = 0; i < AF_MAX; i++)
-               nf_ct_l3protos[i] = &nf_conntrack_l3proto_generic;
-       write_unlock_bh(&nf_conntrack_lock);
-
        /* For use by REJECT target */
        rcu_assign_pointer(ip_ct_attach, __nf_conntrack_attach);