reassembly.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. /*
  2. * IPv6 fragment reassembly
  3. * Linux INET6 implementation
  4. *
  5. * Authors:
  6. * Pedro Roque <roque@di.fc.ul.pt>
  7. *
  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. /*
  18. * Fixes:
  19. * Andi Kleen Make it work with multiple hosts.
  20. * More RFC compliance.
  21. *
  22. * Horst von Brand Add missing #include <linux/string.h>
  23. * Alexey Kuznetsov SMP races, threading, cleanup.
  24. * Patrick McHardy LRU queue of frag heads for evictor.
  25. * Mitsuru KANDA @USAGI Register inet6_protocol{}.
  26. * David Stevens and
  27. * YOSHIFUJI,H. @USAGI Always remove fragment header to
  28. * calculate ICV correctly.
  29. */
  30. #include <linux/errno.h>
  31. #include <linux/types.h>
  32. #include <linux/string.h>
  33. #include <linux/socket.h>
  34. #include <linux/sockios.h>
  35. #include <linux/jiffies.h>
  36. #include <linux/net.h>
  37. #include <linux/list.h>
  38. #include <linux/netdevice.h>
  39. #include <linux/in6.h>
  40. #include <linux/ipv6.h>
  41. #include <linux/icmpv6.h>
  42. #include <linux/random.h>
  43. #include <linux/jhash.h>
  44. #include <linux/skbuff.h>
  45. #include <net/sock.h>
  46. #include <net/snmp.h>
  47. #include <net/ipv6.h>
  48. #include <net/ip6_route.h>
  49. #include <net/protocol.h>
  50. #include <net/transp_v6.h>
  51. #include <net/rawv6.h>
  52. #include <net/ndisc.h>
  53. #include <net/addrconf.h>
  54. #include <net/inet_frag.h>
  55. struct ip6frag_skb_cb
  56. {
  57. struct inet6_skb_parm h;
  58. int offset;
  59. };
  60. #define FRAG6_CB(skb) ((struct ip6frag_skb_cb*)((skb)->cb))
  61. /*
  62. * Equivalent of ipv4 struct ipq
  63. */
  64. struct frag_queue
  65. {
  66. struct inet_frag_queue q;
  67. __be32 id; /* fragment id */
  68. struct in6_addr saddr;
  69. struct in6_addr daddr;
  70. int iif;
  71. unsigned int csum;
  72. __u16 nhoffset;
  73. };
  74. struct inet_frags_ctl ip6_frags_ctl __read_mostly = {
  75. .high_thresh = 256 * 1024,
  76. .low_thresh = 192 * 1024,
  77. .timeout = IPV6_FRAG_TIMEOUT,
  78. .secret_interval = 10 * 60 * HZ,
  79. };
  80. static struct inet_frags ip6_frags;
  81. int ip6_frag_nqueues(void)
  82. {
  83. return ip6_frags.nqueues;
  84. }
  85. int ip6_frag_mem(void)
  86. {
  87. return atomic_read(&ip6_frags.mem);
  88. }
  89. static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
  90. struct net_device *dev);
  91. /*
  92. * callers should be careful not to use the hash value outside the ipfrag_lock
  93. * as doing so could race with ipfrag_hash_rnd being recalculated.
  94. */
  95. static unsigned int ip6qhashfn(__be32 id, struct in6_addr *saddr,
  96. struct in6_addr *daddr)
  97. {
  98. u32 a, b, c;
  99. a = (__force u32)saddr->s6_addr32[0];
  100. b = (__force u32)saddr->s6_addr32[1];
  101. c = (__force u32)saddr->s6_addr32[2];
  102. a += JHASH_GOLDEN_RATIO;
  103. b += JHASH_GOLDEN_RATIO;
  104. c += ip6_frags.rnd;
  105. __jhash_mix(a, b, c);
  106. a += (__force u32)saddr->s6_addr32[3];
  107. b += (__force u32)daddr->s6_addr32[0];
  108. c += (__force u32)daddr->s6_addr32[1];
  109. __jhash_mix(a, b, c);
  110. a += (__force u32)daddr->s6_addr32[2];
  111. b += (__force u32)daddr->s6_addr32[3];
  112. c += (__force u32)id;
  113. __jhash_mix(a, b, c);
  114. return c & (INETFRAGS_HASHSZ - 1);
  115. }
  116. static unsigned int ip6_hashfn(struct inet_frag_queue *q)
  117. {
  118. struct frag_queue *fq;
  119. fq = container_of(q, struct frag_queue, q);
  120. return ip6qhashfn(fq->id, &fq->saddr, &fq->daddr);
  121. }
  122. int ip6_frag_match(struct inet_frag_queue *q, void *a)
  123. {
  124. struct frag_queue *fq;
  125. struct ip6_create_arg *arg = a;
  126. fq = container_of(q, struct frag_queue, q);
  127. return (fq->id == arg->id &&
  128. ipv6_addr_equal(&fq->saddr, arg->src) &&
  129. ipv6_addr_equal(&fq->daddr, arg->dst));
  130. }
  131. EXPORT_SYMBOL(ip6_frag_match);
  132. /* Memory Tracking Functions. */
  133. static inline void frag_kfree_skb(struct sk_buff *skb, int *work)
  134. {
  135. if (work)
  136. *work -= skb->truesize;
  137. atomic_sub(skb->truesize, &ip6_frags.mem);
  138. kfree_skb(skb);
  139. }
  140. void ip6_frag_init(struct inet_frag_queue *q, void *a)
  141. {
  142. struct frag_queue *fq = container_of(q, struct frag_queue, q);
  143. struct ip6_create_arg *arg = a;
  144. fq->id = arg->id;
  145. ipv6_addr_copy(&fq->saddr, arg->src);
  146. ipv6_addr_copy(&fq->daddr, arg->dst);
  147. }
  148. EXPORT_SYMBOL(ip6_frag_init);
  149. /* Destruction primitives. */
  150. static __inline__ void fq_put(struct frag_queue *fq)
  151. {
  152. inet_frag_put(&fq->q, &ip6_frags);
  153. }
  154. /* Kill fq entry. It is not destroyed immediately,
  155. * because caller (and someone more) holds reference count.
  156. */
  157. static __inline__ void fq_kill(struct frag_queue *fq)
  158. {
  159. inet_frag_kill(&fq->q, &ip6_frags);
  160. }
  161. static void ip6_evictor(struct inet6_dev *idev)
  162. {
  163. int evicted;
  164. evicted = inet_frag_evictor(&ip6_frags);
  165. if (evicted)
  166. IP6_ADD_STATS_BH(idev, IPSTATS_MIB_REASMFAILS, evicted);
  167. }
  168. static void ip6_frag_expire(unsigned long data)
  169. {
  170. struct frag_queue *fq;
  171. struct net_device *dev = NULL;
  172. fq = container_of((struct inet_frag_queue *)data, struct frag_queue, q);
  173. spin_lock(&fq->q.lock);
  174. if (fq->q.last_in & COMPLETE)
  175. goto out;
  176. fq_kill(fq);
  177. dev = dev_get_by_index(&init_net, fq->iif);
  178. if (!dev)
  179. goto out;
  180. rcu_read_lock();
  181. IP6_INC_STATS_BH(__in6_dev_get(dev), IPSTATS_MIB_REASMTIMEOUT);
  182. IP6_INC_STATS_BH(__in6_dev_get(dev), IPSTATS_MIB_REASMFAILS);
  183. rcu_read_unlock();
  184. /* Don't send error if the first segment did not arrive. */
  185. if (!(fq->q.last_in&FIRST_IN) || !fq->q.fragments)
  186. goto out;
  187. /*
  188. But use as source device on which LAST ARRIVED
  189. segment was received. And do not use fq->dev
  190. pointer directly, device might already disappeared.
  191. */
  192. fq->q.fragments->dev = dev;
  193. icmpv6_send(fq->q.fragments, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0, dev);
  194. out:
  195. if (dev)
  196. dev_put(dev);
  197. spin_unlock(&fq->q.lock);
  198. fq_put(fq);
  199. }
  200. static __inline__ struct frag_queue *
  201. fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst,
  202. struct inet6_dev *idev)
  203. {
  204. struct inet_frag_queue *q;
  205. struct ip6_create_arg arg;
  206. unsigned int hash;
  207. arg.id = id;
  208. arg.src = src;
  209. arg.dst = dst;
  210. hash = ip6qhashfn(id, src, dst);
  211. q = inet_frag_find(&ip6_frags, &arg, hash);
  212. if (q == NULL)
  213. goto oom;
  214. return container_of(q, struct frag_queue, q);
  215. oom:
  216. IP6_INC_STATS_BH(idev, IPSTATS_MIB_REASMFAILS);
  217. return NULL;
  218. }
  219. static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
  220. struct frag_hdr *fhdr, int nhoff)
  221. {
  222. struct sk_buff *prev, *next;
  223. struct net_device *dev;
  224. int offset, end;
  225. if (fq->q.last_in & COMPLETE)
  226. goto err;
  227. offset = ntohs(fhdr->frag_off) & ~0x7;
  228. end = offset + (ntohs(ipv6_hdr(skb)->payload_len) -
  229. ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1)));
  230. if ((unsigned int)end > IPV6_MAXPLEN) {
  231. IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
  232. IPSTATS_MIB_INHDRERRORS);
  233. icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
  234. ((u8 *)&fhdr->frag_off -
  235. skb_network_header(skb)));
  236. return -1;
  237. }
  238. if (skb->ip_summed == CHECKSUM_COMPLETE) {
  239. const unsigned char *nh = skb_network_header(skb);
  240. skb->csum = csum_sub(skb->csum,
  241. csum_partial(nh, (u8 *)(fhdr + 1) - nh,
  242. 0));
  243. }
  244. /* Is this the final fragment? */
  245. if (!(fhdr->frag_off & htons(IP6_MF))) {
  246. /* If we already have some bits beyond end
  247. * or have different end, the segment is corrupted.
  248. */
  249. if (end < fq->q.len ||
  250. ((fq->q.last_in & LAST_IN) && end != fq->q.len))
  251. goto err;
  252. fq->q.last_in |= LAST_IN;
  253. fq->q.len = end;
  254. } else {
  255. /* Check if the fragment is rounded to 8 bytes.
  256. * Required by the RFC.
  257. */
  258. if (end & 0x7) {
  259. /* RFC2460 says always send parameter problem in
  260. * this case. -DaveM
  261. */
  262. IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
  263. IPSTATS_MIB_INHDRERRORS);
  264. icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
  265. offsetof(struct ipv6hdr, payload_len));
  266. return -1;
  267. }
  268. if (end > fq->q.len) {
  269. /* Some bits beyond end -> corruption. */
  270. if (fq->q.last_in & LAST_IN)
  271. goto err;
  272. fq->q.len = end;
  273. }
  274. }
  275. if (end == offset)
  276. goto err;
  277. /* Point into the IP datagram 'data' part. */
  278. if (!pskb_pull(skb, (u8 *) (fhdr + 1) - skb->data))
  279. goto err;
  280. if (pskb_trim_rcsum(skb, end - offset))
  281. goto err;
  282. /* Find out which fragments are in front and at the back of us
  283. * in the chain of fragments so far. We must know where to put
  284. * this fragment, right?
  285. */
  286. prev = NULL;
  287. for(next = fq->q.fragments; next != NULL; next = next->next) {
  288. if (FRAG6_CB(next)->offset >= offset)
  289. break; /* bingo! */
  290. prev = next;
  291. }
  292. /* We found where to put this one. Check for overlap with
  293. * preceding fragment, and, if needed, align things so that
  294. * any overlaps are eliminated.
  295. */
  296. if (prev) {
  297. int i = (FRAG6_CB(prev)->offset + prev->len) - offset;
  298. if (i > 0) {
  299. offset += i;
  300. if (end <= offset)
  301. goto err;
  302. if (!pskb_pull(skb, i))
  303. goto err;
  304. if (skb->ip_summed != CHECKSUM_UNNECESSARY)
  305. skb->ip_summed = CHECKSUM_NONE;
  306. }
  307. }
  308. /* Look for overlap with succeeding segments.
  309. * If we can merge fragments, do it.
  310. */
  311. while (next && FRAG6_CB(next)->offset < end) {
  312. int i = end - FRAG6_CB(next)->offset; /* overlap is 'i' bytes */
  313. if (i < next->len) {
  314. /* Eat head of the next overlapped fragment
  315. * and leave the loop. The next ones cannot overlap.
  316. */
  317. if (!pskb_pull(next, i))
  318. goto err;
  319. FRAG6_CB(next)->offset += i; /* next fragment */
  320. fq->q.meat -= i;
  321. if (next->ip_summed != CHECKSUM_UNNECESSARY)
  322. next->ip_summed = CHECKSUM_NONE;
  323. break;
  324. } else {
  325. struct sk_buff *free_it = next;
  326. /* Old fragment is completely overridden with
  327. * new one drop it.
  328. */
  329. next = next->next;
  330. if (prev)
  331. prev->next = next;
  332. else
  333. fq->q.fragments = next;
  334. fq->q.meat -= free_it->len;
  335. frag_kfree_skb(free_it, NULL);
  336. }
  337. }
  338. FRAG6_CB(skb)->offset = offset;
  339. /* Insert this fragment in the chain of fragments. */
  340. skb->next = next;
  341. if (prev)
  342. prev->next = skb;
  343. else
  344. fq->q.fragments = skb;
  345. dev = skb->dev;
  346. if (dev) {
  347. fq->iif = dev->ifindex;
  348. skb->dev = NULL;
  349. }
  350. fq->q.stamp = skb->tstamp;
  351. fq->q.meat += skb->len;
  352. atomic_add(skb->truesize, &ip6_frags.mem);
  353. /* The first fragment.
  354. * nhoffset is obtained from the first fragment, of course.
  355. */
  356. if (offset == 0) {
  357. fq->nhoffset = nhoff;
  358. fq->q.last_in |= FIRST_IN;
  359. }
  360. if (fq->q.last_in == (FIRST_IN | LAST_IN) && fq->q.meat == fq->q.len)
  361. return ip6_frag_reasm(fq, prev, dev);
  362. write_lock(&ip6_frags.lock);
  363. list_move_tail(&fq->q.lru_list, &ip6_frags.lru_list);
  364. write_unlock(&ip6_frags.lock);
  365. return -1;
  366. err:
  367. IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS);
  368. kfree_skb(skb);
  369. return -1;
  370. }
  371. /*
  372. * Check if this packet is complete.
  373. * Returns NULL on failure by any reason, and pointer
  374. * to current nexthdr field in reassembled frame.
  375. *
  376. * It is called with locked fq, and caller must check that
  377. * queue is eligible for reassembly i.e. it is not COMPLETE,
  378. * the last and the first frames arrived and all the bits are here.
  379. */
  380. static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
  381. struct net_device *dev)
  382. {
  383. struct sk_buff *fp, *head = fq->q.fragments;
  384. int payload_len;
  385. unsigned int nhoff;
  386. fq_kill(fq);
  387. /* Make the one we just received the head. */
  388. if (prev) {
  389. head = prev->next;
  390. fp = skb_clone(head, GFP_ATOMIC);
  391. if (!fp)
  392. goto out_oom;
  393. fp->next = head->next;
  394. prev->next = fp;
  395. skb_morph(head, fq->q.fragments);
  396. head->next = fq->q.fragments->next;
  397. kfree_skb(fq->q.fragments);
  398. fq->q.fragments = head;
  399. }
  400. BUG_TRAP(head != NULL);
  401. BUG_TRAP(FRAG6_CB(head)->offset == 0);
  402. /* Unfragmented part is taken from the first segment. */
  403. payload_len = ((head->data - skb_network_header(head)) -
  404. sizeof(struct ipv6hdr) + fq->q.len -
  405. sizeof(struct frag_hdr));
  406. if (payload_len > IPV6_MAXPLEN)
  407. goto out_oversize;
  408. /* Head of list must not be cloned. */
  409. if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC))
  410. goto out_oom;
  411. /* If the first fragment is fragmented itself, we split
  412. * it to two chunks: the first with data and paged part
  413. * and the second, holding only fragments. */
  414. if (skb_shinfo(head)->frag_list) {
  415. struct sk_buff *clone;
  416. int i, plen = 0;
  417. if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL)
  418. goto out_oom;
  419. clone->next = head->next;
  420. head->next = clone;
  421. skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list;
  422. skb_shinfo(head)->frag_list = NULL;
  423. for (i=0; i<skb_shinfo(head)->nr_frags; i++)
  424. plen += skb_shinfo(head)->frags[i].size;
  425. clone->len = clone->data_len = head->data_len - plen;
  426. head->data_len -= clone->len;
  427. head->len -= clone->len;
  428. clone->csum = 0;
  429. clone->ip_summed = head->ip_summed;
  430. atomic_add(clone->truesize, &ip6_frags.mem);
  431. }
  432. /* We have to remove fragment header from datagram and to relocate
  433. * header in order to calculate ICV correctly. */
  434. nhoff = fq->nhoffset;
  435. skb_network_header(head)[nhoff] = skb_transport_header(head)[0];
  436. memmove(head->head + sizeof(struct frag_hdr), head->head,
  437. (head->data - head->head) - sizeof(struct frag_hdr));
  438. head->mac_header += sizeof(struct frag_hdr);
  439. head->network_header += sizeof(struct frag_hdr);
  440. skb_shinfo(head)->frag_list = head->next;
  441. skb_reset_transport_header(head);
  442. skb_push(head, head->data - skb_network_header(head));
  443. atomic_sub(head->truesize, &ip6_frags.mem);
  444. for (fp=head->next; fp; fp = fp->next) {
  445. head->data_len += fp->len;
  446. head->len += fp->len;
  447. if (head->ip_summed != fp->ip_summed)
  448. head->ip_summed = CHECKSUM_NONE;
  449. else if (head->ip_summed == CHECKSUM_COMPLETE)
  450. head->csum = csum_add(head->csum, fp->csum);
  451. head->truesize += fp->truesize;
  452. atomic_sub(fp->truesize, &ip6_frags.mem);
  453. }
  454. head->next = NULL;
  455. head->dev = dev;
  456. head->tstamp = fq->q.stamp;
  457. ipv6_hdr(head)->payload_len = htons(payload_len);
  458. IP6CB(head)->nhoff = nhoff;
  459. /* Yes, and fold redundant checksum back. 8) */
  460. if (head->ip_summed == CHECKSUM_COMPLETE)
  461. head->csum = csum_partial(skb_network_header(head),
  462. skb_network_header_len(head),
  463. head->csum);
  464. rcu_read_lock();
  465. IP6_INC_STATS_BH(__in6_dev_get(dev), IPSTATS_MIB_REASMOKS);
  466. rcu_read_unlock();
  467. fq->q.fragments = NULL;
  468. return 1;
  469. out_oversize:
  470. if (net_ratelimit())
  471. printk(KERN_DEBUG "ip6_frag_reasm: payload len = %d\n", payload_len);
  472. goto out_fail;
  473. out_oom:
  474. if (net_ratelimit())
  475. printk(KERN_DEBUG "ip6_frag_reasm: no memory for reassembly\n");
  476. out_fail:
  477. rcu_read_lock();
  478. IP6_INC_STATS_BH(__in6_dev_get(dev), IPSTATS_MIB_REASMFAILS);
  479. rcu_read_unlock();
  480. return -1;
  481. }
  482. static int ipv6_frag_rcv(struct sk_buff *skb)
  483. {
  484. struct frag_hdr *fhdr;
  485. struct frag_queue *fq;
  486. struct ipv6hdr *hdr = ipv6_hdr(skb);
  487. IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS);
  488. /* Jumbo payload inhibits frag. header */
  489. if (hdr->payload_len==0) {
  490. IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
  491. icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
  492. skb_network_header_len(skb));
  493. return -1;
  494. }
  495. if (!pskb_may_pull(skb, (skb_transport_offset(skb) +
  496. sizeof(struct frag_hdr)))) {
  497. IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
  498. icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
  499. skb_network_header_len(skb));
  500. return -1;
  501. }
  502. hdr = ipv6_hdr(skb);
  503. fhdr = (struct frag_hdr *)skb_transport_header(skb);
  504. if (!(fhdr->frag_off & htons(0xFFF9))) {
  505. /* It is not a fragmented frame */
  506. skb->transport_header += sizeof(struct frag_hdr);
  507. IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMOKS);
  508. IP6CB(skb)->nhoff = (u8 *)fhdr - skb_network_header(skb);
  509. return 1;
  510. }
  511. if (atomic_read(&ip6_frags.mem) > ip6_frags_ctl.high_thresh)
  512. ip6_evictor(ip6_dst_idev(skb->dst));
  513. if ((fq = fq_find(fhdr->identification, &hdr->saddr, &hdr->daddr,
  514. ip6_dst_idev(skb->dst))) != NULL) {
  515. int ret;
  516. spin_lock(&fq->q.lock);
  517. ret = ip6_frag_queue(fq, skb, fhdr, IP6CB(skb)->nhoff);
  518. spin_unlock(&fq->q.lock);
  519. fq_put(fq);
  520. return ret;
  521. }
  522. IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS);
  523. kfree_skb(skb);
  524. return -1;
  525. }
  526. static struct inet6_protocol frag_protocol =
  527. {
  528. .handler = ipv6_frag_rcv,
  529. .flags = INET6_PROTO_NOPOLICY,
  530. };
  531. void __init ipv6_frag_init(void)
  532. {
  533. if (inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT) < 0)
  534. printk(KERN_ERR "ipv6_frag_init: Could not register protocol\n");
  535. ip6_frags.ctl = &ip6_frags_ctl;
  536. ip6_frags.hashfn = ip6_hashfn;
  537. ip6_frags.constructor = ip6_frag_init;
  538. ip6_frags.destructor = NULL;
  539. ip6_frags.skb_free = NULL;
  540. ip6_frags.qsize = sizeof(struct frag_queue);
  541. ip6_frags.match = ip6_frag_match;
  542. ip6_frags.frag_expire = ip6_frag_expire;
  543. inet_frags_init(&ip6_frags);
  544. }