public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv-kernelland linux-2.6.21 compatibility
@ 2008-07-17  1:34 Scott Raynel
  2008-07-17  8:00 ` Simon Wunderlich
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Raynel @ 2008-07-17  1:34 UTC (permalink / raw)
  To: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 372 bytes --]

Hi there,

Not sure how you guys want patches submitted, so point me in the right  
direction if this is not it. Here's a simple patch that enables  
compilation on linux-2.6.21 (and possibly earlier, though I've tested  
2.6.16 and it doesn't work).

Cheers,

--
Scott Raynel
WAND Network Research Group
Department of Computer Science
University of Waikato
New Zealand



[-- Attachment #2: compat-2.6.21.patch --]
[-- Type: application/octet-stream, Size: 2619 bytes --]

diff --git a/batman-adv-kernelland/batman-core/compat.h b/batman-adv-kernelland/batman-core/compat.h
new file mode 100644
index 0000000..cb94665
--- /dev/null
+++ b/batman-adv-kernelland/batman-core/compat.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2007-2008 B.A.T.M.A.N. contributors:
+ * Marek Lindner, Simon Wunderlich
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ *
+ *
+ * This file contains macros for maintaining compatibility with older versions
+ * of the Linux kernel.
+ */
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
+
+#define skb_set_network_header(_skb, _offset) \
+	do { (_skb)->nh.raw = (_skb)->data + (_offset); } while (0)
+
+#define skb_reset_mac_header(_skb) \
+	do { (_skb)->mac.raw = (_skb)->data; } while (0)
+
+#define list_first_entry(ptr, type, member) \
+	list_entry((ptr)->next, type, member)
+
+#endif
diff --git a/batman-adv-kernelland/batman-core/device.c b/batman-adv-kernelland/batman-core/device.c
index 80bc31c..18b026a 100644
--- a/batman-adv-kernelland/batman-core/device.c
+++ b/batman-adv-kernelland/batman-core/device.c
@@ -28,7 +28,7 @@
 #include "types.h"
 #include "hash.h"
 
-
+#include "compat.h"
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 #include <linux/devfs_fs_kernel.h>
diff --git a/batman-adv-kernelland/batman-core/send.c b/batman-adv-kernelland/batman-core/send.c
index ee6e8de..48e05bc 100644
--- a/batman-adv-kernelland/batman-core/send.c
+++ b/batman-adv-kernelland/batman-core/send.c
@@ -29,6 +29,7 @@
 #include "types.h"
 #include "vis.h"
 
+#include "compat.h"
 
 
 static DECLARE_DELAYED_WORK(send_own_packet_wq, send_own_packet_work);
@@ -73,7 +74,7 @@ void send_raw_packet(unsigned char *pack_buff, int pack_buff_len, uint8_t *src_a
 	ethhdr->h_proto = htons(ETH_P_BATMAN);
 
 	skb_reset_mac_header(skb);
-	skb->network_header = skb->mac_header + ETH_HLEN;
+	skb_set_network_header(skb, ETH_HLEN);
 	skb->priority = TC_PRIO_CONTROL;
 	skb->protocol = __constant_htons(ETH_P_BATMAN);
 	skb->dev = batman_if->net_dev;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-07-18  5:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-17  1:34 [B.A.T.M.A.N.] [PATCH] batman-adv-kernelland linux-2.6.21 compatibility Scott Raynel
2008-07-17  8:00 ` Simon Wunderlich
2008-07-17 11:32   ` Scott Raynel
2008-07-18  5:53   ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox