reassembly.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * IPv6 fragment reassembly
  4. * Linux INET6 implementation
  5. *
  6. * Authors:
  7. * Pedro Roque <roque@di.fc.ul.pt>
  8. *
  9. * Based on: net/ipv4/ip_fragment.c
  10. */
  11. /*
  12. * Fixes:
  13. * Andi Kleen Make it work with multiple hosts.
  14. * More RFC compliance.
  15. *
  16. * Horst von Brand Add missing #include <linux/string.h>
  17. * Alexey Kuznetsov SMP races, threading, cleanup.
  18. * Patrick McHardy LRU queue of frag heads for evictor.
  19. * Mitsuru KANDA @USAGI Register inet6_protocol{}.
  20. * David Stevens and
  21. * YOSHIFUJI,H. @USAGI Always remove fragment header to
  22. * calculate ICV correctly.
  23. */
  24. #define pr_fmt(fmt) "IPv6: " fmt
  25. #include <linux/errno.h>
  26. #include <linux/types.h>
  27. #include <linux/string.h>
  28. #include <linux/socket.h>
  29. #include <linux/sockios.h>
  30. #include <linux/jiffies.h>
  31. #include <linux/net.h>
  32. #include <linux/list.h>
  33. #include <linux/netdevice.h>
  34. #include <linux/in6.h>
  35. #include <linux/ipv6.h>
  36. #include <linux/icmpv6.h>
  37. #include <linux/random.h>
  38. #include <linux/jhash.h>
  39. #include <linux/skbuff.h>
  40. #include <linux/slab.h>
  41. #include <linux/export.h>
  42. #include <linux/tcp.h>
  43. #include <linux/udp.h>
  44. #include <net/sock.h>
  45. #include <net/snmp.h>
  46. #include <net/ipv6.h>
  47. #include <net/ip6_route.h>
  48. #include <net/protocol.h>
  49. #include <net/transp_v6.h>
  50. #include <net/rawv6.h>
  51. #include <net/ndisc.h>
  52. #include <net/addrconf.h>
  53. #include <net/ipv6_frag.h>
  54. #include <net/inet_ecn.h>
  55. static const char ip6_frag_cache_name[] = "ip6-frags";
  56. static u8 ip6_frag_ecn(const struct ipv6hdr *ipv6h)
  57. {
  58. return 1 << (ipv6_get_dsfield(ipv6h) & INET_ECN_MASK);
  59. }
  60. static struct inet_frags ip6_frags;
  61. static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *skb,
  62. struct sk_buff *prev_tail, struct net_device *dev,
  63. int *refs);
  64. static void ip6_frag_expire(struct timer_list *t)
  65. {
  66. struct inet_frag_queue *frag = timer_container_of(frag, t, timer);
  67. struct frag_queue *fq;
  68. fq = container_of(frag, struct frag_queue, q);
  69. ip6frag_expire_frag_queue(fq->q.fqdir->net, fq);
  70. }
  71. static struct frag_queue *
  72. fq_find(struct net *net, __be32 id, const struct ipv6hdr *hdr, int iif)
  73. {
  74. struct frag_v6_compare_key key = {
  75. .id = id,
  76. .saddr = hdr->saddr,
  77. .daddr = hdr->daddr,
  78. .user = IP6_DEFRAG_LOCAL_DELIVER,
  79. .iif = iif,
  80. };
  81. struct inet_frag_queue *q;
  82. if (!(ipv6_addr_type(&hdr->daddr) & (IPV6_ADDR_MULTICAST |
  83. IPV6_ADDR_LINKLOCAL)))
  84. key.iif = 0;
  85. q = inet_frag_find(net->ipv6.fqdir, &key);
  86. if (!q)
  87. return NULL;
  88. return container_of(q, struct frag_queue, q);
  89. }
  90. static int ip6_frag_queue(struct net *net,
  91. struct frag_queue *fq, struct sk_buff *skb,
  92. struct frag_hdr *fhdr, int nhoff,
  93. u32 *prob_offset, int *refs)
  94. {
  95. int offset, end, fragsize;
  96. struct sk_buff *prev_tail;
  97. struct net_device *dev;
  98. int err = -ENOENT;
  99. SKB_DR(reason);
  100. u8 ecn;
  101. /* If reassembly is already done, @skb must be a duplicate frag. */
  102. if (fq->q.flags & INET_FRAG_COMPLETE) {
  103. SKB_DR_SET(reason, DUP_FRAG);
  104. goto err;
  105. }
  106. err = -EINVAL;
  107. offset = ntohs(fhdr->frag_off) & ~0x7;
  108. end = offset + (ntohs(ipv6_hdr(skb)->payload_len) -
  109. ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1)));
  110. if ((unsigned int)end > IPV6_MAXPLEN) {
  111. *prob_offset = (u8 *)&fhdr->frag_off - skb_network_header(skb);
  112. /* note that if prob_offset is set, the skb is freed elsewhere,
  113. * we do not free it here.
  114. */
  115. return -1;
  116. }
  117. ecn = ip6_frag_ecn(ipv6_hdr(skb));
  118. if (skb->ip_summed == CHECKSUM_COMPLETE) {
  119. const unsigned char *nh = skb_network_header(skb);
  120. skb->csum = csum_sub(skb->csum,
  121. csum_partial(nh, (u8 *)(fhdr + 1) - nh,
  122. 0));
  123. }
  124. /* Is this the final fragment? */
  125. if (!(fhdr->frag_off & htons(IP6_MF))) {
  126. /* If we already have some bits beyond end
  127. * or have different end, the segment is corrupted.
  128. */
  129. if (end < fq->q.len ||
  130. ((fq->q.flags & INET_FRAG_LAST_IN) && end != fq->q.len))
  131. goto discard_fq;
  132. fq->q.flags |= INET_FRAG_LAST_IN;
  133. fq->q.len = end;
  134. } else {
  135. /* Check if the fragment is rounded to 8 bytes.
  136. * Required by the RFC.
  137. */
  138. if (end & 0x7) {
  139. /* RFC2460 says always send parameter problem in
  140. * this case. -DaveM
  141. */
  142. *prob_offset = offsetof(struct ipv6hdr, payload_len);
  143. return -1;
  144. }
  145. if (end > fq->q.len) {
  146. /* Some bits beyond end -> corruption. */
  147. if (fq->q.flags & INET_FRAG_LAST_IN)
  148. goto discard_fq;
  149. fq->q.len = end;
  150. }
  151. }
  152. if (end == offset)
  153. goto discard_fq;
  154. err = -ENOMEM;
  155. /* Point into the IP datagram 'data' part. */
  156. if (!pskb_pull(skb, (u8 *) (fhdr + 1) - skb->data))
  157. goto discard_fq;
  158. err = pskb_trim_rcsum(skb, end - offset);
  159. if (err)
  160. goto discard_fq;
  161. /* Note : skb->rbnode and skb->dev share the same location. */
  162. dev = skb->dev;
  163. /* Makes sure compiler wont do silly aliasing games */
  164. barrier();
  165. prev_tail = fq->q.fragments_tail;
  166. err = inet_frag_queue_insert(&fq->q, skb, offset, end);
  167. if (err)
  168. goto insert_error;
  169. if (dev)
  170. fq->iif = dev->ifindex;
  171. fq->q.stamp = skb->tstamp;
  172. fq->q.tstamp_type = skb->tstamp_type;
  173. fq->q.meat += skb->len;
  174. fq->ecn |= ecn;
  175. add_frag_mem_limit(fq->q.fqdir, skb->truesize);
  176. fragsize = -skb_network_offset(skb) + skb->len;
  177. if (fragsize > fq->q.max_size)
  178. fq->q.max_size = fragsize;
  179. /* The first fragment.
  180. * nhoffset is obtained from the first fragment, of course.
  181. */
  182. if (offset == 0) {
  183. fq->nhoffset = nhoff;
  184. fq->q.flags |= INET_FRAG_FIRST_IN;
  185. }
  186. if (fq->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&
  187. fq->q.meat == fq->q.len) {
  188. unsigned long orefdst = skb->_skb_refdst;
  189. skb->_skb_refdst = 0UL;
  190. err = ip6_frag_reasm(fq, skb, prev_tail, dev, refs);
  191. skb->_skb_refdst = orefdst;
  192. return err;
  193. }
  194. skb_dst_drop(skb);
  195. return -EINPROGRESS;
  196. insert_error:
  197. if (err == IPFRAG_DUP) {
  198. SKB_DR_SET(reason, DUP_FRAG);
  199. err = -EINVAL;
  200. goto err;
  201. }
  202. err = -EINVAL;
  203. __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
  204. IPSTATS_MIB_REASM_OVERLAPS);
  205. discard_fq:
  206. inet_frag_kill(&fq->q, refs);
  207. __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
  208. IPSTATS_MIB_REASMFAILS);
  209. err:
  210. kfree_skb_reason(skb, reason);
  211. return err;
  212. }
  213. /*
  214. * Check if this packet is complete.
  215. *
  216. * It is called with locked fq, and caller must check that
  217. * queue is eligible for reassembly i.e. it is not COMPLETE,
  218. * the last and the first frames arrived and all the bits are here.
  219. */
  220. static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *skb,
  221. struct sk_buff *prev_tail, struct net_device *dev,
  222. int *refs)
  223. {
  224. struct net *net = fq->q.fqdir->net;
  225. unsigned int nhoff;
  226. void *reasm_data;
  227. int payload_len;
  228. u8 ecn;
  229. inet_frag_kill(&fq->q, refs);
  230. ecn = ip_frag_ecn_table[fq->ecn];
  231. if (unlikely(ecn == 0xff))
  232. goto out_fail;
  233. reasm_data = inet_frag_reasm_prepare(&fq->q, skb, prev_tail);
  234. if (!reasm_data)
  235. goto out_oom;
  236. payload_len = -skb_network_offset(skb) -
  237. sizeof(struct ipv6hdr) + fq->q.len -
  238. sizeof(struct frag_hdr);
  239. if (payload_len > IPV6_MAXPLEN)
  240. goto out_oversize;
  241. /* We have to remove fragment header from datagram and to relocate
  242. * header in order to calculate ICV correctly. */
  243. nhoff = fq->nhoffset;
  244. skb_network_header(skb)[nhoff] = skb_transport_header(skb)[0];
  245. memmove(skb->head + sizeof(struct frag_hdr), skb->head,
  246. (skb->data - skb->head) - sizeof(struct frag_hdr));
  247. if (skb_mac_header_was_set(skb))
  248. skb->mac_header += sizeof(struct frag_hdr);
  249. skb->network_header += sizeof(struct frag_hdr);
  250. skb_reset_transport_header(skb);
  251. inet_frag_reasm_finish(&fq->q, skb, reasm_data, true);
  252. skb->dev = dev;
  253. ipv6_hdr(skb)->payload_len = htons(payload_len);
  254. ipv6_change_dsfield(ipv6_hdr(skb), 0xff, ecn);
  255. IP6CB(skb)->nhoff = nhoff;
  256. IP6CB(skb)->flags |= IP6SKB_FRAGMENTED;
  257. IP6CB(skb)->frag_max_size = fq->q.max_size;
  258. /* Yes, and fold redundant checksum back. 8) */
  259. skb_postpush_rcsum(skb, skb_network_header(skb),
  260. skb_network_header_len(skb));
  261. __IP6_INC_STATS(net, __in6_dev_stats_get(dev, skb), IPSTATS_MIB_REASMOKS);
  262. fq->q.rb_fragments = RB_ROOT;
  263. fq->q.fragments_tail = NULL;
  264. fq->q.last_run_head = NULL;
  265. return 1;
  266. out_oversize:
  267. net_dbg_ratelimited("ip6_frag_reasm: payload len = %d\n", payload_len);
  268. goto out_fail;
  269. out_oom:
  270. net_dbg_ratelimited("ip6_frag_reasm: no memory for reassembly\n");
  271. out_fail:
  272. __IP6_INC_STATS(net, __in6_dev_stats_get(dev, skb), IPSTATS_MIB_REASMFAILS);
  273. inet_frag_kill(&fq->q, refs);
  274. return -1;
  275. }
  276. static int ipv6_frag_rcv(struct sk_buff *skb)
  277. {
  278. const struct ipv6hdr *hdr = ipv6_hdr(skb);
  279. struct net *net = skb_dst_dev_net(skb);
  280. struct frag_hdr *fhdr;
  281. struct frag_queue *fq;
  282. u8 nexthdr;
  283. int iif;
  284. if (IP6CB(skb)->flags & IP6SKB_FRAGMENTED)
  285. goto fail_hdr;
  286. __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMREQDS);
  287. /* Jumbo payload inhibits frag. header */
  288. if (hdr->payload_len == 0)
  289. goto fail_hdr;
  290. if (!pskb_may_pull(skb, (skb_transport_offset(skb) +
  291. sizeof(struct frag_hdr))))
  292. goto fail_hdr;
  293. hdr = ipv6_hdr(skb);
  294. fhdr = (struct frag_hdr *)skb_transport_header(skb);
  295. if (!(fhdr->frag_off & htons(IP6_OFFSET | IP6_MF))) {
  296. /* It is not a fragmented frame */
  297. skb->transport_header += sizeof(struct frag_hdr);
  298. __IP6_INC_STATS(net,
  299. ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMOKS);
  300. IP6CB(skb)->nhoff = (u8 *)fhdr - skb_network_header(skb);
  301. IP6CB(skb)->flags |= IP6SKB_FRAGMENTED;
  302. IP6CB(skb)->frag_max_size = ntohs(hdr->payload_len) +
  303. sizeof(struct ipv6hdr);
  304. return 1;
  305. }
  306. /* RFC 8200, Section 4.5 Fragment Header:
  307. * If the first fragment does not include all headers through an
  308. * Upper-Layer header, then that fragment should be discarded and
  309. * an ICMP Parameter Problem, Code 3, message should be sent to
  310. * the source of the fragment, with the Pointer field set to zero.
  311. */
  312. nexthdr = hdr->nexthdr;
  313. if (ipv6frag_thdr_truncated(skb, skb_network_offset(skb) + sizeof(struct ipv6hdr), &nexthdr)) {
  314. __IP6_INC_STATS(net, __in6_dev_get_safely(skb->dev),
  315. IPSTATS_MIB_INHDRERRORS);
  316. icmpv6_param_prob(skb, ICMPV6_HDR_INCOMP, 0);
  317. return -1;
  318. }
  319. iif = skb->dev ? skb->dev->ifindex : 0;
  320. rcu_read_lock();
  321. fq = fq_find(net, fhdr->identification, hdr, iif);
  322. if (fq) {
  323. u32 prob_offset = 0;
  324. int ret, refs = 0;
  325. spin_lock(&fq->q.lock);
  326. fq->iif = iif;
  327. ret = ip6_frag_queue(net, fq, skb, fhdr, IP6CB(skb)->nhoff,
  328. &prob_offset, &refs);
  329. spin_unlock(&fq->q.lock);
  330. rcu_read_unlock();
  331. inet_frag_putn(&fq->q, refs);
  332. if (prob_offset) {
  333. __IP6_INC_STATS(net, __in6_dev_get_safely(skb->dev),
  334. IPSTATS_MIB_INHDRERRORS);
  335. /* icmpv6_param_prob() calls kfree_skb(skb) */
  336. icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, prob_offset);
  337. }
  338. return ret;
  339. }
  340. rcu_read_unlock();
  341. __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_REASMFAILS);
  342. kfree_skb(skb);
  343. return -1;
  344. fail_hdr:
  345. __IP6_INC_STATS(net, __in6_dev_get_safely(skb->dev),
  346. IPSTATS_MIB_INHDRERRORS);
  347. icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb_network_header_len(skb));
  348. return -1;
  349. }
  350. static const struct inet6_protocol frag_protocol = {
  351. .handler = ipv6_frag_rcv,
  352. .flags = INET6_PROTO_NOPOLICY,
  353. };
  354. #ifdef CONFIG_SYSCTL
  355. static struct ctl_table ip6_frags_ns_ctl_table[] = {
  356. {
  357. .procname = "ip6frag_high_thresh",
  358. .maxlen = sizeof(unsigned long),
  359. .mode = 0644,
  360. .proc_handler = proc_doulongvec_minmax,
  361. },
  362. {
  363. .procname = "ip6frag_low_thresh",
  364. .maxlen = sizeof(unsigned long),
  365. .mode = 0644,
  366. .proc_handler = proc_doulongvec_minmax,
  367. },
  368. {
  369. .procname = "ip6frag_time",
  370. .maxlen = sizeof(int),
  371. .mode = 0644,
  372. .proc_handler = proc_dointvec_jiffies,
  373. },
  374. };
  375. /* secret interval has been deprecated */
  376. static int ip6_frags_secret_interval_unused;
  377. static struct ctl_table ip6_frags_ctl_table[] = {
  378. {
  379. .procname = "ip6frag_secret_interval",
  380. .data = &ip6_frags_secret_interval_unused,
  381. .maxlen = sizeof(int),
  382. .mode = 0644,
  383. .proc_handler = proc_dointvec_jiffies,
  384. },
  385. };
  386. static int __net_init ip6_frags_ns_sysctl_register(struct net *net)
  387. {
  388. struct ctl_table *table;
  389. struct ctl_table_header *hdr;
  390. table = ip6_frags_ns_ctl_table;
  391. if (!net_eq(net, &init_net)) {
  392. table = kmemdup(table, sizeof(ip6_frags_ns_ctl_table), GFP_KERNEL);
  393. if (!table)
  394. goto err_alloc;
  395. }
  396. table[0].data = &net->ipv6.fqdir->high_thresh;
  397. table[0].extra1 = &net->ipv6.fqdir->low_thresh;
  398. table[1].data = &net->ipv6.fqdir->low_thresh;
  399. table[1].extra2 = &net->ipv6.fqdir->high_thresh;
  400. table[2].data = &net->ipv6.fqdir->timeout;
  401. hdr = register_net_sysctl_sz(net, "net/ipv6", table,
  402. ARRAY_SIZE(ip6_frags_ns_ctl_table));
  403. if (!hdr)
  404. goto err_reg;
  405. net->ipv6.sysctl.frags_hdr = hdr;
  406. return 0;
  407. err_reg:
  408. if (!net_eq(net, &init_net))
  409. kfree(table);
  410. err_alloc:
  411. return -ENOMEM;
  412. }
  413. static void __net_exit ip6_frags_ns_sysctl_unregister(struct net *net)
  414. {
  415. const struct ctl_table *table;
  416. table = net->ipv6.sysctl.frags_hdr->ctl_table_arg;
  417. unregister_net_sysctl_table(net->ipv6.sysctl.frags_hdr);
  418. if (!net_eq(net, &init_net))
  419. kfree(table);
  420. }
  421. static struct ctl_table_header *ip6_ctl_header;
  422. static int ip6_frags_sysctl_register(void)
  423. {
  424. ip6_ctl_header = register_net_sysctl(&init_net, "net/ipv6",
  425. ip6_frags_ctl_table);
  426. return ip6_ctl_header == NULL ? -ENOMEM : 0;
  427. }
  428. static void ip6_frags_sysctl_unregister(void)
  429. {
  430. unregister_net_sysctl_table(ip6_ctl_header);
  431. }
  432. #else
  433. static int ip6_frags_ns_sysctl_register(struct net *net)
  434. {
  435. return 0;
  436. }
  437. static void ip6_frags_ns_sysctl_unregister(struct net *net)
  438. {
  439. }
  440. static int ip6_frags_sysctl_register(void)
  441. {
  442. return 0;
  443. }
  444. static void ip6_frags_sysctl_unregister(void)
  445. {
  446. }
  447. #endif
  448. static int __net_init ipv6_frags_init_net(struct net *net)
  449. {
  450. int res;
  451. res = fqdir_init(&net->ipv6.fqdir, &ip6_frags, net);
  452. if (res < 0)
  453. return res;
  454. net->ipv6.fqdir->high_thresh = IPV6_FRAG_HIGH_THRESH;
  455. net->ipv6.fqdir->low_thresh = IPV6_FRAG_LOW_THRESH;
  456. net->ipv6.fqdir->timeout = IPV6_FRAG_TIMEOUT;
  457. res = ip6_frags_ns_sysctl_register(net);
  458. if (res < 0)
  459. fqdir_exit(net->ipv6.fqdir);
  460. return res;
  461. }
  462. static void __net_exit ipv6_frags_pre_exit_net(struct net *net)
  463. {
  464. fqdir_pre_exit(net->ipv6.fqdir);
  465. }
  466. static void __net_exit ipv6_frags_exit_net(struct net *net)
  467. {
  468. ip6_frags_ns_sysctl_unregister(net);
  469. fqdir_exit(net->ipv6.fqdir);
  470. }
  471. static struct pernet_operations ip6_frags_ops = {
  472. .init = ipv6_frags_init_net,
  473. .pre_exit = ipv6_frags_pre_exit_net,
  474. .exit = ipv6_frags_exit_net,
  475. };
  476. static const struct rhashtable_params ip6_rhash_params = {
  477. .head_offset = offsetof(struct inet_frag_queue, node),
  478. .hashfn = ip6frag_key_hashfn,
  479. .obj_hashfn = ip6frag_obj_hashfn,
  480. .obj_cmpfn = ip6frag_obj_cmpfn,
  481. .automatic_shrinking = true,
  482. };
  483. int __init ipv6_frag_init(void)
  484. {
  485. int ret;
  486. ip6_frags.constructor = ip6frag_init;
  487. ip6_frags.destructor = NULL;
  488. ip6_frags.qsize = sizeof(struct frag_queue);
  489. ip6_frags.frag_expire = ip6_frag_expire;
  490. ip6_frags.frags_cache_name = ip6_frag_cache_name;
  491. ip6_frags.rhash_params = ip6_rhash_params;
  492. ret = inet_frags_init(&ip6_frags);
  493. if (ret)
  494. goto out;
  495. ret = inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT);
  496. if (ret)
  497. goto err_protocol;
  498. ret = ip6_frags_sysctl_register();
  499. if (ret)
  500. goto err_sysctl;
  501. ret = register_pernet_subsys(&ip6_frags_ops);
  502. if (ret)
  503. goto err_pernet;
  504. out:
  505. return ret;
  506. err_pernet:
  507. ip6_frags_sysctl_unregister();
  508. err_sysctl:
  509. inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT);
  510. err_protocol:
  511. inet_frags_fini(&ip6_frags);
  512. goto out;
  513. }
  514. void ipv6_frag_exit(void)
  515. {
  516. ip6_frags_sysctl_unregister();
  517. unregister_pernet_subsys(&ip6_frags_ops);
  518. inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT);
  519. inet_frags_fini(&ip6_frags);
  520. }