1 --- a/include/linux/ip.h
2 +++ b/include/linux/ip.h
3 @@ -104,6 +104,16 @@ struct iphdr {
4 /*The options start here. */
8 +#include <linux/skbuff.h>
10 +static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
12 + return (struct iphdr *)skb_network_header(skb);
19 __u8 hdrlen; /* This one is measured in 32 bit units! */
20 --- a/include/linux/skbuff.h
21 +++ b/include/linux/skbuff.h
22 @@ -966,6 +966,16 @@ static inline void skb_reserve(struct sk
26 +static inline unsigned char *skb_network_header(const struct sk_buff *skb)
31 +static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
37 * CPUs often take a performance hit when accessing unaligned memory
38 * locations. The actual performance hit varies, it can be small if the
39 --- a/include/net/ip.h
40 +++ b/include/net/ip.h
41 @@ -43,6 +43,11 @@ struct inet_skb_parm
42 #define IPSKB_REROUTED 16
45 +static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
47 + return ip_hdr(skb)->ihl * 4;