]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv4/ip_gre.c
[SK_BUFF]: Use skb_reset_network_header in skb_push cases
[net-next-2.6.git] / net / ipv4 / ip_gre.c
index 476cb6084c75047026980d44d7ba43b4da39a0cd..f84ca6668fb90382309ac581a513d3b62226467c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *     Linux NET3:     GRE over IP protocol decoder. 
+ *     Linux NET3:     GRE over IP protocol decoder.
  *
  *     Authors: Alexey Kuznetsov (kuznet@ms2.inr.ac.ru)
  *
@@ -13,7 +13,6 @@
 #include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/types.h>
-#include <linux/sched.h>
 #include <linux/kernel.h>
 #include <asm/uaccess.h>
 #include <linux/skbuff.h>
@@ -63,7 +62,7 @@
    solution, but it supposes maintaing new variable in ALL
    skb, even if no tunneling is used.
 
-   Current solution: t->recursion lock breaks dead loops. It looks 
+   Current solution: t->recursion lock breaks dead loops. It looks
    like dev->tbusy flag, but I preferred new variable, because
    the semantics is different. One day, when hard_start_xmit
    will be multithreaded we will have to use skb->encapsulation.
@@ -475,7 +474,7 @@ out:
        dst_release(skb2->dst);
        skb2->dst = NULL;
        skb_pull(skb2, skb->data - (u8*)eiph);
-       skb2->nh.raw = skb2->data;
+       skb_reset_network_header(skb2);
 
        /* Try to guess incoming interface */
        memset(&fl, 0, sizeof(fl));
@@ -613,11 +612,11 @@ static int ipgre_rcv(struct sk_buff *skb)
                if (flags == 0 &&
                    skb->protocol == htons(ETH_P_WCCP)) {
                        skb->protocol = htons(ETH_P_IP);
-                       if ((*(h + offset) & 0xF0) != 0x40) 
+                       if ((*(h + offset) & 0xF0) != 0x40)
                                offset += 4;
                }
 
-               skb->mac.raw = skb->nh.raw;
+               skb_reset_mac_header(skb);
                skb->nh.raw = __pskb_pull(skb, offset);
                skb_postpull_rcsum(skb, skb->h.raw, offset);
                skb->pkt_type = PACKET_HOST;
@@ -816,7 +815,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
                struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
                if (!new_skb) {
                        ip_rt_put(rt);
-                       stats->tx_dropped++;
+                       stats->tx_dropped++;
                        dev_kfree_skb(skb);
                        tunnel->recursion--;
                        return 0;
@@ -829,7 +828,8 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
        skb->h.raw = skb->nh.raw;
-       skb->nh.raw = skb_push(skb, gre_hlen);
+       skb_push(skb, gre_hlen);
+       skb_reset_network_header(skb);
        memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
        IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
                              IPSKB_REROUTED);
@@ -1008,7 +1008,8 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
                                goto done;
                        dev = t->dev;
                }
-               err = unregister_netdevice(dev);
+               unregister_netdevice(dev);
+               err = 0;
                break;
 
        default:
@@ -1043,7 +1044,7 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
    so that I had to set ARPHRD_IPGRE to a random value.
    I have an impression, that Cisco could make something similar,
    but this feature is apparently missing in IOS<=11.2(8).
-   
+
    I set up 10.66.66/24 and fec0:6666:6666::0/96 as virtual networks
    with broadcast 224.66.66.66. If you have access to mbone, play with me :-)
 
@@ -1075,9 +1076,9 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh
        p[1]            = htons(type);
 
        /*
-        *      Set the source hardware address. 
+        *      Set the source hardware address.
         */
-        
+
        if (saddr)
                memcpy(&iph->saddr, saddr, 4);
 
@@ -1087,7 +1088,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh
        }
        if (iph->daddr && !MULTICAST(iph->daddr))
                return t->hlen;
-       
+
        return -t->hlen;
 }