Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 1 | /* |
| 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> |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 10 | */ |
| 11 | |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 12 | #include <linux/types.h> |
| 13 | #include <linux/ipv6.h> |
| 14 | #include <linux/in6.h> |
| 15 | #include <linux/netfilter.h> |
| 16 | #include <linux/module.h> |
| 17 | #include <linux/skbuff.h> |
| 18 | #include <linux/icmp.h> |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 19 | #include <net/ipv6.h> |
Pavel Emelyanov | 04128f2 | 2007-10-15 02:33:45 -0700 | [diff] [blame] | 20 | #include <net/inet_frag.h> |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 21 | |
Patrick McHardy | 8fa9ff6 | 2009-12-15 16:59:59 +0100 | [diff] [blame] | 22 | #include <linux/netfilter_bridge.h> |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 23 | #include <linux/netfilter_ipv6.h> |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 24 | #include <linux/netfilter_ipv6/ip6_tables.h> |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 25 | #include <net/netfilter/nf_conntrack.h> |
| 26 | #include <net/netfilter/nf_conntrack_helper.h> |
Martin Josefsson | 605dcad | 2006-11-29 02:35:06 +0100 | [diff] [blame] | 27 | #include <net/netfilter/nf_conntrack_l4proto.h> |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 28 | #include <net/netfilter/nf_conntrack_l3proto.h> |
| 29 | #include <net/netfilter/nf_conntrack_core.h> |
Patrick McHardy | 5d0aa2c | 2010-02-15 18:13:33 +0100 | [diff] [blame] | 30 | #include <net/netfilter/nf_conntrack_zones.h> |
Patrick McHardy | 41d73ec | 2013-08-27 08:50:12 +0200 | [diff] [blame] | 31 | #include <net/netfilter/nf_conntrack_seqadj.h> |
Christoph Paasch | 9d2493f | 2009-03-16 15:15:35 +0100 | [diff] [blame] | 32 | #include <net/netfilter/ipv6/nf_conntrack_ipv6.h> |
Patrick McHardy | 58a317f | 2012-08-26 19:14:12 +0200 | [diff] [blame] | 33 | #include <net/netfilter/nf_nat_helper.h> |
Balazs Scheidler | e97c3e2 | 2010-10-21 16:03:43 +0200 | [diff] [blame] | 34 | #include <net/netfilter/ipv6/nf_defrag_ipv6.h> |
Patrick McHardy | 74f7a65 | 2009-08-25 15:33:08 +0200 | [diff] [blame] | 35 | #include <net/netfilter/nf_log.h> |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 36 | |
Jan Engelhardt | 8ce8439 | 2008-04-14 11:15:52 +0200 | [diff] [blame] | 37 | static bool ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, |
| 38 | struct nf_conntrack_tuple *tuple) |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 39 | { |
Jan Engelhardt | 3294858 | 2008-01-31 04:53:24 -0800 | [diff] [blame] | 40 | const u_int32_t *ap; |
| 41 | u_int32_t _addrs[8]; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 42 | |
| 43 | ap = skb_header_pointer(skb, nhoff + offsetof(struct ipv6hdr, saddr), |
| 44 | sizeof(_addrs), _addrs); |
| 45 | if (ap == NULL) |
Jan Engelhardt | 8ce8439 | 2008-04-14 11:15:52 +0200 | [diff] [blame] | 46 | return false; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 47 | |
| 48 | memcpy(tuple->src.u3.ip6, ap, sizeof(tuple->src.u3.ip6)); |
| 49 | memcpy(tuple->dst.u3.ip6, ap + 4, sizeof(tuple->dst.u3.ip6)); |
| 50 | |
Jan Engelhardt | 8ce8439 | 2008-04-14 11:15:52 +0200 | [diff] [blame] | 51 | return true; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 52 | } |
| 53 | |
Jan Engelhardt | 8ce8439 | 2008-04-14 11:15:52 +0200 | [diff] [blame] | 54 | static bool ipv6_invert_tuple(struct nf_conntrack_tuple *tuple, |
| 55 | const struct nf_conntrack_tuple *orig) |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 56 | { |
| 57 | memcpy(tuple->src.u3.ip6, orig->dst.u3.ip6, sizeof(tuple->src.u3.ip6)); |
| 58 | memcpy(tuple->dst.u3.ip6, orig->src.u3.ip6, sizeof(tuple->dst.u3.ip6)); |
| 59 | |
Jan Engelhardt | 8ce8439 | 2008-04-14 11:15:52 +0200 | [diff] [blame] | 60 | return true; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 61 | } |
| 62 | |
Joe Perches | 824f1fb | 2014-09-29 16:08:22 -0700 | [diff] [blame] | 63 | static void ipv6_print_tuple(struct seq_file *s, |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 64 | const struct nf_conntrack_tuple *tuple) |
| 65 | { |
Joe Perches | 824f1fb | 2014-09-29 16:08:22 -0700 | [diff] [blame] | 66 | seq_printf(s, "src=%pI6 dst=%pI6 ", |
| 67 | tuple->src.u3.ip6, tuple->dst.u3.ip6); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 68 | } |
| 69 | |
Yasuyuki Kozakai | ffc3069 | 2007-07-14 20:44:50 -0700 | [diff] [blame] | 70 | static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, |
| 71 | unsigned int *dataoff, u_int8_t *protonum) |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 72 | { |
Yasuyuki Kozakai | ffc3069 | 2007-07-14 20:44:50 -0700 | [diff] [blame] | 73 | unsigned int extoff = nhoff + sizeof(struct ipv6hdr); |
Patrick McHardy | 2b60af0 | 2012-08-26 19:13:59 +0200 | [diff] [blame] | 74 | __be16 frag_off; |
Yasuyuki Kozakai | ffc3069 | 2007-07-14 20:44:50 -0700 | [diff] [blame] | 75 | int protoff; |
Patrick McHardy | 2b60af0 | 2012-08-26 19:13:59 +0200 | [diff] [blame] | 76 | u8 nexthdr; |
Yasuyuki Kozakai | ffc3069 | 2007-07-14 20:44:50 -0700 | [diff] [blame] | 77 | |
| 78 | if (skb_copy_bits(skb, nhoff + offsetof(struct ipv6hdr, nexthdr), |
Patrick McHardy | 2b60af0 | 2012-08-26 19:13:59 +0200 | [diff] [blame] | 79 | &nexthdr, sizeof(nexthdr)) != 0) { |
Yasuyuki Kozakai | ffc3069 | 2007-07-14 20:44:50 -0700 | [diff] [blame] | 80 | pr_debug("ip6_conntrack_core: can't get nexthdr\n"); |
| 81 | return -NF_ACCEPT; |
| 82 | } |
Patrick McHardy | 2b60af0 | 2012-08-26 19:13:59 +0200 | [diff] [blame] | 83 | protoff = ipv6_skip_exthdr(skb, extoff, &nexthdr, &frag_off); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 84 | /* |
Florent Fourcot | d7a769f | 2012-12-14 00:53:33 +0000 | [diff] [blame] | 85 | * (protoff == skb->len) means the packet has not data, just |
| 86 | * IPv6 and possibly extensions headers, but it is tracked anyway |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 87 | */ |
Patrick McHardy | 2b60af0 | 2012-08-26 19:13:59 +0200 | [diff] [blame] | 88 | if (protoff < 0 || (frag_off & htons(~0x7)) != 0) { |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 89 | pr_debug("ip6_conntrack_core: can't find proto in pkt\n"); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 90 | return -NF_ACCEPT; |
| 91 | } |
| 92 | |
| 93 | *dataoff = protoff; |
Patrick McHardy | 2b60af0 | 2012-08-26 19:13:59 +0200 | [diff] [blame] | 94 | *protonum = nexthdr; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 95 | return NF_ACCEPT; |
| 96 | } |
| 97 | |
Eric W. Biederman | 06198b3 | 2015-09-18 14:33:06 -0500 | [diff] [blame] | 98 | static unsigned int ipv6_helper(void *priv, |
Pablo Neira Ayuso | 12f7a50 | 2012-05-13 21:44:54 +0200 | [diff] [blame] | 99 | struct sk_buff *skb, |
David S. Miller | 238e54c | 2015-04-03 20:32:56 -0400 | [diff] [blame] | 100 | const struct nf_hook_state *state) |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 101 | { |
| 102 | struct nf_conn *ct; |
Jan Engelhardt | 3294858 | 2008-01-31 04:53:24 -0800 | [diff] [blame] | 103 | const struct nf_conn_help *help; |
| 104 | const struct nf_conntrack_helper *helper; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 105 | enum ip_conntrack_info ctinfo; |
Patrick McHardy | 4cdd3408 | 2012-08-26 19:13:58 +0200 | [diff] [blame] | 106 | __be16 frag_off; |
| 107 | int protoff; |
| 108 | u8 nexthdr; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 109 | |
| 110 | /* This is where we call the helper: as the packet goes out. */ |
Herbert Xu | 3db05fe | 2007-10-15 00:53:15 -0700 | [diff] [blame] | 111 | ct = nf_ct_get(skb, &ctinfo); |
Eric Dumazet | fb04883 | 2011-05-19 15:44:27 +0200 | [diff] [blame] | 112 | if (!ct || ctinfo == IP_CT_RELATED_REPLY) |
Pablo Neira Ayuso | 12f7a50 | 2012-05-13 21:44:54 +0200 | [diff] [blame] | 113 | return NF_ACCEPT; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 114 | |
Harald Welte | dc808fe | 2006-03-20 17:56:32 -0800 | [diff] [blame] | 115 | help = nfct_help(ct); |
Patrick McHarrdy | 3c158f7 | 2007-06-05 12:55:27 -0700 | [diff] [blame] | 116 | if (!help) |
Pablo Neira Ayuso | 12f7a50 | 2012-05-13 21:44:54 +0200 | [diff] [blame] | 117 | return NF_ACCEPT; |
Aaron Conole | e2361cb | 2016-09-21 11:35:04 -0400 | [diff] [blame] | 118 | /* rcu_read_lock()ed by nf_hook_thresh */ |
Patrick McHarrdy | 3c158f7 | 2007-06-05 12:55:27 -0700 | [diff] [blame] | 119 | helper = rcu_dereference(help->helper); |
| 120 | if (!helper) |
Pablo Neira Ayuso | 12f7a50 | 2012-05-13 21:44:54 +0200 | [diff] [blame] | 121 | return NF_ACCEPT; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 122 | |
Patrick McHardy | 4cdd3408 | 2012-08-26 19:13:58 +0200 | [diff] [blame] | 123 | nexthdr = ipv6_hdr(skb)->nexthdr; |
| 124 | protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr, |
| 125 | &frag_off); |
| 126 | if (protoff < 0 || (frag_off & htons(~0x7)) != 0) { |
Patrick McHardy | 0d53778 | 2007-07-07 22:39:38 -0700 | [diff] [blame] | 127 | pr_debug("proto header not found\n"); |
Harald Welte | dc808fe | 2006-03-20 17:56:32 -0800 | [diff] [blame] | 128 | return NF_ACCEPT; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 129 | } |
| 130 | |
Pablo Neira Ayuso | b20ab9cc | 2013-02-10 18:56:56 +0100 | [diff] [blame] | 131 | return helper->help(skb, protoff, ct, ctinfo); |
Pablo Neira Ayuso | 12f7a50 | 2012-05-13 21:44:54 +0200 | [diff] [blame] | 132 | } |
| 133 | |
Eric W. Biederman | 06198b3 | 2015-09-18 14:33:06 -0500 | [diff] [blame] | 134 | static unsigned int ipv6_confirm(void *priv, |
Pablo Neira Ayuso | 12f7a50 | 2012-05-13 21:44:54 +0200 | [diff] [blame] | 135 | struct sk_buff *skb, |
David S. Miller | 238e54c | 2015-04-03 20:32:56 -0400 | [diff] [blame] | 136 | const struct nf_hook_state *state) |
Pablo Neira Ayuso | 12f7a50 | 2012-05-13 21:44:54 +0200 | [diff] [blame] | 137 | { |
Patrick McHardy | 58a317f | 2012-08-26 19:14:12 +0200 | [diff] [blame] | 138 | struct nf_conn *ct; |
| 139 | enum ip_conntrack_info ctinfo; |
| 140 | unsigned char pnum = ipv6_hdr(skb)->nexthdr; |
| 141 | int protoff; |
| 142 | __be16 frag_off; |
| 143 | |
| 144 | ct = nf_ct_get(skb, &ctinfo); |
| 145 | if (!ct || ctinfo == IP_CT_RELATED_REPLY) |
| 146 | goto out; |
| 147 | |
| 148 | protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &pnum, |
| 149 | &frag_off); |
| 150 | if (protoff < 0 || (frag_off & htons(~0x7)) != 0) { |
| 151 | pr_debug("proto header not found\n"); |
| 152 | goto out; |
| 153 | } |
| 154 | |
| 155 | /* adjust seqs for loopback traffic only in outgoing direction */ |
| 156 | if (test_bit(IPS_SEQ_ADJUST_BIT, &ct->status) && |
| 157 | !nf_is_loopback_packet(skb)) { |
Patrick McHardy | 41d73ec | 2013-08-27 08:50:12 +0200 | [diff] [blame] | 158 | if (!nf_ct_seq_adjust(skb, ct, ctinfo, protoff)) { |
Patrick McHardy | 58a317f | 2012-08-26 19:14:12 +0200 | [diff] [blame] | 159 | NF_CT_STAT_INC_ATOMIC(nf_ct_net(ct), drop); |
| 160 | return NF_DROP; |
| 161 | } |
| 162 | } |
| 163 | out: |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 164 | /* We've seen it coming out the other side: confirm it */ |
Herbert Xu | 3db05fe | 2007-10-15 00:53:15 -0700 | [diff] [blame] | 165 | return nf_conntrack_confirm(skb); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 166 | } |
| 167 | |
Eric W. Biederman | 06198b3 | 2015-09-18 14:33:06 -0500 | [diff] [blame] | 168 | static unsigned int ipv6_conntrack_in(void *priv, |
Alexey Dobriyan | a702a65 | 2008-10-08 11:35:04 +0200 | [diff] [blame] | 169 | struct sk_buff *skb, |
David S. Miller | 238e54c | 2015-04-03 20:32:56 -0400 | [diff] [blame] | 170 | const struct nf_hook_state *state) |
Alexey Dobriyan | a702a65 | 2008-10-08 11:35:04 +0200 | [diff] [blame] | 171 | { |
Eric W. Biederman | 082a758 | 2015-09-18 14:32:56 -0500 | [diff] [blame] | 172 | return nf_conntrack_in(state->net, PF_INET6, state->hook, skb); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 173 | } |
| 174 | |
Eric W. Biederman | 06198b3 | 2015-09-18 14:33:06 -0500 | [diff] [blame] | 175 | static unsigned int ipv6_conntrack_local(void *priv, |
Herbert Xu | 3db05fe | 2007-10-15 00:53:15 -0700 | [diff] [blame] | 176 | struct sk_buff *skb, |
David S. Miller | 238e54c | 2015-04-03 20:32:56 -0400 | [diff] [blame] | 177 | const struct nf_hook_state *state) |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 178 | { |
| 179 | /* root is playing with raw sockets. */ |
Herbert Xu | 3db05fe | 2007-10-15 00:53:15 -0700 | [diff] [blame] | 180 | if (skb->len < sizeof(struct ipv6hdr)) { |
Joe Perches | e87cc47 | 2012-05-13 21:56:26 +0000 | [diff] [blame] | 181 | net_notice_ratelimited("ipv6_conntrack_local: packet too short\n"); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 182 | return NF_ACCEPT; |
| 183 | } |
Eric W. Biederman | 082a758 | 2015-09-18 14:32:56 -0500 | [diff] [blame] | 184 | return nf_conntrack_in(state->net, PF_INET6, state->hook, skb); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 185 | } |
| 186 | |
Patrick McHardy | 1999414 | 2007-12-05 01:23:00 -0800 | [diff] [blame] | 187 | static struct nf_hook_ops ipv6_conntrack_ops[] __read_mostly = { |
Patrick McHardy | 964ddaa | 2006-04-06 14:09:49 -0700 | [diff] [blame] | 188 | { |
Patrick McHardy | 964ddaa | 2006-04-06 14:09:49 -0700 | [diff] [blame] | 189 | .hook = ipv6_conntrack_in, |
Jan Engelhardt | 57750a2 | 2009-06-13 06:22:18 +0200 | [diff] [blame] | 190 | .pf = NFPROTO_IPV6, |
Patrick McHardy | 6e23ae2 | 2007-11-19 18:53:30 -0800 | [diff] [blame] | 191 | .hooknum = NF_INET_PRE_ROUTING, |
Patrick McHardy | 964ddaa | 2006-04-06 14:09:49 -0700 | [diff] [blame] | 192 | .priority = NF_IP6_PRI_CONNTRACK, |
| 193 | }, |
| 194 | { |
| 195 | .hook = ipv6_conntrack_local, |
Jan Engelhardt | 57750a2 | 2009-06-13 06:22:18 +0200 | [diff] [blame] | 196 | .pf = NFPROTO_IPV6, |
Patrick McHardy | 6e23ae2 | 2007-11-19 18:53:30 -0800 | [diff] [blame] | 197 | .hooknum = NF_INET_LOCAL_OUT, |
Patrick McHardy | 964ddaa | 2006-04-06 14:09:49 -0700 | [diff] [blame] | 198 | .priority = NF_IP6_PRI_CONNTRACK, |
| 199 | }, |
| 200 | { |
Pablo Neira Ayuso | 12f7a50 | 2012-05-13 21:44:54 +0200 | [diff] [blame] | 201 | .hook = ipv6_helper, |
Pablo Neira Ayuso | 12f7a50 | 2012-05-13 21:44:54 +0200 | [diff] [blame] | 202 | .pf = NFPROTO_IPV6, |
| 203 | .hooknum = NF_INET_POST_ROUTING, |
| 204 | .priority = NF_IP6_PRI_CONNTRACK_HELPER, |
| 205 | }, |
| 206 | { |
Patrick McHardy | 964ddaa | 2006-04-06 14:09:49 -0700 | [diff] [blame] | 207 | .hook = ipv6_confirm, |
Jan Engelhardt | 57750a2 | 2009-06-13 06:22:18 +0200 | [diff] [blame] | 208 | .pf = NFPROTO_IPV6, |
Patrick McHardy | 6e23ae2 | 2007-11-19 18:53:30 -0800 | [diff] [blame] | 209 | .hooknum = NF_INET_POST_ROUTING, |
Patrick McHardy | 964ddaa | 2006-04-06 14:09:49 -0700 | [diff] [blame] | 210 | .priority = NF_IP6_PRI_LAST, |
| 211 | }, |
| 212 | { |
Pablo Neira Ayuso | 12f7a50 | 2012-05-13 21:44:54 +0200 | [diff] [blame] | 213 | .hook = ipv6_helper, |
Pablo Neira Ayuso | 12f7a50 | 2012-05-13 21:44:54 +0200 | [diff] [blame] | 214 | .pf = NFPROTO_IPV6, |
| 215 | .hooknum = NF_INET_LOCAL_IN, |
| 216 | .priority = NF_IP6_PRI_CONNTRACK_HELPER, |
| 217 | }, |
| 218 | { |
Patrick McHardy | 964ddaa | 2006-04-06 14:09:49 -0700 | [diff] [blame] | 219 | .hook = ipv6_confirm, |
Jan Engelhardt | 57750a2 | 2009-06-13 06:22:18 +0200 | [diff] [blame] | 220 | .pf = NFPROTO_IPV6, |
Patrick McHardy | 6e23ae2 | 2007-11-19 18:53:30 -0800 | [diff] [blame] | 221 | .hooknum = NF_INET_LOCAL_IN, |
Patrick McHardy | 964ddaa | 2006-04-06 14:09:49 -0700 | [diff] [blame] | 222 | .priority = NF_IP6_PRI_LAST-1, |
| 223 | }, |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 224 | }; |
| 225 | |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 226 | static int |
| 227 | ipv6_getorigdst(struct sock *sk, int optval, void __user *user, int *len) |
| 228 | { |
Paolo Abeni | 4ec264d | 2018-01-30 19:01:40 +0100 | [diff] [blame] | 229 | struct nf_conntrack_tuple tuple = { .src.l3num = NFPROTO_IPV6 }; |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 230 | const struct ipv6_pinfo *inet6 = inet6_sk(sk); |
Paolo Abeni | 4ec264d | 2018-01-30 19:01:40 +0100 | [diff] [blame] | 231 | const struct inet_sock *inet = inet_sk(sk); |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 232 | const struct nf_conntrack_tuple_hash *h; |
| 233 | struct sockaddr_in6 sin6; |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 234 | struct nf_conn *ct; |
Paolo Abeni | 4ec264d | 2018-01-30 19:01:40 +0100 | [diff] [blame] | 235 | __be32 flow_label; |
| 236 | int bound_dev_if; |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 237 | |
Paolo Abeni | 4ec264d | 2018-01-30 19:01:40 +0100 | [diff] [blame] | 238 | lock_sock(sk); |
Eric Dumazet | efe4208 | 2013-10-03 15:42:29 -0700 | [diff] [blame] | 239 | tuple.src.u3.in6 = sk->sk_v6_rcv_saddr; |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 240 | tuple.src.u.tcp.port = inet->inet_sport; |
Eric Dumazet | efe4208 | 2013-10-03 15:42:29 -0700 | [diff] [blame] | 241 | tuple.dst.u3.in6 = sk->sk_v6_daddr; |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 242 | tuple.dst.u.tcp.port = inet->inet_dport; |
| 243 | tuple.dst.protonum = sk->sk_protocol; |
Paolo Abeni | 4ec264d | 2018-01-30 19:01:40 +0100 | [diff] [blame] | 244 | bound_dev_if = sk->sk_bound_dev_if; |
| 245 | flow_label = inet6->flow_label; |
| 246 | release_sock(sk); |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 247 | |
Paolo Abeni | 4ec264d | 2018-01-30 19:01:40 +0100 | [diff] [blame] | 248 | if (tuple.dst.protonum != IPPROTO_TCP && |
| 249 | tuple.dst.protonum != IPPROTO_SCTP) |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 250 | return -ENOPROTOOPT; |
| 251 | |
| 252 | if (*len < 0 || (unsigned int) *len < sizeof(sin6)) |
| 253 | return -EINVAL; |
| 254 | |
Daniel Borkmann | 308ac91 | 2015-08-08 21:40:01 +0200 | [diff] [blame] | 255 | h = nf_conntrack_find_get(sock_net(sk), &nf_ct_zone_dflt, &tuple); |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 256 | if (!h) { |
| 257 | pr_debug("IP6T_SO_ORIGINAL_DST: Can't find %pI6c/%u-%pI6c/%u.\n", |
| 258 | &tuple.src.u3.ip6, ntohs(tuple.src.u.tcp.port), |
| 259 | &tuple.dst.u3.ip6, ntohs(tuple.dst.u.tcp.port)); |
| 260 | return -ENOENT; |
| 261 | } |
| 262 | |
| 263 | ct = nf_ct_tuplehash_to_ctrack(h); |
| 264 | |
| 265 | sin6.sin6_family = AF_INET6; |
| 266 | sin6.sin6_port = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u.tcp.port; |
Paolo Abeni | 4ec264d | 2018-01-30 19:01:40 +0100 | [diff] [blame] | 267 | sin6.sin6_flowinfo = flow_label & IPV6_FLOWINFO_MASK; |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 268 | memcpy(&sin6.sin6_addr, |
| 269 | &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.in6, |
| 270 | sizeof(sin6.sin6_addr)); |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 271 | |
| 272 | nf_ct_put(ct); |
Paolo Abeni | 4ec264d | 2018-01-30 19:01:40 +0100 | [diff] [blame] | 273 | sin6.sin6_scope_id = ipv6_iface_scope_id(&sin6.sin6_addr, bound_dev_if); |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 274 | return copy_to_user(user, &sin6, sizeof(sin6)) ? -EFAULT : 0; |
| 275 | } |
| 276 | |
Amerigo Wang | 07a9362 | 2012-10-29 16:23:10 +0000 | [diff] [blame] | 277 | #if IS_ENABLED(CONFIG_NF_CT_NETLINK) |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 278 | |
| 279 | #include <linux/netfilter/nfnetlink.h> |
| 280 | #include <linux/netfilter/nfnetlink_conntrack.h> |
| 281 | |
Patrick McHardy | fdf7083 | 2007-09-28 14:37:41 -0700 | [diff] [blame] | 282 | static int ipv6_tuple_to_nlattr(struct sk_buff *skb, |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 283 | const struct nf_conntrack_tuple *tuple) |
| 284 | { |
Jiri Benc | 930345e | 2015-03-29 16:59:25 +0200 | [diff] [blame] | 285 | if (nla_put_in6_addr(skb, CTA_IP_V6_SRC, &tuple->src.u3.in6) || |
| 286 | nla_put_in6_addr(skb, CTA_IP_V6_DST, &tuple->dst.u3.in6)) |
David S. Miller | e549a6b | 2012-04-01 20:28:52 -0400 | [diff] [blame] | 287 | goto nla_put_failure; |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 288 | return 0; |
| 289 | |
Patrick McHardy | df6fb86 | 2007-09-28 14:37:03 -0700 | [diff] [blame] | 290 | nla_put_failure: |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 291 | return -1; |
| 292 | } |
| 293 | |
Patrick McHardy | f73e924 | 2007-09-28 14:39:55 -0700 | [diff] [blame] | 294 | static const struct nla_policy ipv6_nla_policy[CTA_IP_MAX+1] = { |
| 295 | [CTA_IP_V6_SRC] = { .len = sizeof(u_int32_t)*4 }, |
| 296 | [CTA_IP_V6_DST] = { .len = sizeof(u_int32_t)*4 }, |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 297 | }; |
| 298 | |
Patrick McHardy | fdf7083 | 2007-09-28 14:37:41 -0700 | [diff] [blame] | 299 | static int ipv6_nlattr_to_tuple(struct nlattr *tb[], |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 300 | struct nf_conntrack_tuple *t) |
| 301 | { |
Patrick McHardy | df6fb86 | 2007-09-28 14:37:03 -0700 | [diff] [blame] | 302 | if (!tb[CTA_IP_V6_SRC] || !tb[CTA_IP_V6_DST]) |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 303 | return -EINVAL; |
| 304 | |
Jiri Benc | 67b61f6 | 2015-03-29 16:59:26 +0200 | [diff] [blame] | 305 | t->src.u3.in6 = nla_get_in6_addr(tb[CTA_IP_V6_SRC]); |
| 306 | t->dst.u3.in6 = nla_get_in6_addr(tb[CTA_IP_V6_DST]); |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 307 | |
| 308 | return 0; |
| 309 | } |
Holger Eitzenberger | a400c30 | 2009-03-25 21:53:39 +0100 | [diff] [blame] | 310 | |
| 311 | static int ipv6_nlattr_tuple_size(void) |
| 312 | { |
| 313 | return nla_policy_len(ipv6_nla_policy, CTA_IP_MAX + 1); |
| 314 | } |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 315 | #endif |
| 316 | |
Patrick McHardy | 61075af | 2007-07-14 20:48:19 -0700 | [diff] [blame] | 317 | struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6 __read_mostly = { |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 318 | .l3proto = PF_INET6, |
| 319 | .name = "ipv6", |
| 320 | .pkt_to_tuple = ipv6_pkt_to_tuple, |
| 321 | .invert_tuple = ipv6_invert_tuple, |
| 322 | .print_tuple = ipv6_print_tuple, |
Yasuyuki Kozakai | ffc3069 | 2007-07-14 20:44:50 -0700 | [diff] [blame] | 323 | .get_l4proto = ipv6_get_l4proto, |
Amerigo Wang | 07a9362 | 2012-10-29 16:23:10 +0000 | [diff] [blame] | 324 | #if IS_ENABLED(CONFIG_NF_CT_NETLINK) |
Patrick McHardy | fdf7083 | 2007-09-28 14:37:41 -0700 | [diff] [blame] | 325 | .tuple_to_nlattr = ipv6_tuple_to_nlattr, |
Holger Eitzenberger | a400c30 | 2009-03-25 21:53:39 +0100 | [diff] [blame] | 326 | .nlattr_tuple_size = ipv6_nlattr_tuple_size, |
Patrick McHardy | fdf7083 | 2007-09-28 14:37:41 -0700 | [diff] [blame] | 327 | .nlattr_to_tuple = ipv6_nlattr_to_tuple, |
Patrick McHardy | f73e924 | 2007-09-28 14:39:55 -0700 | [diff] [blame] | 328 | .nla_policy = ipv6_nla_policy, |
Pablo Neira Ayuso | c1d10ad | 2006-01-05 12:19:05 -0800 | [diff] [blame] | 329 | #endif |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 330 | .me = THIS_MODULE, |
| 331 | }; |
| 332 | |
Patrick McHardy | 32292a7 | 2006-04-06 14:11:30 -0700 | [diff] [blame] | 333 | MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET6)); |
| 334 | MODULE_LICENSE("GPL"); |
| 335 | MODULE_AUTHOR("Yasuyuki KOZAKAI @USAGI <yasuyuki.kozakai@toshiba.co.jp>"); |
| 336 | |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 337 | static struct nf_sockopt_ops so_getorigdst6 = { |
| 338 | .pf = NFPROTO_IPV6, |
| 339 | .get_optmin = IP6T_SO_ORIGINAL_DST, |
| 340 | .get_optmax = IP6T_SO_ORIGINAL_DST + 1, |
| 341 | .get = ipv6_getorigdst, |
| 342 | .owner = THIS_MODULE, |
| 343 | }; |
| 344 | |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 345 | static int ipv6_net_init(struct net *net) |
| 346 | { |
| 347 | int ret = 0; |
| 348 | |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 349 | ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_tcp6); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 350 | if (ret < 0) { |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 351 | pr_err("nf_conntrack_tcp6: pernet registration failed\n"); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 352 | goto out; |
| 353 | } |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 354 | ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_udp6); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 355 | if (ret < 0) { |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 356 | pr_err("nf_conntrack_udp6: pernet registration failed\n"); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 357 | goto cleanup_tcp6; |
| 358 | } |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 359 | ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_icmpv6); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 360 | if (ret < 0) { |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 361 | pr_err("nf_conntrack_icmp6: pernet registration failed\n"); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 362 | goto cleanup_udp6; |
| 363 | } |
Gao feng | 6330750 | 2013-01-21 22:10:33 +0000 | [diff] [blame] | 364 | ret = nf_ct_l3proto_pernet_register(net, &nf_conntrack_l3proto_ipv6); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 365 | if (ret < 0) { |
Gao feng | 6330750 | 2013-01-21 22:10:33 +0000 | [diff] [blame] | 366 | pr_err("nf_conntrack_ipv6: pernet registration failed.\n"); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 367 | goto cleanup_icmpv6; |
| 368 | } |
| 369 | return 0; |
| 370 | cleanup_icmpv6: |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 371 | nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_icmpv6); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 372 | cleanup_udp6: |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 373 | nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_udp6); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 374 | cleanup_tcp6: |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 375 | nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_tcp6); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 376 | out: |
| 377 | return ret; |
| 378 | } |
| 379 | |
| 380 | static void ipv6_net_exit(struct net *net) |
| 381 | { |
Gao feng | 6330750 | 2013-01-21 22:10:33 +0000 | [diff] [blame] | 382 | nf_ct_l3proto_pernet_unregister(net, &nf_conntrack_l3proto_ipv6); |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 383 | nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_icmpv6); |
| 384 | nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_udp6); |
| 385 | nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_tcp6); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 386 | } |
| 387 | |
| 388 | static struct pernet_operations ipv6_net_ops = { |
| 389 | .init = ipv6_net_init, |
| 390 | .exit = ipv6_net_exit, |
| 391 | }; |
| 392 | |
Patrick McHardy | 32292a7 | 2006-04-06 14:11:30 -0700 | [diff] [blame] | 393 | static int __init nf_conntrack_l3proto_ipv6_init(void) |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 394 | { |
| 395 | int ret = 0; |
| 396 | |
Patrick McHardy | 32292a7 | 2006-04-06 14:11:30 -0700 | [diff] [blame] | 397 | need_conntrack(); |
Balazs Scheidler | e97c3e2 | 2010-10-21 16:03:43 +0200 | [diff] [blame] | 398 | nf_defrag_ipv6_enable(); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 399 | |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 400 | ret = nf_register_sockopt(&so_getorigdst6); |
| 401 | if (ret < 0) { |
| 402 | pr_err("Unable to register netfilter socket option\n"); |
| 403 | return ret; |
| 404 | } |
| 405 | |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 406 | ret = register_pernet_subsys(&ipv6_net_ops); |
| 407 | if (ret < 0) |
Gao feng | 6330750 | 2013-01-21 22:10:33 +0000 | [diff] [blame] | 408 | goto cleanup_sockopt; |
| 409 | |
Patrick McHardy | 964ddaa | 2006-04-06 14:09:49 -0700 | [diff] [blame] | 410 | ret = nf_register_hooks(ipv6_conntrack_ops, |
| 411 | ARRAY_SIZE(ipv6_conntrack_ops)); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 412 | if (ret < 0) { |
Stephen Hemminger | 654d0fb | 2010-05-13 15:02:08 +0200 | [diff] [blame] | 413 | pr_err("nf_conntrack_ipv6: can't register pre-routing defrag " |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 414 | "hook.\n"); |
Gao feng | 6330750 | 2013-01-21 22:10:33 +0000 | [diff] [blame] | 415 | goto cleanup_pernet; |
| 416 | } |
| 417 | |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 418 | ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_tcp6); |
| 419 | if (ret < 0) { |
| 420 | pr_err("nf_conntrack_ipv6: can't register tcp6 proto.\n"); |
| 421 | goto cleanup_hooks; |
| 422 | } |
| 423 | |
| 424 | ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_udp6); |
| 425 | if (ret < 0) { |
| 426 | pr_err("nf_conntrack_ipv6: can't register udp6 proto.\n"); |
| 427 | goto cleanup_tcp6; |
| 428 | } |
| 429 | |
| 430 | ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_icmpv6); |
| 431 | if (ret < 0) { |
| 432 | pr_err("nf_conntrack_ipv6: can't register icmpv6 proto.\n"); |
| 433 | goto cleanup_udp6; |
| 434 | } |
| 435 | |
Gao feng | 6330750 | 2013-01-21 22:10:33 +0000 | [diff] [blame] | 436 | ret = nf_ct_l3proto_register(&nf_conntrack_l3proto_ipv6); |
| 437 | if (ret < 0) { |
| 438 | pr_err("nf_conntrack_ipv6: can't register ipv6 proto.\n"); |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 439 | goto cleanup_icmpv6; |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 440 | } |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 441 | return ret; |
| 442 | |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 443 | cleanup_icmpv6: |
| 444 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_icmpv6); |
| 445 | cleanup_udp6: |
| 446 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_udp6); |
| 447 | cleanup_tcp6: |
| 448 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_tcp6); |
Gao feng | 6330750 | 2013-01-21 22:10:33 +0000 | [diff] [blame] | 449 | cleanup_hooks: |
| 450 | nf_unregister_hooks(ipv6_conntrack_ops, ARRAY_SIZE(ipv6_conntrack_ops)); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 451 | cleanup_pernet: |
Gao feng | 6330750 | 2013-01-21 22:10:33 +0000 | [diff] [blame] | 452 | unregister_pernet_subsys(&ipv6_net_ops); |
| 453 | cleanup_sockopt: |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 454 | nf_unregister_sockopt(&so_getorigdst6); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 455 | return ret; |
| 456 | } |
| 457 | |
Andrew Morton | 65b4b4e | 2006-03-28 16:37:06 -0800 | [diff] [blame] | 458 | static void __exit nf_conntrack_l3proto_ipv6_fini(void) |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 459 | { |
Patrick McHardy | 32292a7 | 2006-04-06 14:11:30 -0700 | [diff] [blame] | 460 | synchronize_net(); |
Gao feng | 6330750 | 2013-01-21 22:10:33 +0000 | [diff] [blame] | 461 | nf_ct_l3proto_unregister(&nf_conntrack_l3proto_ipv6); |
Gao feng | c296bb4 | 2013-01-23 12:51:10 +0100 | [diff] [blame] | 462 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_tcp6); |
| 463 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_udp6); |
| 464 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_icmpv6); |
Patrick McHardy | 32292a7 | 2006-04-06 14:11:30 -0700 | [diff] [blame] | 465 | nf_unregister_hooks(ipv6_conntrack_ops, ARRAY_SIZE(ipv6_conntrack_ops)); |
Gao feng | a7c439d | 2012-05-28 21:04:17 +0000 | [diff] [blame] | 466 | unregister_pernet_subsys(&ipv6_net_ops); |
Florian Westphal | 121d1e0 | 2012-10-30 01:08:49 +0000 | [diff] [blame] | 467 | nf_unregister_sockopt(&so_getorigdst6); |
Yasuyuki Kozakai | 9fb9cbb | 2005-11-09 16:38:16 -0800 | [diff] [blame] | 468 | } |
| 469 | |
Andrew Morton | 65b4b4e | 2006-03-28 16:37:06 -0800 | [diff] [blame] | 470 | module_init(nf_conntrack_l3proto_ipv6_init); |
| 471 | module_exit(nf_conntrack_l3proto_ipv6_fini); |