aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorHarald Welte <laforge@netfilter.org>2005-08-09 22:39:00 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 18:35:01 -0400
commit020b4c12dbe3868d792a01d7c1470cd837abe10f (patch)
tree4c5963a206f67eda6f8ff74ac33f7ed7e4acc164 /net/ipv6
parent089af26c706d1473f641c909fee7c878d29c1f1a (diff)
[NETFILTER]: Move ipv4 specific code from net/core/netfilter.c to net/ipv4/netfilter.c
Netfilter cleanup - Move ipv4 code from net/core/netfilter.c to net/ipv4/netfilter.c - Move ipv6 netfilter code from net/ipv6/ip6_output.c to net/ipv6/netfilter.c Signed-off-by: Harald Welte <laforge@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/Makefile2
-rw-r--r--net/ipv6/ip6_output.c32
-rw-r--r--net/ipv6/ipv6_syms.c3
-rw-r--r--net/ipv6/netfilter.c43
4 files changed, 44 insertions, 36 deletions
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile
index b39e04940590..5bccea2d81b4 100644
--- a/net/ipv6/Makefile
+++ b/net/ipv6/Makefile
@@ -8,7 +8,7 @@ ipv6-objs := af_inet6.o anycast.o ip6_output.o ip6_input.o addrconf.o sit.o \
8 route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o raw.o \ 8 route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o raw.o \
9 protocol.o icmp.o mcast.o reassembly.o tcp_ipv6.o \ 9 protocol.o icmp.o mcast.o reassembly.o tcp_ipv6.o \
10 exthdrs.o sysctl_net_ipv6.o datagram.o proc.o \ 10 exthdrs.o sysctl_net_ipv6.o datagram.o proc.o \
11 ip6_flowlabel.o ipv6_syms.o 11 ip6_flowlabel.o ipv6_syms.o netfilter.o
12 12
13ipv6-$(CONFIG_XFRM) += xfrm6_policy.o xfrm6_state.o xfrm6_input.o \ 13ipv6-$(CONFIG_XFRM) += xfrm6_policy.o xfrm6_state.o xfrm6_input.o \
14 xfrm6_output.o 14 xfrm6_output.o
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 590d2b797197..a7fcbcc83576 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -153,38 +153,6 @@ int ip6_output(struct sk_buff *skb)
153 return ip6_output2(skb); 153 return ip6_output2(skb);
154} 154}
155 155
156#ifdef CONFIG_NETFILTER
157int ip6_route_me_harder(struct sk_buff *skb)
158{
159 struct ipv6hdr *iph = skb->nh.ipv6h;
160 struct dst_entry *dst;
161 struct flowi fl = {
162 .oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
163 .nl_u =
164 { .ip6_u =
165 { .daddr = iph->daddr,
166 .saddr = iph->saddr, } },
167 .proto = iph->nexthdr,
168 };
169
170 dst = ip6_route_output(skb->sk, &fl);
171
172 if (dst->error) {
173 IP6_INC_STATS(IPSTATS_MIB_OUTNOROUTES);
174 LIMIT_NETDEBUG(
175 printk(KERN_DEBUG "ip6_route_me_harder: No more route.\n"));
176 dst_release(dst);
177 return -EINVAL;
178 }
179
180 /* Drop old route. */
181 dst_release(skb->dst);
182
183 skb->dst = dst;
184 return 0;
185}
186#endif
187
188/* 156/*
189 * xmit an sk_buff (used by TCP) 157 * xmit an sk_buff (used by TCP)
190 */ 158 */
diff --git a/net/ipv6/ipv6_syms.c b/net/ipv6/ipv6_syms.c
index 5ade5a5d1990..37a4a99c9fe9 100644
--- a/net/ipv6/ipv6_syms.c
+++ b/net/ipv6/ipv6_syms.c
@@ -15,9 +15,6 @@ EXPORT_SYMBOL(ndisc_mc_map);
15EXPORT_SYMBOL(register_inet6addr_notifier); 15EXPORT_SYMBOL(register_inet6addr_notifier);
16EXPORT_SYMBOL(unregister_inet6addr_notifier); 16EXPORT_SYMBOL(unregister_inet6addr_notifier);
17EXPORT_SYMBOL(ip6_route_output); 17EXPORT_SYMBOL(ip6_route_output);
18#ifdef CONFIG_NETFILTER
19EXPORT_SYMBOL(ip6_route_me_harder);
20#endif
21EXPORT_SYMBOL(addrconf_lock); 18EXPORT_SYMBOL(addrconf_lock);
22EXPORT_SYMBOL(ipv6_setsockopt); 19EXPORT_SYMBOL(ipv6_setsockopt);
23EXPORT_SYMBOL(ipv6_getsockopt); 20EXPORT_SYMBOL(ipv6_getsockopt);
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
new file mode 100644
index 000000000000..5656d0959aba
--- /dev/null
+++ b/net/ipv6/netfilter.c
@@ -0,0 +1,43 @@
1#include <linux/config.h>
2#include <linux/init.h>
3
4#ifdef CONFIG_NETFILTER
5
6#include <linux/kernel.h>
7#include <linux/ipv6.h>
8#include <net/dst.h>
9#include <net/ipv6.h>
10#include <net/ip6_route.h>
11
12int ip6_route_me_harder(struct sk_buff *skb)
13{
14 struct ipv6hdr *iph = skb->nh.ipv6h;
15 struct dst_entry *dst;
16 struct flowi fl = {
17 .oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
18 .nl_u =
19 { .ip6_u =
20 { .daddr = iph->daddr,
21 .saddr = iph->saddr, } },
22 .proto = iph->nexthdr,
23 };
24
25 dst = ip6_route_output(skb->sk, &fl);
26
27 if (dst->error) {
28 IP6_INC_STATS(IPSTATS_MIB_OUTNOROUTES);
29 LIMIT_NETDEBUG(
30 printk(KERN_DEBUG "ip6_route_me_harder: No more route.\n"));
31 dst_release(dst);
32 return -EINVAL;
33 }
34
35 /* Drop old route. */
36 dst_release(skb->dst);
37
38 skb->dst = dst;
39 return 0;
40}
41EXPORT_SYMBOL(ip6_route_me_harder);
42
43#endif /* CONFIG_NETFILTER */