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