blob: db129a7a6192b5f72e0420c649f52ad2362d97da [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * IPv6 fragment reassembly
YOSHIFUJI Hideaki1ab14572007-02-09 23:24:49 +09003 * Linux INET6 implementation
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
5 * Authors:
YOSHIFUJI Hideaki1ab14572007-02-09 23:24:49 +09006 * Pedro Roque <roque@di.fc.ul.pt>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
8 * $Id: reassembly.c,v 1.26 2001/03/07 22:00:57 davem Exp $
9 *
10 * Based on: net/ipv4/ip_fragment.c
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
YOSHIFUJI Hideaki1ab14572007-02-09 23:24:49 +090018/*
19 * Fixes:
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 * Andi Kleen Make it work with multiple hosts.
21 * More RFC compliance.
22 *
23 * Horst von Brand Add missing #include <linux/string.h>
24 * Alexey Kuznetsov SMP races, threading, cleanup.
25 * Patrick McHardy LRU queue of frag heads for evictor.
26 * Mitsuru KANDA @USAGI Register inet6_protocol{}.
27 * David Stevens and
28 * YOSHIFUJI,H. @USAGI Always remove fragment header to
29 * calculate ICV correctly.
30 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <linux/errno.h>
32#include <linux/types.h>
33#include <linux/string.h>
34#include <linux/socket.h>
35#include <linux/sockios.h>
36#include <linux/jiffies.h>
37#include <linux/net.h>
38#include <linux/list.h>
39#include <linux/netdevice.h>
40#include <linux/in6.h>
41#include <linux/ipv6.h>
42#include <linux/icmpv6.h>
43#include <linux/random.h>
44#include <linux/jhash.h>
Herbert Xuf61944e2007-10-15 01:28:47 -070045#include <linux/skbuff.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
47#include <net/sock.h>
48#include <net/snmp.h>
49
50#include <net/ipv6.h>
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +090051#include <net/ip6_route.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070052#include <net/protocol.h>
53#include <net/transp_v6.h>
54#include <net/rawv6.h>
55#include <net/ndisc.h>
56#include <net/addrconf.h>
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -070057#include <net/inet_frag.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
Linus Torvalds1da177e2005-04-16 15:20:36 -070059struct ip6frag_skb_cb
60{
61 struct inet6_skb_parm h;
62 int offset;
63};
64
65#define FRAG6_CB(skb) ((struct ip6frag_skb_cb*)((skb)->cb))
66
67
68/*
69 * Equivalent of ipv4 struct ipq
70 */
71
72struct frag_queue
73{
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -070074 struct inet_frag_queue q;
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Al Viroe69a4ad2006-11-14 20:56:00 -080076 __be32 id; /* fragment id */
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 struct in6_addr saddr;
78 struct in6_addr daddr;
79
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 int iif;
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 unsigned int csum;
Linus Torvalds1da177e2005-04-16 15:20:36 -070082 __u16 nhoffset;
Linus Torvalds1da177e2005-04-16 15:20:36 -070083};
84
Pavel Emelyanov04128f22007-10-15 02:33:45 -070085struct inet_frags_ctl ip6_frags_ctl __read_mostly = {
86 .high_thresh = 256 * 1024,
87 .low_thresh = 192 * 1024,
88 .timeout = IPV6_FRAG_TIMEOUT,
89 .secret_interval = 10 * 60 * HZ,
90};
91
Pavel Emelyanov7eb95152007-10-15 02:31:52 -070092static struct inet_frags ip6_frags;
Linus Torvalds1da177e2005-04-16 15:20:36 -070093
Pavel Emelyanov7eb95152007-10-15 02:31:52 -070094int ip6_frag_nqueues(void)
95{
96 return ip6_frags.nqueues;
97}
Linus Torvalds1da177e2005-04-16 15:20:36 -070098
Pavel Emelyanov7eb95152007-10-15 02:31:52 -070099int ip6_frag_mem(void)
100{
101 return atomic_read(&ip6_frags.mem);
102}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103
Herbert Xuf61944e2007-10-15 01:28:47 -0700104static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
105 struct net_device *dev);
106
Zach Brownf6596f92006-04-10 16:05:34 -0700107/*
108 * callers should be careful not to use the hash value outside the ipfrag_lock
109 * as doing so could race with ipfrag_hash_rnd being recalculated.
110 */
Al Viroe69a4ad2006-11-14 20:56:00 -0800111static unsigned int ip6qhashfn(__be32 id, struct in6_addr *saddr,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112 struct in6_addr *daddr)
113{
114 u32 a, b, c;
115
Al Viroe69a4ad2006-11-14 20:56:00 -0800116 a = (__force u32)saddr->s6_addr32[0];
117 b = (__force u32)saddr->s6_addr32[1];
118 c = (__force u32)saddr->s6_addr32[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119
120 a += JHASH_GOLDEN_RATIO;
121 b += JHASH_GOLDEN_RATIO;
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700122 c += ip6_frags.rnd;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 __jhash_mix(a, b, c);
124
Al Viroe69a4ad2006-11-14 20:56:00 -0800125 a += (__force u32)saddr->s6_addr32[3];
126 b += (__force u32)daddr->s6_addr32[0];
127 c += (__force u32)daddr->s6_addr32[1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128 __jhash_mix(a, b, c);
129
Al Viroe69a4ad2006-11-14 20:56:00 -0800130 a += (__force u32)daddr->s6_addr32[2];
131 b += (__force u32)daddr->s6_addr32[3];
132 c += (__force u32)id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 __jhash_mix(a, b, c);
134
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700135 return c & (INETFRAGS_HASHSZ - 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136}
137
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138static void ip6_frag_secret_rebuild(unsigned long dummy)
139{
140 unsigned long now = jiffies;
141 int i;
142
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700143 write_lock(&ip6_frags.lock);
144 get_random_bytes(&ip6_frags.rnd, sizeof(u32));
145 for (i = 0; i < INETFRAGS_HASHSZ; i++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146 struct frag_queue *q;
Yasuyuki Kozakaie7c8a412005-11-16 12:55:37 -0800147 struct hlist_node *p, *n;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700149 hlist_for_each_entry_safe(q, p, n, &ip6_frags.hash[i], q.list) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 unsigned int hval = ip6qhashfn(q->id,
151 &q->saddr,
152 &q->daddr);
153
154 if (hval != i) {
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700155 hlist_del(&q->q.list);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156
157 /* Relink to new hash chain. */
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700158 hlist_add_head(&q->q.list,
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700159 &ip6_frags.hash[hval]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160
Yasuyuki Kozakaie7c8a412005-11-16 12:55:37 -0800161 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 }
163 }
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700164 write_unlock(&ip6_frags.lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165
Pavel Emelyanov04128f22007-10-15 02:33:45 -0700166 mod_timer(&ip6_frags.secret_timer, now + ip6_frags_ctl.secret_interval);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167}
168
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169/* Memory Tracking Functions. */
170static inline void frag_kfree_skb(struct sk_buff *skb, int *work)
171{
172 if (work)
173 *work -= skb->truesize;
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700174 atomic_sub(skb->truesize, &ip6_frags.mem);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 kfree_skb(skb);
176}
177
178static inline void frag_free_queue(struct frag_queue *fq, int *work)
179{
180 if (work)
181 *work -= sizeof(struct frag_queue);
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700182 atomic_sub(sizeof(struct frag_queue), &ip6_frags.mem);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 kfree(fq);
184}
185
186static inline struct frag_queue *frag_alloc_queue(void)
187{
Ingo Oeser78c784c2006-03-20 23:01:17 -0800188 struct frag_queue *fq = kzalloc(sizeof(struct frag_queue), GFP_ATOMIC);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189
190 if(!fq)
191 return NULL;
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700192 atomic_add(sizeof(struct frag_queue), &ip6_frags.mem);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193 return fq;
194}
195
196/* Destruction primitives. */
197
198/* Complete destruction of fq. */
199static void ip6_frag_destroy(struct frag_queue *fq, int *work)
200{
201 struct sk_buff *fp;
202
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700203 BUG_TRAP(fq->q.last_in&COMPLETE);
204 BUG_TRAP(del_timer(&fq->q.timer) == 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205
206 /* Release all fragment data. */
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700207 fp = fq->q.fragments;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 while (fp) {
209 struct sk_buff *xp = fp->next;
210
211 frag_kfree_skb(fp, work);
212 fp = xp;
213 }
214
215 frag_free_queue(fq, work);
216}
217
218static __inline__ void fq_put(struct frag_queue *fq, int *work)
219{
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700220 if (atomic_dec_and_test(&fq->q.refcnt))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 ip6_frag_destroy(fq, work);
222}
223
224/* Kill fq entry. It is not destroyed immediately,
225 * because caller (and someone more) holds reference count.
226 */
227static __inline__ void fq_kill(struct frag_queue *fq)
228{
Pavel Emelyanov277e6502007-10-15 02:37:18 -0700229 inet_frag_kill(&fq->q, &ip6_frags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230}
231
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900232static void ip6_evictor(struct inet6_dev *idev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233{
234 struct frag_queue *fq;
235 struct list_head *tmp;
236 int work;
237
Pavel Emelyanov04128f22007-10-15 02:33:45 -0700238 work = atomic_read(&ip6_frags.mem) - ip6_frags_ctl.low_thresh;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 if (work <= 0)
240 return;
241
242 while(work > 0) {
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700243 read_lock(&ip6_frags.lock);
244 if (list_empty(&ip6_frags.lru_list)) {
245 read_unlock(&ip6_frags.lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246 return;
247 }
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700248 tmp = ip6_frags.lru_list.next;
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700249 fq = list_entry(tmp, struct frag_queue, q.lru_list);
250 atomic_inc(&fq->q.refcnt);
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700251 read_unlock(&ip6_frags.lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700253 spin_lock(&fq->q.lock);
254 if (!(fq->q.last_in&COMPLETE))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 fq_kill(fq);
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700256 spin_unlock(&fq->q.lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257
258 fq_put(fq, &work);
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900259 IP6_INC_STATS_BH(idev, IPSTATS_MIB_REASMFAILS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260 }
261}
262
263static void ip6_frag_expire(unsigned long data)
264{
265 struct frag_queue *fq = (struct frag_queue *) data;
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900266 struct net_device *dev = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700268 spin_lock(&fq->q.lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700270 if (fq->q.last_in & COMPLETE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271 goto out;
272
273 fq_kill(fq);
274
Eric W. Biederman881d9662007-09-17 11:56:21 -0700275 dev = dev_get_by_index(&init_net, fq->iif);
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900276 if (!dev)
277 goto out;
278
279 rcu_read_lock();
280 IP6_INC_STATS_BH(__in6_dev_get(dev), IPSTATS_MIB_REASMTIMEOUT);
281 IP6_INC_STATS_BH(__in6_dev_get(dev), IPSTATS_MIB_REASMFAILS);
282 rcu_read_unlock();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283
Ingo Oeser78c784c2006-03-20 23:01:17 -0800284 /* Don't send error if the first segment did not arrive. */
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700285 if (!(fq->q.last_in&FIRST_IN) || !fq->q.fragments)
Ingo Oeser78c784c2006-03-20 23:01:17 -0800286 goto out;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287
Ingo Oeser78c784c2006-03-20 23:01:17 -0800288 /*
289 But use as source device on which LAST ARRIVED
290 segment was received. And do not use fq->dev
291 pointer directly, device might already disappeared.
292 */
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700293 fq->q.fragments->dev = dev;
294 icmpv6_send(fq->q.fragments, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0, dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295out:
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900296 if (dev)
297 dev_put(dev);
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700298 spin_unlock(&fq->q.lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 fq_put(fq, NULL);
300}
301
302/* Creation primitives. */
303
304
Zach Brownf6596f92006-04-10 16:05:34 -0700305static struct frag_queue *ip6_frag_intern(struct frag_queue *fq_in)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306{
307 struct frag_queue *fq;
Zach Brownf6596f92006-04-10 16:05:34 -0700308 unsigned int hash;
Yasuyuki Kozakaie7c8a412005-11-16 12:55:37 -0800309#ifdef CONFIG_SMP
310 struct hlist_node *n;
311#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700313 write_lock(&ip6_frags.lock);
Zach Brownf6596f92006-04-10 16:05:34 -0700314 hash = ip6qhashfn(fq_in->id, &fq_in->saddr, &fq_in->daddr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315#ifdef CONFIG_SMP
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700316 hlist_for_each_entry(fq, n, &ip6_frags.hash[hash], q.list) {
YOSHIFUJI Hideaki1ab14572007-02-09 23:24:49 +0900317 if (fq->id == fq_in->id &&
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 ipv6_addr_equal(&fq_in->saddr, &fq->saddr) &&
319 ipv6_addr_equal(&fq_in->daddr, &fq->daddr)) {
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700320 atomic_inc(&fq->q.refcnt);
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700321 write_unlock(&ip6_frags.lock);
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700322 fq_in->q.last_in |= COMPLETE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323 fq_put(fq_in, NULL);
324 return fq;
325 }
326 }
327#endif
328 fq = fq_in;
329
Pavel Emelyanov04128f22007-10-15 02:33:45 -0700330 if (!mod_timer(&fq->q.timer, jiffies + ip6_frags_ctl.timeout))
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700331 atomic_inc(&fq->q.refcnt);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700333 atomic_inc(&fq->q.refcnt);
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700334 hlist_add_head(&fq->q.list, &ip6_frags.hash[hash]);
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700335 INIT_LIST_HEAD(&fq->q.lru_list);
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700336 list_add_tail(&fq->q.lru_list, &ip6_frags.lru_list);
337 ip6_frags.nqueues++;
338 write_unlock(&ip6_frags.lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339 return fq;
340}
341
342
343static struct frag_queue *
Al Viroe69a4ad2006-11-14 20:56:00 -0800344ip6_frag_create(__be32 id, struct in6_addr *src, struct in6_addr *dst,
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900345 struct inet6_dev *idev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346{
347 struct frag_queue *fq;
348
349 if ((fq = frag_alloc_queue()) == NULL)
350 goto oom;
351
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352 fq->id = id;
353 ipv6_addr_copy(&fq->saddr, src);
354 ipv6_addr_copy(&fq->daddr, dst);
355
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700356 init_timer(&fq->q.timer);
357 fq->q.timer.function = ip6_frag_expire;
358 fq->q.timer.data = (long) fq;
359 spin_lock_init(&fq->q.lock);
360 atomic_set(&fq->q.refcnt, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361
Zach Brownf6596f92006-04-10 16:05:34 -0700362 return ip6_frag_intern(fq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363
364oom:
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900365 IP6_INC_STATS_BH(idev, IPSTATS_MIB_REASMFAILS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366 return NULL;
367}
368
369static __inline__ struct frag_queue *
Al Viroe69a4ad2006-11-14 20:56:00 -0800370fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst,
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900371 struct inet6_dev *idev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372{
373 struct frag_queue *fq;
Yasuyuki Kozakaie7c8a412005-11-16 12:55:37 -0800374 struct hlist_node *n;
Zach Brownf6596f92006-04-10 16:05:34 -0700375 unsigned int hash;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700377 read_lock(&ip6_frags.lock);
Zach Brownf6596f92006-04-10 16:05:34 -0700378 hash = ip6qhashfn(id, src, dst);
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700379 hlist_for_each_entry(fq, n, &ip6_frags.hash[hash], q.list) {
YOSHIFUJI Hideaki1ab14572007-02-09 23:24:49 +0900380 if (fq->id == id &&
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381 ipv6_addr_equal(src, &fq->saddr) &&
382 ipv6_addr_equal(dst, &fq->daddr)) {
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700383 atomic_inc(&fq->q.refcnt);
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700384 read_unlock(&ip6_frags.lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700385 return fq;
386 }
387 }
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700388 read_unlock(&ip6_frags.lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900390 return ip6_frag_create(id, src, dst, idev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391}
392
393
Herbert Xuf61944e2007-10-15 01:28:47 -0700394static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395 struct frag_hdr *fhdr, int nhoff)
396{
397 struct sk_buff *prev, *next;
Herbert Xuf61944e2007-10-15 01:28:47 -0700398 struct net_device *dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399 int offset, end;
400
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700401 if (fq->q.last_in & COMPLETE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402 goto err;
403
404 offset = ntohs(fhdr->frag_off) & ~0x7;
Arnaldo Carvalho de Melo0660e032007-04-25 17:54:47 -0700405 end = offset + (ntohs(ipv6_hdr(skb)->payload_len) -
406 ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407
408 if ((unsigned int)end > IPV6_MAXPLEN) {
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900409 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
410 IPSTATS_MIB_INHDRERRORS);
Arnaldo Carvalho de Melod56f90a2007-04-10 20:50:43 -0700411 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
412 ((u8 *)&fhdr->frag_off -
413 skb_network_header(skb)));
Herbert Xuf61944e2007-10-15 01:28:47 -0700414 return -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415 }
416
Arnaldo Carvalho de Melod56f90a2007-04-10 20:50:43 -0700417 if (skb->ip_summed == CHECKSUM_COMPLETE) {
418 const unsigned char *nh = skb_network_header(skb);
YOSHIFUJI Hideaki1ab14572007-02-09 23:24:49 +0900419 skb->csum = csum_sub(skb->csum,
Arnaldo Carvalho de Melod56f90a2007-04-10 20:50:43 -0700420 csum_partial(nh, (u8 *)(fhdr + 1) - nh,
421 0));
422 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423
424 /* Is this the final fragment? */
425 if (!(fhdr->frag_off & htons(IP6_MF))) {
426 /* If we already have some bits beyond end
427 * or have different end, the segment is corrupted.
428 */
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700429 if (end < fq->q.len ||
430 ((fq->q.last_in & LAST_IN) && end != fq->q.len))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431 goto err;
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700432 fq->q.last_in |= LAST_IN;
433 fq->q.len = end;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434 } else {
435 /* Check if the fragment is rounded to 8 bytes.
436 * Required by the RFC.
437 */
438 if (end & 0x7) {
439 /* RFC2460 says always send parameter problem in
440 * this case. -DaveM
441 */
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900442 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
443 IPSTATS_MIB_INHDRERRORS);
YOSHIFUJI Hideaki1ab14572007-02-09 23:24:49 +0900444 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445 offsetof(struct ipv6hdr, payload_len));
Herbert Xuf61944e2007-10-15 01:28:47 -0700446 return -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447 }
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700448 if (end > fq->q.len) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449 /* Some bits beyond end -> corruption. */
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700450 if (fq->q.last_in & LAST_IN)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451 goto err;
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700452 fq->q.len = end;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700453 }
454 }
455
456 if (end == offset)
457 goto err;
458
459 /* Point into the IP datagram 'data' part. */
460 if (!pskb_pull(skb, (u8 *) (fhdr + 1) - skb->data))
461 goto err;
YOSHIFUJI Hideaki1ab14572007-02-09 23:24:49 +0900462
Stephen Hemminger42ca89c2005-09-08 12:57:43 -0700463 if (pskb_trim_rcsum(skb, end - offset))
464 goto err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465
466 /* Find out which fragments are in front and at the back of us
467 * in the chain of fragments so far. We must know where to put
468 * this fragment, right?
469 */
470 prev = NULL;
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700471 for(next = fq->q.fragments; next != NULL; next = next->next) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 if (FRAG6_CB(next)->offset >= offset)
473 break; /* bingo! */
474 prev = next;
475 }
476
477 /* We found where to put this one. Check for overlap with
478 * preceding fragment, and, if needed, align things so that
479 * any overlaps are eliminated.
480 */
481 if (prev) {
482 int i = (FRAG6_CB(prev)->offset + prev->len) - offset;
483
484 if (i > 0) {
485 offset += i;
486 if (end <= offset)
487 goto err;
488 if (!pskb_pull(skb, i))
489 goto err;
490 if (skb->ip_summed != CHECKSUM_UNNECESSARY)
491 skb->ip_summed = CHECKSUM_NONE;
492 }
493 }
494
495 /* Look for overlap with succeeding segments.
496 * If we can merge fragments, do it.
497 */
498 while (next && FRAG6_CB(next)->offset < end) {
499 int i = end - FRAG6_CB(next)->offset; /* overlap is 'i' bytes */
500
501 if (i < next->len) {
502 /* Eat head of the next overlapped fragment
503 * and leave the loop. The next ones cannot overlap.
504 */
505 if (!pskb_pull(next, i))
506 goto err;
507 FRAG6_CB(next)->offset += i; /* next fragment */
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700508 fq->q.meat -= i;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509 if (next->ip_summed != CHECKSUM_UNNECESSARY)
510 next->ip_summed = CHECKSUM_NONE;
511 break;
512 } else {
513 struct sk_buff *free_it = next;
514
515 /* Old fragment is completely overridden with
516 * new one drop it.
517 */
518 next = next->next;
519
520 if (prev)
521 prev->next = next;
522 else
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700523 fq->q.fragments = next;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700525 fq->q.meat -= free_it->len;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700526 frag_kfree_skb(free_it, NULL);
527 }
528 }
529
530 FRAG6_CB(skb)->offset = offset;
531
532 /* Insert this fragment in the chain of fragments. */
533 skb->next = next;
534 if (prev)
535 prev->next = skb;
536 else
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700537 fq->q.fragments = skb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538
Herbert Xuf61944e2007-10-15 01:28:47 -0700539 dev = skb->dev;
540 if (dev) {
541 fq->iif = dev->ifindex;
542 skb->dev = NULL;
543 }
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700544 fq->q.stamp = skb->tstamp;
545 fq->q.meat += skb->len;
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700546 atomic_add(skb->truesize, &ip6_frags.mem);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700547
548 /* The first fragment.
549 * nhoffset is obtained from the first fragment, of course.
550 */
551 if (offset == 0) {
552 fq->nhoffset = nhoff;
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700553 fq->q.last_in |= FIRST_IN;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554 }
Herbert Xuf61944e2007-10-15 01:28:47 -0700555
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700556 if (fq->q.last_in == (FIRST_IN | LAST_IN) && fq->q.meat == fq->q.len)
Herbert Xuf61944e2007-10-15 01:28:47 -0700557 return ip6_frag_reasm(fq, prev, dev);
558
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700559 write_lock(&ip6_frags.lock);
560 list_move_tail(&fq->q.lru_list, &ip6_frags.lru_list);
561 write_unlock(&ip6_frags.lock);
Herbert Xuf61944e2007-10-15 01:28:47 -0700562 return -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563
564err:
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900565 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566 kfree_skb(skb);
Herbert Xuf61944e2007-10-15 01:28:47 -0700567 return -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568}
569
570/*
571 * Check if this packet is complete.
572 * Returns NULL on failure by any reason, and pointer
573 * to current nexthdr field in reassembled frame.
574 *
575 * It is called with locked fq, and caller must check that
576 * queue is eligible for reassembly i.e. it is not COMPLETE,
577 * the last and the first frames arrived and all the bits are here.
578 */
Herbert Xuf61944e2007-10-15 01:28:47 -0700579static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700580 struct net_device *dev)
581{
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700582 struct sk_buff *fp, *head = fq->q.fragments;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583 int payload_len;
584 unsigned int nhoff;
585
586 fq_kill(fq);
587
Herbert Xuf61944e2007-10-15 01:28:47 -0700588 /* Make the one we just received the head. */
589 if (prev) {
590 head = prev->next;
591 fp = skb_clone(head, GFP_ATOMIC);
592
593 if (!fp)
594 goto out_oom;
595
596 fp->next = head->next;
597 prev->next = fp;
598
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700599 skb_morph(head, fq->q.fragments);
600 head->next = fq->q.fragments->next;
Herbert Xuf61944e2007-10-15 01:28:47 -0700601
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700602 kfree_skb(fq->q.fragments);
603 fq->q.fragments = head;
Herbert Xuf61944e2007-10-15 01:28:47 -0700604 }
605
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606 BUG_TRAP(head != NULL);
607 BUG_TRAP(FRAG6_CB(head)->offset == 0);
608
609 /* Unfragmented part is taken from the first segment. */
Arnaldo Carvalho de Melod56f90a2007-04-10 20:50:43 -0700610 payload_len = ((head->data - skb_network_header(head)) -
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700611 sizeof(struct ipv6hdr) + fq->q.len -
Arnaldo Carvalho de Melod56f90a2007-04-10 20:50:43 -0700612 sizeof(struct frag_hdr));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613 if (payload_len > IPV6_MAXPLEN)
614 goto out_oversize;
615
616 /* Head of list must not be cloned. */
617 if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC))
618 goto out_oom;
619
620 /* If the first fragment is fragmented itself, we split
621 * it to two chunks: the first with data and paged part
622 * and the second, holding only fragments. */
623 if (skb_shinfo(head)->frag_list) {
624 struct sk_buff *clone;
625 int i, plen = 0;
626
627 if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL)
628 goto out_oom;
629 clone->next = head->next;
630 head->next = clone;
631 skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list;
632 skb_shinfo(head)->frag_list = NULL;
633 for (i=0; i<skb_shinfo(head)->nr_frags; i++)
634 plen += skb_shinfo(head)->frags[i].size;
635 clone->len = clone->data_len = head->data_len - plen;
636 head->data_len -= clone->len;
637 head->len -= clone->len;
638 clone->csum = 0;
639 clone->ip_summed = head->ip_summed;
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700640 atomic_add(clone->truesize, &ip6_frags.mem);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700641 }
642
643 /* We have to remove fragment header from datagram and to relocate
644 * header in order to calculate ICV correctly. */
645 nhoff = fq->nhoffset;
Arnaldo Carvalho de Melob0e380b2007-04-10 21:21:55 -0700646 skb_network_header(head)[nhoff] = skb_transport_header(head)[0];
YOSHIFUJI Hideaki1ab14572007-02-09 23:24:49 +0900647 memmove(head->head + sizeof(struct frag_hdr), head->head,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 (head->data - head->head) - sizeof(struct frag_hdr));
Arnaldo Carvalho de Melob0e380b2007-04-10 21:21:55 -0700649 head->mac_header += sizeof(struct frag_hdr);
650 head->network_header += sizeof(struct frag_hdr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651
652 skb_shinfo(head)->frag_list = head->next;
Arnaldo Carvalho de Melobadff6d2007-03-13 13:06:52 -0300653 skb_reset_transport_header(head);
Arnaldo Carvalho de Melod56f90a2007-04-10 20:50:43 -0700654 skb_push(head, head->data - skb_network_header(head));
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700655 atomic_sub(head->truesize, &ip6_frags.mem);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700656
657 for (fp=head->next; fp; fp = fp->next) {
658 head->data_len += fp->len;
659 head->len += fp->len;
660 if (head->ip_summed != fp->ip_summed)
661 head->ip_summed = CHECKSUM_NONE;
Patrick McHardy84fa7932006-08-29 16:44:56 -0700662 else if (head->ip_summed == CHECKSUM_COMPLETE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 head->csum = csum_add(head->csum, fp->csum);
664 head->truesize += fp->truesize;
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700665 atomic_sub(fp->truesize, &ip6_frags.mem);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666 }
667
668 head->next = NULL;
669 head->dev = dev;
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700670 head->tstamp = fq->q.stamp;
Arnaldo Carvalho de Melo0660e032007-04-25 17:54:47 -0700671 ipv6_hdr(head)->payload_len = htons(payload_len);
Patrick McHardy951dbc82006-01-06 23:02:34 -0800672 IP6CB(head)->nhoff = nhoff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 /* Yes, and fold redundant checksum back. 8) */
Patrick McHardy84fa7932006-08-29 16:44:56 -0700675 if (head->ip_summed == CHECKSUM_COMPLETE)
Arnaldo Carvalho de Melod56f90a2007-04-10 20:50:43 -0700676 head->csum = csum_partial(skb_network_header(head),
Arnaldo Carvalho de Melocfe1fc72007-03-16 17:26:39 -0300677 skb_network_header_len(head),
Arnaldo Carvalho de Melod56f90a2007-04-10 20:50:43 -0700678 head->csum);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900680 rcu_read_lock();
681 IP6_INC_STATS_BH(__in6_dev_get(dev), IPSTATS_MIB_REASMOKS);
682 rcu_read_unlock();
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700683 fq->q.fragments = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 return 1;
685
686out_oversize:
687 if (net_ratelimit())
688 printk(KERN_DEBUG "ip6_frag_reasm: payload len = %d\n", payload_len);
689 goto out_fail;
690out_oom:
691 if (net_ratelimit())
692 printk(KERN_DEBUG "ip6_frag_reasm: no memory for reassembly\n");
693out_fail:
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900694 rcu_read_lock();
695 IP6_INC_STATS_BH(__in6_dev_get(dev), IPSTATS_MIB_REASMFAILS);
696 rcu_read_unlock();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700697 return -1;
698}
699
Patrick McHardy951dbc82006-01-06 23:02:34 -0800700static int ipv6_frag_rcv(struct sk_buff **skbp)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700701{
YOSHIFUJI Hideaki1ab14572007-02-09 23:24:49 +0900702 struct sk_buff *skb = *skbp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700703 struct frag_hdr *fhdr;
704 struct frag_queue *fq;
Arnaldo Carvalho de Melo0660e032007-04-25 17:54:47 -0700705 struct ipv6hdr *hdr = ipv6_hdr(skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900707 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708
709 /* Jumbo payload inhibits frag. header */
710 if (hdr->payload_len==0) {
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900711 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
Arnaldo Carvalho de Melocfe1fc72007-03-16 17:26:39 -0300712 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
713 skb_network_header_len(skb));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700714 return -1;
715 }
Arnaldo Carvalho de Meloea2ae172007-04-25 17:55:53 -0700716 if (!pskb_may_pull(skb, (skb_transport_offset(skb) +
717 sizeof(struct frag_hdr)))) {
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900718 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
Arnaldo Carvalho de Melocfe1fc72007-03-16 17:26:39 -0300719 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
720 skb_network_header_len(skb));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700721 return -1;
722 }
723
Arnaldo Carvalho de Melo0660e032007-04-25 17:54:47 -0700724 hdr = ipv6_hdr(skb);
Arnaldo Carvalho de Melo9c702202007-04-25 18:04:18 -0700725 fhdr = (struct frag_hdr *)skb_transport_header(skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700726
727 if (!(fhdr->frag_off & htons(0xFFF9))) {
728 /* It is not a fragmented frame */
Arnaldo Carvalho de Melob0e380b2007-04-10 21:21:55 -0700729 skb->transport_header += sizeof(struct frag_hdr);
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900730 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMOKS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700731
Arnaldo Carvalho de Melod56f90a2007-04-10 20:50:43 -0700732 IP6CB(skb)->nhoff = (u8 *)fhdr - skb_network_header(skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700733 return 1;
734 }
735
Pavel Emelyanov04128f22007-10-15 02:33:45 -0700736 if (atomic_read(&ip6_frags.mem) > ip6_frags_ctl.high_thresh)
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900737 ip6_evictor(ip6_dst_idev(skb->dst));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700738
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900739 if ((fq = fq_find(fhdr->identification, &hdr->saddr, &hdr->daddr,
740 ip6_dst_idev(skb->dst))) != NULL) {
Herbert Xuf61944e2007-10-15 01:28:47 -0700741 int ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700742
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700743 spin_lock(&fq->q.lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700744
Herbert Xuf61944e2007-10-15 01:28:47 -0700745 ret = ip6_frag_queue(fq, skb, fhdr, IP6CB(skb)->nhoff);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700746
Pavel Emelyanov5ab11c92007-10-15 02:24:19 -0700747 spin_unlock(&fq->q.lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748 fq_put(fq, NULL);
749 return ret;
750 }
751
YOSHIFUJI Hideakia11d2062006-11-04 20:11:37 +0900752 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700753 kfree_skb(skb);
754 return -1;
755}
756
757static struct inet6_protocol frag_protocol =
758{
759 .handler = ipv6_frag_rcv,
760 .flags = INET6_PROTO_NOPOLICY,
761};
762
763void __init ipv6_frag_init(void)
764{
765 if (inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT) < 0)
766 printk(KERN_ERR "ipv6_frag_init: Could not register protocol\n");
767
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700768 init_timer(&ip6_frags.secret_timer);
769 ip6_frags.secret_timer.function = ip6_frag_secret_rebuild;
Pavel Emelyanov04128f22007-10-15 02:33:45 -0700770 ip6_frags.secret_timer.expires = jiffies + ip6_frags_ctl.secret_interval;
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700771 add_timer(&ip6_frags.secret_timer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700772
Pavel Emelyanov04128f22007-10-15 02:33:45 -0700773 ip6_frags.ctl = &ip6_frags_ctl;
Pavel Emelyanov7eb95152007-10-15 02:31:52 -0700774 inet_frags_init(&ip6_frags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700775}