--- /dev/null
+This is an OpenWrt package feed containing community maintained routing packages.
+
+To use these packages, add the following line to the feeds.conf
+in the OpenWrt buildroot:
+
+ src-git openwrt-routing git://github.com/openwrt-routing/packages.git
+
+Update the feed:
+
+ ./scripts/feeds update openwrt-routing
+
+Activate the package:
+
+ ./scripts/feeds install -a -p openwrt-routing
+
+The routing packages should now appear in menuconfig.
+
+
--- /dev/null
+#
+# Copyright (C) 2008-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=batmand
+PKG_REV:=1439
+PKG_VERSION:=r$(PKG_REV)
+PKG_RELEASE:=2
+PKG_EXTRA_CFLAGS=-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_REV)\"
+
+PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=$(if $(PKG_BRANCH),$(PKG_BRANCH),$(PKG_NAME))-$(PKG_VERSION)
+PKG_SOURCE_URL:=http://downloads.open-mesh.org/svn/batman/trunk/
+PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
+PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
+
+PKG_KMOD_BUILD_DIR:=$(PKG_BUILD_DIR)/batman/linux/modules
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/batmand/Default
+ URL:=http://www.open-mesh.org/
+ MAINTAINER:=Marek Lindner <lindner_marek@yahoo.de>
+endef
+
+define Package/batmand
+$(call Package/batmand/Default)
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=Routing and Redirection
+ DEPENDS:=+libpthread +kmod-tun
+ TITLE:=B.A.T.M.A.N. layer 3 routing daemon
+endef
+
+define Package/batmand/description
+B.A.T.M.A.N. layer 3 routing daemon
+endef
+
+define Package/vis
+$(call Package/batmand/Default)
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=Routing and Redirection
+ DEPENDS:=+libpthread
+ TITLE:=visualization server for B.A.T.M.A.N. layer 3
+endef
+
+define Package/vis/description
+visualization server for B.A.T.M.A.N. layer 3
+endef
+
+define KernelPackage/batgat
+$(call Package/batmand/Default)
+ SUBMENU:=Network Support
+ DEPENDS:=+batmand @BROKEN
+ TITLE:=B.A.T.M.A.N. gateway module
+ FILES:=$(PKG_KMOD_BUILD_DIR)/batgat.$(LINUX_KMOD_SUFFIX)
+ AUTOLOAD:=$(call AutoLoad,50,batgat)
+endef
+
+
+define KernelPackage/batgat/description
+Kernel gateway module for B.A.T.M.A.N. for better tunnel performance
+endef
+
+MAKE_BATMAND_ARGS += \
+ EXTRA_CFLAGS='$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)' \
+ CCFLAGS="$(TARGET_CFLAGS)" \
+ OFLAGS="$(TARGET_CFLAGS)" \
+ REVISION="$(PKG_REV)" \
+ CC="$(TARGET_CC)" \
+ NODEBUG=1 \
+ UNAME="Linux" \
+ INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
+ STRIP="/bin/true" \
+ batmand install
+
+MAKE_VIS_ARGS += \
+ EXTRA_CFLAGS='$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)' \
+ CCFLAGS="$(TARGET_CFLAGS)" \
+ OFLAGS="$(TARGET_CFLAGS)" \
+ REVISION="$(PKG_REV)" \
+ CC="$(TARGET_CC)" \
+ NODEBUG=1 \
+ UNAME="Linux" \
+ INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
+ STRIP="/bin/true" \
+ vis install
+
+MAKE_BATGAT_ARGS += \
+ CROSS_COMPILE="$(TARGET_CROSS)" \
+ ARCH="$(LINUX_KARCH)" \
+ PATH="$(TARGET_PATH)" \
+ SUBDIRS="$(PKG_KMOD_BUILD_DIR)" \
+ LINUX_VERSION="$(LINUX_VERSION)" \
+ REVISION="$(PKG_REV)" modules
+
+
+define Build/Configure
+endef
+
+ifneq ($(DEVELOPER)$(CONFIG_PACKAGE_batmand),)
+ BUILD_BATMAND := $(MAKE) -C $(PKG_BUILD_DIR)/batman $(MAKE_BATMAND_ARGS)
+endif
+
+ifneq ($(DEVELOPER)$(CONFIG_PACKAGE_vis),)
+ BUILD_VIS := $(MAKE) -C $(PKG_BUILD_DIR)/vis $(MAKE_VIS_ARGS)
+endif
+
+ifneq ($(DEVELOPER)$(CONFIG_PACKAGE_kmod-batgat),)
+ BUILD_BATGAT := $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATGAT_ARGS)
+endif
+
+define Build/Compile
+ $(BUILD_BATMAND)
+ $(BUILD_VIS)
+ cp $(PKG_KMOD_BUILD_DIR)/Makefile.kbuild $(PKG_KMOD_BUILD_DIR)/Makefile
+ $(BUILD_BATGAT)
+endef
+
+define Package/batmand/install
+ $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/batmand $(1)/usr/sbin/
+ $(INSTALL_BIN) ./files/etc/init.d/batmand $(1)/etc/init.d
+ $(INSTALL_DATA) ./files/etc/config/batmand $(1)/etc/config
+endef
+
+define Package/batmand/conffiles
+/etc/config/batmand
+endef
+
+define Package/vis/install
+ $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/vis $(1)/usr/sbin/
+ $(INSTALL_BIN) ./files/etc/init.d/vis $(1)/etc/init.d
+ $(INSTALL_DATA) ./files/etc/config/vis $(1)/etc/config
+endef
+
+define Package/vis/conffiles
+/etc/config/vis
+endef
+
+$(eval $(call BuildPackage,batmand))
+$(eval $(call BuildPackage,vis))
+$(eval $(call KernelPackage,batgat))
--- /dev/null
+config batmand general
+ option interface ath0
+ option hna
+ option gateway_class
+ option originator_interval
+ option preferred_gateway
+ option routing_class
+ option visualisation_srv
+ option policy_routing_script
+ option disable_client_nat
+ option disable_aggregation
+
--- /dev/null
+config vis general
+ option interface ath0
+
--- /dev/null
+#!/bin/sh /etc/rc.common
+START=90
+
+start () {
+ interface=$(uci get batmand.general.interface)
+ if [ "$interface" = "" ]; then
+ echo $1 Error, you must specify at least a network interface
+ exit
+ fi
+ hnas=$(uci get batmand.general.hna)
+ gateway_class=$(uci get batmand.general.gateway_class)
+ originator_interval=$(uci get batmand.general.originator_interval)
+ preferred_gateway=$(uci get batmand.general.preferred_gateway)
+ routing_class=$(uci get batmand.general.routing_class)
+ visualisation_srv=$(uci get batmand.general.visualisation_srv)
+ policy_routing_script=$(uci get batmand.general.policy_routing_script)
+ disable_client_nat=$(uci get batmand.general.disable_client_nat)
+ disable_aggregation=$(uci get batmand.general.disable_aggregation)
+ batman_args=""
+
+ for hna in $hnas
+ do
+ batman_args=${batman_args}'-a '$hna' '
+ done
+
+ if [ $gateway_class ]; then
+ batman_args=${batman_args}'-g '$gateway_class' '
+ fi
+
+ if [ $originator_interval ]; then
+ batman_args=${batman_args}'-o '$originator_interval' '
+ fi
+
+ if [ $preferred_gateway ]; then
+ batman_args=${batman_args}'-p '$preferred_gateway' '
+ fi
+
+ if [ $routing_class ]; then
+ batman_args=${batman_args}'-r '$routing_class' '
+ fi
+
+ if [ $visualisation_srv ]; then
+ batman_args=${batman_args}'-s '$visualisation_srv' '
+ fi
+
+ if [ $policy_routing_script ]; then
+ batman_args=${batman_args}'--policy-routing-script '$policy_routing_script' '
+ fi
+
+ if [ $disable_client_nat ]; then
+ batman_args=${batman_args}'--disable-client-nat '
+ fi
+
+ if [ $disable_aggregation ]; then
+ batman_args=${batman_args}'--disable-aggregation '
+ fi
+
+ batman_args=${batman_args}$interface
+ batmand $batman_args >/dev/null 2>&1
+}
+
+stop () {
+ killall batmand
+}
+
+
--- /dev/null
+#!/bin/sh /etc/rc.common
+START=90
+
+start () {
+ interface=$(uci get vis.general.interface)
+ if [ "$interface" = "" ]; then
+ echo $1 Error, you must specify at least a network interface
+ exit
+ fi
+ vis_args=$interface
+
+ vis $vis_args >/dev/null 2>&1
+}
+
+stop () {
+ killall vis
+}
+
+
--- /dev/null
+---
+ batman/linux/modules/gateway.c | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+--- batmand-r1439.orig/batman/linux/modules/gateway.c
++++ batmand-r1439/batman/linux/modules/gateway.c
+@@ -29,6 +29,7 @@ static struct class *batman_class;
+ static int batgat_open(struct inode *inode, struct file *filp);
+ static int batgat_release(struct inode *inode, struct file *file);
+ static int batgat_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg );
++static long batgat_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg );
+
+
+ static void udp_data_ready(struct sock *sk, int len);
+@@ -53,7 +54,11 @@ static int proc_clients_read(char *buf,
+ static struct file_operations fops = {
+ .open = batgat_open,
+ .release = batgat_release,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++ .unlocked_ioctl = batgat_ioctl_unlocked,
++#else
+ .ioctl = batgat_ioctl,
++#endif
+ };
+
+
+@@ -166,6 +171,20 @@ static int batgat_release(struct inode *
+ }
+
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++#include <linux/smp_lock.h>
++static long batgat_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg )
++{
++ int ret;
++
++ lock_kernel();
++ ret = batgat_ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
++ unlock_kernel();
++
++ return ret;
++}
++#endif
++
+ static int batgat_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg )
+ {
+ uint8_t tmp_ip[4];