aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/skbuff.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r--include/linux/skbuff.h74
1 files changed, 52 insertions, 22 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index d7c839a21842..948527e42a60 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -27,6 +27,7 @@
27#include <linux/highmem.h> 27#include <linux/highmem.h>
28#include <linux/poll.h> 28#include <linux/poll.h>
29#include <linux/net.h> 29#include <linux/net.h>
30#include <linux/textsearch.h>
30#include <net/checksum.h> 31#include <net/checksum.h>
31 32
32#define HAVE_ALLOC_SKB /* For the drivers to know */ 33#define HAVE_ALLOC_SKB /* For the drivers to know */
@@ -182,7 +183,6 @@ struct skb_shared_info {
182 * @priority: Packet queueing priority 183 * @priority: Packet queueing priority
183 * @users: User count - see {datagram,tcp}.c 184 * @users: User count - see {datagram,tcp}.c
184 * @protocol: Packet protocol from driver 185 * @protocol: Packet protocol from driver
185 * @security: Security level of packet
186 * @truesize: Buffer size 186 * @truesize: Buffer size
187 * @head: Head of buffer 187 * @head: Head of buffer
188 * @data: Data head pointer 188 * @data: Data head pointer
@@ -248,18 +248,18 @@ struct sk_buff {
248 data_len, 248 data_len,
249 mac_len, 249 mac_len,
250 csum; 250 csum;
251 unsigned char local_df,
252 cloned:1,
253 nohdr:1,
254 pkt_type,
255 ip_summed;
256 __u32 priority; 251 __u32 priority;
257 unsigned short protocol, 252 __u8 local_df:1,
258 security; 253 cloned:1,
254 ip_summed:2,
255 nohdr:1;
256 /* 3 bits spare */
257 __u8 pkt_type;
258 __be16 protocol;
259 259
260 void (*destructor)(struct sk_buff *skb); 260 void (*destructor)(struct sk_buff *skb);
261#ifdef CONFIG_NETFILTER 261#ifdef CONFIG_NETFILTER
262 unsigned long nfmark; 262 unsigned long nfmark;
263 __u32 nfcache; 263 __u32 nfcache;
264 __u32 nfctinfo; 264 __u32 nfctinfo;
265 struct nf_conntrack *nfct; 265 struct nf_conntrack *nfct;
@@ -300,20 +300,26 @@ struct sk_buff {
300#include <asm/system.h> 300#include <asm/system.h>
301 301
302extern void __kfree_skb(struct sk_buff *skb); 302extern void __kfree_skb(struct sk_buff *skb);
303extern struct sk_buff *alloc_skb(unsigned int size, int priority); 303extern struct sk_buff *alloc_skb(unsigned int size,
304 unsigned int __nocast priority);
304extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, 305extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
305 unsigned int size, int priority); 306 unsigned int size,
307 unsigned int __nocast priority);
306extern void kfree_skbmem(struct sk_buff *skb); 308extern void kfree_skbmem(struct sk_buff *skb);
307extern struct sk_buff *skb_clone(struct sk_buff *skb, int priority); 309extern struct sk_buff *skb_clone(struct sk_buff *skb,
308extern struct sk_buff *skb_copy(const struct sk_buff *skb, int priority); 310 unsigned int __nocast priority);
309extern struct sk_buff *pskb_copy(struct sk_buff *skb, int gfp_mask); 311extern struct sk_buff *skb_copy(const struct sk_buff *skb,
312 unsigned int __nocast priority);
313extern struct sk_buff *pskb_copy(struct sk_buff *skb,
314 unsigned int __nocast gfp_mask);
310extern int pskb_expand_head(struct sk_buff *skb, 315extern int pskb_expand_head(struct sk_buff *skb,
311 int nhead, int ntail, int gfp_mask); 316 int nhead, int ntail,
317 unsigned int __nocast gfp_mask);
312extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, 318extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
313 unsigned int headroom); 319 unsigned int headroom);
314extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 320extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
315 int newheadroom, int newtailroom, 321 int newheadroom, int newtailroom,
316 int priority); 322 unsigned int __nocast priority);
317extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad); 323extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad);
318#define dev_kfree_skb(a) kfree_skb(a) 324#define dev_kfree_skb(a) kfree_skb(a)
319extern void skb_over_panic(struct sk_buff *skb, int len, 325extern void skb_over_panic(struct sk_buff *skb, int len,
@@ -321,6 +327,28 @@ extern void skb_over_panic(struct sk_buff *skb, int len,
321extern void skb_under_panic(struct sk_buff *skb, int len, 327extern void skb_under_panic(struct sk_buff *skb, int len,
322 void *here); 328 void *here);
323 329
330struct skb_seq_state
331{
332 __u32 lower_offset;
333 __u32 upper_offset;
334 __u32 frag_idx;
335 __u32 stepped_offset;
336 struct sk_buff *root_skb;
337 struct sk_buff *cur_skb;
338 __u8 *frag_data;
339};
340
341extern void skb_prepare_seq_read(struct sk_buff *skb,
342 unsigned int from, unsigned int to,
343 struct skb_seq_state *st);
344extern unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
345 struct skb_seq_state *st);
346extern void skb_abort_seq_read(struct skb_seq_state *st);
347
348extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
349 unsigned int to, struct ts_config *config,
350 struct ts_state *state);
351
324/* Internal */ 352/* Internal */
325#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) 353#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end))
326 354
@@ -442,7 +470,8 @@ static inline int skb_shared(const struct sk_buff *skb)
442 * 470 *
443 * NULL is returned on a memory allocation failure. 471 * NULL is returned on a memory allocation failure.
444 */ 472 */
445static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) 473static inline struct sk_buff *skb_share_check(struct sk_buff *skb,
474 unsigned int __nocast pri)
446{ 475{
447 might_sleep_if(pri & __GFP_WAIT); 476 might_sleep_if(pri & __GFP_WAIT);
448 if (skb_shared(skb)) { 477 if (skb_shared(skb)) {
@@ -473,7 +502,8 @@ static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri)
473 * 502 *
474 * %NULL is returned on a memory allocation failure. 503 * %NULL is returned on a memory allocation failure.
475 */ 504 */
476static inline struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) 505static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
506 unsigned int __nocast pri)
477{ 507{
478 might_sleep_if(pri & __GFP_WAIT); 508 might_sleep_if(pri & __GFP_WAIT);
479 if (skb_cloned(skb)) { 509 if (skb_cloned(skb)) {
@@ -979,7 +1009,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
979 * %NULL is returned in there is no free memory. 1009 * %NULL is returned in there is no free memory.
980 */ 1010 */
981static inline struct sk_buff *__dev_alloc_skb(unsigned int length, 1011static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
982 int gfp_mask) 1012 unsigned int __nocast gfp_mask)
983{ 1013{
984 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask); 1014 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask);
985 if (likely(skb)) 1015 if (likely(skb))
@@ -1092,8 +1122,8 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
1092 * If there is no free memory -ENOMEM is returned, otherwise zero 1122 * If there is no free memory -ENOMEM is returned, otherwise zero
1093 * is returned and the old skb data released. 1123 * is returned and the old skb data released.
1094 */ 1124 */
1095extern int __skb_linearize(struct sk_buff *skb, int gfp); 1125extern int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp);
1096static inline int skb_linearize(struct sk_buff *skb, int gfp) 1126static inline int skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp)
1097{ 1127{
1098 return __skb_linearize(skb, gfp); 1128 return __skb_linearize(skb, gfp);
1099} 1129}
@@ -1188,7 +1218,7 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1188{ 1218{
1189 int hlen = skb_headlen(skb); 1219 int hlen = skb_headlen(skb);
1190 1220
1191 if (offset + len <= hlen) 1221 if (hlen - offset >= len)
1192 return skb->data + offset; 1222 return skb->data + offset;
1193 1223
1194 if (skb_copy_bits(skb, offset, buffer, len) < 0) 1224 if (skb_copy_bits(skb, offset, buffer, len) < 0)