1 #include <linux/kernel.h>
3 #include <linux/ipv6.h>
4 #include <linux/netfilter.h>
5 #include <linux/netfilter_ipv6.h>
6 #include <linux/export.h>
16 struct net *
net = dev_net(skb_dst(skb)->
dev);
17 const struct ipv6hdr *iph = ipv6_hdr(skb);
21 .flowi6_oif = skb->
sk ? skb->
sk->sk_bound_dev_if : 0,
22 .flowi6_mark = skb->
mark,
38 skb_dst_set(skb, dst);
42 xfrm_decode_session(skb, flowi6_to_flowi(&fl6),
AF_INET6) == 0) {
43 skb_dst_set(skb,
NULL);
44 dst =
xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), skb->
sk, 0);
47 skb_dst_set(skb, dst);
52 hh_len = skb_dst(skb)->dev->hard_header_len;
53 if (skb_headroom(skb) < hh_len &&
73 static void nf_ip6_saveroute(
const struct sk_buff *
skb,
79 const struct ipv6hdr *iph = ipv6_hdr(skb);
93 const struct ipv6hdr *iph = ipv6_hdr(skb);
94 if (!ipv6_addr_equal(&iph->
daddr, &rt_info->
daddr) ||
95 !ipv6_addr_equal(&iph->
saddr, &rt_info->
saddr) ||
106 static const struct inet_sock fake_sk = {
108 .
sk.sk_bound_dev_if = 1,
111 const void *
sk = strict ? &fake_sk :
NULL;
127 const struct ipv6hdr *ip6h = ipv6_hdr(skb);
135 skb->
len - dataoff, protocol,
144 skb->
csum = ~csum_unfold(
158 unsigned int dataoff,
unsigned int len,
161 const struct ipv6hdr *ip6h = ipv6_hdr(skb);
167 if (len == skb->
len - dataoff)
183 static const struct nf_afinfo nf_ip6_afinfo = {
186 .checksum_partial = nf_ip6_checksum_partial,
187 .route = nf_ip6_route,
188 .saveroute = nf_ip6_saveroute,
189 .reroute = nf_ip6_reroute,