1 #ifndef __LINUX_SKBUFF_WRAPPER_H
2 #define __LINUX_SKBUFF_WRAPPER_H 1
4 #include_next <linux/skbuff.h>
6 #include <linux/version.h>
8 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
9 /* Emulate Linux 2.6.17 and later behavior, in which kfree_skb silently ignores
10 * null pointer arguments. */
11 #define kfree_skb(skb) kfree_skb_maybe_null(skb)
12 static inline void kfree_skb_maybe_null(struct sk_buff *skb)
14 if (likely(skb != NULL))
19 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
21 #define mac_header mac.raw
22 #define network_header nh.raw
25 /* Note that CHECKSUM_PARTIAL is not implemented, but this allows us to at
26 * least test against it: see update_csum() in forward.c. */
27 #define CHECKSUM_PARTIAL 3
28 #define CHECKSUM_COMPLETE CHECKSUM_HW
30 static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
35 static inline void skb_set_transport_header(struct sk_buff *skb,
38 skb->h.raw = skb->data + offset;
41 static inline unsigned char *skb_network_header(const struct sk_buff *skb)
46 static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
48 skb->nh.raw = skb->data + offset;
51 static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
56 static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
58 skb->mac.raw = skb->data + offset;
61 #endif /* linux kernel < 2.6.22 */