aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2013-05-28 16:34:29 -0400
committerDavid S. Miller <davem@davemloft.net>2013-05-29 02:49:07 -0400
commit7cc461900549fc480eb133948649a1edb7eaaa6f (patch)
tree32782f0156c0eb27b2b188d7882e9c2e77d7c8c5 /include/linux
parent158874cac61245b84e939c92c53db7000122b7b0 (diff)
net, ipv4, ipv6: Correct assignment of skb->network_header to skb->tail
This corrects an regression introduced by "net: Use 16bits for *_headers fields of struct skbuff" when NET_SKBUFF_DATA_USES_OFFSET is not set. In that case skb->tail will be a pointer however skb->network_header is now an offset. This patch corrects the problem by adding a wrapper to return skb tail as an offset regardless of the value of NET_SKBUFF_DATA_USES_OFFSET. It seems that skb->tail that this offset may be more than 64k and some care has been taken to treat such cases as an error. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/skbuff.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 8f2b830772a8..5f931191cf57 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1391,6 +1391,11 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
1391 skb_reset_tail_pointer(skb); 1391 skb_reset_tail_pointer(skb);
1392 skb->tail += offset; 1392 skb->tail += offset;
1393} 1393}
1394
1395static inline unsigned long skb_tail_offset(const struct sk_buff *skb)
1396{
1397 return skb->tail;
1398}
1394#else /* NET_SKBUFF_DATA_USES_OFFSET */ 1399#else /* NET_SKBUFF_DATA_USES_OFFSET */
1395static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) 1400static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
1396{ 1401{
@@ -1407,6 +1412,10 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
1407 skb->tail = skb->data + offset; 1412 skb->tail = skb->data + offset;
1408} 1413}
1409 1414
1415static inline unsigned long skb_tail_offset(const struct sk_buff *skb)
1416{
1417 return skb->tail - skb->head;
1418}
1410#endif /* NET_SKBUFF_DATA_USES_OFFSET */ 1419#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1411 1420
1412/* 1421/*