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
6 +#ifndef __KAODV_COMPAT_H
7 +#define __KAODV_COMPAT_H
9 +#include <linux/version.h>
10 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
12 +#define ip_hdr(_skb) _skb->nh.iph
13 +#define skb_reset_network_header(_skb) do { \
14 + _skb->nh.iph = (struct iphdr *)_skb->data; \
18 +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) */
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
27 skb_set_owner_w(nskb, skb->sk);
32 skb_put(nskb, sizeof(struct min_ipenc_hdr));
38 - iph = skb->nh.iph = (struct iphdr *)skb->data;
39 + skb_reset_network_header(skb);
40 + iph = (struct iphdr *)skb->data;
42 ipe = (struct min_ipenc_hdr *)(skb->data + (iph->ihl << 2));
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);
56 struct sk_buff *ip_pkt_decapsulate(struct sk_buff *skb)
58 struct min_ipenc_hdr *ipe;
59 - /* skb->nh.iph is probably not set yet */
60 - struct iphdr *iph = skb->nh.iph;
62 + struct iphdr *iph = ip_hdr(skb);
64 ipe = (struct min_ipenc_hdr *)((char *)iph + (iph->ihl << 2));
67 skb->len - (iph->ihl << 2) - sizeof(struct min_ipenc_hdr));
69 skb_trim(skb, skb->len - sizeof(struct min_ipenc_hdr));
71 - skb->nh.iph = iph = (struct iphdr *)skb->data;
73 + skb_reset_network_header(skb);
74 + iph = (struct iphdr *)skb->data;
76 iph->tot_len = htons((ntohs(iph->tot_len) - sizeof(struct min_ipenc_hdr)));
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
84 #include <linux/skbuff.h>
85 #include <asm/byteorder.h>
86 +#include "kaodv-compat.h"
88 #define IPPROTO_MIPE 55
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
95 const struct net_device *out,
96 int (*okfn) (struct sk_buff *))
98 - struct iphdr *iph = (*skb)->nh.iph;
99 + struct iphdr *iph = ip_hdr(*skb);
101 struct in_addr ifaddr, bcaddr;
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);
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
117 #include <linux/inetdevice.h>
118 #include <linux/list.h>
119 #include <linux/spinlock.h>
120 +#include "kaodv-compat.h"
122 /* Interface information */
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
130 int status = -EINVAL;
131 struct kaodv_queue_entry *entry;
132 - struct iphdr *iph = skb->nh.iph;
133 + struct iphdr *iph = ip_hdr(skb);
135 entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
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
142 *****************************************************************************/
143 #ifndef _KAODV_QUEUE_H
144 #define _KAODV_QUEUE_H
145 +#include "kaodv-compat.h"
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
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);
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);
161 + kaodvnl = netlink_kernel_create(NETLINK_AODV, AODVGRP_MAX, kaodv_netlink_rcv_sk, NULL, THIS_MODULE);
163 if (kaodvnl == NULL) {
164 printk(KERN_ERR "kaodv_netlink: failed to create netlink socket\n");