diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-11 21:39:41 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:25:01 -0400 |
commit | c14d2450cb7fe1786e2ec325172baf66922bf597 (patch) | |
tree | 1186bfb1ed197e81a1ff816a513ad69503d5d786 | |
parent | 878c814500b123dd61a5e211879a32e5fd932713 (diff) |
[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 <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/skbuff.h | 5 | ||||
-rw-r--r-- | net/ax25/ax25_out.c | 6 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 3 | ||||
-rw-r--r-- | 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 76d30f34b986..870438fba93f 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) | |||
970 | skb->nh.raw = skb->data; | 970 | skb->nh.raw = skb->data; |
971 | } | 971 | } |
972 | 972 | ||
973 | static inline void skb_set_network_header(struct sk_buff *skb, const int offset) | ||
974 | { | ||
975 | skb->nh.raw = skb->data + offset; | ||
976 | } | ||
977 | |||
973 | static inline int skb_network_offset(const struct sk_buff *skb) | 978 | static inline int skb_network_offset(const struct sk_buff *skb) |
974 | { | 979 | { |
975 | return skb->nh.raw - skb->data; | 980 | return skb->nh.raw - skb->data; |
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c index 02dea851a11a..e66953ce53e7 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) | |||
148 | 148 | ||
149 | if (ka9qfrag == 1) { | 149 | if (ka9qfrag == 1) { |
150 | skb_reserve(skbn, frontlen + 2); | 150 | skb_reserve(skbn, frontlen + 2); |
151 | skbn->nh.raw = skbn->data + skb_network_offset(skb); | 151 | skb_set_network_header(skbn, |
152 | skb_network_offset(skb)); | ||
152 | memcpy(skb_put(skbn, len), skb->data, len); | 153 | memcpy(skb_put(skbn, len), skb->data, len); |
153 | p = skb_push(skbn, 2); | 154 | p = skb_push(skbn, 2); |
154 | 155 | ||
@@ -161,7 +162,8 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) | |||
161 | } | 162 | } |
162 | } else { | 163 | } else { |
163 | skb_reserve(skbn, frontlen + 1); | 164 | skb_reserve(skbn, frontlen + 1); |
164 | skbn->nh.raw = skbn->data + skb_network_offset(skb); | 165 | skb_set_network_header(skbn, |
166 | skb_network_offset(skb)); | ||
165 | memcpy(skb_put(skbn, len), skb->data, len); | 167 | memcpy(skb_put(skbn, len), skb->data, len); |
166 | p = skb_push(skbn, 1); | 168 | p = skb_push(skbn, 1); |
167 | *p = AX25_P_TEXT; | 169 | *p = AX25_P_TEXT; |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index eae228469627..15de9d43950e 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -928,9 +928,9 @@ alloc_new_skb: | |||
928 | * Find where to start putting bytes. | 928 | * Find where to start putting bytes. |
929 | */ | 929 | */ |
930 | data = skb_put(skb, fraglen); | 930 | data = skb_put(skb, fraglen); |
931 | skb->nh.raw = data + exthdrlen; | 931 | skb_set_network_header(skb, exthdrlen); |
932 | skb->h.raw = skb->nh.raw + fragheaderlen; | ||
932 | data += fragheaderlen; | 933 | data += fragheaderlen; |
933 | skb->h.raw = data + exthdrlen; | ||
934 | 934 | ||
935 | if (fraggap) { | 935 | if (fraggap) { |
936 | skb->csum = skb_copy_and_csum_bits( | 936 | skb->csum = skb_copy_and_csum_bits( |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 00190835cea1..5da823a32250 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, | |||
3634 | return; | 3634 | return; |
3635 | 3635 | ||
3636 | skb_set_mac_header(nskb, skb_mac_header(skb) - skb->head); | 3636 | skb_set_mac_header(nskb, skb_mac_header(skb) - skb->head); |
3637 | nskb->nh.raw = nskb->data + (skb_network_header(skb) - skb->head); | 3637 | skb_set_network_header(nskb, |
3638 | skb_network_header(skb) - skb->head); | ||
3638 | nskb->h.raw = nskb->data + (skb->h.raw - skb->head); | 3639 | nskb->h.raw = nskb->data + (skb->h.raw - skb->head); |
3639 | 3640 | ||
3640 | skb_reserve(nskb, header); | 3641 | skb_reserve(nskb, header); |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index f1dfcc319717..bd25825c0ccd 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1206,9 +1206,9 @@ alloc_new_skb: | |||
1206 | * Find where to start putting bytes | 1206 | * Find where to start putting bytes |
1207 | */ | 1207 | */ |
1208 | data = skb_put(skb, fraglen); | 1208 | data = skb_put(skb, fraglen); |
1209 | skb->nh.raw = data + exthdrlen; | 1209 | skb_set_network_header(skb, exthdrlen); |
1210 | data += fragheaderlen; | 1210 | data += fragheaderlen; |
1211 | skb->h.raw = data + exthdrlen; | 1211 | skb->h.raw = skb->nh.raw + fragheaderlen; |
1212 | 1212 | ||
1213 | if (fraggap) { | 1213 | if (fraggap) { |
1214 | skb->csum = skb_copy_and_csum_bits( | 1214 | skb->csum = skb_copy_and_csum_bits( |