Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c14d2450cb7fe1786e2ec325172baf66922bf597
Commit:     c14d2450cb7fe1786e2ec325172baf66922bf597
Parent:     878c814500b123dd61a5e211879a32e5fd932713
Author:     Arnaldo Carvalho de Melo <[EMAIL PROTECTED]>
AuthorDate: Sun Mar 11 22:39:41 2007 -0300
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Apr 25 22:25:01 2007 -0700

    [SK_BUFF]: Introduce skb_set_network_header
    
    For the cases where the network header is being set to a offset from 
skb->data.
    
    Signed-off-by: Arnaldo Carvalho de Melo <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 include/linux/skbuff.h |    5 +++++
 net/ax25/ax25_out.c    |    6 ++++--
 net/ipv4/ip_output.c   |    4 ++--
 net/ipv4/tcp_input.c   |    3 ++-
 net/ipv6/ip6_output.c  |    4 ++--
 5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 76d30f3..870438f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -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;
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c
index 02dea85..e66953c 100644
--- a/net/ax25/ax25_out.c
+++ b/net/ax25/ax25_out.c
@@ -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;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index eae2284..15de9d4 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -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(
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 0019083..5da823a 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -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);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index f1dfcc3..bd25825 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -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(
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to