165 lines
5.5 KiB
Diff
165 lines
5.5 KiB
Diff
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");
|