diff options
Diffstat (limited to 'net/ipv4/xfrm4_output.c')
| -rw-r--r-- | net/ipv4/xfrm4_output.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c index 40e701f2e1e0..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 | { |
| 73 | memset(IPCB(skb), 0, sizeof(*IPCB(skb))); | ||
| 74 | skb->protocol = htons(ETH_P_IP); | ||
| 75 | |||
| 76 | #ifdef CONFIG_NETFILTER | ||
| 77 | IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED; | ||
| 78 | #endif | ||
| 79 | |||
| 80 | return xfrm_output(skb); | ||
| 81 | } | ||
| 82 | |||
| 83 | static int __xfrm4_output(struct sk_buff *skb) | ||
| 84 | { | ||
| 85 | struct xfrm_state *x = skb_dst(skb)->xfrm; | ||
| 86 | |||
| 76 | #ifdef CONFIG_NETFILTER | 87 | #ifdef CONFIG_NETFILTER |
| 77 | if (!skb_dst(skb)->xfrm) { | 88 | if (!x) { |
| 78 | IPCB(skb)->flags |= IPSKB_REROUTED; | 89 | IPCB(skb)->flags |= IPSKB_REROUTED; |
| 79 | return dst_output(skb); | 90 | return dst_output(skb); |
| 80 | } | 91 | } |
| 81 | |||
| 82 | IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED; | ||
| 83 | #endif | 92 | #endif |
| 84 | 93 | ||
| 85 | skb->protocol = htons(ETH_P_IP); | 94 | return x->outer_mode->afinfo->output_finish(skb); |
| 86 | return xfrm_output(skb); | ||
| 87 | } | 95 | } |
| 88 | 96 | ||
| 89 | int xfrm4_output(struct sock *sk, struct sk_buff *skb) | 97 | int xfrm4_output(struct sock *sk, struct sk_buff *skb) |
| 90 | { | 98 | { |
| 91 | struct dst_entry *dst = skb_dst(skb); | ||
| 92 | struct xfrm_state *x = dst->xfrm; | ||
| 93 | |||
| 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 | ||
