diff options
Diffstat (limited to 'net/ipv6/xfrm6_output.c')
-rw-r--r-- | net/ipv6/xfrm6_output.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index 656976760ad4..bc2e80e3b0b1 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c | |||
@@ -10,10 +10,12 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/if_ether.h> | 12 | #include <linux/if_ether.h> |
13 | #include <linux/compiler.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/module.h> | ||
14 | #include <linux/skbuff.h> | 15 | #include <linux/skbuff.h> |
15 | #include <linux/icmpv6.h> | 16 | #include <linux/icmpv6.h> |
16 | #include <linux/netfilter_ipv6.h> | 17 | #include <linux/netfilter_ipv6.h> |
18 | #include <net/dst.h> | ||
17 | #include <net/ipv6.h> | 19 | #include <net/ipv6.h> |
18 | #include <net/xfrm.h> | 20 | #include <net/xfrm.h> |
19 | 21 | ||
@@ -43,19 +45,38 @@ static int xfrm6_tunnel_check_size(struct sk_buff *skb) | |||
43 | return ret; | 45 | return ret; |
44 | } | 46 | } |
45 | 47 | ||
48 | int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb) | ||
49 | { | ||
50 | int err; | ||
51 | |||
52 | err = xfrm6_tunnel_check_size(skb); | ||
53 | if (err) | ||
54 | return err; | ||
55 | |||
56 | return xfrm6_extract_header(skb); | ||
57 | } | ||
58 | |||
59 | int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb) | ||
60 | { | ||
61 | int err; | ||
62 | |||
63 | err = x->inner_mode->afinfo->extract_output(x, skb); | ||
64 | if (err) | ||
65 | return err; | ||
66 | |||
67 | memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); | ||
68 | |||
69 | skb->protocol = htons(ETH_P_IPV6); | ||
70 | |||
71 | return x->outer_mode->output2(x, skb); | ||
72 | } | ||
73 | EXPORT_SYMBOL(xfrm6_prepare_output); | ||
74 | |||
46 | static inline int xfrm6_output_one(struct sk_buff *skb) | 75 | static inline int xfrm6_output_one(struct sk_buff *skb) |
47 | { | 76 | { |
48 | struct dst_entry *dst = skb->dst; | ||
49 | struct xfrm_state *x = dst->xfrm; | ||
50 | struct ipv6hdr *iph; | 77 | struct ipv6hdr *iph; |
51 | int err; | 78 | int err; |
52 | 79 | ||
53 | if (x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL) { | ||
54 | err = xfrm6_tunnel_check_size(skb); | ||
55 | if (err) | ||
56 | goto error_nolock; | ||
57 | } | ||
58 | |||
59 | err = xfrm_output(skb); | 80 | err = xfrm_output(skb); |
60 | if (err) | 81 | if (err) |
61 | goto error_nolock; | 82 | goto error_nolock; |