diff options
Diffstat (limited to 'net/ipv6/xfrm6_mode_tunnel.c')
-rw-r--r-- | net/ipv6/xfrm6_mode_tunnel.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c index d45ce5d44197..f7d0d6612650 100644 --- a/net/ipv6/xfrm6_mode_tunnel.c +++ b/net/ipv6/xfrm6_mode_tunnel.c | |||
@@ -25,12 +25,6 @@ static inline void ipip6_ecn_decapsulate(struct sk_buff *skb) | |||
25 | IP6_ECN_set_ce(inner_iph); | 25 | IP6_ECN_set_ce(inner_iph); |
26 | } | 26 | } |
27 | 27 | ||
28 | static inline void ip6ip_ecn_decapsulate(struct sk_buff *skb) | ||
29 | { | ||
30 | if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6_hdr(skb)))) | ||
31 | IP_ECN_set_ce(ipip_hdr(skb)); | ||
32 | } | ||
33 | |||
34 | /* Add encapsulation header. | 28 | /* Add encapsulation header. |
35 | * | 29 | * |
36 | * The top IP header will be constructed per RFC 2401. | 30 | * The top IP header will be constructed per RFC 2401. |
@@ -68,10 +62,8 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) | |||
68 | { | 62 | { |
69 | int err = -EINVAL; | 63 | int err = -EINVAL; |
70 | const unsigned char *old_mac; | 64 | const unsigned char *old_mac; |
71 | const unsigned char *nh = skb_network_header(skb); | ||
72 | 65 | ||
73 | if (nh[IP6CB(skb)->nhoff] != IPPROTO_IPV6 && | 66 | if (XFRM_MODE_SKB_CB(skb)->protocol != IPPROTO_IPV6) |
74 | nh[IP6CB(skb)->nhoff] != IPPROTO_IPIP) | ||
75 | goto out; | 67 | goto out; |
76 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) | 68 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) |
77 | goto out; | 69 | goto out; |
@@ -80,18 +72,12 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) | |||
80 | (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) | 72 | (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) |
81 | goto out; | 73 | goto out; |
82 | 74 | ||
83 | nh = skb_network_header(skb); | 75 | if (x->props.flags & XFRM_STATE_DECAP_DSCP) |
84 | if (nh[IP6CB(skb)->nhoff] == IPPROTO_IPV6) { | 76 | ipv6_copy_dscp(ipv6_get_dsfield(ipv6_hdr(skb)), |
85 | if (x->props.flags & XFRM_STATE_DECAP_DSCP) | 77 | ipipv6_hdr(skb)); |
86 | ipv6_copy_dscp(ipv6_get_dsfield(ipv6_hdr(skb)), | 78 | if (!(x->props.flags & XFRM_STATE_NOECN)) |
87 | ipipv6_hdr(skb)); | 79 | ipip6_ecn_decapsulate(skb); |
88 | if (!(x->props.flags & XFRM_STATE_NOECN)) | 80 | |
89 | ipip6_ecn_decapsulate(skb); | ||
90 | } else { | ||
91 | if (!(x->props.flags & XFRM_STATE_NOECN)) | ||
92 | ip6ip_ecn_decapsulate(skb); | ||
93 | skb->protocol = htons(ETH_P_IP); | ||
94 | } | ||
95 | old_mac = skb_mac_header(skb); | 81 | old_mac = skb_mac_header(skb); |
96 | skb_set_mac_header(skb, -skb->mac_len); | 82 | skb_set_mac_header(skb, -skb->mac_len); |
97 | memmove(skb_mac_header(skb), old_mac, skb->mac_len); | 83 | memmove(skb_mac_header(skb), old_mac, skb->mac_len); |
@@ -103,7 +89,8 @@ out: | |||
103 | } | 89 | } |
104 | 90 | ||
105 | static struct xfrm_mode xfrm6_tunnel_mode = { | 91 | static struct xfrm_mode xfrm6_tunnel_mode = { |
106 | .input = xfrm6_tunnel_input, | 92 | .input2 = xfrm6_tunnel_input, |
93 | .input = xfrm_prepare_input, | ||
107 | .output2 = xfrm6_tunnel_output, | 94 | .output2 = xfrm6_tunnel_output, |
108 | .output = xfrm6_prepare_output, | 95 | .output = xfrm6_prepare_output, |
109 | .owner = THIS_MODULE, | 96 | .owner = THIS_MODULE, |