* [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
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv-kernelland linux-2.6.21 compatibility
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
0 siblings, 2 replies; 4+ messages in thread
From: Simon Wunderlich @ 2008-07-17 8:00 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
[-- Attachment #1: Type: text/plain, Size: 1214 bytes --]
Hey Scott,
thank you for the patch, it looks good to me so i applied it. Having a
compat.h is a good idea, maybe we should use it even more to get rid of
some ugly #ifdef's. :)
I've tested your patch against various kernels, it seems to work until
2.6.20, but breaks for 2.6.19.
We welcome any kind of patches, so don't hesitate to submit. We can
integrate them directly (like your patch) or offer them on our homepage
(like the quagga patches [1]).
Thanks again,
Simon
[1] http://downloads.open-mesh.net/batman/patches/quagga/
On Thu, Jul 17, 2008 at 01:34:53PM +1200, Scott Raynel wrote:
> 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
>
>
> _______________________________________________
> B.A.T.M.A.N mailing list
> B.A.T.M.A.N@open-mesh.net
> https://list.open-mesh.net/mm/listinfo/b.a.t.m.a.n
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv-kernelland linux-2.6.21 compatibility
2008-07-17 8:00 ` Simon Wunderlich
@ 2008-07-17 11:32 ` Scott Raynel
2008-07-18 5:53 ` Marek Lindner
1 sibling, 0 replies; 4+ messages in thread
From: Scott Raynel @ 2008-07-17 11:32 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Hi Simon,
On 17/07/2008, at 8:00 PM, Simon Wunderlich wrote:
> Hey Scott,
>
> thank you for the patch, it looks good to me so i applied it. Having a
> compat.h is a good idea, maybe we should use it even more to get rid
> of
> some ugly #ifdef's. :)
> I've tested your patch against various kernels, it seems to work until
> 2.6.20, but breaks for 2.6.19.
Great, thanks. The idea of a compat.h for those macros is blatantly
stolen from madwifi, which I'm a casual contributor to :) If I get
some more spare time I'll look at fixes for earlier kernels, but I
needed to target 2.6.21 with a project I'm working on, hence the
patch :)
>
>
> We welcome any kind of patches, so don't hesitate to submit. We can
> integrate them directly (like your patch) or offer them on our
> homepage
> (like the quagga patches [1]).
>
I'll keep that in mind - hopefully as we start to play with the module
some more I'll be able contribute further.
Cheers,
--
Scott Raynel
WAND Network Research Group
Department of Computer Science
University of Waikato
New Zealand
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv-kernelland linux-2.6.21 compatibility
2008-07-17 8:00 ` Simon Wunderlich
2008-07-17 11:32 ` Scott Raynel
@ 2008-07-18 5:53 ` Marek Lindner
1 sibling, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2008-07-18 5:53 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Thursday, 17. July 2008 16:00:54 Simon Wunderlich wrote:
> thank you for the patch, it looks good to me so i applied it. Having a
> compat.h is a good idea, maybe we should use it even more to get rid of
> some ugly #ifdef's. :)
Yes, I agree - I like that idea.
> We welcome any kind of patches, so don't hesitate to submit. We can
> integrate them directly (like your patch) or offer them on our homepage
> (like the quagga patches [1]).
Correct - just send us what you have and we can directly integrate it. :-)
Greetings,
Marek
^ permalink raw reply [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