]> err.no Git - linux-2.6/commitdiff
[SK_BUFF]: Introduce skb_set_network_header
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 12 Mar 2007 01:39:41 +0000 (22:39 -0300)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:25:01 +0000 (22:25 -0700)
For the cases where the network header is being set to a offset from skb->data.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h
net/ax25/ax25_out.c
net/ipv4/ip_output.c
net/ipv4/tcp_input.c
net/ipv6/ip6_output.c

index 76d30f34b98607992edab503e6e1a2dd45f40b31..870438fba93fae2be33dabc347da20ea591730ee 100644 (file)
@@ -970,6 +970,11 @@ static inline void skb_reset_network_header(struct sk_buff *skb)
        skb->nh.raw = skb->data;
 }
 
+static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
+{
+       skb->nh.raw = skb->data + offset;
+}
+
 static inline int skb_network_offset(const struct sk_buff *skb)
 {
        return skb->nh.raw - skb->data;
index 02dea851a11a0f0aaffacdd908c2348305a136b7..e66953ce53e74ccc5f55b54867e6a67d04a6eca1 100644 (file)
@@ -148,7 +148,8 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
 
                        if (ka9qfrag == 1) {
                                skb_reserve(skbn, frontlen + 2);
-                               skbn->nh.raw = skbn->data + skb_network_offset(skb);
+                               skb_set_network_header(skbn,
+                                                     skb_network_offset(skb));
                                memcpy(skb_put(skbn, len), skb->data, len);
                                p = skb_push(skbn, 2);
 
@@ -161,7 +162,8 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
                                }
                        } else {
                                skb_reserve(skbn, frontlen + 1);
-                               skbn->nh.raw = skbn->data + skb_network_offset(skb);
+                               skb_set_network_header(skbn,
+                                                     skb_network_offset(skb));
                                memcpy(skb_put(skbn, len), skb->data, len);
                                p = skb_push(skbn, 1);
                                *p = AX25_P_TEXT;
index eae22846962796b6d8280506b44a2d43ebbbbdf2..15de9d43950e061baa20e09c8a1cd86a1578955e 100644 (file)
@@ -928,9 +928,9 @@ alloc_new_skb:
                         *      Find where to start putting bytes.
                         */
                        data = skb_put(skb, fraglen);
-                       skb->nh.raw = data + exthdrlen;
+                       skb_set_network_header(skb, exthdrlen);
+                       skb->h.raw = skb->nh.raw + fragheaderlen;
                        data += fragheaderlen;
-                       skb->h.raw = data + exthdrlen;
 
                        if (fraggap) {
                                skb->csum = skb_copy_and_csum_bits(
index 00190835cea150377c48227a1919a18057ac571d..5da823a322508c7002a52928d1aa9de7036c9856 100644 (file)
@@ -3634,7 +3634,8 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list,
                        return;
 
                skb_set_mac_header(nskb, skb_mac_header(skb) - skb->head);
-               nskb->nh.raw = nskb->data + (skb_network_header(skb) - skb->head);
+               skb_set_network_header(nskb,
+                                      skb_network_header(skb) - skb->head);
                nskb->h.raw = nskb->data + (skb->h.raw - skb->head);
 
                skb_reserve(nskb, header);
index f1dfcc319717738217e6625d5f7fd21cfc9db69c..bd25825c0ccd48d4bad6cfdea1e1c0ed937d8d4c 100644 (file)
@@ -1206,9 +1206,9 @@ alloc_new_skb:
                         *      Find where to start putting bytes
                         */
                        data = skb_put(skb, fraglen);
-                       skb->nh.raw = data + exthdrlen;
+                       skb_set_network_header(skb, exthdrlen);
                        data += fragheaderlen;
-                       skb->h.raw = data + exthdrlen;
+                       skb->h.raw = skb->nh.raw + fragheaderlen;
 
                        if (fraggap) {
                                skb->csum = skb_copy_and_csum_bits(