[x86] grub: Natively build grub only on x86 linux hosts, cross compile everywhere...
[openwrt.git] / package / aodv-uu / patches / 005-linux_2.6.22_skbuff.patch
1 Index: aodv-uu-0.9.3/lnx/kaodv-compat.h
2 ===================================================================
3 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4 +++ aodv-uu-0.9.3/lnx/kaodv-compat.h 2007-06-17 02:49:46.844217144 +0200
5 @@ -0,0 +1,15 @@
6 +#ifndef __KAODV_COMPAT_H
7 +#define __KAODV_COMPAT_H
8 +
9 +#include <linux/version.h>
10 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
11 +
12 +#define ip_hdr(_skb) (_skb)->nh.iph
13 +#define skb_reset_network_header(_skb) do { \
14 + _skb->nh.iph = (struct iphdr *)_skb->data; \
15 + } while (0);
16 +
17 +
18 +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) */
19 +
20 +#endif
21 Index: aodv-uu-0.9.3/lnx/kaodv-ipenc.c
22 ===================================================================
23 --- aodv-uu-0.9.3.orig/lnx/kaodv-ipenc.c 2007-06-17 02:31:56.448941960 +0200
24 +++ aodv-uu-0.9.3/lnx/kaodv-ipenc.c 2007-06-17 02:45:50.420159064 +0200
25 @@ -64,7 +64,7 @@
26 if (skb->sk != NULL)
27 skb_set_owner_w(nskb, skb->sk);
28
29 - iph = skb->nh.iph;
30 + iph = ip_hdr(skb);
31
32 skb_put(nskb, sizeof(struct min_ipenc_hdr));
33
34 @@ -78,7 +78,8 @@
35 skb = nskb;
36
37 /* Update pointers */
38 - iph = skb->nh.iph = (struct iphdr *)skb->data;
39 + skb_reset_network_header(skb);
40 + iph = (struct iphdr *)skb->data;
41
42 ipe = (struct min_ipenc_hdr *)(skb->data + (iph->ihl << 2));
43
44 @@ -99,8 +100,8 @@
45
46 ip_send_check(iph);
47
48 - if (skb->nh.iph->id == 0)
49 - ip_select_ident(skb->nh.iph, skb->dst, NULL);
50 + if (ip_hdr(skb)->id == 0)
51 + ip_select_ident(ip_hdr(skb), skb->dst, NULL);
52
53 return skb;
54 }
55 @@ -108,9 +109,7 @@
56 struct sk_buff *ip_pkt_decapsulate(struct sk_buff *skb)
57 {
58 struct min_ipenc_hdr *ipe;
59 - /* skb->nh.iph is probably not set yet */
60 - struct iphdr *iph = skb->nh.iph;
61 -
62 + struct iphdr *iph = ip_hdr(skb);
63
64 ipe = (struct min_ipenc_hdr *)((char *)iph + (iph->ihl << 2));
65
66 @@ -123,8 +122,9 @@
67 skb->len - (iph->ihl << 2) - sizeof(struct min_ipenc_hdr));
68
69 skb_trim(skb, skb->len - sizeof(struct min_ipenc_hdr));
70 -
71 - skb->nh.iph = iph = (struct iphdr *)skb->data;
72 +
73 + skb_reset_network_header(skb);
74 + iph = (struct iphdr *)skb->data;
75
76 iph->tot_len = htons((ntohs(iph->tot_len) - sizeof(struct min_ipenc_hdr)));
77 ip_send_check(iph);
78 Index: aodv-uu-0.9.3/lnx/kaodv-ipenc.h
79 ===================================================================
80 --- aodv-uu-0.9.3.orig/lnx/kaodv-ipenc.h 2007-06-17 02:44:13.881835120 +0200
81 +++ aodv-uu-0.9.3/lnx/kaodv-ipenc.h 2007-06-17 02:44:16.549429584 +0200
82 @@ -27,6 +27,7 @@
83 #include <linux/ip.h>
84 #include <linux/skbuff.h>
85 #include <asm/byteorder.h>
86 +#include "kaodv-compat.h"
87
88 #define IPPROTO_MIPE 55
89
90 Index: aodv-uu-0.9.3/lnx/kaodv-mod.c
91 ===================================================================
92 --- aodv-uu-0.9.3.orig/lnx/kaodv-mod.c 2007-06-17 02:43:33.776931992 +0200
93 +++ aodv-uu-0.9.3/lnx/kaodv-mod.c 2007-06-17 02:43:39.008136728 +0200
94 @@ -120,7 +120,7 @@
95 const struct net_device *out,
96 int (*okfn) (struct sk_buff *))
97 {
98 - struct iphdr *iph = (*skb)->nh.iph;
99 + struct iphdr *iph = ip_hdr(*skb);
100 struct expl_entry e;
101 struct in_addr ifaddr, bcaddr;
102 int res = 0;
103 @@ -188,7 +188,7 @@
104 if (is_gateway && iph->protocol == IPPROTO_MIPE &&
105 iph->daddr == ifaddr.s_addr) {
106 ip_pkt_decapsulate(*skb);
107 - iph = (*skb)->nh.iph;
108 + iph = ip_hdr(*skb);
109 return NF_ACCEPT;
110 }
111 /* Ignore packets generated locally or that are for this
112 Index: aodv-uu-0.9.3/lnx/kaodv-mod.h
113 ===================================================================
114 --- aodv-uu-0.9.3.orig/lnx/kaodv-mod.h 2007-06-17 02:44:32.498005032 +0200
115 +++ aodv-uu-0.9.3/lnx/kaodv-mod.h 2007-06-17 02:44:34.662675952 +0200
116 @@ -5,6 +5,7 @@
117 #include <linux/inetdevice.h>
118 #include <linux/list.h>
119 #include <linux/spinlock.h>
120 +#include "kaodv-compat.h"
121
122 /* Interface information */
123 struct if_info {
124 Index: aodv-uu-0.9.3/lnx/kaodv-queue.c
125 ===================================================================
126 --- aodv-uu-0.9.3.orig/lnx/kaodv-queue.c 2007-06-17 02:45:01.513593992 +0200
127 +++ aodv-uu-0.9.3/lnx/kaodv-queue.c 2007-06-17 02:45:11.534070648 +0200
128 @@ -152,7 +152,7 @@
129 {
130 int status = -EINVAL;
131 struct kaodv_queue_entry *entry;
132 - struct iphdr *iph = skb->nh.iph;
133 + struct iphdr *iph = ip_hdr(skb);
134
135 entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
136
137 Index: aodv-uu-0.9.3/lnx/kaodv-queue.h
138 ===================================================================
139 --- aodv-uu-0.9.3.orig/lnx/kaodv-queue.h 2007-06-17 02:44:50.537262648 +0200
140 +++ aodv-uu-0.9.3/lnx/kaodv-queue.h 2007-06-17 02:44:53.629792512 +0200
141 @@ -21,6 +21,7 @@
142 *****************************************************************************/
143 #ifndef _KAODV_QUEUE_H
144 #define _KAODV_QUEUE_H
145 +#include "kaodv-compat.h"
146
147 #define KAODV_QUEUE_DROP 1
148 #define KAODV_QUEUE_SEND 2
149 Index: aodv-uu-0.9.3/lnx/kaodv-netlink.c
150 ===================================================================
151 --- aodv-uu-0.9.3.orig/lnx/kaodv-netlink.c 2007-06-17 02:47:48.927143264 +0200
152 +++ aodv-uu-0.9.3/lnx/kaodv-netlink.c 2007-06-17 02:49:11.604574384 +0200
153 @@ -338,8 +338,10 @@
154 netlink_register_notifier(&kaodv_nl_notifier);
155 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14))
156 kaodvnl = netlink_kernel_create(NETLINK_AODV, kaodv_netlink_rcv_sk);
157 -#else
158 +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
159 kaodvnl = netlink_kernel_create(NETLINK_AODV, AODVGRP_MAX, kaodv_netlink_rcv_sk, THIS_MODULE);
160 +#else
161 + kaodvnl = netlink_kernel_create(NETLINK_AODV, AODVGRP_MAX, kaodv_netlink_rcv_sk, NULL, THIS_MODULE);
162 #endif
163 if (kaodvnl == NULL) {
164 printk(KERN_ERR "kaodv_netlink: failed to create netlink socket\n");
This page took 0.047793 seconds and 5 git commands to generate.