update iptables to 1.4.0 (2.6 kernels only), refresh kernel patches
[openwrt/staging/wigyori.git] / target / linux / generic-2.6 / patches / 999-backport_ip_hdr_and_friends.patch
1 Index: linux-2.6.21.7/include/linux/ip.h
2 ===================================================================
3 --- linux-2.6.21.7.orig/include/linux/ip.h
4 +++ linux-2.6.21.7/include/linux/ip.h
5 @@ -104,6 +104,16 @@ struct iphdr {
6 /*The options start here. */
7 };
8
9 +#ifdef __KERNEL__
10 +#include <linux/skbuff.h>
11 +
12 +static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
13 +{
14 + return (struct iphdr *)skb_network_header(skb);
15 +}
16 +
17 +#endif
18 +
19 struct ip_auth_hdr {
20 __u8 nexthdr;
21 __u8 hdrlen; /* This one is measured in 32 bit units! */
22 Index: linux-2.6.21.7/include/linux/skbuff.h
23 ===================================================================
24 --- linux-2.6.21.7.orig/include/linux/skbuff.h
25 +++ linux-2.6.21.7/include/linux/skbuff.h
26 @@ -966,6 +966,16 @@ static inline void skb_reserve(struct sk
27 skb->tail += len;
28 }
29
30 +static inline unsigned char *skb_network_header(const struct sk_buff *skb)
31 +{
32 + return skb->nh.raw;
33 +}
34 +
35 +static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
36 +{
37 + return skb->tail;
38 +}
39 +
40 /*
41 * CPUs often take a performance hit when accessing unaligned memory
42 * locations. The actual performance hit varies, it can be small if the
43 Index: linux-2.6.21.7/include/net/ip.h
44 ===================================================================
45 --- linux-2.6.21.7.orig/include/net/ip.h
46 +++ linux-2.6.21.7/include/net/ip.h
47 @@ -43,6 +43,11 @@ struct inet_skb_parm
48 #define IPSKB_REROUTED 16
49 };
50
51 +static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
52 +{
53 + return ip_hdr(skb)->ihl * 4;
54 +}
55 +
56 struct ipcm_cookie
57 {
58 __be32 addr;