diff options
Diffstat (limited to 'net/ipv4/xfrm4_output.c')
-rw-r--r-- | net/ipv4/xfrm4_output.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c index baa0f63731fd..186a8ecf92fa 100644 --- a/net/ipv4/xfrm4_output.c +++ b/net/ipv4/xfrm4_output.c | |||
@@ -62,10 +62,7 @@ int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb) | |||
62 | if (err) | 62 | if (err) |
63 | return err; | 63 | return err; |
64 | 64 | ||
65 | memset(IPCB(skb), 0, sizeof(*IPCB(skb))); | 65 | IPCB(skb)->flags |= IPSKB_XFRM_TUNNEL_SIZE; |
66 | IPCB(skb)->flags |= IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED; | ||
67 | |||
68 | skb->protocol = htons(ETH_P_IP); | ||
69 | 66 | ||
70 | return x->outer_mode->output2(x, skb); | 67 | return x->outer_mode->output2(x, skb); |
71 | } | 68 | } |
@@ -73,27 +70,34 @@ EXPORT_SYMBOL(xfrm4_prepare_output); | |||
73 | 70 | ||
74 | int xfrm4_output_finish(struct sk_buff *skb) | 71 | int xfrm4_output_finish(struct sk_buff *skb) |
75 | { | 72 | { |
76 | #ifdef CONFIG_NETFILTER | 73 | memset(IPCB(skb), 0, sizeof(*IPCB(skb))); |
77 | if (!skb_dst(skb)->xfrm) { | 74 | skb->protocol = htons(ETH_P_IP); |
78 | IPCB(skb)->flags |= IPSKB_REROUTED; | ||
79 | return dst_output(skb); | ||
80 | } | ||
81 | 75 | ||
76 | #ifdef CONFIG_NETFILTER | ||
82 | IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED; | 77 | IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED; |
83 | #endif | 78 | #endif |
84 | 79 | ||
85 | skb->protocol = htons(ETH_P_IP); | ||
86 | return xfrm_output(skb); | 80 | return xfrm_output(skb); |
87 | } | 81 | } |
88 | 82 | ||
89 | int xfrm4_output(struct sk_buff *skb) | 83 | static int __xfrm4_output(struct sk_buff *skb) |
90 | { | 84 | { |
91 | struct dst_entry *dst = skb_dst(skb); | 85 | struct xfrm_state *x = skb_dst(skb)->xfrm; |
92 | struct xfrm_state *x = dst->xfrm; | 86 | |
87 | #ifdef CONFIG_NETFILTER | ||
88 | if (!x) { | ||
89 | IPCB(skb)->flags |= IPSKB_REROUTED; | ||
90 | return dst_output(skb); | ||
91 | } | ||
92 | #endif | ||
93 | 93 | ||
94 | return x->outer_mode->afinfo->output_finish(skb); | ||
95 | } | ||
96 | |||
97 | int xfrm4_output(struct sock *sk, struct sk_buff *skb) | ||
98 | { | ||
94 | return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING, skb, | 99 | return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING, skb, |
95 | NULL, dst->dev, | 100 | NULL, skb_dst(skb)->dev, __xfrm4_output, |
96 | x->outer_mode->afinfo->output_finish, | ||
97 | !(IPCB(skb)->flags & IPSKB_REROUTED)); | 101 | !(IPCB(skb)->flags & IPSKB_REROUTED)); |
98 | } | 102 | } |
99 | 103 | ||