Merge branch 'proc-cmdline' (/proc/<pid>/cmdline fixes)
[linux-2.6-block.git] / net / ipv6 / netfilter / nf_conntrack_reasm.c
index 84322ce81d7082f4ed4a6dafae312d04c0556dcc..0f82c150543b75f42c35f0199244a3a8cf5dd3f7 100644 (file)
@@ -54,26 +54,21 @@ static struct inet_frags nf_frags;
 static struct ctl_table nf_ct_frag6_sysctl_table[] = {
        {
                .procname       = "nf_conntrack_frag6_timeout",
-               .data           = &init_net.nf_frag.frags.timeout,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
                .proc_handler   = proc_dointvec_jiffies,
        },
        {
                .procname       = "nf_conntrack_frag6_low_thresh",
-               .data           = &init_net.nf_frag.frags.low_thresh,
                .maxlen         = sizeof(unsigned long),
                .mode           = 0644,
                .proc_handler   = proc_doulongvec_minmax,
-               .extra2         = &init_net.nf_frag.frags.high_thresh
        },
        {
                .procname       = "nf_conntrack_frag6_high_thresh",
-               .data           = &init_net.nf_frag.frags.high_thresh,
                .maxlen         = sizeof(unsigned long),
                .mode           = 0644,
                .proc_handler   = proc_doulongvec_minmax,
-               .extra1         = &init_net.nf_frag.frags.low_thresh
        },
        { }
 };
@@ -89,15 +84,15 @@ static int nf_ct_frag6_sysctl_register(struct net *net)
                                GFP_KERNEL);
                if (table == NULL)
                        goto err_alloc;
-
-               table[0].data = &net->nf_frag.frags.timeout;
-               table[1].data = &net->nf_frag.frags.low_thresh;
-               table[1].extra2 = &net->nf_frag.frags.high_thresh;
-               table[2].data = &net->nf_frag.frags.high_thresh;
-               table[2].extra1 = &net->nf_frag.frags.low_thresh;
-               table[2].extra2 = &init_net.nf_frag.frags.high_thresh;
        }
 
+       table[0].data   = &net->nf_frag.fqdir->timeout;
+       table[1].data   = &net->nf_frag.fqdir->low_thresh;
+       table[1].extra2 = &net->nf_frag.fqdir->high_thresh;
+       table[2].data   = &net->nf_frag.fqdir->high_thresh;
+       table[2].extra1 = &net->nf_frag.fqdir->low_thresh;
+       table[2].extra2 = &init_net.nf_frag.fqdir->high_thresh;
+
        hdr = register_net_sysctl(net, "net/netfilter", table);
        if (hdr == NULL)
                goto err_reg;
@@ -144,12 +139,10 @@ static void nf_ct_frag6_expire(struct timer_list *t)
 {
        struct inet_frag_queue *frag = from_timer(frag, t, timer);
        struct frag_queue *fq;
-       struct net *net;
 
        fq = container_of(frag, struct frag_queue, q);
-       net = container_of(fq->q.net, struct net, nf_frag.frags);
 
-       ip6frag_expire_frag_queue(net, fq);
+       ip6frag_expire_frag_queue(fq->q.fqdir->net, fq);
 }
 
 /* Creation primitives. */
@@ -165,7 +158,7 @@ static struct frag_queue *fq_find(struct net *net, __be32 id, u32 user,
        };
        struct inet_frag_queue *q;
 
-       q = inet_frag_find(&net->nf_frag.frags, &key);
+       q = inet_frag_find(net->nf_frag.fqdir, &key);
        if (!q)
                return NULL;
 
@@ -278,7 +271,7 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,
        fq->ecn |= ecn;
        if (payload_len > fq->q.max_size)
                fq->q.max_size = payload_len;
-       add_frag_mem_limit(fq->q.net, skb->truesize);
+       add_frag_mem_limit(fq->q.fqdir, skb->truesize);
 
        /* The first fragment.
         * nhoffset is obtained from the first fragment, of course.
@@ -421,7 +414,7 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
                if (skb_copy_bits(skb, start, &hdr, sizeof(hdr)))
                        BUG();
                if (nexthdr == NEXTHDR_AUTH)
-                       hdrlen = (hdr.hdrlen+2)<<2;
+                       hdrlen = ipv6_authlen(&hdr);
                else
                        hdrlen = ipv6_optlen(&hdr);
 
@@ -494,29 +487,35 @@ static int nf_ct_net_init(struct net *net)
 {
        int res;
 
-       net->nf_frag.frags.high_thresh = IPV6_FRAG_HIGH_THRESH;
-       net->nf_frag.frags.low_thresh = IPV6_FRAG_LOW_THRESH;
-       net->nf_frag.frags.timeout = IPV6_FRAG_TIMEOUT;
-       net->nf_frag.frags.f = &nf_frags;
-
-       res = inet_frags_init_net(&net->nf_frag.frags);
+       res = fqdir_init(&net->nf_frag.fqdir, &nf_frags, net);
        if (res < 0)
                return res;
+
+       net->nf_frag.fqdir->high_thresh = IPV6_FRAG_HIGH_THRESH;
+       net->nf_frag.fqdir->low_thresh = IPV6_FRAG_LOW_THRESH;
+       net->nf_frag.fqdir->timeout = IPV6_FRAG_TIMEOUT;
+
        res = nf_ct_frag6_sysctl_register(net);
        if (res < 0)
-               inet_frags_exit_net(&net->nf_frag.frags);
+               fqdir_exit(net->nf_frag.fqdir);
        return res;
 }
 
+static void nf_ct_net_pre_exit(struct net *net)
+{
+       fqdir_pre_exit(net->nf_frag.fqdir);
+}
+
 static void nf_ct_net_exit(struct net *net)
 {
        nf_ct_frags6_sysctl_unregister(net);
-       inet_frags_exit_net(&net->nf_frag.frags);
+       fqdir_exit(net->nf_frag.fqdir);
 }
 
 static struct pernet_operations nf_ct_net_ops = {
-       .init = nf_ct_net_init,
-       .exit = nf_ct_net_exit,
+       .init           = nf_ct_net_init,
+       .pre_exit       = nf_ct_net_pre_exit,
+       .exit           = nf_ct_net_exit,
 };
 
 static const struct rhashtable_params nfct_rhash_params = {