[SK_BUFF]: Introduce skb_reset_network_header(skb)
[powerpc.git] / net / ipv6 / xfrm6_mode_tunnel.c
index 0bc866c..8ce5ef2 100644 (file)
@@ -53,7 +53,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
        skb_push(skb, x->props.header_len);
        iph = skb->nh.ipv6h;
 
-       skb->nh.raw = skb->data;
+       skb_reset_network_header(skb);
        top_iph = skb->nh.ipv6h;
        skb->nh.raw = &top_iph->nexthdr;
        skb->h.ipv6h = top_iph + 1;
@@ -86,6 +86,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
 static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
 {
        int err = -EINVAL;
+       const unsigned char *old_mac;
 
        if (skb->nh.raw[IP6CB(skb)->nhoff] != IPPROTO_IPV6
            && skb->nh.raw[IP6CB(skb)->nhoff] != IPPROTO_IPIP)
@@ -107,9 +108,10 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
                        ip6ip_ecn_decapsulate(skb);
                skb->protocol = htons(ETH_P_IP);
        }
-       skb->mac.raw = memmove(skb->data - skb->mac_len,
-                              skb->mac.raw, skb->mac_len);
-       skb->nh.raw = skb->data;
+       old_mac = skb_mac_header(skb);
+       skb_set_mac_header(skb, -skb->mac_len);
+       memmove(skb_mac_header(skb), old_mac, skb->mac_len);
+       skb_reset_network_header(skb);
        err = 0;
 
 out: