diff options
Diffstat (limited to 'net/ipv6/xfrm6_mode_tunnel.c')
-rw-r--r-- | net/ipv6/xfrm6_mode_tunnel.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c index 8ce5ef2d0b1c..498f17b5c42f 100644 --- a/net/ipv6/xfrm6_mode_tunnel.c +++ b/net/ipv6/xfrm6_mode_tunnel.c | |||
@@ -87,9 +87,10 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) | |||
87 | { | 87 | { |
88 | int err = -EINVAL; | 88 | int err = -EINVAL; |
89 | const unsigned char *old_mac; | 89 | const unsigned char *old_mac; |
90 | const unsigned char *nh = skb_network_header(skb); | ||
90 | 91 | ||
91 | if (skb->nh.raw[IP6CB(skb)->nhoff] != IPPROTO_IPV6 | 92 | if (nh[IP6CB(skb)->nhoff] != IPPROTO_IPV6 && |
92 | && skb->nh.raw[IP6CB(skb)->nhoff] != IPPROTO_IPIP) | 93 | nh[IP6CB(skb)->nhoff] != IPPROTO_IPIP) |
93 | goto out; | 94 | goto out; |
94 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) | 95 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) |
95 | goto out; | 96 | goto out; |
@@ -98,7 +99,8 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) | |||
98 | (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) | 99 | (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) |
99 | goto out; | 100 | goto out; |
100 | 101 | ||
101 | if (skb->nh.raw[IP6CB(skb)->nhoff] == IPPROTO_IPV6) { | 102 | nh = skb_network_header(skb); |
103 | if (nh[IP6CB(skb)->nhoff] == IPPROTO_IPV6) { | ||
102 | if (x->props.flags & XFRM_STATE_DECAP_DSCP) | 104 | if (x->props.flags & XFRM_STATE_DECAP_DSCP) |
103 | ipv6_copy_dscp(skb->nh.ipv6h, skb->h.ipv6h); | 105 | ipv6_copy_dscp(skb->nh.ipv6h, skb->h.ipv6h); |
104 | if (!(x->props.flags & XFRM_STATE_NOECN)) | 106 | if (!(x->props.flags & XFRM_STATE_NOECN)) |