]> bbs.cooldavid.org Git - net-next-2.6.git/blame - net/ipv6/netfilter.c
[NETFILTER]: Move ipv4 specific code from net/core/netfilter.c to net/ipv4/netfilter.c
[net-next-2.6.git] / net / ipv6 / netfilter.c
CommitLineData
020b4c12
HW
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 */