Merge branches 'release', 'acpi_pm_device_sleep_state' and 'battery' into release
[pandora-kernel.git] / net / ipv6 / netfilter / nf_conntrack_reasm.c
1 /*
2  * IPv6 fragment reassembly for connection tracking
3  *
4  * Copyright (C)2004 USAGI/WIDE Project
5  *
6  * Author:
7  *      Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
8  *
9  * Based on: net/ipv6/reassembly.c
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version
14  * 2 of the License, or (at your option) any later version.
15  */
16
17 #include <linux/errno.h>
18 #include <linux/types.h>
19 #include <linux/string.h>
20 #include <linux/socket.h>
21 #include <linux/sockios.h>
22 #include <linux/jiffies.h>
23 #include <linux/net.h>
24 #include <linux/list.h>
25 #include <linux/netdevice.h>
26 #include <linux/in6.h>
27 #include <linux/ipv6.h>
28 #include <linux/icmpv6.h>
29 #include <linux/random.h>
30 #include <linux/jhash.h>
31
32 #include <net/sock.h>
33 #include <net/snmp.h>
34 #include <net/inet_frag.h>
35
36 #include <net/ipv6.h>
37 #include <net/protocol.h>
38 #include <net/transp_v6.h>
39 #include <net/rawv6.h>
40 #include <net/ndisc.h>
41 #include <net/addrconf.h>
42 #include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
43 #include <linux/sysctl.h>
44 #include <linux/netfilter.h>
45 #include <linux/netfilter_ipv6.h>
46 #include <linux/kernel.h>
47 #include <linux/module.h>
48
49 #define NF_CT_FRAG6_HIGH_THRESH 262144 /* == 256*1024 */
50 #define NF_CT_FRAG6_LOW_THRESH 196608  /* == 192*1024 */
51 #define NF_CT_FRAG6_TIMEOUT IPV6_FRAG_TIMEOUT
52
53 struct nf_ct_frag6_skb_cb
54 {
55         struct inet6_skb_parm   h;
56         int                     offset;
57         struct sk_buff          *orig;
58 };
59
60 #define NFCT_FRAG6_CB(skb)      ((struct nf_ct_frag6_skb_cb*)((skb)->cb))
61
62 struct nf_ct_frag6_queue
63 {
64         struct inet_frag_queue  q;
65
66         __be32                  id;             /* fragment id          */
67         struct in6_addr         saddr;
68         struct in6_addr         daddr;
69
70         unsigned int            csum;
71         __u16                   nhoffset;
72 };
73
74 static struct inet_frags nf_frags;
75 static struct netns_frags nf_init_frags;
76
77 #ifdef CONFIG_SYSCTL
78 struct ctl_table nf_ct_ipv6_sysctl_table[] = {
79         {
80                 .procname       = "nf_conntrack_frag6_timeout",
81                 .data           = &nf_init_frags.timeout,
82                 .maxlen         = sizeof(unsigned int),
83                 .mode           = 0644,
84                 .proc_handler   = &proc_dointvec_jiffies,
85         },
86         {
87                 .ctl_name       = NET_NF_CONNTRACK_FRAG6_LOW_THRESH,
88                 .procname       = "nf_conntrack_frag6_low_thresh",
89                 .data           = &nf_init_frags.low_thresh,
90                 .maxlen         = sizeof(unsigned int),
91                 .mode           = 0644,
92                 .proc_handler   = &proc_dointvec,
93         },
94         {
95                 .ctl_name       = NET_NF_CONNTRACK_FRAG6_HIGH_THRESH,
96                 .procname       = "nf_conntrack_frag6_high_thresh",
97                 .data           = &nf_init_frags.high_thresh,
98                 .maxlen         = sizeof(unsigned int),
99                 .mode           = 0644,
100                 .proc_handler   = &proc_dointvec,
101         },
102         { .ctl_name = 0 }
103 };
104 #endif
105
106 static unsigned int ip6qhashfn(__be32 id, struct in6_addr *saddr,
107                                struct in6_addr *daddr)
108 {
109         u32 a, b, c;
110
111         a = (__force u32)saddr->s6_addr32[0];
112         b = (__force u32)saddr->s6_addr32[1];
113         c = (__force u32)saddr->s6_addr32[2];
114
115         a += JHASH_GOLDEN_RATIO;
116         b += JHASH_GOLDEN_RATIO;
117         c += nf_frags.rnd;
118         __jhash_mix(a, b, c);
119
120         a += (__force u32)saddr->s6_addr32[3];
121         b += (__force u32)daddr->s6_addr32[0];
122         c += (__force u32)daddr->s6_addr32[1];
123         __jhash_mix(a, b, c);
124
125         a += (__force u32)daddr->s6_addr32[2];
126         b += (__force u32)daddr->s6_addr32[3];
127         c += (__force u32)id;
128         __jhash_mix(a, b, c);
129
130         return c & (INETFRAGS_HASHSZ - 1);
131 }
132
133 static unsigned int nf_hashfn(struct inet_frag_queue *q)
134 {
135         struct nf_ct_frag6_queue *nq;
136
137         nq = container_of(q, struct nf_ct_frag6_queue, q);
138         return ip6qhashfn(nq->id, &nq->saddr, &nq->daddr);
139 }
140
141 static void nf_skb_free(struct sk_buff *skb)
142 {
143         if (NFCT_FRAG6_CB(skb)->orig)
144                 kfree_skb(NFCT_FRAG6_CB(skb)->orig);
145 }
146
147 /* Memory Tracking Functions. */
148 static inline void frag_kfree_skb(struct sk_buff *skb, unsigned int *work)
149 {
150         if (work)
151                 *work -= skb->truesize;
152         atomic_sub(skb->truesize, &nf_init_frags.mem);
153         nf_skb_free(skb);
154         kfree_skb(skb);
155 }
156
157 /* Destruction primitives. */
158
159 static __inline__ void fq_put(struct nf_ct_frag6_queue *fq)
160 {
161         inet_frag_put(&fq->q, &nf_frags);
162 }
163
164 /* Kill fq entry. It is not destroyed immediately,
165  * because caller (and someone more) holds reference count.
166  */
167 static __inline__ void fq_kill(struct nf_ct_frag6_queue *fq)
168 {
169         inet_frag_kill(&fq->q, &nf_frags);
170 }
171
172 static void nf_ct_frag6_evictor(void)
173 {
174         inet_frag_evictor(&nf_init_frags, &nf_frags);
175 }
176
177 static void nf_ct_frag6_expire(unsigned long data)
178 {
179         struct nf_ct_frag6_queue *fq;
180
181         fq = container_of((struct inet_frag_queue *)data,
182                         struct nf_ct_frag6_queue, q);
183
184         spin_lock(&fq->q.lock);
185
186         if (fq->q.last_in & COMPLETE)
187                 goto out;
188
189         fq_kill(fq);
190
191 out:
192         spin_unlock(&fq->q.lock);
193         fq_put(fq);
194 }
195
196 /* Creation primitives. */
197
198 static __inline__ struct nf_ct_frag6_queue *
199 fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst)
200 {
201         struct inet_frag_queue *q;
202         struct ip6_create_arg arg;
203         unsigned int hash;
204
205         arg.id = id;
206         arg.src = src;
207         arg.dst = dst;
208         hash = ip6qhashfn(id, src, dst);
209
210         q = inet_frag_find(&nf_init_frags, &nf_frags, &arg, hash);
211         if (q == NULL)
212                 goto oom;
213
214         return container_of(q, struct nf_ct_frag6_queue, q);
215
216 oom:
217         pr_debug("Can't alloc new queue\n");
218         return NULL;
219 }
220
221
222 static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb,
223                              struct frag_hdr *fhdr, int nhoff)
224 {
225         struct sk_buff *prev, *next;
226         int offset, end;
227
228         if (fq->q.last_in & COMPLETE) {
229                 pr_debug("Allready completed\n");
230                 goto err;
231         }
232
233         offset = ntohs(fhdr->frag_off) & ~0x7;
234         end = offset + (ntohs(ipv6_hdr(skb)->payload_len) -
235                         ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1)));
236
237         if ((unsigned int)end > IPV6_MAXPLEN) {
238                 pr_debug("offset is too large.\n");
239                 return -1;
240         }
241
242         if (skb->ip_summed == CHECKSUM_COMPLETE) {
243                 const unsigned char *nh = skb_network_header(skb);
244                 skb->csum = csum_sub(skb->csum,
245                                      csum_partial(nh, (u8 *)(fhdr + 1) - nh,
246                                                   0));
247         }
248
249         /* Is this the final fragment? */
250         if (!(fhdr->frag_off & htons(IP6_MF))) {
251                 /* If we already have some bits beyond end
252                  * or have different end, the segment is corrupted.
253                  */
254                 if (end < fq->q.len ||
255                     ((fq->q.last_in & LAST_IN) && end != fq->q.len)) {
256                         pr_debug("already received last fragment\n");
257                         goto err;
258                 }
259                 fq->q.last_in |= LAST_IN;
260                 fq->q.len = end;
261         } else {
262                 /* Check if the fragment is rounded to 8 bytes.
263                  * Required by the RFC.
264                  */
265                 if (end & 0x7) {
266                         /* RFC2460 says always send parameter problem in
267                          * this case. -DaveM
268                          */
269                         pr_debug("end of fragment not rounded to 8 bytes.\n");
270                         return -1;
271                 }
272                 if (end > fq->q.len) {
273                         /* Some bits beyond end -> corruption. */
274                         if (fq->q.last_in & LAST_IN) {
275                                 pr_debug("last packet already reached.\n");
276                                 goto err;
277                         }
278                         fq->q.len = end;
279                 }
280         }
281
282         if (end == offset)
283                 goto err;
284
285         /* Point into the IP datagram 'data' part. */
286         if (!pskb_pull(skb, (u8 *) (fhdr + 1) - skb->data)) {
287                 pr_debug("queue: message is too short.\n");
288                 goto err;
289         }
290         if (pskb_trim_rcsum(skb, end - offset)) {
291                 pr_debug("Can't trim\n");
292                 goto err;
293         }
294
295         /* Find out which fragments are in front and at the back of us
296          * in the chain of fragments so far.  We must know where to put
297          * this fragment, right?
298          */
299         prev = NULL;
300         for (next = fq->q.fragments; next != NULL; next = next->next) {
301                 if (NFCT_FRAG6_CB(next)->offset >= offset)
302                         break;  /* bingo! */
303                 prev = next;
304         }
305
306         /* We found where to put this one.  Check for overlap with
307          * preceding fragment, and, if needed, align things so that
308          * any overlaps are eliminated.
309          */
310         if (prev) {
311                 int i = (NFCT_FRAG6_CB(prev)->offset + prev->len) - offset;
312
313                 if (i > 0) {
314                         offset += i;
315                         if (end <= offset) {
316                                 pr_debug("overlap\n");
317                                 goto err;
318                         }
319                         if (!pskb_pull(skb, i)) {
320                                 pr_debug("Can't pull\n");
321                                 goto err;
322                         }
323                         if (skb->ip_summed != CHECKSUM_UNNECESSARY)
324                                 skb->ip_summed = CHECKSUM_NONE;
325                 }
326         }
327
328         /* Look for overlap with succeeding segments.
329          * If we can merge fragments, do it.
330          */
331         while (next && NFCT_FRAG6_CB(next)->offset < end) {
332                 /* overlap is 'i' bytes */
333                 int i = end - NFCT_FRAG6_CB(next)->offset;
334
335                 if (i < next->len) {
336                         /* Eat head of the next overlapped fragment
337                          * and leave the loop. The next ones cannot overlap.
338                          */
339                         pr_debug("Eat head of the overlapped parts.: %d", i);
340                         if (!pskb_pull(next, i))
341                                 goto err;
342
343                         /* next fragment */
344                         NFCT_FRAG6_CB(next)->offset += i;
345                         fq->q.meat -= i;
346                         if (next->ip_summed != CHECKSUM_UNNECESSARY)
347                                 next->ip_summed = CHECKSUM_NONE;
348                         break;
349                 } else {
350                         struct sk_buff *free_it = next;
351
352                         /* Old fragmnet is completely overridden with
353                          * new one drop it.
354                          */
355                         next = next->next;
356
357                         if (prev)
358                                 prev->next = next;
359                         else
360                                 fq->q.fragments = next;
361
362                         fq->q.meat -= free_it->len;
363                         frag_kfree_skb(free_it, NULL);
364                 }
365         }
366
367         NFCT_FRAG6_CB(skb)->offset = offset;
368
369         /* Insert this fragment in the chain of fragments. */
370         skb->next = next;
371         if (prev)
372                 prev->next = skb;
373         else
374                 fq->q.fragments = skb;
375
376         skb->dev = NULL;
377         fq->q.stamp = skb->tstamp;
378         fq->q.meat += skb->len;
379         atomic_add(skb->truesize, &nf_init_frags.mem);
380
381         /* The first fragment.
382          * nhoffset is obtained from the first fragment, of course.
383          */
384         if (offset == 0) {
385                 fq->nhoffset = nhoff;
386                 fq->q.last_in |= FIRST_IN;
387         }
388         write_lock(&nf_frags.lock);
389         list_move_tail(&fq->q.lru_list, &nf_init_frags.lru_list);
390         write_unlock(&nf_frags.lock);
391         return 0;
392
393 err:
394         return -1;
395 }
396
397 /*
398  *      Check if this packet is complete.
399  *      Returns NULL on failure by any reason, and pointer
400  *      to current nexthdr field in reassembled frame.
401  *
402  *      It is called with locked fq, and caller must check that
403  *      queue is eligible for reassembly i.e. it is not COMPLETE,
404  *      the last and the first frames arrived and all the bits are here.
405  */
406 static struct sk_buff *
407 nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
408 {
409         struct sk_buff *fp, *op, *head = fq->q.fragments;
410         int    payload_len;
411
412         fq_kill(fq);
413
414         BUG_TRAP(head != NULL);
415         BUG_TRAP(NFCT_FRAG6_CB(head)->offset == 0);
416
417         /* Unfragmented part is taken from the first segment. */
418         payload_len = ((head->data - skb_network_header(head)) -
419                        sizeof(struct ipv6hdr) + fq->q.len -
420                        sizeof(struct frag_hdr));
421         if (payload_len > IPV6_MAXPLEN) {
422                 pr_debug("payload len is too large.\n");
423                 goto out_oversize;
424         }
425
426         /* Head of list must not be cloned. */
427         if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC)) {
428                 pr_debug("skb is cloned but can't expand head");
429                 goto out_oom;
430         }
431
432         /* If the first fragment is fragmented itself, we split
433          * it to two chunks: the first with data and paged part
434          * and the second, holding only fragments. */
435         if (skb_shinfo(head)->frag_list) {
436                 struct sk_buff *clone;
437                 int i, plen = 0;
438
439                 if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL) {
440                         pr_debug("Can't alloc skb\n");
441                         goto out_oom;
442                 }
443                 clone->next = head->next;
444                 head->next = clone;
445                 skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list;
446                 skb_shinfo(head)->frag_list = NULL;
447                 for (i=0; i<skb_shinfo(head)->nr_frags; i++)
448                         plen += skb_shinfo(head)->frags[i].size;
449                 clone->len = clone->data_len = head->data_len - plen;
450                 head->data_len -= clone->len;
451                 head->len -= clone->len;
452                 clone->csum = 0;
453                 clone->ip_summed = head->ip_summed;
454
455                 NFCT_FRAG6_CB(clone)->orig = NULL;
456                 atomic_add(clone->truesize, &nf_init_frags.mem);
457         }
458
459         /* We have to remove fragment header from datagram and to relocate
460          * header in order to calculate ICV correctly. */
461         skb_network_header(head)[fq->nhoffset] = skb_transport_header(head)[0];
462         memmove(head->head + sizeof(struct frag_hdr), head->head,
463                 (head->data - head->head) - sizeof(struct frag_hdr));
464         head->mac_header += sizeof(struct frag_hdr);
465         head->network_header += sizeof(struct frag_hdr);
466
467         skb_shinfo(head)->frag_list = head->next;
468         skb_reset_transport_header(head);
469         skb_push(head, head->data - skb_network_header(head));
470         atomic_sub(head->truesize, &nf_init_frags.mem);
471
472         for (fp=head->next; fp; fp = fp->next) {
473                 head->data_len += fp->len;
474                 head->len += fp->len;
475                 if (head->ip_summed != fp->ip_summed)
476                         head->ip_summed = CHECKSUM_NONE;
477                 else if (head->ip_summed == CHECKSUM_COMPLETE)
478                         head->csum = csum_add(head->csum, fp->csum);
479                 head->truesize += fp->truesize;
480                 atomic_sub(fp->truesize, &nf_init_frags.mem);
481         }
482
483         head->next = NULL;
484         head->dev = dev;
485         head->tstamp = fq->q.stamp;
486         ipv6_hdr(head)->payload_len = htons(payload_len);
487
488         /* Yes, and fold redundant checksum back. 8) */
489         if (head->ip_summed == CHECKSUM_COMPLETE)
490                 head->csum = csum_partial(skb_network_header(head),
491                                           skb_network_header_len(head),
492                                           head->csum);
493
494         fq->q.fragments = NULL;
495
496         /* all original skbs are linked into the NFCT_FRAG6_CB(head).orig */
497         fp = skb_shinfo(head)->frag_list;
498         if (NFCT_FRAG6_CB(fp)->orig == NULL)
499                 /* at above code, head skb is divided into two skbs. */
500                 fp = fp->next;
501
502         op = NFCT_FRAG6_CB(head)->orig;
503         for (; fp; fp = fp->next) {
504                 struct sk_buff *orig = NFCT_FRAG6_CB(fp)->orig;
505
506                 op->next = orig;
507                 op = orig;
508                 NFCT_FRAG6_CB(fp)->orig = NULL;
509         }
510
511         return head;
512
513 out_oversize:
514         if (net_ratelimit())
515                 printk(KERN_DEBUG "nf_ct_frag6_reasm: payload len = %d\n", payload_len);
516         goto out_fail;
517 out_oom:
518         if (net_ratelimit())
519                 printk(KERN_DEBUG "nf_ct_frag6_reasm: no memory for reassembly\n");
520 out_fail:
521         return NULL;
522 }
523
524 /*
525  * find the header just before Fragment Header.
526  *
527  * if success return 0 and set ...
528  * (*prevhdrp): the value of "Next Header Field" in the header
529  *              just before Fragment Header.
530  * (*prevhoff): the offset of "Next Header Field" in the header
531  *              just before Fragment Header.
532  * (*fhoff)   : the offset of Fragment Header.
533  *
534  * Based on ipv6_skip_hdr() in net/ipv6/exthdr.c
535  *
536  */
537 static int
538 find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
539 {
540         u8 nexthdr = ipv6_hdr(skb)->nexthdr;
541         const int netoff = skb_network_offset(skb);
542         u8 prev_nhoff = netoff + offsetof(struct ipv6hdr, nexthdr);
543         int start = netoff + sizeof(struct ipv6hdr);
544         int len = skb->len - start;
545         u8 prevhdr = NEXTHDR_IPV6;
546
547         while (nexthdr != NEXTHDR_FRAGMENT) {
548                 struct ipv6_opt_hdr hdr;
549                 int hdrlen;
550
551                 if (!ipv6_ext_hdr(nexthdr)) {
552                         return -1;
553                 }
554                 if (len < (int)sizeof(struct ipv6_opt_hdr)) {
555                         pr_debug("too short\n");
556                         return -1;
557                 }
558                 if (nexthdr == NEXTHDR_NONE) {
559                         pr_debug("next header is none\n");
560                         return -1;
561                 }
562                 if (skb_copy_bits(skb, start, &hdr, sizeof(hdr)))
563                         BUG();
564                 if (nexthdr == NEXTHDR_AUTH)
565                         hdrlen = (hdr.hdrlen+2)<<2;
566                 else
567                         hdrlen = ipv6_optlen(&hdr);
568
569                 prevhdr = nexthdr;
570                 prev_nhoff = start;
571
572                 nexthdr = hdr.nexthdr;
573                 len -= hdrlen;
574                 start += hdrlen;
575         }
576
577         if (len < 0)
578                 return -1;
579
580         *prevhdrp = prevhdr;
581         *prevhoff = prev_nhoff;
582         *fhoff = start;
583
584         return 0;
585 }
586
587 struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
588 {
589         struct sk_buff *clone;
590         struct net_device *dev = skb->dev;
591         struct frag_hdr *fhdr;
592         struct nf_ct_frag6_queue *fq;
593         struct ipv6hdr *hdr;
594         int fhoff, nhoff;
595         u8 prevhdr;
596         struct sk_buff *ret_skb = NULL;
597
598         /* Jumbo payload inhibits frag. header */
599         if (ipv6_hdr(skb)->payload_len == 0) {
600                 pr_debug("payload len = 0\n");
601                 return skb;
602         }
603
604         if (find_prev_fhdr(skb, &prevhdr, &nhoff, &fhoff) < 0)
605                 return skb;
606
607         clone = skb_clone(skb, GFP_ATOMIC);
608         if (clone == NULL) {
609                 pr_debug("Can't clone skb\n");
610                 return skb;
611         }
612
613         NFCT_FRAG6_CB(clone)->orig = skb;
614
615         if (!pskb_may_pull(clone, fhoff + sizeof(*fhdr))) {
616                 pr_debug("message is too short.\n");
617                 goto ret_orig;
618         }
619
620         skb_set_transport_header(clone, fhoff);
621         hdr = ipv6_hdr(clone);
622         fhdr = (struct frag_hdr *)skb_transport_header(clone);
623
624         if (!(fhdr->frag_off & htons(0xFFF9))) {
625                 pr_debug("Invalid fragment offset\n");
626                 /* It is not a fragmented frame */
627                 goto ret_orig;
628         }
629
630         if (atomic_read(&nf_init_frags.mem) > nf_init_frags.high_thresh)
631                 nf_ct_frag6_evictor();
632
633         fq = fq_find(fhdr->identification, &hdr->saddr, &hdr->daddr);
634         if (fq == NULL) {
635                 pr_debug("Can't find and can't create new queue\n");
636                 goto ret_orig;
637         }
638
639         spin_lock(&fq->q.lock);
640
641         if (nf_ct_frag6_queue(fq, clone, fhdr, nhoff) < 0) {
642                 spin_unlock(&fq->q.lock);
643                 pr_debug("Can't insert skb to queue\n");
644                 fq_put(fq);
645                 goto ret_orig;
646         }
647
648         if (fq->q.last_in == (FIRST_IN|LAST_IN) && fq->q.meat == fq->q.len) {
649                 ret_skb = nf_ct_frag6_reasm(fq, dev);
650                 if (ret_skb == NULL)
651                         pr_debug("Can't reassemble fragmented packets\n");
652         }
653         spin_unlock(&fq->q.lock);
654
655         fq_put(fq);
656         return ret_skb;
657
658 ret_orig:
659         kfree_skb(clone);
660         return skb;
661 }
662
663 void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
664                         struct net_device *in, struct net_device *out,
665                         int (*okfn)(struct sk_buff *))
666 {
667         struct sk_buff *s, *s2;
668
669         for (s = NFCT_FRAG6_CB(skb)->orig; s;) {
670                 nf_conntrack_put_reasm(s->nfct_reasm);
671                 nf_conntrack_get_reasm(skb);
672                 s->nfct_reasm = skb;
673
674                 s2 = s->next;
675                 s->next = NULL;
676
677                 NF_HOOK_THRESH(PF_INET6, hooknum, s, in, out, okfn,
678                                NF_IP6_PRI_CONNTRACK_DEFRAG + 1);
679                 s = s2;
680         }
681         nf_conntrack_put_reasm(skb);
682 }
683
684 int nf_ct_frag6_init(void)
685 {
686         nf_frags.hashfn = nf_hashfn;
687         nf_frags.constructor = ip6_frag_init;
688         nf_frags.destructor = NULL;
689         nf_frags.skb_free = nf_skb_free;
690         nf_frags.qsize = sizeof(struct nf_ct_frag6_queue);
691         nf_frags.match = ip6_frag_match;
692         nf_frags.frag_expire = nf_ct_frag6_expire;
693         nf_frags.secret_interval = 10 * 60 * HZ;
694         nf_init_frags.timeout = IPV6_FRAG_TIMEOUT;
695         nf_init_frags.high_thresh = 256 * 1024;
696         nf_init_frags.low_thresh = 192 * 1024;
697         inet_frags_init_net(&nf_init_frags);
698         inet_frags_init(&nf_frags);
699
700         return 0;
701 }
702
703 void nf_ct_frag6_cleanup(void)
704 {
705         inet_frags_fini(&nf_frags);
706
707         nf_init_frags.low_thresh = 0;
708         nf_ct_frag6_evictor();
709 }