From patchwork Wed Sep 24 21:58:53 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 5328 Received: from lana.hrz.tu-chemnitz.de (lana.hrz.tu-chemnitz.de [134.109.132.3]) by open-mesh.net (8.13.4/8.13.4/Debian-3sarge3) with ESMTP id m8OM3W0F026349 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 25 Sep 2008 00:03:34 +0200 Received: from galba.hrz.tu-chemnitz.de ([134.109.133.156] helo=mailbox.hrz.tu-chemnitz.de) by lana.hrz.tu-chemnitz.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1KicNt-00035N-RA for b.a.t.m.a.n@open-mesh.net; Wed, 24 Sep 2008 23:58:57 +0200 Received: from vpnclient-011.hrz.tu-chemnitz.de ([134.109.232.11] helo=sven-desktop) by mailbox.hrz.tu-chemnitz.de with smtp (Exim 4.69) (envelope-from ) id 1KicNs-0001Sf-H5 for b.a.t.m.a.n@open-mesh.net; Wed, 24 Sep 2008 23:58:57 +0200 Received: by sven-desktop (nbSMTP-1.00) for uid 1000 sven.eckelmann@gmx.de; Wed, 24 Sep 2008 23:58:57 +0200 (CEST) Date: Wed, 24 Sep 2008 23:58:53 +0200 From: Sven Eckelmann To: b.a.t.m.a.n@open-mesh.net Message-ID: <20080924215853.GA9253@sven-desktop.lazhur.ath.cx> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Scan-Signature: 5a834eac827b5e5d09d6c5dc7634b523 Subject: [B.A.T.M.A.N.] [PATCH] Backport gateway module to 2.6.18 X-BeenThere: b.a.t.m.a.n@open-mesh.net X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Sep 2008 22:03:34 -0000 kernel_bind and other kernel socket api functions were defined by linux v2.6.18-310-gac5a488 and ip_hdr first appeared in linux v2.6.21-122-geddc9ec. To provide these functions a new compatibility header file with the name compat26.h was added to provide an easy way to support older kernels. Other "#if LINUX_VERSION_CODE" should be copied into this file. --- batman/linux/modules/compat26.h | 42 +++++++++++++++++++++++++++++++++++++++ batman/linux/modules/gateway.c | 1 + 2 files changed, 43 insertions(+), 0 deletions(-) create mode 100644 batman/linux/modules/compat26.h diff --git a/batman/linux/modules/compat26.h b/batman/linux/modules/compat26.h new file mode 100644 index 0000000..a95b229 --- /dev/null +++ b/batman/linux/modules/compat26.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2008 BATMAN contributors: + * Thomas Lopatic, Corinna 'Elektra' Aichele, Axel Neumann, Marek Lindner, Andreas Langer + * 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. + */ + +#include /* LINUX_VERSION_CODE */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) + +#define skb_network_header(_skb) \ + ((_skb)->nh.raw) + +static inline struct iphdr *ip_hdr(const struct sk_buff *skb) +{ + return (struct iphdr *)skb_network_header(skb); +} +#endif /* KERNEL_VERSION(2, 6, 22) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) + +static inline int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen) +{ + return sock->ops->bind(sock, addr, addrlen); +} +#endif /* KERNEL_VERSION(2, 6, 19) */ diff --git a/batman/linux/modules/gateway.c b/batman/linux/modules/gateway.c index 7272c50..965f87b 100644 --- a/batman/linux/modules/gateway.c +++ b/batman/linux/modules/gateway.c @@ -19,6 +19,7 @@ #include "gateway.h" #include "hash.h" +#include "compat26.h" static struct class *batman_class;