]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ax25/ax25_in.c
[SK_BUFF]: Introduce skb_reset_transport_header(skb)
[net-next-2.6.git] / net / ax25 / ax25_in.c
index 73cfc3411c461d50d7dbb7d718dd3e2315d26428..724ad5ce75d45f223b0b630eef318b9ade9f374b 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/socket.h>
 #include <linux/in.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/timer.h>
 #include <linux/string.h>
 #include <linux/sockios.h>
@@ -62,8 +61,8 @@ static int ax25_rx_fragment(ax25_cb *ax25, struct sk_buff *skb)
                                        skb_reserve(skbn, AX25_MAX_HEADER_LEN);
 
                                        skbn->dev   = ax25->ax25_dev->dev;
-                                       skbn->h.raw = skbn->data;
-                                       skbn->nh.raw = skbn->data;
+                                       skb_reset_network_header(skbn);
+                                       skb_reset_transport_header(skbn);
 
                                        /* Copy data from the fragments */
                                        while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL) {
@@ -102,8 +101,8 @@ static int ax25_rx_fragment(ax25_cb *ax25, struct sk_buff *skb)
 int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
 {
        int (*func)(struct sk_buff *, ax25_cb *);
-       volatile int queued = 0;
        unsigned char pid;
+       int queued = 0;
 
        if (skb == NULL) return 0;
 
@@ -123,8 +122,8 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
                }
 
                skb_pull(skb, 1);       /* Remove PID */
-               skb->mac.raw  = skb->nh.raw;
-               skb->nh.raw   = skb->data;
+               skb_reset_mac_header(skb);
+               skb_reset_network_header(skb);
                skb->dev      = ax25->ax25_dev->dev;
                skb->pkt_type = PACKET_HOST;
                skb->protocol = htons(ETH_P_IP);
@@ -197,7 +196,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
         *      Process the AX.25/LAPB frame.
         */
 
-       skb->h.raw = skb->data;
+       skb_reset_transport_header(skb);
 
        if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) {
                kfree_skb(skb);
@@ -247,8 +246,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
                switch (skb->data[1]) {
                case AX25_P_IP:
                        skb_pull(skb,2);                /* drop PID/CTRL */
-                       skb->h.raw    = skb->data;
-                       skb->nh.raw   = skb->data;
+                       skb_reset_transport_header(skb);
+                       skb_reset_network_header(skb);
                        skb->dev      = dev;
                        skb->pkt_type = PACKET_HOST;
                        skb->protocol = htons(ETH_P_IP);
@@ -257,8 +256,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
 
                case AX25_P_ARP:
                        skb_pull(skb,2);
-                       skb->h.raw    = skb->data;
-                       skb->nh.raw   = skb->data;
+                       skb_reset_transport_header(skb);
+                       skb_reset_network_header(skb);
                        skb->dev      = dev;
                        skb->pkt_type = PACKET_HOST;
                        skb->protocol = htons(ETH_P_ARP);
@@ -401,10 +400,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
        }
 
        if (dp.ndigi == 0) {
-               if (ax25->digipeat != NULL) {
-                       kfree(ax25->digipeat);
-                       ax25->digipeat = NULL;
-               }
+               kfree(ax25->digipeat);
+               ax25->digipeat = NULL;
        } else {
                /* Reverse the source SABM's path */
                memcpy(ax25->digipeat, &reverse_dp, sizeof(ax25_digi));