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.h87
1 files changed, 52 insertions, 35 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index cc04f5cd2286..0061c9470482 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
@@ -193,7 +193,6 @@ struct skb_shared_info {
193 * @nfcache: Cache info 193 * @nfcache: Cache info
194 * @nfct: Associated connection, if any 194 * @nfct: Associated connection, if any
195 * @nfctinfo: Relationship of this skb to the connection 195 * @nfctinfo: Relationship of this skb to the connection
196 * @nf_debug: Netfilter debugging
197 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 196 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
198 * @private: Data which is private to the HIPPI implementation 197 * @private: Data which is private to the HIPPI implementation
199 * @tc_index: Traffic control index 198 * @tc_index: Traffic control index
@@ -249,24 +248,21 @@ struct sk_buff {
249 data_len, 248 data_len,
250 mac_len, 249 mac_len,
251 csum; 250 csum;
252 unsigned char local_df,
253 cloned:1,
254 nohdr:1,
255 pkt_type,
256 ip_summed;
257 __u32 priority; 251 __u32 priority;
258 unsigned short protocol, 252 __u8 local_df:1,
259 security; 253 cloned:1,
254 ip_summed:2,
255 nohdr:1;
256 /* 3 bits spare */
257 __u8 pkt_type;
258 __u16 protocol;
260 259
261 void (*destructor)(struct sk_buff *skb); 260 void (*destructor)(struct sk_buff *skb);
262#ifdef CONFIG_NETFILTER 261#ifdef CONFIG_NETFILTER
263 unsigned long nfmark; 262 unsigned long nfmark;
264 __u32 nfcache; 263 __u32 nfcache;
265 __u32 nfctinfo; 264 __u32 nfctinfo;
266 struct nf_conntrack *nfct; 265 struct nf_conntrack *nfct;
267#ifdef CONFIG_NETFILTER_DEBUG
268 unsigned int nf_debug;
269#endif
270#ifdef CONFIG_BRIDGE_NETFILTER 266#ifdef CONFIG_BRIDGE_NETFILTER
271 struct nf_bridge_info *nf_bridge; 267 struct nf_bridge_info *nf_bridge;
272#endif 268#endif
@@ -304,20 +300,26 @@ struct sk_buff {
304#include <asm/system.h> 300#include <asm/system.h>
305 301
306extern void __kfree_skb(struct sk_buff *skb); 302extern void __kfree_skb(struct sk_buff *skb);
307extern struct sk_buff *alloc_skb(unsigned int size, int priority); 303extern struct sk_buff *alloc_skb(unsigned int size,
304 unsigned int __nocast priority);
308extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, 305extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
309 unsigned int size, int priority); 306 unsigned int size,
307 unsigned int __nocast priority);
310extern void kfree_skbmem(struct sk_buff *skb); 308extern void kfree_skbmem(struct sk_buff *skb);
311extern struct sk_buff *skb_clone(struct sk_buff *skb, int priority); 309extern struct sk_buff *skb_clone(struct sk_buff *skb,
312extern struct sk_buff *skb_copy(const struct sk_buff *skb, int priority); 310 unsigned int __nocast priority);
313extern 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);
314extern int pskb_expand_head(struct sk_buff *skb, 315extern int pskb_expand_head(struct sk_buff *skb,
315 int nhead, int ntail, int gfp_mask); 316 int nhead, int ntail,
317 unsigned int __nocast gfp_mask);
316extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, 318extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
317 unsigned int headroom); 319 unsigned int headroom);
318extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 320extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
319 int newheadroom, int newtailroom, 321 int newheadroom, int newtailroom,
320 int priority); 322 unsigned int __nocast priority);
321extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad); 323extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad);
322#define dev_kfree_skb(a) kfree_skb(a) 324#define dev_kfree_skb(a) kfree_skb(a)
323extern void skb_over_panic(struct sk_buff *skb, int len, 325extern void skb_over_panic(struct sk_buff *skb, int len,
@@ -325,6 +327,28 @@ extern void skb_over_panic(struct sk_buff *skb, int len,
325extern void skb_under_panic(struct sk_buff *skb, int len, 327extern void skb_under_panic(struct sk_buff *skb, int len,
326 void *here); 328 void *here);
327 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
328/* Internal */ 352/* Internal */
329#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) 353#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end))
330 354
@@ -446,7 +470,8 @@ static inline int skb_shared(const struct sk_buff *skb)
446 * 470 *
447 * NULL is returned on a memory allocation failure. 471 * NULL is returned on a memory allocation failure.
448 */ 472 */
449static 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)
450{ 475{
451 might_sleep_if(pri & __GFP_WAIT); 476 might_sleep_if(pri & __GFP_WAIT);
452 if (skb_shared(skb)) { 477 if (skb_shared(skb)) {
@@ -477,7 +502,8 @@ static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri)
477 * 502 *
478 * %NULL is returned on a memory allocation failure. 503 * %NULL is returned on a memory allocation failure.
479 */ 504 */
480static 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)
481{ 507{
482 might_sleep_if(pri & __GFP_WAIT); 508 might_sleep_if(pri & __GFP_WAIT);
483 if (skb_cloned(skb)) { 509 if (skb_cloned(skb)) {
@@ -983,7 +1009,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
983 * %NULL is returned in there is no free memory. 1009 * %NULL is returned in there is no free memory.
984 */ 1010 */
985static inline struct sk_buff *__dev_alloc_skb(unsigned int length, 1011static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
986 int gfp_mask) 1012 unsigned int __nocast gfp_mask)
987{ 1013{
988 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask); 1014 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask);
989 if (likely(skb)) 1015 if (likely(skb))
@@ -1096,8 +1122,8 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
1096 * If there is no free memory -ENOMEM is returned, otherwise zero 1122 * If there is no free memory -ENOMEM is returned, otherwise zero
1097 * is returned and the old skb data released. 1123 * is returned and the old skb data released.
1098 */ 1124 */
1099extern int __skb_linearize(struct sk_buff *skb, int gfp); 1125extern int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp);
1100static inline int skb_linearize(struct sk_buff *skb, int gfp) 1126static inline int skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp)
1101{ 1127{
1102 return __skb_linearize(skb, gfp); 1128 return __skb_linearize(skb, gfp);
1103} 1129}
@@ -1192,7 +1218,7 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1192{ 1218{
1193 int hlen = skb_headlen(skb); 1219 int hlen = skb_headlen(skb);
1194 1220
1195 if (offset + len <= hlen) 1221 if (hlen - offset >= len)
1196 return skb->data + offset; 1222 return skb->data + offset;
1197 1223
1198 if (skb_copy_bits(skb, offset, buffer, len) < 0) 1224 if (skb_copy_bits(skb, offset, buffer, len) < 0)
@@ -1219,15 +1245,6 @@ static inline void nf_reset(struct sk_buff *skb)
1219{ 1245{
1220 nf_conntrack_put(skb->nfct); 1246 nf_conntrack_put(skb->nfct);
1221 skb->nfct = NULL; 1247 skb->nfct = NULL;
1222#ifdef CONFIG_NETFILTER_DEBUG
1223 skb->nf_debug = 0;
1224#endif
1225}
1226static inline void nf_reset_debug(struct sk_buff *skb)
1227{
1228#ifdef CONFIG_NETFILTER_DEBUG
1229 skb->nf_debug = 0;
1230#endif
1231} 1248}
1232 1249
1233#ifdef CONFIG_BRIDGE_NETFILTER 1250#ifdef CONFIG_BRIDGE_NETFILTER