blob: 2a71c3b669f17993b562cd1875a7b4f04e082b38 [file] [log] [blame]
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -08001/*
2 * Copyright (C)2004 USAGI/WIDE Project
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Author:
9 * Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
10 *
11 * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
12 * - support Layer 3 protocol independent connection tracking.
13 * Based on the original ip_conntrack code which had the following
14 * copyright information:
15 * (C) 1999-2001 Paul `Rusty' Russell
16 * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
17 *
18 * 23 Mar 2004: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
19 * - add get_features() to support various size of conntrack
20 * structures.
21 */
22
23#include <linux/config.h>
24#include <linux/types.h>
25#include <linux/ipv6.h>
26#include <linux/in6.h>
27#include <linux/netfilter.h>
28#include <linux/module.h>
29#include <linux/skbuff.h>
30#include <linux/icmp.h>
31#include <linux/sysctl.h>
32#include <net/ipv6.h>
33
34#include <linux/netfilter_ipv6.h>
35#include <net/netfilter/nf_conntrack.h>
36#include <net/netfilter/nf_conntrack_helper.h>
37#include <net/netfilter/nf_conntrack_protocol.h>
38#include <net/netfilter/nf_conntrack_l3proto.h>
39#include <net/netfilter/nf_conntrack_core.h>
40
41#if 0
42#define DEBUGP printk
43#else
44#define DEBUGP(format, args...)
45#endif
46
47DECLARE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat);
48
49static int ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff,
50 struct nf_conntrack_tuple *tuple)
51{
52 u_int32_t _addrs[8], *ap;
53
54 ap = skb_header_pointer(skb, nhoff + offsetof(struct ipv6hdr, saddr),
55 sizeof(_addrs), _addrs);
56 if (ap == NULL)
57 return 0;
58
59 memcpy(tuple->src.u3.ip6, ap, sizeof(tuple->src.u3.ip6));
60 memcpy(tuple->dst.u3.ip6, ap + 4, sizeof(tuple->dst.u3.ip6));
61
62 return 1;
63}
64
65static int ipv6_invert_tuple(struct nf_conntrack_tuple *tuple,
66 const struct nf_conntrack_tuple *orig)
67{
68 memcpy(tuple->src.u3.ip6, orig->dst.u3.ip6, sizeof(tuple->src.u3.ip6));
69 memcpy(tuple->dst.u3.ip6, orig->src.u3.ip6, sizeof(tuple->dst.u3.ip6));
70
71 return 1;
72}
73
74static int ipv6_print_tuple(struct seq_file *s,
75 const struct nf_conntrack_tuple *tuple)
76{
Joe Perches46b86a22006-01-13 14:29:07 -080077 return seq_printf(s, "src=" NIP6_FMT " dst=" NIP6_FMT " ",
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -080078 NIP6(*((struct in6_addr *)tuple->src.u3.ip6)),
79 NIP6(*((struct in6_addr *)tuple->dst.u3.ip6)));
80}
81
82static int ipv6_print_conntrack(struct seq_file *s,
83 const struct nf_conn *conntrack)
84{
85 return 0;
86}
87
88/*
89 * Based on ipv6_skip_exthdr() in net/ipv6/exthdr.c
90 *
91 * This function parses (probably truncated) exthdr set "hdr"
92 * of length "len". "nexthdrp" initially points to some place,
93 * where type of the first header can be found.
94 *
95 * It skips all well-known exthdrs, and returns pointer to the start
96 * of unparsable area i.e. the first header with unknown type.
97 * if success, *nexthdr is updated by type/protocol of this header.
98 *
99 * NOTES: - it may return pointer pointing beyond end of packet,
100 * if the last recognized header is truncated in the middle.
101 * - if packet is truncated, so that all parsed headers are skipped,
102 * it returns -1.
103 * - if packet is fragmented, return pointer of the fragment header.
104 * - ESP is unparsable for now and considered like
105 * normal payload protocol.
106 * - Note also special handling of AUTH header. Thanks to IPsec wizards.
107 */
108
109int nf_ct_ipv6_skip_exthdr(struct sk_buff *skb, int start, u8 *nexthdrp,
110 int len)
111{
112 u8 nexthdr = *nexthdrp;
113
114 while (ipv6_ext_hdr(nexthdr)) {
115 struct ipv6_opt_hdr hdr;
116 int hdrlen;
117
118 if (len < (int)sizeof(struct ipv6_opt_hdr))
119 return -1;
120 if (nexthdr == NEXTHDR_NONE)
121 break;
122 if (nexthdr == NEXTHDR_FRAGMENT)
123 break;
124 if (skb_copy_bits(skb, start, &hdr, sizeof(hdr)))
125 BUG();
126 if (nexthdr == NEXTHDR_AUTH)
127 hdrlen = (hdr.hdrlen+2)<<2;
128 else
129 hdrlen = ipv6_optlen(&hdr);
130
131 nexthdr = hdr.nexthdr;
132 len -= hdrlen;
133 start += hdrlen;
134 }
135
136 *nexthdrp = nexthdr;
137 return start;
138}
139
140static int
141ipv6_prepare(struct sk_buff **pskb, unsigned int hooknum, unsigned int *dataoff,
142 u_int8_t *protonum)
143{
144 unsigned int extoff;
145 unsigned char pnum;
146 int protoff;
147
148 extoff = (u8*)((*pskb)->nh.ipv6h + 1) - (*pskb)->data;
149 pnum = (*pskb)->nh.ipv6h->nexthdr;
150
151 protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
152 (*pskb)->len - extoff);
153
154 /*
155 * (protoff == (*pskb)->len) mean that the packet doesn't have no data
156 * except of IPv6 & ext headers. but it's tracked anyway. - YK
157 */
158 if ((protoff < 0) || (protoff > (*pskb)->len)) {
159 DEBUGP("ip6_conntrack_core: can't find proto in pkt\n");
160 NF_CT_STAT_INC(error);
161 NF_CT_STAT_INC(invalid);
162 return -NF_ACCEPT;
163 }
164
165 *dataoff = protoff;
166 *protonum = pnum;
167 return NF_ACCEPT;
168}
169
170static u_int32_t ipv6_get_features(const struct nf_conntrack_tuple *tuple)
171{
172 return NF_CT_F_BASIC;
173}
174
175static unsigned int ipv6_confirm(unsigned int hooknum,
176 struct sk_buff **pskb,
177 const struct net_device *in,
178 const struct net_device *out,
179 int (*okfn)(struct sk_buff *))
180{
181 struct nf_conn *ct;
Harald Weltedc808fe2006-03-20 17:56:32 -0800182 struct nf_conn_help *help;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800183 enum ip_conntrack_info ctinfo;
Harald Weltedc808fe2006-03-20 17:56:32 -0800184 unsigned int ret, protoff;
185 unsigned int extoff = (u8*)((*pskb)->nh.ipv6h + 1)
186 - (*pskb)->data;
187 unsigned char pnum = (*pskb)->nh.ipv6h->nexthdr;
188
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800189
190 /* This is where we call the helper: as the packet goes out. */
191 ct = nf_ct_get(*pskb, &ctinfo);
Patrick McHardy6442f1c2006-05-29 18:21:53 -0700192 if (!ct || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)
Harald Weltedc808fe2006-03-20 17:56:32 -0800193 goto out;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800194
Harald Weltedc808fe2006-03-20 17:56:32 -0800195 help = nfct_help(ct);
196 if (!help || !help->helper)
197 goto out;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800198
Harald Weltedc808fe2006-03-20 17:56:32 -0800199 protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
200 (*pskb)->len - extoff);
201 if (protoff < 0 || protoff > (*pskb)->len ||
202 pnum == NEXTHDR_FRAGMENT) {
203 DEBUGP("proto header not found\n");
204 return NF_ACCEPT;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800205 }
206
Harald Weltedc808fe2006-03-20 17:56:32 -0800207 ret = help->helper->help(pskb, protoff, ct, ctinfo);
208 if (ret != NF_ACCEPT)
209 return ret;
210out:
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800211 /* We've seen it coming out the other side: confirm it */
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800212 return nf_conntrack_confirm(pskb);
213}
214
215extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb);
216extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
217 struct net_device *in,
218 struct net_device *out,
219 int (*okfn)(struct sk_buff *));
220static unsigned int ipv6_defrag(unsigned int hooknum,
221 struct sk_buff **pskb,
222 const struct net_device *in,
223 const struct net_device *out,
224 int (*okfn)(struct sk_buff *))
225{
226 struct sk_buff *reasm;
227
228 /* Previously seen (loopback)? */
229 if ((*pskb)->nfct)
230 return NF_ACCEPT;
231
232 reasm = nf_ct_frag6_gather(*pskb);
233
234 /* queued */
235 if (reasm == NULL)
236 return NF_STOLEN;
237
238 /* error occured or not fragmented */
239 if (reasm == *pskb)
240 return NF_ACCEPT;
241
242 nf_ct_frag6_output(hooknum, reasm, (struct net_device *)in,
243 (struct net_device *)out, okfn);
244
245 return NF_STOLEN;
246}
247
248static unsigned int ipv6_conntrack_in(unsigned int hooknum,
249 struct sk_buff **pskb,
250 const struct net_device *in,
251 const struct net_device *out,
252 int (*okfn)(struct sk_buff *))
253{
254 struct sk_buff *reasm = (*pskb)->nfct_reasm;
255
256 /* This packet is fragmented and has reassembled packet. */
257 if (reasm) {
258 /* Reassembled packet isn't parsed yet ? */
259 if (!reasm->nfct) {
260 unsigned int ret;
261
262 ret = nf_conntrack_in(PF_INET6, hooknum, &reasm);
263 if (ret != NF_ACCEPT)
264 return ret;
265 }
266 nf_conntrack_get(reasm->nfct);
267 (*pskb)->nfct = reasm->nfct;
268 return NF_ACCEPT;
269 }
270
271 return nf_conntrack_in(PF_INET6, hooknum, pskb);
272}
273
274static unsigned int ipv6_conntrack_local(unsigned int hooknum,
275 struct sk_buff **pskb,
276 const struct net_device *in,
277 const struct net_device *out,
278 int (*okfn)(struct sk_buff *))
279{
280 /* root is playing with raw sockets. */
281 if ((*pskb)->len < sizeof(struct ipv6hdr)) {
282 if (net_ratelimit())
283 printk("ipv6_conntrack_local: packet too short\n");
284 return NF_ACCEPT;
285 }
286 return ipv6_conntrack_in(hooknum, pskb, in, out, okfn);
287}
288
Patrick McHardy964ddaa2006-04-06 14:09:49 -0700289static struct nf_hook_ops ipv6_conntrack_ops[] = {
290 {
291 .hook = ipv6_defrag,
292 .owner = THIS_MODULE,
293 .pf = PF_INET6,
294 .hooknum = NF_IP6_PRE_ROUTING,
295 .priority = NF_IP6_PRI_CONNTRACK_DEFRAG,
296 },
297 {
298 .hook = ipv6_conntrack_in,
299 .owner = THIS_MODULE,
300 .pf = PF_INET6,
301 .hooknum = NF_IP6_PRE_ROUTING,
302 .priority = NF_IP6_PRI_CONNTRACK,
303 },
304 {
305 .hook = ipv6_conntrack_local,
306 .owner = THIS_MODULE,
307 .pf = PF_INET6,
308 .hooknum = NF_IP6_LOCAL_OUT,
309 .priority = NF_IP6_PRI_CONNTRACK,
310 },
311 {
312 .hook = ipv6_defrag,
313 .owner = THIS_MODULE,
314 .pf = PF_INET6,
315 .hooknum = NF_IP6_LOCAL_OUT,
316 .priority = NF_IP6_PRI_CONNTRACK_DEFRAG,
317 },
318 {
319 .hook = ipv6_confirm,
320 .owner = THIS_MODULE,
321 .pf = PF_INET6,
322 .hooknum = NF_IP6_POST_ROUTING,
323 .priority = NF_IP6_PRI_LAST,
324 },
325 {
326 .hook = ipv6_confirm,
327 .owner = THIS_MODULE,
328 .pf = PF_INET6,
329 .hooknum = NF_IP6_LOCAL_IN,
330 .priority = NF_IP6_PRI_LAST-1,
331 },
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800332};
333
334#ifdef CONFIG_SYSCTL
335
336/* From nf_conntrack_proto_icmpv6.c */
Patrick McHardybabbdb12006-01-09 17:48:09 -0800337extern unsigned int nf_ct_icmpv6_timeout;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800338
339/* From nf_conntrack_frag6.c */
Patrick McHardybabbdb12006-01-09 17:48:09 -0800340extern unsigned int nf_ct_frag6_timeout;
Yasuyuki Kozakai7686a022005-11-14 15:27:43 -0800341extern unsigned int nf_ct_frag6_low_thresh;
342extern unsigned int nf_ct_frag6_high_thresh;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800343
344static struct ctl_table_header *nf_ct_ipv6_sysctl_header;
345
346static ctl_table nf_ct_sysctl_table[] = {
347 {
348 .ctl_name = NET_NF_CONNTRACK_ICMPV6_TIMEOUT,
349 .procname = "nf_conntrack_icmpv6_timeout",
350 .data = &nf_ct_icmpv6_timeout,
351 .maxlen = sizeof(unsigned int),
352 .mode = 0644,
353 .proc_handler = &proc_dointvec_jiffies,
354 },
355 {
356 .ctl_name = NET_NF_CONNTRACK_FRAG6_TIMEOUT,
357 .procname = "nf_conntrack_frag6_timeout",
358 .data = &nf_ct_frag6_timeout,
359 .maxlen = sizeof(unsigned int),
360 .mode = 0644,
361 .proc_handler = &proc_dointvec_jiffies,
362 },
363 {
364 .ctl_name = NET_NF_CONNTRACK_FRAG6_LOW_THRESH,
365 .procname = "nf_conntrack_frag6_low_thresh",
366 .data = &nf_ct_frag6_low_thresh,
367 .maxlen = sizeof(unsigned int),
368 .mode = 0644,
Yasuyuki Kozakai7686a022005-11-14 15:27:43 -0800369 .proc_handler = &proc_dointvec,
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800370 },
371 {
372 .ctl_name = NET_NF_CONNTRACK_FRAG6_HIGH_THRESH,
373 .procname = "nf_conntrack_frag6_high_thresh",
374 .data = &nf_ct_frag6_high_thresh,
375 .maxlen = sizeof(unsigned int),
376 .mode = 0644,
Yasuyuki Kozakai7686a022005-11-14 15:27:43 -0800377 .proc_handler = &proc_dointvec,
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800378 },
379 { .ctl_name = 0 }
380};
381
382static ctl_table nf_ct_netfilter_table[] = {
383 {
384 .ctl_name = NET_NETFILTER,
385 .procname = "netfilter",
386 .mode = 0555,
387 .child = nf_ct_sysctl_table,
388 },
389 { .ctl_name = 0 }
390};
391
392static ctl_table nf_ct_net_table[] = {
393 {
394 .ctl_name = CTL_NET,
395 .procname = "net",
396 .mode = 0555,
397 .child = nf_ct_netfilter_table,
398 },
399 { .ctl_name = 0 }
400};
401#endif
402
Pablo Neira Ayusoc1d10ad2006-01-05 12:19:05 -0800403#if defined(CONFIG_NF_CT_NETLINK) || \
404 defined(CONFIG_NF_CT_NETLINK_MODULE)
405
406#include <linux/netfilter/nfnetlink.h>
407#include <linux/netfilter/nfnetlink_conntrack.h>
408
409static int ipv6_tuple_to_nfattr(struct sk_buff *skb,
410 const struct nf_conntrack_tuple *tuple)
411{
412 NFA_PUT(skb, CTA_IP_V6_SRC, sizeof(u_int32_t) * 4,
413 &tuple->src.u3.ip6);
414 NFA_PUT(skb, CTA_IP_V6_DST, sizeof(u_int32_t) * 4,
415 &tuple->dst.u3.ip6);
416 return 0;
417
418nfattr_failure:
419 return -1;
420}
421
422static const size_t cta_min_ip[CTA_IP_MAX] = {
423 [CTA_IP_V6_SRC-1] = sizeof(u_int32_t)*4,
424 [CTA_IP_V6_DST-1] = sizeof(u_int32_t)*4,
425};
426
427static int ipv6_nfattr_to_tuple(struct nfattr *tb[],
428 struct nf_conntrack_tuple *t)
429{
430 if (!tb[CTA_IP_V6_SRC-1] || !tb[CTA_IP_V6_DST-1])
431 return -EINVAL;
432
433 if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
434 return -EINVAL;
435
436 memcpy(&t->src.u3.ip6, NFA_DATA(tb[CTA_IP_V6_SRC-1]),
437 sizeof(u_int32_t) * 4);
438 memcpy(&t->dst.u3.ip6, NFA_DATA(tb[CTA_IP_V6_DST-1]),
439 sizeof(u_int32_t) * 4);
440
441 return 0;
442}
443#endif
444
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800445struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6 = {
446 .l3proto = PF_INET6,
447 .name = "ipv6",
448 .pkt_to_tuple = ipv6_pkt_to_tuple,
449 .invert_tuple = ipv6_invert_tuple,
450 .print_tuple = ipv6_print_tuple,
451 .print_conntrack = ipv6_print_conntrack,
452 .prepare = ipv6_prepare,
Pablo Neira Ayusoc1d10ad2006-01-05 12:19:05 -0800453#if defined(CONFIG_NF_CT_NETLINK) || \
454 defined(CONFIG_NF_CT_NETLINK_MODULE)
455 .tuple_to_nfattr = ipv6_tuple_to_nfattr,
456 .nfattr_to_tuple = ipv6_nfattr_to_tuple,
457#endif
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800458 .get_features = ipv6_get_features,
459 .me = THIS_MODULE,
460};
461
462extern struct nf_conntrack_protocol nf_conntrack_protocol_tcp6;
463extern struct nf_conntrack_protocol nf_conntrack_protocol_udp6;
464extern struct nf_conntrack_protocol nf_conntrack_protocol_icmpv6;
465extern int nf_ct_frag6_init(void);
466extern void nf_ct_frag6_cleanup(void);
Patrick McHardy32292a72006-04-06 14:11:30 -0700467
468MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET6));
469MODULE_LICENSE("GPL");
470MODULE_AUTHOR("Yasuyuki KOZAKAI @USAGI <yasuyuki.kozakai@toshiba.co.jp>");
471
472static int __init nf_conntrack_l3proto_ipv6_init(void)
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800473{
474 int ret = 0;
475
Patrick McHardy32292a72006-04-06 14:11:30 -0700476 need_conntrack();
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800477
478 ret = nf_ct_frag6_init();
479 if (ret < 0) {
480 printk("nf_conntrack_ipv6: can't initialize frag6.\n");
Patrick McHardy32292a72006-04-06 14:11:30 -0700481 return ret;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800482 }
483 ret = nf_conntrack_protocol_register(&nf_conntrack_protocol_tcp6);
484 if (ret < 0) {
485 printk("nf_conntrack_ipv6: can't register tcp.\n");
486 goto cleanup_frag6;
487 }
488
489 ret = nf_conntrack_protocol_register(&nf_conntrack_protocol_udp6);
490 if (ret < 0) {
491 printk("nf_conntrack_ipv6: can't register udp.\n");
492 goto cleanup_tcp;
493 }
494
495 ret = nf_conntrack_protocol_register(&nf_conntrack_protocol_icmpv6);
496 if (ret < 0) {
497 printk("nf_conntrack_ipv6: can't register icmpv6.\n");
498 goto cleanup_udp;
499 }
500
501 ret = nf_conntrack_l3proto_register(&nf_conntrack_l3proto_ipv6);
502 if (ret < 0) {
503 printk("nf_conntrack_ipv6: can't register ipv6\n");
504 goto cleanup_icmpv6;
505 }
506
Patrick McHardy964ddaa2006-04-06 14:09:49 -0700507 ret = nf_register_hooks(ipv6_conntrack_ops,
508 ARRAY_SIZE(ipv6_conntrack_ops));
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800509 if (ret < 0) {
510 printk("nf_conntrack_ipv6: can't register pre-routing defrag "
511 "hook.\n");
512 goto cleanup_ipv6;
513 }
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800514#ifdef CONFIG_SYSCTL
515 nf_ct_ipv6_sysctl_header = register_sysctl_table(nf_ct_net_table, 0);
516 if (nf_ct_ipv6_sysctl_header == NULL) {
517 printk("nf_conntrack: can't register to sysctl.\n");
518 ret = -ENOMEM;
Patrick McHardy964ddaa2006-04-06 14:09:49 -0700519 goto cleanup_hooks;
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800520 }
521#endif
522 return ret;
523
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800524#ifdef CONFIG_SYSCTL
Patrick McHardy964ddaa2006-04-06 14:09:49 -0700525 cleanup_hooks:
Patrick McHardy964ddaa2006-04-06 14:09:49 -0700526 nf_unregister_hooks(ipv6_conntrack_ops, ARRAY_SIZE(ipv6_conntrack_ops));
Patrick McHardy32292a72006-04-06 14:11:30 -0700527#endif
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800528 cleanup_ipv6:
529 nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv6);
530 cleanup_icmpv6:
531 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_icmpv6);
532 cleanup_udp:
533 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_udp6);
534 cleanup_tcp:
535 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_tcp6);
536 cleanup_frag6:
537 nf_ct_frag6_cleanup();
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800538 return ret;
539}
540
Andrew Morton65b4b4e2006-03-28 16:37:06 -0800541static void __exit nf_conntrack_l3proto_ipv6_fini(void)
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800542{
Patrick McHardy32292a72006-04-06 14:11:30 -0700543 synchronize_net();
544#ifdef CONFIG_SYSCTL
545 unregister_sysctl_table(nf_ct_ipv6_sysctl_header);
546#endif
547 nf_unregister_hooks(ipv6_conntrack_ops, ARRAY_SIZE(ipv6_conntrack_ops));
548 nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv6);
549 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_icmpv6);
550 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_udp6);
551 nf_conntrack_protocol_unregister(&nf_conntrack_protocol_tcp6);
552 nf_ct_frag6_cleanup();
Yasuyuki Kozakai9fb9cbb2005-11-09 16:38:16 -0800553}
554
Andrew Morton65b4b4e2006-03-28 16:37:06 -0800555module_init(nf_conntrack_l3proto_ipv6_init);
556module_exit(nf_conntrack_l3proto_ipv6_fini);