[NETFILTER]: Move ipv4 specific code from net/core/netfilter.c to net/ipv4/netfilter.c
[linux-2.6/mini2440.git] / net / ipv6 / netfilter.c
blob5656d0959aba7ff9ae0734f24cfa88857a6251f5
1 #include <linux/config.h>
2 #include <linux/init.h>
4 #ifdef CONFIG_NETFILTER
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>
12 int ip6_route_me_harder(struct sk_buff *skb)
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,
25 dst = ip6_route_output(skb->sk, &fl);
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;
35 /* Drop old route. */
36 dst_release(skb->dst);
38 skb->dst = dst;
39 return 0;
41 EXPORT_SYMBOL(ip6_route_me_harder);
43 #endif /* CONFIG_NETFILTER */