From 522ce8dfdb7f74492ce9d2884a088796f9afe0d2 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Sun, 6 Feb 2011 20:32:58 +0000 Subject: [PATCH 01/41] batman-adv: rename folder name to match project & package name git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@25394 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Config.in | 13 ++++ Makefile | 106 ++++++++++++++++++++++++++++++++ files/etc/config/batman-adv | 13 ++++ files/etc/init.d/batman-adv | 117 ++++++++++++++++++++++++++++++++++++ 4 files changed, 249 insertions(+) create mode 100644 Config.in create mode 100644 Makefile create mode 100644 files/etc/config/batman-adv create mode 100644 files/etc/init.d/batman-adv diff --git a/Config.in b/Config.in new file mode 100644 index 0000000..ad11d3a --- /dev/null +++ b/Config.in @@ -0,0 +1,13 @@ + +config KMOD_BATMAN_ADV_DEBUG_LOG + bool "enable verbose debug logging" + depends PACKAGE_kmod-batman-adv + default n +config KMOD_BATMAN_ADV_BATCTL + bool "enable batctl" + depends PACKAGE_kmod-batman-adv + default y + help + batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced. + It is an easier method for configuring batman-adv and + provides some additional tools for debugging as well. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ee2aa54 --- /dev/null +++ b/Makefile @@ -0,0 +1,106 @@ +# +# Copyright (C) 2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: Makefile 5624 2006-11-23 00:29:07Z nbd $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=batman-adv + +PKG_VERSION:=2011.0.0 +PKG_MD5SUM:=9f59f63010f083a1ff56f977c9972f71 +BATCTL_MD5SUM:=48e1b3c4b6033215abb52ae757746f05 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION) +PKG_TOOL_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/batctl-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk + +define KernelPackage/batman-adv + URL:=http://www.open-mesh.org/ + MAINTAINER:=Marek Lindner + SUBMENU:=Network Support + DEPENDS:=@!LINUX_2_4 + TITLE:=B.A.T.M.A.N. Adv + FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,50,batman-adv) +endef + +define KernelPackage/batman-adv/description +B.A.T.M.A.N. advanced is a kernel module which allows to +build layer 2 mesh networks. This package contains the +version $(PKG_VERSION) of the kernel module plus its user space +configuration & managerment tool batctl. +endef + +define KernelPackage/batman-adv/config + source "$(SOURCE)/Config.in" +endef + +MAKE_BATMAN_ADV_ARGS += \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + PATH="$(TARGET_PATH)" \ + $(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),EXTRA_CFLAGS="-DCONFIG_BATMAN_ADV_DEBUG") \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + LINUX_VERSION="$(LINUX_VERSION)" \ + REVISION="" modules + +MAKE_BATCTL_ARGS += \ + CFLAGS="$(TARGET_CFLAGS)" \ + CCFLAGS="$(TARGET_CFLAGS)" \ + OFLAGS="$(TARGET_CFLAGS)" \ + REVISION="" \ + CC="$(TARGET_CC)" \ + NODEBUG=1 \ + UNAME="Linux" \ + INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \ + STRIP="/bin/true" \ + batctl install + +ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),) +define Download/batctl + FILE:=batctl-$(PKG_VERSION).tar.gz + URL:=$(PKG_SOURCE_URL) + MD5SUM:=$(BATCTL_MD5SUM) +endef +$(eval $(call Download,batctl)) + +BUILD_BATCTL = $(MAKE) -C $(PKG_TOOL_BUILD_DIR) $(MAKE_BATCTL_ARGS) +endif + +define Build/Compile + tar xzf "$(DL_DIR)/batctl-$(PKG_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)" + cp $(PKG_BUILD_DIR)/Makefile.kbuild $(PKG_BUILD_DIR)/Makefile + $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATMAN_ADV_ARGS) + $(BUILD_BATCTL) +endef + +define Build/Clean + rm -rf $(BUILD_DIR)/$(PKG_NAME)/ +endef + +ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),) +define KernelPackage/batman-adv/install + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d + $(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d + $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/batctl $(1)/usr/sbin/ +endef +else +define KernelPackage/batman-adv/install + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d + $(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d + $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config +endef +endif + +$(eval $(call KernelPackage,batman-adv)) diff --git a/files/etc/config/batman-adv b/files/etc/config/batman-adv new file mode 100644 index 0000000..9c66c93 --- /dev/null +++ b/files/etc/config/batman-adv @@ -0,0 +1,13 @@ + +config 'mesh' 'bat0' + option 'interfaces' 'wlan0' + option 'aggregated_ogms' + option 'bonding' + option 'fragmentation' + option 'gw_bandwidth' + option 'gw_mode' + option 'gw_sel_class' + option 'log_level' + option 'orig_interval' + option 'vis_mode' + diff --git a/files/etc/init.d/batman-adv b/files/etc/init.d/batman-adv new file mode 100644 index 0000000..5011b6d --- /dev/null +++ b/files/etc/init.d/batman-adv @@ -0,0 +1,117 @@ +#!/bin/sh /etc/rc.common +START=90 + +is_module_loaded() { + + if [ ! -d "/sys/module/batman_adv" ]; then + echo "batman-adv module directory not found - was the kernel module loaded ?" >&2 + return 0 + fi + + return 1 +} + +start_mesh () { + local meshif="$1" + local interfaces aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval vis_mode + + is_module_loaded + [ $? -ne 1 ] && return + + config_get interfaces "$meshif" interfaces + config_get aggregated_ogms "$meshif" aggregated_ogms + config_get bonding "$meshif" bonding + config_get fragmentation "$meshif" fragmentation + config_get gw_bandwidth "$meshif" gw_bandwidth + config_get gw_mode "$meshif" gw_mode + config_get gw_sel_class "$meshif" gw_sel_class + config_get log_level "$meshif" log_level + config_get orig_interval "$meshif" orig_interval + config_get vis_mode "$meshif" vis_mode + + if [ "$interfaces" = "" ]; then + echo Error, you must specify at least a network interface + return + fi + + for interface in $interfaces + do + [ ! -f "/sys/class/net/$interface/batman_adv/mesh_iface" ] && echo "Can't add interface $interface - ignoring" && continue + echo $meshif > /sys/class/net/$interface/batman_adv/mesh_iface + done + + if [ $orig_interval ]; then + echo $orig_interval > /sys/class/net/$meshif/mesh/orig_interval + fi + + if [ $log_level ]; then + echo $log_level > /sys/class/net/$meshif/mesh/log_level 2>&- + fi + + if [ $aggregated_ogms ]; then + echo $aggregated_ogms > /sys/class/net/$meshif/mesh/aggregated_ogms + fi + + if [ $bonding ]; then + echo $bonding > /sys/class/net/$meshif/mesh/bonding + fi + + if [ $fragmentation ]; then + echo $fragmentation > /sys/class/net/$meshif/mesh/fragmentation + fi + + if [ $gw_bandwidth ]; then + echo $gw_bandwidth > /sys/class/net/$meshif/mesh/gw_bandwidth + fi + + if [ $gw_mode ]; then + echo $gw_mode > /sys/class/net/$meshif/mesh/gw_mode + fi + + if [ $gw_sel_class ]; then + echo $gw_sel_class > /sys/class/net/$meshif/mesh/gw_sel_class + fi + + if [ $vis_mode ]; then + echo $vis_mode > /sys/class/net/$meshif/mesh/vis_mode + fi +} + +stop_mesh() { + local meshif="$1" + + is_module_loaded + [ $? -ne 1 ] && return + + for iface in $(ls /sys/class/net/*) + do + [ ! -f "$iface/batman_adv/mesh_iface" ] && continue + [ "$(head -1 $iface/batman_adv/mesh_iface)" != "status: $meshif" ] && continue + + echo "none" > $iface/batman_adv/mesh_iface + done +} + +# can also be used with "batman-adv start bat0" +start() { + config_load batman-adv + + if [ -n "$1" ]; then + start_mesh $1 + else + config_foreach start_mesh mesh + fi +} + +# can also be used with "batman-adv stop bat0" +stop () { + config_load batman-adv + + if [ -n "$1" ]; then + stop_mesh $1 + else + config_foreach stop_mesh mesh + fi +} + + From 5e425847797adc35072b91e61d8036f9b9327bfc Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Tue, 19 Apr 2011 12:43:10 +0000 Subject: [PATCH 02/41] batman-adv: upgrade package to latest release (2011.1.0) git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@26718 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ee2aa54..6ddb6bb 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2011.0.0 -PKG_MD5SUM:=9f59f63010f083a1ff56f977c9972f71 -BATCTL_MD5SUM:=48e1b3c4b6033215abb52ae757746f05 +PKG_VERSION:=2011.1.0 +PKG_MD5SUM:=a05a3ff72bbc12859539f6a9e14af098 +BATCTL_MD5SUM:=d3c7cca45c223a0ab80373fcb434dd5e PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) From a884fb1bf744421e1b3799f5c2772e0e6f86803b Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Tue, 19 Apr 2011 12:49:37 +0000 Subject: [PATCH 03/41] batman-adv: init script tries to retrieve interfaces from uci The batman-adv init script will query uci (network.$iface.ifname) to retrieve the interface name to re-use the existing network configuration system. The default iface configuration (batman-adv.bat0.interfaces) is set to 'mesh' which allows to start batman-adv as soon as the network configuration contains a 'mesh' stanza. Signed-off-by: Filippo Sallemi Signed-off-by: Gioacchino Mazzurco git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@26719 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- files/etc/config/batman-adv | 2 +- files/etc/init.d/batman-adv | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/files/etc/config/batman-adv b/files/etc/config/batman-adv index 9c66c93..31ef797 100644 --- a/files/etc/config/batman-adv +++ b/files/etc/config/batman-adv @@ -1,6 +1,6 @@ config 'mesh' 'bat0' - option 'interfaces' 'wlan0' + option 'interfaces' 'mesh' option 'aggregated_ogms' option 'bonding' option 'fragmentation' diff --git a/files/etc/init.d/batman-adv b/files/etc/init.d/batman-adv index 5011b6d..a6a8500 100644 --- a/files/etc/init.d/batman-adv +++ b/files/etc/init.d/batman-adv @@ -1,4 +1,6 @@ #!/bin/sh /etc/rc.common +# Copyright (C) 2011 OpenWrt.org + START=90 is_module_loaded() { @@ -33,11 +35,16 @@ start_mesh () { echo Error, you must specify at least a network interface return fi - + for interface in $interfaces do - [ ! -f "/sys/class/net/$interface/batman_adv/mesh_iface" ] && echo "Can't add interface $interface - ignoring" && continue - echo $meshif > /sys/class/net/$interface/batman_adv/mesh_iface + ifname=$(uci -P /var/state get network.$interface.ifname 2>&-) + [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && { + ifname=${interface} + [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && echo "Can't add interface $ifname - ignoring" && continue + } + + echo $meshif > /sys/class/net/$ifname/batman_adv/mesh_iface done if [ $orig_interval ]; then @@ -86,7 +93,7 @@ stop_mesh() { for iface in $(ls /sys/class/net/*) do [ ! -f "$iface/batman_adv/mesh_iface" ] && continue - [ "$(head -1 $iface/batman_adv/mesh_iface)" != "status: $meshif" ] && continue + [ "$(head -1 $iface/batman_adv/mesh_iface)" != "$meshif" ] && continue echo "none" > $iface/batman_adv/mesh_iface done From e64df6a0b5093b8040d2258589f97876a14f2cf9 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Fri, 24 Jun 2011 02:28:53 +0000 Subject: [PATCH 04/41] batman-adv: upgrade package to latest release (2011.2.0) git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@27268 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 6ddb6bb..53d724e 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2011.1.0 -PKG_MD5SUM:=a05a3ff72bbc12859539f6a9e14af098 -BATCTL_MD5SUM:=d3c7cca45c223a0ab80373fcb434dd5e +PKG_VERSION:=2011.2.0 +PKG_MD5SUM:=1ef45406201913cc08ac01e47ad2d034 +BATCTL_MD5SUM:=69e7fe915f2c1867b74e6efe7c627dd5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) @@ -73,11 +73,26 @@ define Download/batctl endef $(eval $(call Download,batctl)) +EXTRACT_BATCTL = tar xzf "$(DL_DIR)/batctl-$(PKG_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)" +PATCH_BATCTL = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)","*batctl*") BUILD_BATCTL = $(MAKE) -C $(PKG_TOOL_BUILD_DIR) $(MAKE_BATCTL_ARGS) endif +define Build/DoPatch + @if [ -d "$(2)" ]; then \ + if [ "$$$$(ls $(2) | grep -Ec $(3))" -gt 0 ]; then \ + $(PATCH) "$(1)" "$(2)" "$(3)"; \ + fi; \ + fi +endef + +define Build/Patch + $(call Build/DoPatch,"$(PKG_BUILD_DIR)","$(PATCH_DIR)","*batman*") + $(EXTRACT_BATCTL) + $(PATCH_BATCTL) +endef + define Build/Compile - tar xzf "$(DL_DIR)/batctl-$(PKG_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)" cp $(PKG_BUILD_DIR)/Makefile.kbuild $(PKG_BUILD_DIR)/Makefile $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATMAN_ADV_ARGS) $(BUILD_BATCTL) From e60dda15d58d736c98ed9a42958811523ffe3919 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Sun, 21 Aug 2011 23:45:09 +0000 Subject: [PATCH 06/41] batman-adv: upgrade package to latest release (2011.3.0) Also split init script into lib and init script as suggested by Filippo Sallemi to allow including the lib from a hotplug script. Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@28066 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 18 ++++--- files/etc/init.d/batman-adv | 98 +--------------------------------- files/lib/batman-adv/config.sh | 98 ++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 105 deletions(-) create mode 100644 files/lib/batman-adv/config.sh diff --git a/Makefile b/Makefile index 53d724e..f09c883 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2011.2.0 -PKG_MD5SUM:=1ef45406201913cc08ac01e47ad2d034 -BATCTL_MD5SUM:=69e7fe915f2c1867b74e6efe7c627dd5 +PKG_VERSION:=2011.3.0 +PKG_MD5SUM:=0ba4b63f7fe9d2a561662cdc0378caa5 +BATCTL_MD5SUM:=8eb197896049bb04a6beef56015a16b6 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) @@ -27,7 +27,7 @@ define KernelPackage/batman-adv URL:=http://www.open-mesh.org/ MAINTAINER:=Marek Lindner SUBMENU:=Network Support - DEPENDS:=@!LINUX_2_4 + DEPENDS:=@!LINUX_2_4 +kmod-crc16 TITLE:=B.A.T.M.A.N. Adv FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,batman-adv) @@ -61,7 +61,7 @@ MAKE_BATCTL_ARGS += \ CC="$(TARGET_CC)" \ NODEBUG=1 \ UNAME="Linux" \ - INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ STRIP="/bin/true" \ batctl install @@ -104,16 +104,18 @@ endef ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),) define KernelPackage/batman-adv/install - $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/lib/batman-adv $(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d + $(INSTALL_BIN) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/batctl $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/ endef else define KernelPackage/batman-adv/install - $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/lib/batman-adv $(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d + $(INSTALL_BIN) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config endef endif diff --git a/files/etc/init.d/batman-adv b/files/etc/init.d/batman-adv index a6a8500..f0f6789 100644 --- a/files/etc/init.d/batman-adv +++ b/files/etc/init.d/batman-adv @@ -3,101 +3,7 @@ START=90 -is_module_loaded() { - - if [ ! -d "/sys/module/batman_adv" ]; then - echo "batman-adv module directory not found - was the kernel module loaded ?" >&2 - return 0 - fi - - return 1 -} - -start_mesh () { - local meshif="$1" - local interfaces aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval vis_mode - - is_module_loaded - [ $? -ne 1 ] && return - - config_get interfaces "$meshif" interfaces - config_get aggregated_ogms "$meshif" aggregated_ogms - config_get bonding "$meshif" bonding - config_get fragmentation "$meshif" fragmentation - config_get gw_bandwidth "$meshif" gw_bandwidth - config_get gw_mode "$meshif" gw_mode - config_get gw_sel_class "$meshif" gw_sel_class - config_get log_level "$meshif" log_level - config_get orig_interval "$meshif" orig_interval - config_get vis_mode "$meshif" vis_mode - - if [ "$interfaces" = "" ]; then - echo Error, you must specify at least a network interface - return - fi - - for interface in $interfaces - do - ifname=$(uci -P /var/state get network.$interface.ifname 2>&-) - [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && { - ifname=${interface} - [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && echo "Can't add interface $ifname - ignoring" && continue - } - - echo $meshif > /sys/class/net/$ifname/batman_adv/mesh_iface - done - - if [ $orig_interval ]; then - echo $orig_interval > /sys/class/net/$meshif/mesh/orig_interval - fi - - if [ $log_level ]; then - echo $log_level > /sys/class/net/$meshif/mesh/log_level 2>&- - fi - - if [ $aggregated_ogms ]; then - echo $aggregated_ogms > /sys/class/net/$meshif/mesh/aggregated_ogms - fi - - if [ $bonding ]; then - echo $bonding > /sys/class/net/$meshif/mesh/bonding - fi - - if [ $fragmentation ]; then - echo $fragmentation > /sys/class/net/$meshif/mesh/fragmentation - fi - - if [ $gw_bandwidth ]; then - echo $gw_bandwidth > /sys/class/net/$meshif/mesh/gw_bandwidth - fi - - if [ $gw_mode ]; then - echo $gw_mode > /sys/class/net/$meshif/mesh/gw_mode - fi - - if [ $gw_sel_class ]; then - echo $gw_sel_class > /sys/class/net/$meshif/mesh/gw_sel_class - fi - - if [ $vis_mode ]; then - echo $vis_mode > /sys/class/net/$meshif/mesh/vis_mode - fi -} - -stop_mesh() { - local meshif="$1" - - is_module_loaded - [ $? -ne 1 ] && return - - for iface in $(ls /sys/class/net/*) - do - [ ! -f "$iface/batman_adv/mesh_iface" ] && continue - [ "$(head -1 $iface/batman_adv/mesh_iface)" != "$meshif" ] && continue - - echo "none" > $iface/batman_adv/mesh_iface - done -} +. /lib/batman-adv/config.sh # can also be used with "batman-adv start bat0" start() { @@ -120,5 +26,3 @@ stop () { config_foreach stop_mesh mesh fi } - - diff --git a/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh new file mode 100644 index 0000000..347e307 --- /dev/null +++ b/files/lib/batman-adv/config.sh @@ -0,0 +1,98 @@ +#!/bin/sh +# Copyright (C) 2011 OpenWrt.org + +is_module_loaded() { + + if [ ! -d "/sys/module/batman_adv" ]; then + echo "batman-adv module directory not found - was the kernel module loaded ?" >&2 + return 0 + fi + + return 1 +} + +start_mesh () { + local meshif="$1" + local interfaces aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval vis_mode + + is_module_loaded + [ $? -ne 1 ] && return + + config_get interfaces "$meshif" interfaces + config_get aggregated_ogms "$meshif" aggregated_ogms + config_get bonding "$meshif" bonding + config_get fragmentation "$meshif" fragmentation + config_get gw_bandwidth "$meshif" gw_bandwidth + config_get gw_mode "$meshif" gw_mode + config_get gw_sel_class "$meshif" gw_sel_class + config_get log_level "$meshif" log_level + config_get orig_interval "$meshif" orig_interval + config_get vis_mode "$meshif" vis_mode + + if [ "$interfaces" = "" ]; then + echo Error, you must specify at least a network interface + return + fi + + for interface in $interfaces + do + ifname=$(uci -P /var/state get network.$interface.ifname 2>&-) + [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && { + ifname=${interface} + [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && echo "Can't add interface $ifname - ignoring" && continue + } + + echo $meshif > /sys/class/net/$ifname/batman_adv/mesh_iface + done + + if [ $orig_interval ]; then + echo $orig_interval > /sys/class/net/$meshif/mesh/orig_interval + fi + + if [ $log_level ]; then + echo $log_level > /sys/class/net/$meshif/mesh/log_level 2>&- + fi + + if [ $aggregated_ogms ]; then + echo $aggregated_ogms > /sys/class/net/$meshif/mesh/aggregated_ogms + fi + + if [ $bonding ]; then + echo $bonding > /sys/class/net/$meshif/mesh/bonding + fi + + if [ $fragmentation ]; then + echo $fragmentation > /sys/class/net/$meshif/mesh/fragmentation + fi + + if [ $gw_bandwidth ]; then + echo $gw_bandwidth > /sys/class/net/$meshif/mesh/gw_bandwidth + fi + + if [ $gw_mode ]; then + echo $gw_mode > /sys/class/net/$meshif/mesh/gw_mode + fi + + if [ $gw_sel_class ]; then + echo $gw_sel_class > /sys/class/net/$meshif/mesh/gw_sel_class + fi + + if [ $vis_mode ]; then + echo $vis_mode > /sys/class/net/$meshif/mesh/vis_mode + fi +} + +stop_mesh() { + local meshif="$1" + + is_module_loaded + [ $? -ne 1 ] && return + + for iface in $(ls /sys/class/net/*) + do + [ ! -f "$iface/batman_adv/mesh_iface" ] && continue + [ "$(head -1 $iface/batman_adv/mesh_iface)" != "$meshif" ] && continue + + echo "none" > $iface/batman_adv/mesh_iface + done +} From ad9f006cf06be51484d5131e753d45947d9c2ba2 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Thu, 29 Sep 2011 10:18:17 +0000 Subject: [PATCH 07/41] batman-adv: fix upstream latency bug Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@28315 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 3 +- ...o_be_true_for_broadcast_packets_only.patch | 49 +++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 patches/batman-adv_do_bcast_has_to_be_true_for_broadcast_packets_only.patch diff --git a/Makefile b/Makefile index f09c883..0df2ede 100644 --- a/Makefile +++ b/Makefile @@ -78,10 +78,11 @@ PATCH_BATCTL = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)","*b BUILD_BATCTL = $(MAKE) -C $(PKG_TOOL_BUILD_DIR) $(MAKE_BATCTL_ARGS) endif +KPATCH ?= $(PATCH) define Build/DoPatch @if [ -d "$(2)" ]; then \ if [ "$$$$(ls $(2) | grep -Ec $(3))" -gt 0 ]; then \ - $(PATCH) "$(1)" "$(2)" "$(3)"; \ + $(KPATCH) "$(1)" "$(2)" "$(3)"; \ fi; \ fi endef diff --git a/patches/batman-adv_do_bcast_has_to_be_true_for_broadcast_packets_only.patch b/patches/batman-adv_do_bcast_has_to_be_true_for_broadcast_packets_only.patch new file mode 100644 index 0000000..12d0a6a --- /dev/null +++ b/patches/batman-adv_do_bcast_has_to_be_true_for_broadcast_packets_only.patch @@ -0,0 +1,49 @@ +From: Antonio Quartulli + +corrects a critical bug of the GW feature. This bug made all the unicast +packets destined to a GW to be sent as broadcast. This bug is present even if +the sender GW feature is configured as OFF. It's an urgent bug fix and should +be committed as soon as possible. + +This was a regression introduced by 43676ab590c3f8686fd047d34c3e33803eef71f0 + +Signed-off-by: Antonio Quartulli +Signed-off-by: Marek Lindner +--- + soft-interface.c | 10 +++++----- + 1 files changed, 5 insertions(+), 5 deletions(-) + +--- a/soft-interface.c ++++ b/soft-interface.c +@@ -565,7 +565,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) + struct orig_node *orig_node = NULL; + int data_len = skb->len, ret; + short vid = -1; +- bool do_bcast = false; ++ bool do_bcast; + + if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE) + goto dropped; +@@ -598,15 +598,15 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) + tt_local_add(soft_iface, ethhdr->h_source); + + orig_node = transtable_search(bat_priv, ethhdr->h_dest); +- if (is_multicast_ether_addr(ethhdr->h_dest) || +- (orig_node && orig_node->gw_flags)) { ++ do_bcast = is_multicast_ether_addr(ethhdr->h_dest); ++ if (do_bcast || (orig_node && orig_node->gw_flags)) { + ret = gw_is_target(bat_priv, skb, orig_node); + + if (ret < 0) + goto dropped; + +- if (ret == 0) +- do_bcast = true; ++ if (ret) ++ do_bcast = false; + } + + /* ethernet packet should be broadcasted */ +-- +1.7.5.4 + From 84b885f51c95aebb427ef0ba19c379d616762a56 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Mon, 17 Oct 2011 12:16:11 +0000 Subject: [PATCH 08/41] batman-adv: add critical bug fix Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@28472 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...dv_fix_tt_local_reset_flags_function.patch | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 patches/batman-adv_fix_tt_local_reset_flags_function.patch diff --git a/patches/batman-adv_fix_tt_local_reset_flags_function.patch b/patches/batman-adv_fix_tt_local_reset_flags_function.patch new file mode 100644 index 0000000..3d0d51e --- /dev/null +++ b/patches/batman-adv_fix_tt_local_reset_flags_function.patch @@ -0,0 +1,31 @@ +From: Antonio Quartulli + +Currently the counter of tt_local_entry structures (tt_local_num) is incremented +each time the tt_local_reset_flags() is invoked causing the node to send wrong +TT_REPONSE packets containing a copy of non-initialised memory thus corrupting +other nodes global translation table and making higher level communication +impossible. + +Reported-by: Junkeun Song +Signed-off-by: Antonio Quartulli +Acked-by: Junkeun Song +--- + translation-table.c | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +diff --git a/translation-table.c b/translation-table.c +index 2d2cfc1..d4a3917 100644 +--- a/translation-table.c ++++ b/translation-table.c +@@ -1727,6 +1727,8 @@ static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags) + rcu_read_lock(); + hlist_for_each_entry_rcu(tt_local_entry, node, + head, hash_entry) { ++ if (!(tt_local_entry->flags & flags)) ++ continue; + tt_local_entry->flags &= ~flags; + atomic_inc(&bat_priv->num_local_tt); + } +-- +1.7.3.4 + From 6cc850a903b75619a899a977c8aae946dc41b200 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Mon, 17 Oct 2011 12:41:29 +0000 Subject: [PATCH 09/41] batman-adv: yet another critical bug fix Forgot to add this one during the last round. Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@28474 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ..._data_field_in_the_TT_REPONSE_packet.patch | 36 +++++++++++++++++++ ...dv_fix_tt_local_reset_flags_function.patch | 2 -- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 patches/batman-adv_correctly_set_the_data_field_in_the_TT_REPONSE_packet.patch diff --git a/patches/batman-adv_correctly_set_the_data_field_in_the_TT_REPONSE_packet.patch b/patches/batman-adv_correctly_set_the_data_field_in_the_TT_REPONSE_packet.patch new file mode 100644 index 0000000..f83bab5 --- /dev/null +++ b/patches/batman-adv_correctly_set_the_data_field_in_the_TT_REPONSE_packet.patch @@ -0,0 +1,36 @@ +From: Antonio Quartulli + +In the TT_RESPONSE packet, the number of carried entries is not correctly set. +This leads to a wrong interpretation of the packet payload on the receiver side +causing random entries to be added to the global translation table. Therefore +the latter gets always corrupted, triggering a table recovery all the time. + +Signed-off-by: Antonio Quartulli +--- + translation-table.c | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +--- a/translation-table.c ++++ b/translation-table.c +@@ -1054,7 +1054,6 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn, + tt_response = (struct tt_query_packet *)skb_put(skb, + tt_query_size + tt_len); + tt_response->ttvn = ttvn; +- tt_response->tt_data = htons(tt_tot); + + tt_change = (struct tt_change *)(skb->data + tt_query_size); + tt_count = 0; +@@ -1080,6 +1079,10 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn, + } + rcu_read_unlock(); + ++ /* store in the message the number of entries we have successfully ++ * copied */ ++ tt_response->tt_data = htons(tt_count); ++ + out: + return skb; + } +-- +1.7.3.4 + diff --git a/patches/batman-adv_fix_tt_local_reset_flags_function.patch b/patches/batman-adv_fix_tt_local_reset_flags_function.patch index 3d0d51e..1a59bc8 100644 --- a/patches/batman-adv_fix_tt_local_reset_flags_function.patch +++ b/patches/batman-adv_fix_tt_local_reset_flags_function.patch @@ -13,8 +13,6 @@ Acked-by: Junkeun Song translation-table.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) -diff --git a/translation-table.c b/translation-table.c -index 2d2cfc1..d4a3917 100644 --- a/translation-table.c +++ b/translation-table.c @@ -1727,6 +1727,8 @@ static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags) From 9d16ea2d2c41facb3b6e797d4036ffb1b29280a0 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Wed, 19 Oct 2011 12:52:18 +0000 Subject: [PATCH 10/41] batman-adv: update package to lastest bugfix release (2011.3.1) Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@28490 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 11 +++-- ..._data_field_in_the_TT_REPONSE_packet.patch | 36 -------------- ...o_be_true_for_broadcast_packets_only.patch | 49 ------------------- ...dv_fix_tt_local_reset_flags_function.patch | 29 ----------- 4 files changed, 6 insertions(+), 119 deletions(-) delete mode 100644 patches/batman-adv_correctly_set_the_data_field_in_the_TT_REPONSE_packet.patch delete mode 100644 patches/batman-adv_do_bcast_has_to_be_true_for_broadcast_packets_only.patch delete mode 100644 patches/batman-adv_fix_tt_local_reset_flags_function.patch diff --git a/Makefile b/Makefile index 0df2ede..2c04d87 100644 --- a/Makefile +++ b/Makefile @@ -10,15 +10,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2011.3.0 -PKG_MD5SUM:=0ba4b63f7fe9d2a561662cdc0378caa5 +PKG_VERSION:=2011.3.1 +BATCTL_VERSION:=2011.3.0 +PKG_MD5SUM:=54a5caff56a8380f3070111ce84bbfc4 BATCTL_MD5SUM:=8eb197896049bb04a6beef56015a16b6 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION) -PKG_TOOL_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/batctl-$(PKG_VERSION) +PKG_TOOL_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/batctl-$(BATCTL_VERSION) include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/kernel.mk @@ -67,13 +68,13 @@ MAKE_BATCTL_ARGS += \ ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),) define Download/batctl - FILE:=batctl-$(PKG_VERSION).tar.gz + FILE:=batctl-$(BATCTL_VERSION).tar.gz URL:=$(PKG_SOURCE_URL) MD5SUM:=$(BATCTL_MD5SUM) endef $(eval $(call Download,batctl)) -EXTRACT_BATCTL = tar xzf "$(DL_DIR)/batctl-$(PKG_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)" +EXTRACT_BATCTL = tar xzf "$(DL_DIR)/batctl-$(BATCTL_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)" PATCH_BATCTL = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)","*batctl*") BUILD_BATCTL = $(MAKE) -C $(PKG_TOOL_BUILD_DIR) $(MAKE_BATCTL_ARGS) endif diff --git a/patches/batman-adv_correctly_set_the_data_field_in_the_TT_REPONSE_packet.patch b/patches/batman-adv_correctly_set_the_data_field_in_the_TT_REPONSE_packet.patch deleted file mode 100644 index f83bab5..0000000 --- a/patches/batman-adv_correctly_set_the_data_field_in_the_TT_REPONSE_packet.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Antonio Quartulli - -In the TT_RESPONSE packet, the number of carried entries is not correctly set. -This leads to a wrong interpretation of the packet payload on the receiver side -causing random entries to be added to the global translation table. Therefore -the latter gets always corrupted, triggering a table recovery all the time. - -Signed-off-by: Antonio Quartulli ---- - translation-table.c | 5 ++++- - 1 files changed, 4 insertions(+), 1 deletions(-) - ---- a/translation-table.c -+++ b/translation-table.c -@@ -1054,7 +1054,6 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn, - tt_response = (struct tt_query_packet *)skb_put(skb, - tt_query_size + tt_len); - tt_response->ttvn = ttvn; -- tt_response->tt_data = htons(tt_tot); - - tt_change = (struct tt_change *)(skb->data + tt_query_size); - tt_count = 0; -@@ -1080,6 +1079,10 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn, - } - rcu_read_unlock(); - -+ /* store in the message the number of entries we have successfully -+ * copied */ -+ tt_response->tt_data = htons(tt_count); -+ - out: - return skb; - } --- -1.7.3.4 - diff --git a/patches/batman-adv_do_bcast_has_to_be_true_for_broadcast_packets_only.patch b/patches/batman-adv_do_bcast_has_to_be_true_for_broadcast_packets_only.patch deleted file mode 100644 index 12d0a6a..0000000 --- a/patches/batman-adv_do_bcast_has_to_be_true_for_broadcast_packets_only.patch +++ /dev/null @@ -1,49 +0,0 @@ -From: Antonio Quartulli - -corrects a critical bug of the GW feature. This bug made all the unicast -packets destined to a GW to be sent as broadcast. This bug is present even if -the sender GW feature is configured as OFF. It's an urgent bug fix and should -be committed as soon as possible. - -This was a regression introduced by 43676ab590c3f8686fd047d34c3e33803eef71f0 - -Signed-off-by: Antonio Quartulli -Signed-off-by: Marek Lindner ---- - soft-interface.c | 10 +++++----- - 1 files changed, 5 insertions(+), 5 deletions(-) - ---- a/soft-interface.c -+++ b/soft-interface.c -@@ -565,7 +565,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) - struct orig_node *orig_node = NULL; - int data_len = skb->len, ret; - short vid = -1; -- bool do_bcast = false; -+ bool do_bcast; - - if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE) - goto dropped; -@@ -598,15 +598,15 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) - tt_local_add(soft_iface, ethhdr->h_source); - - orig_node = transtable_search(bat_priv, ethhdr->h_dest); -- if (is_multicast_ether_addr(ethhdr->h_dest) || -- (orig_node && orig_node->gw_flags)) { -+ do_bcast = is_multicast_ether_addr(ethhdr->h_dest); -+ if (do_bcast || (orig_node && orig_node->gw_flags)) { - ret = gw_is_target(bat_priv, skb, orig_node); - - if (ret < 0) - goto dropped; - -- if (ret == 0) -- do_bcast = true; -+ if (ret) -+ do_bcast = false; - } - - /* ethernet packet should be broadcasted */ --- -1.7.5.4 - diff --git a/patches/batman-adv_fix_tt_local_reset_flags_function.patch b/patches/batman-adv_fix_tt_local_reset_flags_function.patch deleted file mode 100644 index 1a59bc8..0000000 --- a/patches/batman-adv_fix_tt_local_reset_flags_function.patch +++ /dev/null @@ -1,29 +0,0 @@ -From: Antonio Quartulli - -Currently the counter of tt_local_entry structures (tt_local_num) is incremented -each time the tt_local_reset_flags() is invoked causing the node to send wrong -TT_REPONSE packets containing a copy of non-initialised memory thus corrupting -other nodes global translation table and making higher level communication -impossible. - -Reported-by: Junkeun Song -Signed-off-by: Antonio Quartulli -Acked-by: Junkeun Song ---- - translation-table.c | 2 ++ - 1 files changed, 2 insertions(+), 0 deletions(-) - ---- a/translation-table.c -+++ b/translation-table.c -@@ -1727,6 +1727,8 @@ static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags) - rcu_read_lock(); - hlist_for_each_entry_rcu(tt_local_entry, node, - head, hash_entry) { -+ if (!(tt_local_entry->flags & flags)) -+ continue; - tt_local_entry->flags &= ~flags; - atomic_inc(&bat_priv->num_local_tt); - } --- -1.7.3.4 - From e7806604cbd0ffe4295a5b334fc46cdc027047fe Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Tue, 25 Oct 2011 12:37:44 +0000 Subject: [PATCH 11/41] batman-adv: bugfixes for the 2011.3.1 release Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@28575 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 4 +- ...ld_position_in_tt_local_global_entry.patch | 41 ++++++++++++ ...anity_check_when_removing_global_tts.patch | 23 +++++++ ...ove_references_for_global_tt_entries.patch | 63 +++++++++++++++++++ 4 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 patches/0001-batman-adv_unify_hash_entry_field_position_in_tt_local_global_entry.patch create mode 100644 patches/0002-batman-adv_add_sanity_check_when_removing_global_tts.patch create mode 100644 patches/0003-batman-adv_remove_references_for_global_tt_entries.patch diff --git a/Makefile b/Makefile index 2c04d87..e5a4147 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION) -PKG_TOOL_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/batctl-$(BATCTL_VERSION) +PKG_BATCTL_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/batctl-$(BATCTL_VERSION) include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/kernel.mk @@ -76,7 +76,7 @@ $(eval $(call Download,batctl)) EXTRACT_BATCTL = tar xzf "$(DL_DIR)/batctl-$(BATCTL_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)" PATCH_BATCTL = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)","*batctl*") -BUILD_BATCTL = $(MAKE) -C $(PKG_TOOL_BUILD_DIR) $(MAKE_BATCTL_ARGS) +BUILD_BATCTL = $(MAKE) -C $(PKG_BATCTL_BUILD_DIR) $(MAKE_BATCTL_ARGS) endif KPATCH ?= $(PATCH) diff --git a/patches/0001-batman-adv_unify_hash_entry_field_position_in_tt_local_global_entry.patch b/patches/0001-batman-adv_unify_hash_entry_field_position_in_tt_local_global_entry.patch new file mode 100644 index 0000000..310e281 --- /dev/null +++ b/patches/0001-batman-adv_unify_hash_entry_field_position_in_tt_local_global_entry.patch @@ -0,0 +1,41 @@ + +Function tt_response_fill_table() actually uses a tt_local_entry pointer to +iterate either over the local or the global table entries (it depends on the +what hash table is passed as argument). To iterate over such entries the +hlist_for_each_entry_rcu() macro has to access their "hash_entry" field which +MUST be at the same position in both the tt_global/local_entry structures. + +Reported-by: Simon Wunderlich +Signed-off-by: Antonio Quartulli +--- + types.h | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +--- a/types.h ++++ b/types.h +@@ -224,22 +224,22 @@ struct socket_packet { + + struct tt_local_entry { + uint8_t addr[ETH_ALEN]; ++ struct hlist_node hash_entry; + unsigned long last_seen; + uint16_t flags; + atomic_t refcount; + struct rcu_head rcu; +- struct hlist_node hash_entry; + }; + + struct tt_global_entry { + uint8_t addr[ETH_ALEN]; ++ struct hlist_node hash_entry; /* entry in the global table */ + struct orig_node *orig_node; + uint8_t ttvn; + uint16_t flags; /* only TT_GLOBAL_ROAM is used */ + unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */ + atomic_t refcount; + struct rcu_head rcu; +- struct hlist_node hash_entry; /* entry in the global table */ + }; + + struct tt_change_node { + diff --git a/patches/0002-batman-adv_add_sanity_check_when_removing_global_tts.patch b/patches/0002-batman-adv_add_sanity_check_when_removing_global_tts.patch new file mode 100644 index 0000000..9f43083 --- /dev/null +++ b/patches/0002-batman-adv_add_sanity_check_when_removing_global_tts.patch @@ -0,0 +1,23 @@ + +After removing the batman-adv module, the hash may be already gone +when tt_global_del_orig() tries to clean the hash. This patch adds +a sanity check to avoid this. + +Signed-off-by: Simon Wunderlich +--- + translation-table.c | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +--- a/translation-table.c ++++ b/translation-table.c +@@ -712,6 +712,9 @@ void tt_global_del_orig(struct bat_priv *bat_priv, + struct hlist_head *head; + spinlock_t *list_lock; /* protects write access to the hash lists */ + ++ if (!hash) ++ return; ++ + for (i = 0; i < hash->size; i++) { + head = &hash->table[i]; + list_lock = &hash->list_locks[i]; + diff --git a/patches/0003-batman-adv_remove_references_for_global_tt_entries.patch b/patches/0003-batman-adv_remove_references_for_global_tt_entries.patch new file mode 100644 index 0000000..e155686 --- /dev/null +++ b/patches/0003-batman-adv_remove_references_for_global_tt_entries.patch @@ -0,0 +1,63 @@ + +struct tt_global_entry holds a reference to an orig_node which must be +decremented before deallocating the structure. + +Signed-off-by: Simon Wunderlich +--- + compat.c | 8 -------- + compat.h | 1 - + translation-table.c | 14 +++++++++++++- + 3 files changed, 13 insertions(+), 10 deletions(-) + +--- a/compat.c ++++ b/compat.c +@@ -36,12 +36,4 @@ void free_rcu_tt_local_entry(struct rcu_head *rcu) + kfree(tt_local_entry); + } + +-void free_rcu_tt_global_entry(struct rcu_head *rcu) +-{ +- struct tt_global_entry *tt_global_entry; +- +- tt_global_entry = container_of(rcu, struct tt_global_entry, rcu); +- kfree(tt_global_entry); +-} +- + #endif /* < KERNEL_VERSION(3, 0, 0) */ +--- a/compat.h ++++ b/compat.h +@@ -63,7 +63,6 @@ void free_rcu_gw_node(struct rcu_head *rcu); + void free_rcu_neigh_node(struct rcu_head *rcu); + void free_rcu_softif_neigh(struct rcu_head *rcu); + void free_rcu_tt_local_entry(struct rcu_head *rcu); +-void free_rcu_tt_global_entry(struct rcu_head *rcu); + + #endif /* < KERNEL_VERSION(3, 0, 0) */ + +--- a/translation-table.c ++++ b/translation-table.c +@@ -137,10 +137,22 @@ static void tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry) + kfree_rcu(tt_local_entry, rcu); + } + ++static void tt_global_entry_free_rcu(struct rcu_head *rcu) ++{ ++ struct tt_global_entry *tt_global_entry; ++ ++ tt_global_entry = container_of(rcu, struct tt_global_entry, rcu); ++ ++ if (tt_global_entry->orig_node) ++ orig_node_free_ref(tt_global_entry->orig_node); ++ ++ kfree(tt_global_entry); ++} ++ + static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry) + { + if (atomic_dec_and_test(&tt_global_entry->refcount)) +- kfree_rcu(tt_global_entry, rcu); ++ call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu); + } + + static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr, + From 13da3f36ef903b66a34b880e0a4b417fc5956f80 Mon Sep 17 00:00:00 2001 From: Nicolas Thill Date: Fri, 28 Oct 2011 13:36:51 +0000 Subject: [PATCH 12/41] packages/batman-adv: adjust dependency on CRC16 kernel module git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@28657 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e5a4147..345f64e 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ define KernelPackage/batman-adv URL:=http://www.open-mesh.org/ MAINTAINER:=Marek Lindner SUBMENU:=Network Support - DEPENDS:=@!LINUX_2_4 +kmod-crc16 + DEPENDS:=@!LINUX_2_4 +kmod-lib-crc16 TITLE:=B.A.T.M.A.N. Adv FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,batman-adv) From 88a26692ba0c0f37759695fde57f2877f8909cc4 Mon Sep 17 00:00:00 2001 From: Nicolas Thill Date: Fri, 11 Nov 2011 18:07:06 +0000 Subject: [PATCH 13/41] packages: remove dependency on obsolete LINUX_2_4 symbol git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@28960 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 345f64e..93fc391 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ define KernelPackage/batman-adv URL:=http://www.open-mesh.org/ MAINTAINER:=Marek Lindner SUBMENU:=Network Support - DEPENDS:=@!LINUX_2_4 +kmod-lib-crc16 + DEPENDS:=+kmod-lib-crc16 TITLE:=B.A.T.M.A.N. Adv FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,batman-adv) From 4d5deead5fe39b68c937a6a5d124548646471724 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Mon, 14 Nov 2011 15:52:12 +0000 Subject: [PATCH 14/41] batman-adv: update package to latest release (2011.4.0) Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@29118 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 8 +-- files/etc/config/batman-adv | 1 + files/lib/batman-adv/config.sh | 7 ++- ...ld_position_in_tt_local_global_entry.patch | 41 ------------ ...anity_check_when_removing_global_tts.patch | 23 ------- ...ove_references_for_global_tt_entries.patch | 63 ------------------- 6 files changed, 11 insertions(+), 132 deletions(-) delete mode 100644 patches/0001-batman-adv_unify_hash_entry_field_position_in_tt_local_global_entry.patch delete mode 100644 patches/0002-batman-adv_add_sanity_check_when_removing_global_tts.patch delete mode 100644 patches/0003-batman-adv_remove_references_for_global_tt_entries.patch diff --git a/Makefile b/Makefile index 93fc391..5154862 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2011.3.1 -BATCTL_VERSION:=2011.3.0 -PKG_MD5SUM:=54a5caff56a8380f3070111ce84bbfc4 -BATCTL_MD5SUM:=8eb197896049bb04a6beef56015a16b6 +PKG_VERSION:=2011.4.0 +BATCTL_VERSION:=2011.4.0 +PKG_MD5SUM:=3987d693bd26d8057506b542c3635910 +BATCTL_MD5SUM:=325b25dbb8261f7fa19c6e1d9bfba6e1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) diff --git a/files/etc/config/batman-adv b/files/etc/config/batman-adv index 31ef797..414b119 100644 --- a/files/etc/config/batman-adv +++ b/files/etc/config/batman-adv @@ -2,6 +2,7 @@ config 'mesh' 'bat0' option 'interfaces' 'mesh' option 'aggregated_ogms' + option 'ap_isolation' option 'bonding' option 'fragmentation' option 'gw_bandwidth' diff --git a/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh index 347e307..58a01d2 100644 --- a/files/lib/batman-adv/config.sh +++ b/files/lib/batman-adv/config.sh @@ -13,13 +13,14 @@ is_module_loaded() { start_mesh () { local meshif="$1" - local interfaces aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval vis_mode + local interfaces aggregated_ogms ap_isolation bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval vis_mode is_module_loaded [ $? -ne 1 ] && return config_get interfaces "$meshif" interfaces config_get aggregated_ogms "$meshif" aggregated_ogms + config_get ap_isolation "$meshif" ap_isolation config_get bonding "$meshif" bonding config_get fragmentation "$meshif" fragmentation config_get gw_bandwidth "$meshif" gw_bandwidth @@ -57,6 +58,10 @@ start_mesh () { echo $aggregated_ogms > /sys/class/net/$meshif/mesh/aggregated_ogms fi + if [ $ap_isolation ]; then + echo $ap_isolation > /sys/class/net/$meshif/mesh/ap_isolation + fi + if [ $bonding ]; then echo $bonding > /sys/class/net/$meshif/mesh/bonding fi diff --git a/patches/0001-batman-adv_unify_hash_entry_field_position_in_tt_local_global_entry.patch b/patches/0001-batman-adv_unify_hash_entry_field_position_in_tt_local_global_entry.patch deleted file mode 100644 index 310e281..0000000 --- a/patches/0001-batman-adv_unify_hash_entry_field_position_in_tt_local_global_entry.patch +++ /dev/null @@ -1,41 +0,0 @@ - -Function tt_response_fill_table() actually uses a tt_local_entry pointer to -iterate either over the local or the global table entries (it depends on the -what hash table is passed as argument). To iterate over such entries the -hlist_for_each_entry_rcu() macro has to access their "hash_entry" field which -MUST be at the same position in both the tt_global/local_entry structures. - -Reported-by: Simon Wunderlich -Signed-off-by: Antonio Quartulli ---- - types.h | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - ---- a/types.h -+++ b/types.h -@@ -224,22 +224,22 @@ struct socket_packet { - - struct tt_local_entry { - uint8_t addr[ETH_ALEN]; -+ struct hlist_node hash_entry; - unsigned long last_seen; - uint16_t flags; - atomic_t refcount; - struct rcu_head rcu; -- struct hlist_node hash_entry; - }; - - struct tt_global_entry { - uint8_t addr[ETH_ALEN]; -+ struct hlist_node hash_entry; /* entry in the global table */ - struct orig_node *orig_node; - uint8_t ttvn; - uint16_t flags; /* only TT_GLOBAL_ROAM is used */ - unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */ - atomic_t refcount; - struct rcu_head rcu; -- struct hlist_node hash_entry; /* entry in the global table */ - }; - - struct tt_change_node { - diff --git a/patches/0002-batman-adv_add_sanity_check_when_removing_global_tts.patch b/patches/0002-batman-adv_add_sanity_check_when_removing_global_tts.patch deleted file mode 100644 index 9f43083..0000000 --- a/patches/0002-batman-adv_add_sanity_check_when_removing_global_tts.patch +++ /dev/null @@ -1,23 +0,0 @@ - -After removing the batman-adv module, the hash may be already gone -when tt_global_del_orig() tries to clean the hash. This patch adds -a sanity check to avoid this. - -Signed-off-by: Simon Wunderlich ---- - translation-table.c | 3 +++ - 1 files changed, 3 insertions(+), 0 deletions(-) - ---- a/translation-table.c -+++ b/translation-table.c -@@ -712,6 +712,9 @@ void tt_global_del_orig(struct bat_priv *bat_priv, - struct hlist_head *head; - spinlock_t *list_lock; /* protects write access to the hash lists */ - -+ if (!hash) -+ return; -+ - for (i = 0; i < hash->size; i++) { - head = &hash->table[i]; - list_lock = &hash->list_locks[i]; - diff --git a/patches/0003-batman-adv_remove_references_for_global_tt_entries.patch b/patches/0003-batman-adv_remove_references_for_global_tt_entries.patch deleted file mode 100644 index e155686..0000000 --- a/patches/0003-batman-adv_remove_references_for_global_tt_entries.patch +++ /dev/null @@ -1,63 +0,0 @@ - -struct tt_global_entry holds a reference to an orig_node which must be -decremented before deallocating the structure. - -Signed-off-by: Simon Wunderlich ---- - compat.c | 8 -------- - compat.h | 1 - - translation-table.c | 14 +++++++++++++- - 3 files changed, 13 insertions(+), 10 deletions(-) - ---- a/compat.c -+++ b/compat.c -@@ -36,12 +36,4 @@ void free_rcu_tt_local_entry(struct rcu_head *rcu) - kfree(tt_local_entry); - } - --void free_rcu_tt_global_entry(struct rcu_head *rcu) --{ -- struct tt_global_entry *tt_global_entry; -- -- tt_global_entry = container_of(rcu, struct tt_global_entry, rcu); -- kfree(tt_global_entry); --} -- - #endif /* < KERNEL_VERSION(3, 0, 0) */ ---- a/compat.h -+++ b/compat.h -@@ -63,7 +63,6 @@ void free_rcu_gw_node(struct rcu_head *rcu); - void free_rcu_neigh_node(struct rcu_head *rcu); - void free_rcu_softif_neigh(struct rcu_head *rcu); - void free_rcu_tt_local_entry(struct rcu_head *rcu); --void free_rcu_tt_global_entry(struct rcu_head *rcu); - - #endif /* < KERNEL_VERSION(3, 0, 0) */ - ---- a/translation-table.c -+++ b/translation-table.c -@@ -137,10 +137,22 @@ static void tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry) - kfree_rcu(tt_local_entry, rcu); - } - -+static void tt_global_entry_free_rcu(struct rcu_head *rcu) -+{ -+ struct tt_global_entry *tt_global_entry; -+ -+ tt_global_entry = container_of(rcu, struct tt_global_entry, rcu); -+ -+ if (tt_global_entry->orig_node) -+ orig_node_free_ref(tt_global_entry->orig_node); -+ -+ kfree(tt_global_entry); -+} -+ - static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry) - { - if (atomic_dec_and_test(&tt_global_entry->refcount)) -- kfree_rcu(tt_global_entry, rcu); -+ call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu); - } - - static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr, - From 2d654c0af194a645bc2ba1a0c8936b4b849734a8 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Sun, 5 Feb 2012 16:21:26 +0000 Subject: [PATCH 16/41] batman-adv: upgrade package to latest release 2012.0.0 Also replace init script with hotplug based set of scripts. Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@30272 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 40 +++----- files/etc/config/batman-adv | 3 + files/etc/hotplug.d/net/99-batman-adv | 15 +++ files/etc/init.d/batman-adv | 28 ------ files/lib/batman-adv/config.sh | 138 +++++++++----------------- files/usr/sbin/batman-adv | 46 +++++++++ 6 files changed, 128 insertions(+), 142 deletions(-) create mode 100644 files/etc/hotplug.d/net/99-batman-adv delete mode 100644 files/etc/init.d/batman-adv create mode 100644 files/usr/sbin/batman-adv diff --git a/Makefile b/Makefile index 5154862..8a40994 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2011.4.0 -BATCTL_VERSION:=2011.4.0 -PKG_MD5SUM:=3987d693bd26d8057506b542c3635910 -BATCTL_MD5SUM:=325b25dbb8261f7fa19c6e1d9bfba6e1 +PKG_VERSION:=2012.0.0 +BATCTL_VERSION:=2012.0.0 +PKG_MD5SUM:=f1de23457a47ca4369ee1f0e0b7fc405 +BATCTL_MD5SUM:=27991c2921e18657c7262e917d45106a PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) @@ -74,9 +74,10 @@ define Download/batctl endef $(eval $(call Download,batctl)) -EXTRACT_BATCTL = tar xzf "$(DL_DIR)/batctl-$(BATCTL_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)" -PATCH_BATCTL = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)","*batctl*") -BUILD_BATCTL = $(MAKE) -C $(PKG_BATCTL_BUILD_DIR) $(MAKE_BATCTL_ARGS) +BATCTL_EXTRACT = tar xzf "$(DL_DIR)/batctl-$(BATCTL_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)" +BATCTL_PATCH = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)","*batctl*") +BATCTL_BUILD = $(MAKE) -C $(PKG_BATCTL_BUILD_DIR) $(MAKE_BATCTL_ARGS) +BATCTL_INSTALL = $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/ endif KPATCH ?= $(PATCH) @@ -90,36 +91,27 @@ endef define Build/Patch $(call Build/DoPatch,"$(PKG_BUILD_DIR)","$(PATCH_DIR)","*batman*") - $(EXTRACT_BATCTL) - $(PATCH_BATCTL) + $(BATCTL_EXTRACT) + $(BATCTL_PATCH) endef define Build/Compile cp $(PKG_BUILD_DIR)/Makefile.kbuild $(PKG_BUILD_DIR)/Makefile $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATMAN_ADV_ARGS) - $(BUILD_BATCTL) + $(BATCTL_BUILD) endef define Build/Clean rm -rf $(BUILD_DIR)/$(PKG_NAME)/ endef -ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),) define KernelPackage/batman-adv/install - $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/lib/batman-adv - $(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d - $(INSTALL_BIN) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/lib/batman-adv $(1)/usr/sbin $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/ + $(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv + $(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net + $(INSTALL_BIN) ./files/usr/sbin/batman-adv $(1)/usr/sbin + $(BATCTL_INSTALL) endef -else -define KernelPackage/batman-adv/install - $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/lib/batman-adv - $(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d - $(INSTALL_BIN) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv - $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config -endef -endif $(eval $(call KernelPackage,batman-adv)) diff --git a/files/etc/config/batman-adv b/files/etc/config/batman-adv index 414b119..5197820 100644 --- a/files/etc/config/batman-adv +++ b/files/etc/config/batman-adv @@ -12,3 +12,6 @@ config 'mesh' 'bat0' option 'orig_interval' option 'vis_mode' +# yet another batX instance +# config 'mesh' 'bat5' +# option 'interfaces' 'second_mesh' diff --git a/files/etc/hotplug.d/net/99-batman-adv b/files/etc/hotplug.d/net/99-batman-adv new file mode 100644 index 0000000..2ad83cf --- /dev/null +++ b/files/etc/hotplug.d/net/99-batman-adv @@ -0,0 +1,15 @@ +#!/bin/sh + +. /lib/batman-adv/config.sh + +config_load batman-adv + +case "$ACTION" in + add) + [ -d /sys/class/net/$INTERFACE/mesh/ ] && config_bat "$INTERFACE" + [ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_add_interface mesh "$INTERFACE" + ;; + remove) + [ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_del_interface mesh "$INTERFACE" + ;; +esac diff --git a/files/etc/init.d/batman-adv b/files/etc/init.d/batman-adv deleted file mode 100644 index f0f6789..0000000 --- a/files/etc/init.d/batman-adv +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2011 OpenWrt.org - -START=90 - -. /lib/batman-adv/config.sh - -# can also be used with "batman-adv start bat0" -start() { - config_load batman-adv - - if [ -n "$1" ]; then - start_mesh $1 - else - config_foreach start_mesh mesh - fi -} - -# can also be used with "batman-adv stop bat0" -stop () { - config_load batman-adv - - if [ -n "$1" ]; then - stop_mesh $1 - else - config_foreach stop_mesh mesh - fi -} diff --git a/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh index 58a01d2..d0569bc 100644 --- a/files/lib/batman-adv/config.sh +++ b/files/lib/batman-adv/config.sh @@ -1,103 +1,61 @@ #!/bin/sh -# Copyright (C) 2011 OpenWrt.org -is_module_loaded() { +bat_config(){ + local mesh="$1" + local aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval hop_penalty vis_mode - if [ ! -d "/sys/module/batman_adv" ]; then - echo "batman-adv module directory not found - was the kernel module loaded ?" >&2 - return 0 - fi + config_get aggregated_ogms "$mesh" aggregated_ogms + config_get bonding "$mesh" bonding + config_get fragmentation "$mesh" fragmentation + config_get gw_bandwidth "$mesh" gw_bandwidth + config_get gw_mode "$mesh" gw_mode + config_get gw_sel_class "$mesh" gw_sel_class + config_get log_level "$mesh" log_level + config_get orig_interval "$mesh" orig_interval + config_get hop_penalty "$mesh" hop_penalty + config_get vis_mode "$mesh" vis_mode - return 1 + [ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval + [ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty + [ -n "$log_level" ] && echo $log_level > /sys/class/net/$mesh/mesh/log_level 2>&- + [ -n "$aggregate_ogms" ] && echo $aggregate_ogms > /sys/class/net/$mesh/mesh/aggregate_ogms + [ -n "$bonding" ] && echo $bonding > /sys/class/net/$mesh/mesh/bonding + [ -n "$fragmentation" ] && echo $fragmentation > /sys/class/net/$mesh/mesh/fragmentation + [ -n "$gw_bandwidth" ] && echo $gw_bandwidth > /sys/class/net/$mesh/mesh/gw_bandwidth + [ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$mesh/mesh/gw_mode + [ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class + [ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode } -start_mesh () { - local meshif="$1" - local interfaces aggregated_ogms ap_isolation bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval vis_mode +bat_add_interface(){ + local mesh="$1" + local interface="$2" + local interfaces - is_module_loaded - [ $? -ne 1 ] && return - - config_get interfaces "$meshif" interfaces - config_get aggregated_ogms "$meshif" aggregated_ogms - config_get ap_isolation "$meshif" ap_isolation - config_get bonding "$meshif" bonding - config_get fragmentation "$meshif" fragmentation - config_get gw_bandwidth "$meshif" gw_bandwidth - config_get gw_mode "$meshif" gw_mode - config_get gw_sel_class "$meshif" gw_sel_class - config_get log_level "$meshif" log_level - config_get orig_interval "$meshif" orig_interval - config_get vis_mode "$meshif" vis_mode - - if [ "$interfaces" = "" ]; then - echo Error, you must specify at least a network interface - return - fi + sleep 3s # some device (ath) is very lazy to start + config_get interfaces $mesh interfaces + for iface in $interfaces; do + [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || { + iface=$(uci -q -P/var/state get network.$iface.ifname) + [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || continue + } - for interface in $interfaces - do - ifname=$(uci -P /var/state get network.$interface.ifname 2>&-) - [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && { - ifname=${interface} - [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && echo "Can't add interface $ifname - ignoring" && continue - } - - echo $meshif > /sys/class/net/$ifname/batman_adv/mesh_iface - done - - if [ $orig_interval ]; then - echo $orig_interval > /sys/class/net/$meshif/mesh/orig_interval - fi - - if [ $log_level ]; then - echo $log_level > /sys/class/net/$meshif/mesh/log_level 2>&- - fi - - if [ $aggregated_ogms ]; then - echo $aggregated_ogms > /sys/class/net/$meshif/mesh/aggregated_ogms - fi - - if [ $ap_isolation ]; then - echo $ap_isolation > /sys/class/net/$meshif/mesh/ap_isolation - fi - - if [ $bonding ]; then - echo $bonding > /sys/class/net/$meshif/mesh/bonding - fi - - if [ $fragmentation ]; then - echo $fragmentation > /sys/class/net/$meshif/mesh/fragmentation - fi - - if [ $gw_bandwidth ]; then - echo $gw_bandwidth > /sys/class/net/$meshif/mesh/gw_bandwidth - fi - - if [ $gw_mode ]; then - echo $gw_mode > /sys/class/net/$meshif/mesh/gw_mode - fi - - if [ $gw_sel_class ]; then - echo $gw_sel_class > /sys/class/net/$meshif/mesh/gw_sel_class - fi - - if [ $vis_mode ]; then - echo $vis_mode > /sys/class/net/$meshif/mesh/vis_mode - fi + [ "$iface" = "$interface" ] && echo $mesh > /sys/class/net/$iface/batman_adv/mesh_iface + done } -stop_mesh() { - local meshif="$1" +bat_del_interface(){ + local mesh="$1" + local interface="$2" + local interfaces - is_module_loaded - [ $? -ne 1 ] && return + config_get interfaces $mesh interfaces + for iface in $interfaces; do + [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || { + iface=$(uci -q -P/var/state get network.$iface.ifname) + [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || continue + } - for iface in $(ls /sys/class/net/*) - do - [ ! -f "$iface/batman_adv/mesh_iface" ] && continue - [ "$(head -1 $iface/batman_adv/mesh_iface)" != "$meshif" ] && continue - - echo "none" > $iface/batman_adv/mesh_iface - done + [ "$iface" = "$interface" ] && echo none > /sys/class/net/$iface/batman_adv/mesh_iface + done } diff --git a/files/usr/sbin/batman-adv b/files/usr/sbin/batman-adv new file mode 100644 index 0000000..4f17991 --- /dev/null +++ b/files/usr/sbin/batman-adv @@ -0,0 +1,46 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2011 OpenWrt.org + +. /lib/batman-adv/config.sh + +start_mesh() { + local mesh="$1" + local ifaces=$(awk -F':' '{if (NR > 2) print $1}' /proc/net/dev) + + for iface in $ifaces; do + [ -d /sys/class/net/$iface/batman_adv/ ] && bat_add_interface "$mesh" "$iface" + done + + bat_config "$mesh" +} + +stop_mesh() { + local mesh="$1" + local ifaces=$(awk -F':' '{if (NR > 2) print $1}' /proc/net/dev) + + for iface in $ifaces; do + [ -d /sys/class/net/$iface/batman_adv/ ] && bat_del_interface "$mesh" "$iface" + done +} + +# can also be used with "batman-adv start bat0" +start() { + config_load batman-adv + + if [ -n "$1" ]; then + start_mesh $1 + else + config_foreach start_mesh mesh + fi +} + +# can also be used with "batman-adv stop bat0" +stop () { + config_load batman-adv + + if [ -n "$1" ]; then + stop_mesh $1 + else + config_foreach stop_mesh mesh + fi +} From 32222b3735ef2c5224d9030add57f8b4bde37485 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Sat, 11 Feb 2012 18:15:36 +0000 Subject: [PATCH 17/41] batman-adv: hotplug script fixes * call bat_config() instead of config_bat() (which does not exist) * support ap isolation config option * remove /etc/rc.common from script since it is not an init script anymore Signed-off-by: Filippo Sallemi git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@30457 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- files/etc/hotplug.d/net/99-batman-adv | 2 +- files/lib/batman-adv/config.sh | 3 +++ files/usr/sbin/batman-adv | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/files/etc/hotplug.d/net/99-batman-adv b/files/etc/hotplug.d/net/99-batman-adv index 2ad83cf..fe19e64 100644 --- a/files/etc/hotplug.d/net/99-batman-adv +++ b/files/etc/hotplug.d/net/99-batman-adv @@ -6,7 +6,7 @@ config_load batman-adv case "$ACTION" in add) - [ -d /sys/class/net/$INTERFACE/mesh/ ] && config_bat "$INTERFACE" + [ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE" [ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_add_interface mesh "$INTERFACE" ;; remove) diff --git a/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh index d0569bc..044c2f6 100644 --- a/files/lib/batman-adv/config.sh +++ b/files/lib/batman-adv/config.sh @@ -14,6 +14,7 @@ bat_config(){ config_get orig_interval "$mesh" orig_interval config_get hop_penalty "$mesh" hop_penalty config_get vis_mode "$mesh" vis_mode + config_get ap_isolation "$mesh" ap_isolation [ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval [ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty @@ -25,6 +26,8 @@ bat_config(){ [ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$mesh/mesh/gw_mode [ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class [ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode + [ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation + } bat_add_interface(){ diff --git a/files/usr/sbin/batman-adv b/files/usr/sbin/batman-adv index 4f17991..6580756 100644 --- a/files/usr/sbin/batman-adv +++ b/files/usr/sbin/batman-adv @@ -1,6 +1,7 @@ -#!/bin/sh /etc/rc.common +#!/bin/sh # Copyright (C) 2011 OpenWrt.org +. /etc/functions.sh . /lib/batman-adv/config.sh start_mesh() { @@ -44,3 +45,15 @@ stop () { config_foreach stop_mesh mesh fi } + +restart() { + stop $1 + start $1 +} + +case "$1" in + start) start $2 ;; + stop) stop $2 ;; + restart) restart $2 ;; + *) echo "Usage: batman-adv [mesh instance]" +esac From ec48d0fc00b7a7924970b643a7584b6c8494ba67 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Mon, 16 Apr 2012 17:36:28 +0000 Subject: [PATCH 18/41] batman-adv: upgrade package to latest release 2012.1.0 Also fix hotplug scripts to load batman-adv module when necessary. Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@31317 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 17 +++++++++-------- files/etc/hotplug.d/net/99-batman-adv | 1 + files/lib/batman-adv/config.sh | 17 ++++++++++++++--- files/usr/sbin/batman-adv | 1 + 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 8a40994..3f2737e 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2012.0.0 -BATCTL_VERSION:=2012.0.0 -PKG_MD5SUM:=f1de23457a47ca4369ee1f0e0b7fc405 -BATCTL_MD5SUM:=27991c2921e18657c7262e917d45106a +PKG_VERSION:=2012.1.0 +BATCTL_VERSION:=2012.1.0 +PKG_MD5SUM:=a66fdc92c677aadae339073c560a454e +BATCTL_MD5SUM:=afdc15c886f27f7740212db50db47190 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) @@ -47,12 +47,14 @@ endef MAKE_BATMAN_ADV_ARGS += \ CROSS_COMPILE="$(TARGET_CROSS)" \ + KERNELPATH="$(LINUX_DIR)" \ ARCH="$(LINUX_KARCH)" \ PATH="$(TARGET_PATH)" \ - $(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),EXTRA_CFLAGS="-DCONFIG_BATMAN_ADV_DEBUG") \ SUBDIRS="$(PKG_BUILD_DIR)" \ + PWD="$(PKG_BUILD_DIR)" \ LINUX_VERSION="$(LINUX_VERSION)" \ - REVISION="" modules + CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEVEL_DEBUG_LOG),y,n) \ + REVISION="" all MAKE_BATCTL_ARGS += \ CFLAGS="$(TARGET_CFLAGS)" \ @@ -96,8 +98,7 @@ define Build/Patch endef define Build/Compile - cp $(PKG_BUILD_DIR)/Makefile.kbuild $(PKG_BUILD_DIR)/Makefile - $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATMAN_ADV_ARGS) + $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATMAN_ADV_ARGS) $(BATCTL_BUILD) endef diff --git a/files/etc/hotplug.d/net/99-batman-adv b/files/etc/hotplug.d/net/99-batman-adv index fe19e64..42d4c29 100644 --- a/files/etc/hotplug.d/net/99-batman-adv +++ b/files/etc/hotplug.d/net/99-batman-adv @@ -2,6 +2,7 @@ . /lib/batman-adv/config.sh +bat_load_module config_load batman-adv case "$ACTION" in diff --git a/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh index 044c2f6..24037b0 100644 --- a/files/lib/batman-adv/config.sh +++ b/files/lib/batman-adv/config.sh @@ -1,6 +1,15 @@ #!/bin/sh -bat_config(){ +bat_load_module() +{ + [ -d "/sys/module/batman_adv/" ] && return + + . /etc/functions.sh + load_modules /etc/modules.d/*-lib-crc16 /etc/modules.d/*-batman-adv +} + +bat_config() +{ local mesh="$1" local aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval hop_penalty vis_mode @@ -30,7 +39,8 @@ bat_config(){ } -bat_add_interface(){ +bat_add_interface() +{ local mesh="$1" local interface="$2" local interfaces @@ -47,7 +57,8 @@ bat_add_interface(){ done } -bat_del_interface(){ +bat_del_interface() +{ local mesh="$1" local interface="$2" local interfaces diff --git a/files/usr/sbin/batman-adv b/files/usr/sbin/batman-adv index 6580756..93ae1b5 100644 --- a/files/usr/sbin/batman-adv +++ b/files/usr/sbin/batman-adv @@ -26,6 +26,7 @@ stop_mesh() { # can also be used with "batman-adv start bat0" start() { + bat_load_module config_load batman-adv if [ -n "$1" ]; then From b94a75102f1baeb4b1286774721673b34bda4814 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Tue, 17 Apr 2012 12:09:15 +0000 Subject: [PATCH 19/41] batman-adv: make bat_load_module() compatible with pre-"lib-crc16" times Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@31334 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- files/lib/batman-adv/config.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh index 24037b0..b0cb4b4 100644 --- a/files/lib/batman-adv/config.sh +++ b/files/lib/batman-adv/config.sh @@ -3,9 +3,9 @@ bat_load_module() { [ -d "/sys/module/batman_adv/" ] && return - + . /etc/functions.sh - load_modules /etc/modules.d/*-lib-crc16 /etc/modules.d/*-batman-adv + load_modules /etc/modules.d/*-crc16 /etc/modules.d/*-batman-adv* } bat_config() @@ -36,7 +36,6 @@ bat_config() [ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class [ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode [ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation - } bat_add_interface() From 71679b5a5251bf04b02bc7e89997cb1f09a7cbac Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 5 Jun 2012 15:54:57 +0000 Subject: [PATCH 20/41] [packages] /etc/functions.sh => /lib/functions.sh git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@32061 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- files/lib/batman-adv/config.sh | 2 +- files/usr/sbin/batman-adv | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh index b0cb4b4..49d63d6 100644 --- a/files/lib/batman-adv/config.sh +++ b/files/lib/batman-adv/config.sh @@ -4,7 +4,7 @@ bat_load_module() { [ -d "/sys/module/batman_adv/" ] && return - . /etc/functions.sh + . /lib/functions.sh load_modules /etc/modules.d/*-crc16 /etc/modules.d/*-batman-adv* } diff --git a/files/usr/sbin/batman-adv b/files/usr/sbin/batman-adv index 93ae1b5..ca9e603 100644 --- a/files/usr/sbin/batman-adv +++ b/files/usr/sbin/batman-adv @@ -1,7 +1,7 @@ #!/bin/sh # Copyright (C) 2011 OpenWrt.org -. /etc/functions.sh +. /lib/functions.sh . /lib/batman-adv/config.sh start_mesh() { From 87cd49221faba5e817804747cd3874bd8dd55514 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 12 Jun 2012 01:56:42 +0000 Subject: [PATCH 21/41] batman-adv: add missing dependency git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@32252 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3f2737e..ef40260 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ define KernelPackage/batman-adv URL:=http://www.open-mesh.org/ MAINTAINER:=Marek Lindner SUBMENU:=Network Support - DEPENDS:=+kmod-lib-crc16 + DEPENDS:=+kmod-lib-crc16 +libc TITLE:=B.A.T.M.A.N. Adv FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,batman-adv) From d884f2a724b169ff3935f2a307fc6837684086e5 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Wed, 13 Jun 2012 18:26:26 +0000 Subject: [PATCH 22/41] batman-adv: upgrade package to latest release 2012.2.0 Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@32342 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Config.in | 4 ++++ Makefile | 11 ++++++----- files/etc/config/batman-adv | 1 + files/lib/batman-adv/config.sh | 6 +++++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Config.in b/Config.in index ad11d3a..d6d9320 100644 --- a/Config.in +++ b/Config.in @@ -3,6 +3,10 @@ config KMOD_BATMAN_ADV_DEBUG_LOG bool "enable verbose debug logging" depends PACKAGE_kmod-batman-adv default n +config KMOD_BATMAN_ADV_BLA + bool "enable bridge loop avoidance" + depends PACKAGE_kmod-batman-adv + default y config KMOD_BATMAN_ADV_BATCTL bool "enable batctl" depends PACKAGE_kmod-batman-adv diff --git a/Makefile b/Makefile index ef40260..1647982 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2012.1.0 -BATCTL_VERSION:=2012.1.0 -PKG_MD5SUM:=a66fdc92c677aadae339073c560a454e -BATCTL_MD5SUM:=afdc15c886f27f7740212db50db47190 +PKG_VERSION:=2012.2.0 +BATCTL_VERSION:=2012.2.0 +PKG_MD5SUM:=68967ed1df709de18ab795722dde9341 +BATCTL_MD5SUM:=7abd284098c514d3f2858e8a956c495e PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) @@ -53,7 +53,8 @@ MAKE_BATMAN_ADV_ARGS += \ SUBDIRS="$(PKG_BUILD_DIR)" \ PWD="$(PKG_BUILD_DIR)" \ LINUX_VERSION="$(LINUX_VERSION)" \ - CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEVEL_DEBUG_LOG),y,n) \ + CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),y,n) \ + CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_KMOD_BATMAN_ADV_BLA),y,n) \ REVISION="" all MAKE_BATCTL_ARGS += \ diff --git a/files/etc/config/batman-adv b/files/etc/config/batman-adv index 5197820..fb7b384 100644 --- a/files/etc/config/batman-adv +++ b/files/etc/config/batman-adv @@ -11,6 +11,7 @@ config 'mesh' 'bat0' option 'log_level' option 'orig_interval' option 'vis_mode' + option 'bridge_loop_avoidance' # yet another batX instance # config 'mesh' 'bat5' diff --git a/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh index 49d63d6..35d61ef 100644 --- a/files/lib/batman-adv/config.sh +++ b/files/lib/batman-adv/config.sh @@ -11,7 +11,7 @@ bat_load_module() bat_config() { local mesh="$1" - local aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval hop_penalty vis_mode + local aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval hop_penalty vis_mode bridge_loop_avoidance config_get aggregated_ogms "$mesh" aggregated_ogms config_get bonding "$mesh" bonding @@ -24,6 +24,9 @@ bat_config() config_get hop_penalty "$mesh" hop_penalty config_get vis_mode "$mesh" vis_mode config_get ap_isolation "$mesh" ap_isolation + config_get bridge_loop_avoidance "$mesh" bridge_loop_avoidance + + [ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv mesh $mesh does not exist - check your interface configuration" && return 1 [ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval [ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty @@ -36,6 +39,7 @@ bat_config() [ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class [ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode [ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation + [ -n "$bridge_loop_avoidance" ] && echo $bridge_loop_avoidance > /sys/class/net/$mesh/mesh/bridge_loop_avoidance } bat_add_interface() From b098ecc8388dd79c7c92fc399dc4f0ab8fc2d2f5 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Fri, 15 Jun 2012 19:48:05 +0000 Subject: [PATCH 23/41] batman-adv: fix skb data assignment Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@32386 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...1-batman-adv-fix-skb-data-assignment.patch | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 patches/0001-batman-adv-fix-skb-data-assignment.patch diff --git a/patches/0001-batman-adv-fix-skb-data-assignment.patch b/patches/0001-batman-adv-fix-skb-data-assignment.patch new file mode 100644 index 0000000..e30f229 --- /dev/null +++ b/patches/0001-batman-adv-fix-skb-data-assignment.patch @@ -0,0 +1,35 @@ +From c7d05ee2b60370392d9c7bb1b764fd36b5aec81b Mon Sep 17 00:00:00 2001 +From: Antonio Quartulli +Date: Thu, 14 Jun 2012 22:21:28 +0200 +Subject: [PATCH] batman-adv: fix skb->data assignment + +skb_linearize(skb) possibly rearranges the skb internal data and then changes +the skb->data pointer value. For this reason any other pointer in the code that +was assigned skb->data before invoking skb_linearise(skb) must be re-assigned. + +In the current tt_query message handling code this is not done and therefore, in +case of skb linearization, the pointer used to handle the packet header ends up +in pointing to poisoned memory. The packet is then dropped but the +translation-table mechanism is corrupted. + +Signed-off-by: Antonio Quartulli +--- + routing.c | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +diff --git a/routing.c b/routing.c +index 840e2c6..015471d 100644 +--- a/routing.c ++++ b/routing.c +@@ -617,6 +617,8 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) + * changes */ + if (skb_linearize(skb) < 0) + goto out; ++ /* skb_linearize() possibly changed skb->data */ ++ tt_query = (struct tt_query_packet *)skb->data; + + tt_len = tt_query->tt_data * sizeof(struct tt_change); + +-- +1.7.9.1 + From 178148f7ef4847484be3fc25c4b6e3aed91e0dbd Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Mon, 2 Jul 2012 15:51:27 +0000 Subject: [PATCH 24/41] batman-adv: stability patches Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@32578 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...y-drop-packets-of-known-wifi-clients.patch | 50 ++++++++++++++ ...ace-condition-in-TT-full-table-repla.patch | 65 +++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 patches/0002-batman-adv-only-drop-packets-of-known-wifi-clients.patch create mode 100644 patches/0003-batman-adv-fix-race-condition-in-TT-full-table-repla.patch diff --git a/patches/0002-batman-adv-only-drop-packets-of-known-wifi-clients.patch b/patches/0002-batman-adv-only-drop-packets-of-known-wifi-clients.patch new file mode 100644 index 0000000..adb7958 --- /dev/null +++ b/patches/0002-batman-adv-only-drop-packets-of-known-wifi-clients.patch @@ -0,0 +1,50 @@ +From 7c6c6db94848497178cc246585b59fad4368c3e2 Mon Sep 17 00:00:00 2001 +From: Marek Lindner +Date: Wed, 20 Jun 2012 16:56:04 +0200 +Subject: [PATCH] batman-adv: only drop packets of known wifi clients + +If the source or destination mac address of an ethernet packet +could not be found in the translation table the packet was +dropped if AP isolation was turned on. This behavior would +make it impossible to send broadcast packets over the mesh +as the broadcast address will never enter the translation +table. + +Signed-off-by: Marek Lindner +--- + translation-table.c | 8 ++++---- + 1 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/translation-table.c b/translation-table.c +index a66c2dc..660c40f 100644 +--- a/translation-table.c ++++ b/translation-table.c +@@ -2031,10 +2031,10 @@ bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst) + { + struct tt_local_entry *tt_local_entry = NULL; + struct tt_global_entry *tt_global_entry = NULL; +- bool ret = true; ++ bool ret = false; + + if (!atomic_read(&bat_priv->ap_isolation)) +- return false; ++ goto out; + + tt_local_entry = tt_local_hash_find(bat_priv, dst); + if (!tt_local_entry) +@@ -2044,10 +2044,10 @@ bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst) + if (!tt_global_entry) + goto out; + +- if (_is_ap_isolated(tt_local_entry, tt_global_entry)) ++ if (!_is_ap_isolated(tt_local_entry, tt_global_entry)) + goto out; + +- ret = false; ++ ret = true; + + out: + if (tt_global_entry) +-- +1.7.9.1 + diff --git a/patches/0003-batman-adv-fix-race-condition-in-TT-full-table-repla.patch b/patches/0003-batman-adv-fix-race-condition-in-TT-full-table-repla.patch new file mode 100644 index 0000000..170ce2f --- /dev/null +++ b/patches/0003-batman-adv-fix-race-condition-in-TT-full-table-repla.patch @@ -0,0 +1,65 @@ +From d1f13e24ec3ebdadc2bc08c9d4708197279096fa Mon Sep 17 00:00:00 2001 +From: Antonio Quartulli +Date: Wed, 20 Jun 2012 14:12:56 +0200 +Subject: [PATCH] batman-adv: fix race condition in TT full-table replacement + +bug introduced with cea194d90b11aff7fc289149e4c7f305fad3535a + +In the current TT code, when a TT_Response containing a full table is received +from an originator, first the node purges all the clients for that originator in +the global translation-table and then merges the newly received table. +During the purging phase each client deletion is done by means of a call_rcu() +invocation and at the end of this phase the global entry counter for that +originator is set to 0. However the invoked rcu function decreases the global +entry counter for that originator by one too and since the rcu invocation is +likely to be postponed, the node will end up in first setting the counter to 0 +and then decreasing it one by one for each deleted client. + +This bug leads to having a wrong global entry counter for the related node, say +X. Then when the node with the broken counter will answer to a TT_REQUEST on +behalf of node X, it will create faulty TT_RESPONSE that will generate an +unrecoverable situation on the node that asked for the full table recover. + +The non-recoverability is given by the fact that the node with the broken +counter will keep answering on behalf of X because its knowledge about X's state +(ttvn + tt_crc) is correct. + +To solve this problem the counter is not explicitly set to 0 anymore and the +counter decrement is performed right before the invocation of call_rcu(). + +Signed-off-by: Antonio Quartulli +--- + translation-table.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/translation-table.c b/translation-table.c +index 660c40f..2ab83d7 100644 +--- a/translation-table.c ++++ b/translation-table.c +@@ -141,13 +141,14 @@ static void tt_orig_list_entry_free_rcu(struct rcu_head *rcu) + struct tt_orig_list_entry *orig_entry; + + orig_entry = container_of(rcu, struct tt_orig_list_entry, rcu); +- atomic_dec(&orig_entry->orig_node->tt_size); + orig_node_free_ref(orig_entry->orig_node); + kfree(orig_entry); + } + + static void tt_orig_list_entry_free_ref(struct tt_orig_list_entry *orig_entry) + { ++ /* to avoid race conditions, immediately decrease the tt counter */ ++ atomic_dec(&orig_entry->orig_node->tt_size); + call_rcu(&orig_entry->rcu, tt_orig_list_entry_free_rcu); + } + +@@ -910,7 +911,6 @@ void tt_global_del_orig(struct bat_priv *bat_priv, + } + spin_unlock_bh(list_lock); + } +- atomic_set(&orig_node->tt_size, 0); + orig_node->tt_initialised = false; + } + +-- +1.7.9.1 + From aff0732e3f29e4a95fd78137cf947a407a1f20ac Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Mon, 2 Jul 2012 16:20:20 +0000 Subject: [PATCH 25/41] batman-adv: increase forgotten package release version Reported-by: Jo-Philipp Wich Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@32579 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 1647982..4012fe9 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ PKG_NAME:=batman-adv PKG_VERSION:=2012.2.0 BATCTL_VERSION:=2012.2.0 +PKG_RELEASE:=2 PKG_MD5SUM:=68967ed1df709de18ab795722dde9341 BATCTL_MD5SUM:=7abd284098c514d3f2858e8a956c495e From f208cda134a4bb8baa2dcf974af05984fdd2e1c2 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Mon, 23 Jul 2012 12:51:20 +0000 Subject: [PATCH 26/41] batman-adv: gateway selection class 1 fix More info: https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2012-July/007766.html Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@32789 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- ...t-an-internet-gateway-if-none-was-ch.patch | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 patches/0004-batman-adv-select-an-internet-gateway-if-none-was-ch.patch diff --git a/Makefile b/Makefile index 4012fe9..e0ba232 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PKG_NAME:=batman-adv PKG_VERSION:=2012.2.0 BATCTL_VERSION:=2012.2.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MD5SUM:=68967ed1df709de18ab795722dde9341 BATCTL_MD5SUM:=7abd284098c514d3f2858e8a956c495e diff --git a/patches/0004-batman-adv-select-an-internet-gateway-if-none-was-ch.patch b/patches/0004-batman-adv-select-an-internet-gateway-if-none-was-ch.patch new file mode 100644 index 0000000..fae2ec4 --- /dev/null +++ b/patches/0004-batman-adv-select-an-internet-gateway-if-none-was-ch.patch @@ -0,0 +1,38 @@ +From 0a29f3a348c68f375585e25153da0f0a061fd71d Mon Sep 17 00:00:00 2001 +From: Marek Lindner +Date: Sun, 22 Jul 2012 13:04:48 +0200 +Subject: [PATCH] batman-adv: select an internet gateway if none was chosen +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is a regression introduced by: 6a17ecc4603be7f065c38b288d038a0082bbf21d + +Reported-by: Nicolás Echániz +Signed-off-by: Marek Lindner +--- + gateway_client.c | 6 +++--- + 1 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/gateway_client.c b/gateway_client.c +index 47f7186..dace001 100644 +--- a/gateway_client.c ++++ b/gateway_client.c +@@ -197,11 +197,11 @@ void gw_election(struct bat_priv *bat_priv) + if (atomic_read(&bat_priv->gw_mode) != GW_MODE_CLIENT) + goto out; + +- if (!atomic_dec_not_zero(&bat_priv->gw_reselect)) +- goto out; +- + curr_gw = gw_get_selected_gw_node(bat_priv); + ++ if (!atomic_dec_not_zero(&bat_priv->gw_reselect) && curr_gw) ++ goto out; ++ + next_gw = gw_get_best_gw_node(bat_priv); + + if (curr_gw == next_gw) +-- +1.7.9.1 + From b7d7f8ea5d144e4a6e8150c43dad9805d79448d9 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Wed, 8 Aug 2012 20:40:16 +0000 Subject: [PATCH 27/41] batman-adv: bla2 & gateway mode interaction fix Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@33064 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- ...v-check-incoming-packet-type-for-bla.patch | 121 ++++++++++++++++++ 2 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 patches/0005-batman-adv-check-incoming-packet-type-for-bla.patch diff --git a/Makefile b/Makefile index e0ba232..40e8a51 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PKG_NAME:=batman-adv PKG_VERSION:=2012.2.0 BATCTL_VERSION:=2012.2.0 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_MD5SUM:=68967ed1df709de18ab795722dde9341 BATCTL_MD5SUM:=7abd284098c514d3f2858e8a956c495e diff --git a/patches/0005-batman-adv-check-incoming-packet-type-for-bla.patch b/patches/0005-batman-adv-check-incoming-packet-type-for-bla.patch new file mode 100644 index 0000000..bc42dd1 --- /dev/null +++ b/patches/0005-batman-adv-check-incoming-packet-type-for-bla.patch @@ -0,0 +1,121 @@ +From e32470167379db2ca7713108f1e917c531426eee Mon Sep 17 00:00:00 2001 +From: Simon Wunderlich +Date: Wed, 4 Jul 2012 20:38:19 +0200 +Subject: [PATCH] batman-adv: check incoming packet type for bla + +If the gateway functionality is used, some broadcast packets (DHCP +requests) may be transmitted as unicast packets. As the bridge loop +avoidance code now only considers the payload Ethernet destination, +it may drop the DHCP request for clients which are claimed by other +backbone gateways, because it falsely infers from the broadcast address +that the right backbone gateway should havehandled the broadcast. + +Fix this by checking and delegating the batman-adv packet type used +for transmission. + +Reported-by: Guido Iribarren +Signed-off-by: Simon Wunderlich +--- + bridge_loop_avoidance.c | 15 +++++++++++---- + bridge_loop_avoidance.h | 5 +++-- + soft-interface.c | 6 +++++- + 3 files changed, 19 insertions(+), 7 deletions(-) + +diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c +index 8bf9751..c5863f4 100644 +--- a/bridge_loop_avoidance.c ++++ b/bridge_loop_avoidance.c +@@ -1351,6 +1351,7 @@ void bla_free(struct bat_priv *bat_priv) + * @bat_priv: the bat priv with all the soft interface information + * @skb: the frame to be checked + * @vid: the VLAN ID of the frame ++ * @is_bcast: the packet came in a broadcast packet type. + * + * bla_rx avoidance checks if: + * * we have to race for a claim +@@ -1361,7 +1362,8 @@ void bla_free(struct bat_priv *bat_priv) + * process the skb. + * + */ +-int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) ++int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid, ++ bool is_bcast) + { + struct ethhdr *ethhdr; + struct claim search_claim, *claim = NULL; +@@ -1380,7 +1382,7 @@ int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) + + if (unlikely(atomic_read(&bat_priv->bla_num_requests))) + /* don't allow broadcasts while requests are in flight */ +- if (is_multicast_ether_addr(ethhdr->h_dest)) ++ if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) + goto handled; + + memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN); +@@ -1406,8 +1408,13 @@ int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) + } + + /* if it is a broadcast ... */ +- if (is_multicast_ether_addr(ethhdr->h_dest)) { +- /* ... drop it. the responsible gateway is in charge. */ ++ if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) { ++ /* ... drop it. the responsible gateway is in charge. ++ * ++ * We need to check is_bcast because with the gateway ++ * feature, broadcasts (like DHCP requests) may be sent ++ * using a unicast packet type. ++ */ + goto handled; + } else { + /* seems the client considers us as its best gateway. +diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h +index e39f93a..dc5227b 100644 +--- a/bridge_loop_avoidance.h ++++ b/bridge_loop_avoidance.h +@@ -23,7 +23,8 @@ + #define _NET_BATMAN_ADV_BLA_H_ + + #ifdef CONFIG_BATMAN_ADV_BLA +-int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); ++int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid, ++ bool is_bcast); + int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); + int bla_is_backbone_gw(struct sk_buff *skb, + struct orig_node *orig_node, int hdr_size); +@@ -41,7 +42,7 @@ void bla_free(struct bat_priv *bat_priv); + #else /* ifdef CONFIG_BATMAN_ADV_BLA */ + + static inline int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, +- short vid) ++ short vid, bool is_bcast) + { + return 0; + } +diff --git a/soft-interface.c b/soft-interface.c +index 6e2530b..a0ec0e4 100644 +--- a/soft-interface.c ++++ b/soft-interface.c +@@ -256,7 +256,11 @@ void interface_rx(struct net_device *soft_iface, + struct bat_priv *bat_priv = netdev_priv(soft_iface); + struct ethhdr *ethhdr; + struct vlan_ethhdr *vhdr; ++ struct batman_header *batadv_header = (struct batman_header *)skb->data; + short vid __maybe_unused = -1; ++ bool is_bcast; ++ ++ is_bcast = (batadv_header->packet_type == BAT_BCAST); + + /* check if enough space is available for pulling, and pull */ + if (!pskb_may_pull(skb, hdr_size)) +@@ -302,7 +306,7 @@ void interface_rx(struct net_device *soft_iface, + /* Let the bridge loop avoidance check the packet. If will + * not handle it, we can safely push it up. + */ +- if (bla_rx(bat_priv, skb, vid)) ++ if (bla_rx(bat_priv, skb, vid, is_bcast)) + goto out; + + netif_rx(skb); +-- +1.7.9.1 + From 1373add9ddc41142d7ebec1a336c0f53533b53cb Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Tue, 21 Aug 2012 00:59:11 +0000 Subject: [PATCH 28/41] batman-adv: upgrade package to latest release 2012.3.0 Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@33213 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 10 +- ...1-batman-adv-fix-skb-data-assignment.patch | 35 ----- ...y-drop-packets-of-known-wifi-clients.patch | 50 -------- ...ace-condition-in-TT-full-table-repla.patch | 65 ---------- ...t-an-internet-gateway-if-none-was-ch.patch | 38 ------ ...v-check-incoming-packet-type-for-bla.patch | 121 ------------------ 6 files changed, 5 insertions(+), 314 deletions(-) delete mode 100644 patches/0001-batman-adv-fix-skb-data-assignment.patch delete mode 100644 patches/0002-batman-adv-only-drop-packets-of-known-wifi-clients.patch delete mode 100644 patches/0003-batman-adv-fix-race-condition-in-TT-full-table-repla.patch delete mode 100644 patches/0004-batman-adv-select-an-internet-gateway-if-none-was-ch.patch delete mode 100644 patches/0005-batman-adv-check-incoming-packet-type-for-bla.patch diff --git a/Makefile b/Makefile index 40e8a51..2416c42 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2012.2.0 -BATCTL_VERSION:=2012.2.0 -PKG_RELEASE:=4 -PKG_MD5SUM:=68967ed1df709de18ab795722dde9341 -BATCTL_MD5SUM:=7abd284098c514d3f2858e8a956c495e +PKG_VERSION:=2012.3.0 +BATCTL_VERSION:=2012.3.0 +PKG_RELEASE:=1 +PKG_MD5SUM:=9f2d0bb2792fe0db012203d502e2085c +BATCTL_MD5SUM:=fe9e6a3994539037b48afc5e3d31628c PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) diff --git a/patches/0001-batman-adv-fix-skb-data-assignment.patch b/patches/0001-batman-adv-fix-skb-data-assignment.patch deleted file mode 100644 index e30f229..0000000 --- a/patches/0001-batman-adv-fix-skb-data-assignment.patch +++ /dev/null @@ -1,35 +0,0 @@ -From c7d05ee2b60370392d9c7bb1b764fd36b5aec81b Mon Sep 17 00:00:00 2001 -From: Antonio Quartulli -Date: Thu, 14 Jun 2012 22:21:28 +0200 -Subject: [PATCH] batman-adv: fix skb->data assignment - -skb_linearize(skb) possibly rearranges the skb internal data and then changes -the skb->data pointer value. For this reason any other pointer in the code that -was assigned skb->data before invoking skb_linearise(skb) must be re-assigned. - -In the current tt_query message handling code this is not done and therefore, in -case of skb linearization, the pointer used to handle the packet header ends up -in pointing to poisoned memory. The packet is then dropped but the -translation-table mechanism is corrupted. - -Signed-off-by: Antonio Quartulli ---- - routing.c | 2 ++ - 1 files changed, 2 insertions(+), 0 deletions(-) - -diff --git a/routing.c b/routing.c -index 840e2c6..015471d 100644 ---- a/routing.c -+++ b/routing.c -@@ -617,6 +617,8 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) - * changes */ - if (skb_linearize(skb) < 0) - goto out; -+ /* skb_linearize() possibly changed skb->data */ -+ tt_query = (struct tt_query_packet *)skb->data; - - tt_len = tt_query->tt_data * sizeof(struct tt_change); - --- -1.7.9.1 - diff --git a/patches/0002-batman-adv-only-drop-packets-of-known-wifi-clients.patch b/patches/0002-batman-adv-only-drop-packets-of-known-wifi-clients.patch deleted file mode 100644 index adb7958..0000000 --- a/patches/0002-batman-adv-only-drop-packets-of-known-wifi-clients.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 7c6c6db94848497178cc246585b59fad4368c3e2 Mon Sep 17 00:00:00 2001 -From: Marek Lindner -Date: Wed, 20 Jun 2012 16:56:04 +0200 -Subject: [PATCH] batman-adv: only drop packets of known wifi clients - -If the source or destination mac address of an ethernet packet -could not be found in the translation table the packet was -dropped if AP isolation was turned on. This behavior would -make it impossible to send broadcast packets over the mesh -as the broadcast address will never enter the translation -table. - -Signed-off-by: Marek Lindner ---- - translation-table.c | 8 ++++---- - 1 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/translation-table.c b/translation-table.c -index a66c2dc..660c40f 100644 ---- a/translation-table.c -+++ b/translation-table.c -@@ -2031,10 +2031,10 @@ bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst) - { - struct tt_local_entry *tt_local_entry = NULL; - struct tt_global_entry *tt_global_entry = NULL; -- bool ret = true; -+ bool ret = false; - - if (!atomic_read(&bat_priv->ap_isolation)) -- return false; -+ goto out; - - tt_local_entry = tt_local_hash_find(bat_priv, dst); - if (!tt_local_entry) -@@ -2044,10 +2044,10 @@ bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst) - if (!tt_global_entry) - goto out; - -- if (_is_ap_isolated(tt_local_entry, tt_global_entry)) -+ if (!_is_ap_isolated(tt_local_entry, tt_global_entry)) - goto out; - -- ret = false; -+ ret = true; - - out: - if (tt_global_entry) --- -1.7.9.1 - diff --git a/patches/0003-batman-adv-fix-race-condition-in-TT-full-table-repla.patch b/patches/0003-batman-adv-fix-race-condition-in-TT-full-table-repla.patch deleted file mode 100644 index 170ce2f..0000000 --- a/patches/0003-batman-adv-fix-race-condition-in-TT-full-table-repla.patch +++ /dev/null @@ -1,65 +0,0 @@ -From d1f13e24ec3ebdadc2bc08c9d4708197279096fa Mon Sep 17 00:00:00 2001 -From: Antonio Quartulli -Date: Wed, 20 Jun 2012 14:12:56 +0200 -Subject: [PATCH] batman-adv: fix race condition in TT full-table replacement - -bug introduced with cea194d90b11aff7fc289149e4c7f305fad3535a - -In the current TT code, when a TT_Response containing a full table is received -from an originator, first the node purges all the clients for that originator in -the global translation-table and then merges the newly received table. -During the purging phase each client deletion is done by means of a call_rcu() -invocation and at the end of this phase the global entry counter for that -originator is set to 0. However the invoked rcu function decreases the global -entry counter for that originator by one too and since the rcu invocation is -likely to be postponed, the node will end up in first setting the counter to 0 -and then decreasing it one by one for each deleted client. - -This bug leads to having a wrong global entry counter for the related node, say -X. Then when the node with the broken counter will answer to a TT_REQUEST on -behalf of node X, it will create faulty TT_RESPONSE that will generate an -unrecoverable situation on the node that asked for the full table recover. - -The non-recoverability is given by the fact that the node with the broken -counter will keep answering on behalf of X because its knowledge about X's state -(ttvn + tt_crc) is correct. - -To solve this problem the counter is not explicitly set to 0 anymore and the -counter decrement is performed right before the invocation of call_rcu(). - -Signed-off-by: Antonio Quartulli ---- - translation-table.c | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/translation-table.c b/translation-table.c -index 660c40f..2ab83d7 100644 ---- a/translation-table.c -+++ b/translation-table.c -@@ -141,13 +141,14 @@ static void tt_orig_list_entry_free_rcu(struct rcu_head *rcu) - struct tt_orig_list_entry *orig_entry; - - orig_entry = container_of(rcu, struct tt_orig_list_entry, rcu); -- atomic_dec(&orig_entry->orig_node->tt_size); - orig_node_free_ref(orig_entry->orig_node); - kfree(orig_entry); - } - - static void tt_orig_list_entry_free_ref(struct tt_orig_list_entry *orig_entry) - { -+ /* to avoid race conditions, immediately decrease the tt counter */ -+ atomic_dec(&orig_entry->orig_node->tt_size); - call_rcu(&orig_entry->rcu, tt_orig_list_entry_free_rcu); - } - -@@ -910,7 +911,6 @@ void tt_global_del_orig(struct bat_priv *bat_priv, - } - spin_unlock_bh(list_lock); - } -- atomic_set(&orig_node->tt_size, 0); - orig_node->tt_initialised = false; - } - --- -1.7.9.1 - diff --git a/patches/0004-batman-adv-select-an-internet-gateway-if-none-was-ch.patch b/patches/0004-batman-adv-select-an-internet-gateway-if-none-was-ch.patch deleted file mode 100644 index fae2ec4..0000000 --- a/patches/0004-batman-adv-select-an-internet-gateway-if-none-was-ch.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0a29f3a348c68f375585e25153da0f0a061fd71d Mon Sep 17 00:00:00 2001 -From: Marek Lindner -Date: Sun, 22 Jul 2012 13:04:48 +0200 -Subject: [PATCH] batman-adv: select an internet gateway if none was chosen -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This is a regression introduced by: 6a17ecc4603be7f065c38b288d038a0082bbf21d - -Reported-by: Nicolás Echániz -Signed-off-by: Marek Lindner ---- - gateway_client.c | 6 +++--- - 1 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/gateway_client.c b/gateway_client.c -index 47f7186..dace001 100644 ---- a/gateway_client.c -+++ b/gateway_client.c -@@ -197,11 +197,11 @@ void gw_election(struct bat_priv *bat_priv) - if (atomic_read(&bat_priv->gw_mode) != GW_MODE_CLIENT) - goto out; - -- if (!atomic_dec_not_zero(&bat_priv->gw_reselect)) -- goto out; -- - curr_gw = gw_get_selected_gw_node(bat_priv); - -+ if (!atomic_dec_not_zero(&bat_priv->gw_reselect) && curr_gw) -+ goto out; -+ - next_gw = gw_get_best_gw_node(bat_priv); - - if (curr_gw == next_gw) --- -1.7.9.1 - diff --git a/patches/0005-batman-adv-check-incoming-packet-type-for-bla.patch b/patches/0005-batman-adv-check-incoming-packet-type-for-bla.patch deleted file mode 100644 index bc42dd1..0000000 --- a/patches/0005-batman-adv-check-incoming-packet-type-for-bla.patch +++ /dev/null @@ -1,121 +0,0 @@ -From e32470167379db2ca7713108f1e917c531426eee Mon Sep 17 00:00:00 2001 -From: Simon Wunderlich -Date: Wed, 4 Jul 2012 20:38:19 +0200 -Subject: [PATCH] batman-adv: check incoming packet type for bla - -If the gateway functionality is used, some broadcast packets (DHCP -requests) may be transmitted as unicast packets. As the bridge loop -avoidance code now only considers the payload Ethernet destination, -it may drop the DHCP request for clients which are claimed by other -backbone gateways, because it falsely infers from the broadcast address -that the right backbone gateway should havehandled the broadcast. - -Fix this by checking and delegating the batman-adv packet type used -for transmission. - -Reported-by: Guido Iribarren -Signed-off-by: Simon Wunderlich ---- - bridge_loop_avoidance.c | 15 +++++++++++---- - bridge_loop_avoidance.h | 5 +++-- - soft-interface.c | 6 +++++- - 3 files changed, 19 insertions(+), 7 deletions(-) - -diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c -index 8bf9751..c5863f4 100644 ---- a/bridge_loop_avoidance.c -+++ b/bridge_loop_avoidance.c -@@ -1351,6 +1351,7 @@ void bla_free(struct bat_priv *bat_priv) - * @bat_priv: the bat priv with all the soft interface information - * @skb: the frame to be checked - * @vid: the VLAN ID of the frame -+ * @is_bcast: the packet came in a broadcast packet type. - * - * bla_rx avoidance checks if: - * * we have to race for a claim -@@ -1361,7 +1362,8 @@ void bla_free(struct bat_priv *bat_priv) - * process the skb. - * - */ --int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) -+int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid, -+ bool is_bcast) - { - struct ethhdr *ethhdr; - struct claim search_claim, *claim = NULL; -@@ -1380,7 +1382,7 @@ int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) - - if (unlikely(atomic_read(&bat_priv->bla_num_requests))) - /* don't allow broadcasts while requests are in flight */ -- if (is_multicast_ether_addr(ethhdr->h_dest)) -+ if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) - goto handled; - - memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN); -@@ -1406,8 +1408,13 @@ int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) - } - - /* if it is a broadcast ... */ -- if (is_multicast_ether_addr(ethhdr->h_dest)) { -- /* ... drop it. the responsible gateway is in charge. */ -+ if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) { -+ /* ... drop it. the responsible gateway is in charge. -+ * -+ * We need to check is_bcast because with the gateway -+ * feature, broadcasts (like DHCP requests) may be sent -+ * using a unicast packet type. -+ */ - goto handled; - } else { - /* seems the client considers us as its best gateway. -diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h -index e39f93a..dc5227b 100644 ---- a/bridge_loop_avoidance.h -+++ b/bridge_loop_avoidance.h -@@ -23,7 +23,8 @@ - #define _NET_BATMAN_ADV_BLA_H_ - - #ifdef CONFIG_BATMAN_ADV_BLA --int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); -+int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid, -+ bool is_bcast); - int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); - int bla_is_backbone_gw(struct sk_buff *skb, - struct orig_node *orig_node, int hdr_size); -@@ -41,7 +42,7 @@ void bla_free(struct bat_priv *bat_priv); - #else /* ifdef CONFIG_BATMAN_ADV_BLA */ - - static inline int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, -- short vid) -+ short vid, bool is_bcast) - { - return 0; - } -diff --git a/soft-interface.c b/soft-interface.c -index 6e2530b..a0ec0e4 100644 ---- a/soft-interface.c -+++ b/soft-interface.c -@@ -256,7 +256,11 @@ void interface_rx(struct net_device *soft_iface, - struct bat_priv *bat_priv = netdev_priv(soft_iface); - struct ethhdr *ethhdr; - struct vlan_ethhdr *vhdr; -+ struct batman_header *batadv_header = (struct batman_header *)skb->data; - short vid __maybe_unused = -1; -+ bool is_bcast; -+ -+ is_bcast = (batadv_header->packet_type == BAT_BCAST); - - /* check if enough space is available for pulling, and pull */ - if (!pskb_may_pull(skb, hdr_size)) -@@ -302,7 +306,7 @@ void interface_rx(struct net_device *soft_iface, - /* Let the bridge loop avoidance check the packet. If will - * not handle it, we can safely push it up. - */ -- if (bla_rx(bat_priv, skb, vid)) -+ if (bla_rx(bat_priv, skb, vid, is_bcast)) - goto out; - - netif_rx(skb); --- -1.7.9.1 - From 65d9b8f3d43fb792c8f1a08daa1d42a17ddd0aa6 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Sun, 9 Sep 2012 09:46:55 +0000 Subject: [PATCH 29/41] batman-adv: fix OGM counting on x86 OpenWrt images More info: https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2012-September/007978.html Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@33339 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- ...e-batadv_test_bit-return-0-or-1-only.patch | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 patches/0001-batman-adv-make-batadv_test_bit-return-0-or-1-only.patch diff --git a/Makefile b/Makefile index 2416c42..516e71a 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PKG_NAME:=batman-adv PKG_VERSION:=2012.3.0 BATCTL_VERSION:=2012.3.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MD5SUM:=9f2d0bb2792fe0db012203d502e2085c BATCTL_MD5SUM:=fe9e6a3994539037b48afc5e3d31628c diff --git a/patches/0001-batman-adv-make-batadv_test_bit-return-0-or-1-only.patch b/patches/0001-batman-adv-make-batadv_test_bit-return-0-or-1-only.patch new file mode 100644 index 0000000..e069fa7 --- /dev/null +++ b/patches/0001-batman-adv-make-batadv_test_bit-return-0-or-1-only.patch @@ -0,0 +1,50 @@ +From 716c8c9a8bb7ac1e30e959e50ed74caa7dabe60a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Linus=20L=C3=BCssing?= +Date: Mon, 3 Sep 2012 22:20:31 +0200 +Subject: [PATCH] batman-adv: make batadv_test_bit() return 0 or 1 only +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On some architectures test_bit() can return other values than 0 or 1: + +With a generic x86 OpenWrt image in a kvm setup (batadv_)test_bit() +frequently returns -1 for me, leading to batadv_iv_ogm_update_seqnos() +wrongly signaling a protected seqno window. + +This patch tries to fix this issue by making batadv_test_bit() return 0 +or 1 only. + +Signed-off-by: Linus Lüssing +Acked-by: Sven Eckelmann +--- + bitarray.h | 6 +++--- + 1 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/bitarray.h b/bitarray.h +index a081ce1..cebaae7 100644 +--- a/bitarray.h ++++ b/bitarray.h +@@ -20,8 +20,8 @@ + #ifndef _NET_BATMAN_ADV_BITARRAY_H_ + #define _NET_BATMAN_ADV_BITARRAY_H_ + +-/* returns true if the corresponding bit in the given seq_bits indicates true +- * and curr_seqno is within range of last_seqno ++/* Returns 1 if the corresponding bit in the given seq_bits indicates true ++ * and curr_seqno is within range of last_seqno. Otherwise returns 0. + */ + static inline int batadv_test_bit(const unsigned long *seq_bits, + uint32_t last_seqno, uint32_t curr_seqno) +@@ -32,7 +32,7 @@ static inline int batadv_test_bit(const unsigned long *seq_bits, + if (diff < 0 || diff >= BATADV_TQ_LOCAL_WINDOW_SIZE) + return 0; + else +- return test_bit(diff, seq_bits); ++ return test_bit(diff, seq_bits) != 0; + } + + /* turn corresponding bit on, so we can remember that we got the packet */ +-- +1.7.9.1 + From f7daad8862855d12055110e5d54d409d2935c88c Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Fri, 28 Sep 2012 19:57:00 +0000 Subject: [PATCH 30/41] batman-adv: fix mac addr change and symmetry check More info: * fix mac addr change: https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2012-September/008026.html * symmetry check: https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2012-September/008021.html Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@33588 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- ...Fix-change-mac-address-of-soft-iface.patch | 45 ++++++++++++ ...ymmetry-check-route-flapping-in-mult.patch | 71 +++++++++++++++++++ 3 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 patches/0002-batman-adv-Fix-change-mac-address-of-soft-iface.patch create mode 100644 patches/0003-batman-adv-Fix-symmetry-check-route-flapping-in-mult.patch diff --git a/Makefile b/Makefile index 516e71a..5fdfae6 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PKG_NAME:=batman-adv PKG_VERSION:=2012.3.0 BATCTL_VERSION:=2012.3.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MD5SUM:=9f2d0bb2792fe0db012203d502e2085c BATCTL_MD5SUM:=fe9e6a3994539037b48afc5e3d31628c diff --git a/patches/0002-batman-adv-Fix-change-mac-address-of-soft-iface.patch b/patches/0002-batman-adv-Fix-change-mac-address-of-soft-iface.patch new file mode 100644 index 0000000..21d0959 --- /dev/null +++ b/patches/0002-batman-adv-Fix-change-mac-address-of-soft-iface.patch @@ -0,0 +1,45 @@ +From 86fa71a4985f60da5918e1f43136dae77852cdc3 Mon Sep 17 00:00:00 2001 +From: Def +Date: Thu, 20 Sep 2012 14:56:13 +0200 +Subject: [PATCH] batman-adv: Fix change mac address of soft iface. + +Into function interface_set_mac_addr, the function tt_local_add was +invoked before updating dev->dev_addr. The new MAC address was not +tagged as NoPurge. + +Signed-off-by: Def +--- + soft-interface.c | 7 +++++-- + 1 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/soft-interface.c b/soft-interface.c +index cf26e41..b762068 100644 +--- a/soft-interface.c ++++ b/soft-interface.c +@@ -100,18 +100,21 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) + { + struct batadv_priv *bat_priv = netdev_priv(dev); + struct sockaddr *addr = p; ++ uint8_t old_addr[ETH_ALEN]; + + if (!is_valid_ether_addr(addr->sa_data)) + return -EADDRNOTAVAIL; + ++ memcpy(old_addr, dev->dev_addr, ETH_ALEN); ++ memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); ++ + /* only modify transtable if it has been initialized before */ + if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) { +- batadv_tt_local_remove(bat_priv, dev->dev_addr, ++ batadv_tt_local_remove(bat_priv, old_addr, + "mac address changed", false); + batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX); + } + +- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); + dev->addr_assign_type &= ~NET_ADDR_RANDOM; + return 0; + } +-- +1.7.9.1 + diff --git a/patches/0003-batman-adv-Fix-symmetry-check-route-flapping-in-mult.patch b/patches/0003-batman-adv-Fix-symmetry-check-route-flapping-in-mult.patch new file mode 100644 index 0000000..c36fbce --- /dev/null +++ b/patches/0003-batman-adv-Fix-symmetry-check-route-flapping-in-mult.patch @@ -0,0 +1,71 @@ +From 6c9d9eeac0fb5d6625256cd119d0a4994c63e965 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Linus=20L=C3=BCssing?= +Date: Tue, 18 Sep 2012 03:01:08 +0200 +Subject: [PATCH] batman-adv: Fix symmetry check / route flapping in multi + interface setups +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If receiving an OGM from a neighbor other than the currently selected +and if it has the same TQ then we are supposed to switch if this +neighbor provides a more symmetric link than the currently selected one. + +However this symmetry check currently is broken if the interface of the +neighbor we received the OGM from and the one of the currently selected +neighbor differ: We are currently trying to determine the symmetry of the +link towards the selected router via the link we received the OGM from +instead of just checking via the link towards the currently selected +router. + +This leads to way more route switches than necessary and can lead to +permanent route flapping in many common multi interface setups. + +This patch fixes this issue by using the right interface for this +symmetry check. + +Signed-off-by: Linus Lüssing +--- + bat_iv_ogm.c | 13 +++++++------ + 1 files changed, 7 insertions(+), 6 deletions(-) + +diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c +index e877af8..469daab 100644 +--- a/bat_iv_ogm.c ++++ b/bat_iv_ogm.c +@@ -642,7 +642,8 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, + struct batadv_neigh_node *router = NULL; + struct batadv_orig_node *orig_node_tmp; + struct hlist_node *node; +- uint8_t bcast_own_sum_orig, bcast_own_sum_neigh; ++ int if_num; ++ uint8_t sum_orig, sum_neigh; + uint8_t *neigh_addr; + + batadv_dbg(BATADV_DBG_BATMAN, bat_priv, +@@ -727,17 +728,17 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, + if (router && (neigh_node->tq_avg == router->tq_avg)) { + orig_node_tmp = router->orig_node; + spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); +- bcast_own_sum_orig = +- orig_node_tmp->bcast_own_sum[if_incoming->if_num]; ++ if_num = router->if_incoming->if_num; ++ sum_orig = orig_node_tmp->bcast_own_sum[if_num]; + spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); + + orig_node_tmp = neigh_node->orig_node; + spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); +- bcast_own_sum_neigh = +- orig_node_tmp->bcast_own_sum[if_incoming->if_num]; ++ if_num = neigh_node->if_incoming->if_num; ++ sum_neigh = orig_node_tmp->bcast_own_sum[if_num]; + spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); + +- if (bcast_own_sum_orig >= bcast_own_sum_neigh) ++ if (sum_orig >= sum_neigh) + goto update_tt; + } + +-- +1.7.9.1 + From dcf65f246bbe64e21c8bf509af871227e8d4cd0f Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Sun, 4 Nov 2012 13:26:48 +0000 Subject: [PATCH 31/41] batman-adv: upgrade package to latest release 2012.4.0 Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@34067 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 10 +-- ...e-batadv_test_bit-return-0-or-1-only.patch | 50 ------------- ...Fix-change-mac-address-of-soft-iface.patch | 45 ------------ ...ymmetry-check-route-flapping-in-mult.patch | 71 ------------------- 4 files changed, 5 insertions(+), 171 deletions(-) delete mode 100644 patches/0001-batman-adv-make-batadv_test_bit-return-0-or-1-only.patch delete mode 100644 patches/0002-batman-adv-Fix-change-mac-address-of-soft-iface.patch delete mode 100644 patches/0003-batman-adv-Fix-symmetry-check-route-flapping-in-mult.patch diff --git a/Makefile b/Makefile index 5fdfae6..18f4fff 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2012.3.0 -BATCTL_VERSION:=2012.3.0 -PKG_RELEASE:=3 -PKG_MD5SUM:=9f2d0bb2792fe0db012203d502e2085c -BATCTL_MD5SUM:=fe9e6a3994539037b48afc5e3d31628c +PKG_VERSION:=2012.4.0 +BATCTL_VERSION:=2012.4.0 +PKG_RELEASE:=1 +PKG_MD5SUM:=24e922a64a507b146c32c585538407f2 +BATCTL_MD5SUM:=79d5aa796ae8b008a9fa42c27d4da2c1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) diff --git a/patches/0001-batman-adv-make-batadv_test_bit-return-0-or-1-only.patch b/patches/0001-batman-adv-make-batadv_test_bit-return-0-or-1-only.patch deleted file mode 100644 index e069fa7..0000000 --- a/patches/0001-batman-adv-make-batadv_test_bit-return-0-or-1-only.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 716c8c9a8bb7ac1e30e959e50ed74caa7dabe60a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Linus=20L=C3=BCssing?= -Date: Mon, 3 Sep 2012 22:20:31 +0200 -Subject: [PATCH] batman-adv: make batadv_test_bit() return 0 or 1 only -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On some architectures test_bit() can return other values than 0 or 1: - -With a generic x86 OpenWrt image in a kvm setup (batadv_)test_bit() -frequently returns -1 for me, leading to batadv_iv_ogm_update_seqnos() -wrongly signaling a protected seqno window. - -This patch tries to fix this issue by making batadv_test_bit() return 0 -or 1 only. - -Signed-off-by: Linus Lüssing -Acked-by: Sven Eckelmann ---- - bitarray.h | 6 +++--- - 1 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/bitarray.h b/bitarray.h -index a081ce1..cebaae7 100644 ---- a/bitarray.h -+++ b/bitarray.h -@@ -20,8 +20,8 @@ - #ifndef _NET_BATMAN_ADV_BITARRAY_H_ - #define _NET_BATMAN_ADV_BITARRAY_H_ - --/* returns true if the corresponding bit in the given seq_bits indicates true -- * and curr_seqno is within range of last_seqno -+/* Returns 1 if the corresponding bit in the given seq_bits indicates true -+ * and curr_seqno is within range of last_seqno. Otherwise returns 0. - */ - static inline int batadv_test_bit(const unsigned long *seq_bits, - uint32_t last_seqno, uint32_t curr_seqno) -@@ -32,7 +32,7 @@ static inline int batadv_test_bit(const unsigned long *seq_bits, - if (diff < 0 || diff >= BATADV_TQ_LOCAL_WINDOW_SIZE) - return 0; - else -- return test_bit(diff, seq_bits); -+ return test_bit(diff, seq_bits) != 0; - } - - /* turn corresponding bit on, so we can remember that we got the packet */ --- -1.7.9.1 - diff --git a/patches/0002-batman-adv-Fix-change-mac-address-of-soft-iface.patch b/patches/0002-batman-adv-Fix-change-mac-address-of-soft-iface.patch deleted file mode 100644 index 21d0959..0000000 --- a/patches/0002-batman-adv-Fix-change-mac-address-of-soft-iface.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 86fa71a4985f60da5918e1f43136dae77852cdc3 Mon Sep 17 00:00:00 2001 -From: Def -Date: Thu, 20 Sep 2012 14:56:13 +0200 -Subject: [PATCH] batman-adv: Fix change mac address of soft iface. - -Into function interface_set_mac_addr, the function tt_local_add was -invoked before updating dev->dev_addr. The new MAC address was not -tagged as NoPurge. - -Signed-off-by: Def ---- - soft-interface.c | 7 +++++-- - 1 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/soft-interface.c b/soft-interface.c -index cf26e41..b762068 100644 ---- a/soft-interface.c -+++ b/soft-interface.c -@@ -100,18 +100,21 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) - { - struct batadv_priv *bat_priv = netdev_priv(dev); - struct sockaddr *addr = p; -+ uint8_t old_addr[ETH_ALEN]; - - if (!is_valid_ether_addr(addr->sa_data)) - return -EADDRNOTAVAIL; - -+ memcpy(old_addr, dev->dev_addr, ETH_ALEN); -+ memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); -+ - /* only modify transtable if it has been initialized before */ - if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) { -- batadv_tt_local_remove(bat_priv, dev->dev_addr, -+ batadv_tt_local_remove(bat_priv, old_addr, - "mac address changed", false); - batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX); - } - -- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); - dev->addr_assign_type &= ~NET_ADDR_RANDOM; - return 0; - } --- -1.7.9.1 - diff --git a/patches/0003-batman-adv-Fix-symmetry-check-route-flapping-in-mult.patch b/patches/0003-batman-adv-Fix-symmetry-check-route-flapping-in-mult.patch deleted file mode 100644 index c36fbce..0000000 --- a/patches/0003-batman-adv-Fix-symmetry-check-route-flapping-in-mult.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 6c9d9eeac0fb5d6625256cd119d0a4994c63e965 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Linus=20L=C3=BCssing?= -Date: Tue, 18 Sep 2012 03:01:08 +0200 -Subject: [PATCH] batman-adv: Fix symmetry check / route flapping in multi - interface setups -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -If receiving an OGM from a neighbor other than the currently selected -and if it has the same TQ then we are supposed to switch if this -neighbor provides a more symmetric link than the currently selected one. - -However this symmetry check currently is broken if the interface of the -neighbor we received the OGM from and the one of the currently selected -neighbor differ: We are currently trying to determine the symmetry of the -link towards the selected router via the link we received the OGM from -instead of just checking via the link towards the currently selected -router. - -This leads to way more route switches than necessary and can lead to -permanent route flapping in many common multi interface setups. - -This patch fixes this issue by using the right interface for this -symmetry check. - -Signed-off-by: Linus Lüssing ---- - bat_iv_ogm.c | 13 +++++++------ - 1 files changed, 7 insertions(+), 6 deletions(-) - -diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c -index e877af8..469daab 100644 ---- a/bat_iv_ogm.c -+++ b/bat_iv_ogm.c -@@ -642,7 +642,8 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, - struct batadv_neigh_node *router = NULL; - struct batadv_orig_node *orig_node_tmp; - struct hlist_node *node; -- uint8_t bcast_own_sum_orig, bcast_own_sum_neigh; -+ int if_num; -+ uint8_t sum_orig, sum_neigh; - uint8_t *neigh_addr; - - batadv_dbg(BATADV_DBG_BATMAN, bat_priv, -@@ -727,17 +728,17 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, - if (router && (neigh_node->tq_avg == router->tq_avg)) { - orig_node_tmp = router->orig_node; - spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); -- bcast_own_sum_orig = -- orig_node_tmp->bcast_own_sum[if_incoming->if_num]; -+ if_num = router->if_incoming->if_num; -+ sum_orig = orig_node_tmp->bcast_own_sum[if_num]; - spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); - - orig_node_tmp = neigh_node->orig_node; - spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); -- bcast_own_sum_neigh = -- orig_node_tmp->bcast_own_sum[if_incoming->if_num]; -+ if_num = neigh_node->if_incoming->if_num; -+ sum_neigh = orig_node_tmp->bcast_own_sum[if_num]; - spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); - -- if (bcast_own_sum_orig >= bcast_own_sum_neigh) -+ if (sum_orig >= sum_neigh) - goto update_tt; - } - --- -1.7.9.1 - From f38e4394eb9b7c5994826c9bea585a3b0eb01fc4 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Sat, 17 Nov 2012 06:08:38 +0000 Subject: [PATCH 32/41] batman-adv: ap isolation and bridge loop avoidance fixes Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@34221 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- ...v_fix_tt_global_entries_flags_update.patch | 91 +++++++++++++++ ..._pass_the_client_flag_on_tt_response.patch | 85 ++++++++++++++ ...ts_belonging_to_other_backbone_nodes.patch | 91 +++++++++++++++ ...ess_broadcast_packets_in_BLA_earlier.patch | 110 ++++++++++++++++++ 5 files changed, 378 insertions(+), 1 deletion(-) create mode 100644 patches/0001-batman-adv_fix_tt_global_entries_flags_update.patch create mode 100644 patches/0002-batman-adv_correctly_pass_the_client_flag_on_tt_response.patch create mode 100644 patches/0003-batman-adv_do_not_add_TEMP_clients_belonging_to_other_backbone_nodes.patch create mode 100644 patches/0004-batman-adv_process_broadcast_packets_in_BLA_earlier.patch diff --git a/Makefile b/Makefile index 18f4fff..f782ab7 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PKG_NAME:=batman-adv PKG_VERSION:=2012.4.0 BATCTL_VERSION:=2012.4.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MD5SUM:=24e922a64a507b146c32c585538407f2 BATCTL_MD5SUM:=79d5aa796ae8b008a9fa42c27d4da2c1 diff --git a/patches/0001-batman-adv_fix_tt_global_entries_flags_update.patch b/patches/0001-batman-adv_fix_tt_global_entries_flags_update.patch new file mode 100644 index 0000000..d298dce --- /dev/null +++ b/patches/0001-batman-adv_fix_tt_global_entries_flags_update.patch @@ -0,0 +1,91 @@ +From ordex@autistici.org Fri Nov 16 16:49:15 2012 +X-Apparently-To: lindner_marek@yahoo.de via 188.125.84.188; Fri, 16 Nov 2012 08:50:20 +0000 +Received-SPF: pass (domain of autistici.org designates 178.255.144.35 as permitted sender) +X-YMailISG: LjItQMwWLDsFo9iIj9SpdJB2BfvjP1gD3E_NVQ_UwftNCcRw + mktGb.BmfJsKNd8xzk6l6Af7UUv1xLGNNu25H2xh2Qb5gkNtOz8STnhREHXW + 2wrVlJrV4N5P1GjUMi.mg0HiNw_iW.wstmwKVt21QjNLaCOFSu8oPvFbkYfI + a1bHeL4AaHEU0DrQEdLR8RQ74pEv8hqcWNNMJfG53AiFszd5zBkge1YX_Ce. + tM6HQM.mvYm3leQRAbo9ITvWqlIaaGjSWIinrbKMiIF_MeHSsGZV2vKBn7n6 + q6Afw5YPoHlvIKMLhPDHkCilJ6kL0s7d4pgxe.s9qywWqJjlQUiik_1epdgG + 7EWPJXpL7s_R.rfVjXwyIP.m45MUYOO9yqC_CRpSFikVk4kKhPpALa0dUZOb + ts_1EEStTcoclQAhj2gkxMrTwwGrV4L.thb3f8pRxEzNf._haOS7.I8EXd6a + UEqTCSWEFifITimxDl5iXOn1nov6gi5BthoGXOdf1.3ljQcyrzZnMWsplq5D + u7B_Gjk8YHeWeZma9AhXuCcvmlOBKwNRaGwNy7wI7Bx8KMei7B9cr2jryis3 + jnOGkxmyerkvMvP1e8HQrMC.ge0q718RWZJB_U5JsyNqcCEr7W4qyOggbpcw + E5igrmVqqs2YbDi5LC7.8vOqlVNKrOvfZpGK4BYDU8eVxCNv2yd40Chd2a94 + xUqzzSCq_SDsEvheC1lxOWIEFh3OXjYjp3bx3Eugx1.9gWDOX2k5BLpKkg.A + IM9CcDNqLPdfsQcPCoapHq6vOumxN9pZ8JxiNKRbDmy25ilJlOARJ9rcYTvA + lYH.22GFKzx3ggAuW89UVsw0agTkF55kT.9_84nTSfmle5cUwO5t4lEFXhq9 + V5hy3rjYs8FShSBR6UC5rav23vPHsQESjqLCE0Q4H4HYA._lGDd4qAErDqwe + lToZWLoLTW7telXC2LTnC3JeG8J7L4wJGo9PbfbPx6En.bj6GgfY5qObT0bk + q.5ZOl_vfdcdnjw5sVpMuxpIzRyASOM4Dp40Kd5VF6zajUeGuRA8bXs34Ag- +X-Originating-IP: [178.255.144.35] +Authentication-Results: mta1083.mail.ukl.yahoo.com from=autistici.org; domainkeys=neutral (no sig); from=autistici.org; dkim=pass (ok) +Received: from 127.0.0.1 (EHLO contumacia.investici.org) (178.255.144.35) + by mta1083.mail.ukl.yahoo.com with SMTP; Fri, 16 Nov 2012 08:50:19 +0000 +Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 00F60E8714; + Fri, 16 Nov 2012 08:50:17 +0000 (UTC) +X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org 00F60E8714 +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; + s=stigmate; t=1353055819; + bh=XsI1HH9Qj6JfIxg3GZGAztofUiRgq5pmBZUCGlj/oKs=; + h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; + b=ahp9/Hf4dpprZKMhl2rN3hK5FGhM61FzXZgxzMdz0KqKTvJfjcaS0Ii0a8pAVFilq + TfTcqXNuPDbRE/i6wdU6+QEY1/fkRK7Ij2rWdQECxEVe5pItj8vMCvXH+GYlhjQkcs + ys7ZMqyXXzs9dUqZRenQXLJLuTkcSwuPP7bmGsg0= +From: Antonio Quartulli +To: davem@davemloft.net +Cc: netdev@vger.kernel.org, + Simon Wunderlich , + Marek Lindner , + Sven Eckelmann , + Antonio Quartulli +Subject: [PATCH] batman-adv: fix tt_global_entries flags update +Date: Fri, 16 Nov 2012 09:49:15 +0100 +Message-Id: <1353055758-2901-2-git-send-email-ordex@autistici.org> +X-Mailer: git-send-email 1.8.0 +In-Reply-To: <1353055758-2901-1-git-send-email-ordex@autistici.org> +References: <1353055758-2901-1-git-send-email-ordex@autistici.org> +Status: R +X-Status: N +X-KMail-EncryptionState: +X-KMail-SignatureState: +X-KMail-MDN-Sent: + +Flags carried by a change_entry have to be always copied into the +client entry as they may contain important attributes (e.g. +TT_CLIENT_WIFI). + +For instance, a client added by means of the "early detection +mechanism" has no flag set at the beginning, so they must be updated once the +proper ADD event is received. + +This was introduced by 30cfd02b60e1cb16f5effb0a01f826c5bb7e4c59 +("batman-adv: detect not yet announced clients") + +Signed-off-by: Antonio Quartulli +Signed-off-by: Marek Lindner +--- + translation-table.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/translation-table.c b/translation-table.c +index 112edd3..64c0012 100644 +--- a/translation-table.c ++++ b/translation-table.c +@@ -769,6 +769,12 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv, + */ + tt_global_entry->common.flags &= ~BATADV_TT_CLIENT_TEMP; + ++ /* the change can carry possible "attribute" flags like the ++ * TT_CLIENT_WIFI, therefore they have to be copied in the ++ * client entry ++ */ ++ tt_global_entry->common.flags |= flags; ++ + /* If there is the BATADV_TT_CLIENT_ROAM flag set, there is only + * one originator left in the list and we previously received a + * delete + roaming change for this originator. +-- +1.8.0 + diff --git a/patches/0002-batman-adv_correctly_pass_the_client_flag_on_tt_response.patch b/patches/0002-batman-adv_correctly_pass_the_client_flag_on_tt_response.patch new file mode 100644 index 0000000..ceccae6 --- /dev/null +++ b/patches/0002-batman-adv_correctly_pass_the_client_flag_on_tt_response.patch @@ -0,0 +1,85 @@ +From ordex@autistici.org Fri Nov 16 16:49:16 2012 +X-Apparently-To: lindner_marek@yahoo.de via 188.125.84.191; Fri, 16 Nov 2012 08:50:21 +0000 +Received-SPF: pass (domain of autistici.org designates 178.255.144.35 as permitted sender) +X-YMailISG: fVfMssIWLDsEjVl9FTNnqLYIz03Fp5zMnBfNrwq01TpmFHMe + 4NioQil50ZX.KNrDwxWrNL7F5LVE3iFuNBiOj4vXGfU9GDPuCH8xLBGseyad + EatFIUDFeUMbfEwZPy28z_9EXlsHz5RAaq3WJlVwxlbl8HYO8KDoP.O2uPJB + f1LCApHhOzbwEorY6aey0roQgYwXheDamyypNW23KoTrKRRt2yIX_44YOEX6 + yPbmxmK2m2L048nZkBe5u1LD89PXTn2P07.Km_O95JLxjx1PCFbKa3TBNIk5 + n367Buu6KbhXuIU39l_ilvI6UWIwyDT9gyhYrjDgPn8680zLGVtcXjUO9DLw + lHybXd6kneRWA7krXtrHIxRPJrayaHbsMEztJWBGUMrwglJlJThMRvp8nhgV + nw0fVqbQI7sUiFMZx9QVMETsQ2krXG7GUVNFuELV_ej3IP_vjYBZtLBB8Aqb + Wh9yk0UByNlHv82yvc_N3B67fzOEcJkC6fsFuvC7oBsjFBU.j6ejX_BrPiyi + M7uelmPRLdOujZpZ.7K3Az1nCgdyOcWuf.F37.409a2DQJDh8EuptbFF0gJR + p4nscDuQUch1VOaYVXUzgIFpmVNQbbvV63t2PegzhrYV1xmv8TXv4DPDDmKw + 7zEqGuOok9HayiISSYrlxLiw4a2OQoaNhGPtoFzxVdWJxReku9T6yB8tedcW + ilpf3_Rf1MDCB2W1HxRspPq6RcSu2WleYAINgzrlU6Gsgks2zExjTuYVaIv0 + 9ydk8.K77fsbS11Nmj6cynKgooOZiHpao2I6ggYO5tTM4_R4slHPVZlg8hGB + feKVfKaeYKPYQ3chD99PuxjXoEup9Cn3rmRcWNDMd72ncd1Xk43HHkDyTmSI + 6OXRkTWMEkEhqA6MT7CVOuWnzRaT6AxKBybOso7XWRaiIxi1AOpEy7ihWLNW + pcQkRakzv2wqpknWLMlgHzLZs3LEPSpcCQwHBbVMkLL6S8m_moDLO4fdzz0v + i40nJUsBpxOAl49u3ZTM0G2ccDz5IJVOTuyqbGtZdeG5MBen9DJh4NCYP_No + psAEk9j1XV_1aaAakSNFXnS18XtYBtZaewE.O5KTHddFyFSBWF2VwR2dFEIf + NV9kSDSl6Gm4P2PjYWOdeXf0YiRm6cba_Q-- +X-Originating-IP: [178.255.144.35] +Authentication-Results: mta1027.mail.ukl.yahoo.com from=autistici.org; domainkeys=neutral (no sig); from=autistici.org; dkim=pass (ok) +Received: from 127.0.0.1 (EHLO contumacia.investici.org) (178.255.144.35) + by mta1027.mail.ukl.yahoo.com with SMTP; Fri, 16 Nov 2012 08:50:21 +0000 +Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id CEF29E8797; + Fri, 16 Nov 2012 08:50:19 +0000 (UTC) +X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org CEF29E8797 +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; + s=stigmate; t=1353055821; + bh=Z+GuGLsx9ZvEgtokRJqUrcaZ46uGZCSjpzl9VagyFsY=; + h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; + b=daWWrrrXRKMymNqgCbTU4Z67tlYH+UtOkzrTMpikDtsSVqGhdWuKPG/mY2+eaO+ra + ap5dS/KrwlFmxni3y16IuXKcPQo8EIANkE0mWSXZgOOqh9ps3VrYZBlWoThf8w/NYw + Mw3Bi7uuS75kwEq5akDKroDq8jufp9RVZ+ZVW3oY= +From: Antonio Quartulli +To: davem@davemloft.net +Cc: netdev@vger.kernel.org, + Simon Wunderlich , + Marek Lindner , + Sven Eckelmann , + Antonio Quartulli +Subject: [PATCH] batman-adv: correctly pass the client flag on tt_response +Date: Fri, 16 Nov 2012 09:49:16 +0100 +Message-Id: <1353055758-2901-3-git-send-email-ordex@autistici.org> +X-Mailer: git-send-email 1.8.0 +In-Reply-To: <1353055758-2901-1-git-send-email-ordex@autistici.org> +References: <1353055758-2901-1-git-send-email-ordex@autistici.org> +Status: R +X-Status: N +X-KMail-EncryptionState: +X-KMail-SignatureState: +X-KMail-MDN-Sent: + +When a TT response with the full table is sent, the client flags +should be sent as well. This patch fix the flags assignment when +populating the tt_response to send back + +This was introduced by 30cfd02b60e1cb16f5effb0a01f826c5bb7e4c59 +("batman-adv: detect not yet announced clients") + +Signed-off-by: Antonio Quartulli +Signed-off-by: Marek Lindner +--- + translation-table.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/translation-table.c b/translation-table.c +index 64c0012..fec1a00 100644 +--- a/translation-table.c ++++ b/translation-table.c +@@ -1502,7 +1502,7 @@ batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn, + + memcpy(tt_change->addr, tt_common_entry->addr, + ETH_ALEN); +- tt_change->flags = BATADV_NO_FLAGS; ++ tt_change->flags = tt_common_entry->flags; + + tt_count++; + tt_change++; +-- +1.8.0 + diff --git a/patches/0003-batman-adv_do_not_add_TEMP_clients_belonging_to_other_backbone_nodes.patch b/patches/0003-batman-adv_do_not_add_TEMP_clients_belonging_to_other_backbone_nodes.patch new file mode 100644 index 0000000..e4f1f87 --- /dev/null +++ b/patches/0003-batman-adv_do_not_add_TEMP_clients_belonging_to_other_backbone_nodes.patch @@ -0,0 +1,91 @@ +From ordex@autistici.org Fri Nov 16 16:49:17 2012 +X-Apparently-To: lindner_marek@yahoo.de via 188.125.84.191; Fri, 16 Nov 2012 08:50:23 +0000 +Received-SPF: pass (domain of autistici.org designates 178.255.144.35 as permitted sender) +X-YMailISG: 2XUGKvsWLDvGA03t6tTkIRd1IgFM3maQM0m2SA6K1X6dTDIs + 22VSgKM.DhxAYBiW3Da9K.oH5o6C953_nJPPhur2qBPO.O3cDwjef5_Ugpc9 + EToptn4WCMI_3P8HITy2vYKCSg9Ycsqx9qqZUyxR_6Q1muNYxPYlaakcwXc. + 1ohYca223PQlYfbpn4rBdIT0Hf67oGZa12E_u.UgRAk80txi2mSPmlwJi1v7 + tUv907MDZ5psHzC7gI1A8TiWoRgSe3M68t8k8V.MEHOgITRKJ2fZshNFNdca + lrgJos7q8MPEccQhwYN.VInpv9loDuyCJLgx.seZFqgkKyQ81g0VeT_lZMp. + cXmi1p0etSsdGUkOn7MFKt1dzIoq46ebW1FRMW0RBIecunHshbqZS425M5sa + 6DJ.WZpYRxXqD2osYHboWzcz6Oi02o7r.XwFwyz55p2Hq992vZ06vJd3FQF1 + OmHf014Ni4fKu4au2M8b_fy2bqaSMYNdYIWSPrOzRpVOvQmU6eNJZz9TTaWw + p.giBbKH3qDhw6sn3HtEVZwsrOjNvLiccPeRmHXXp_3cVDy9iO0a2WhEsPyG + HnjeV08RB4j2JuICHcFo68rbC5x6MHkKXc.f4bDQ9KqzmX_av7jotSW2jPHa + eqXDV0tiP1TbuZNBo9ftz367Aver9BvjM3qZOGg2VVAy2FriP4hbbLzAkK7p + oReYyFnOjkbHpXOFkgcMiEZyTYNoD3rsWT68YOLl74dgYraLrIY4Sv0e8bHJ + 5u3v1aHhPNtjKNBxnd2xSSdgblb._mebG3fP1eKBGgil_efLA0cnvskj2w_z + BOCCHWCDYadM8RIkSB3XWkKtjkDZFwzXPEco7DuNhCKvTycFnZ_ilaJTmMSg + juyzcelGzKqOftqt5f1dRKUMSg2JFIv0pwZt4W.DGS4P_SqbWLEShjrxbwEc + b7ew9lr_iukbFzL4uN49A4uFx.J8c2WaZDv1gXvRZEiIHbdkKxlHdVyTuQ05 + aLLDc7Mz9Y68Z7msdzKK8V5LdRqdtCzFogk9seViWAVYXdndAn7XT22cOgci + IhdVk8RULmZ5uouAMr0usTIH_MKtCdInt1Tn.DlGuUEeDw2M5SeSC7cKPETl + lnSu5f8p6_ei9sx7YwdIQDyOG2o_49xM4Oeekeh9x3dGq23BvAEa8Q-- +X-Originating-IP: [178.255.144.35] +Authentication-Results: mta1054.mail.ukl.yahoo.com from=autistici.org; domainkeys=neutral (no sig); from=autistici.org; dkim=pass (ok) +Received: from 127.0.0.1 (EHLO contumacia.investici.org) (178.255.144.35) + by mta1054.mail.ukl.yahoo.com with SMTP; Fri, 16 Nov 2012 08:50:23 +0000 +Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id AD953E8786; + Fri, 16 Nov 2012 08:50:21 +0000 (UTC) +X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org AD953E8786 +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; + s=stigmate; t=1353055823; + bh=Rf2TK97MqcbN9ydt5/Ur6XKfsKU31Fnc1POW6n859o4=; + h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; + b=rOZmgwiyXClabfKLMxvEs9cRsEGiS0CPOTPna1OmakChF1i9/CFcKollV1xOp8g/h + UJMy7F82OyIBYptUTcTXfvQSUD7Lh92tbrWwkAmq3/1CeqKCrcuk5DNhaQYgoKfDpT + qg6uTDtM5bFM21xzsl/0itBJUeRv6y+FQT4mOQeI= +From: Antonio Quartulli +To: davem@davemloft.net +Cc: netdev@vger.kernel.org, + Simon Wunderlich , + Marek Lindner , + Sven Eckelmann , + Antonio Quartulli +Subject: [PATCH] batman-adv: don't add TEMP clients belonging to other backbone nodes +Date: Fri, 16 Nov 2012 09:49:17 +0100 +Message-Id: <1353055758-2901-4-git-send-email-ordex@autistici.org> +X-Mailer: git-send-email 1.8.0 +In-Reply-To: <1353055758-2901-1-git-send-email-ordex@autistici.org> +References: <1353055758-2901-1-git-send-email-ordex@autistici.org> +Status: R +X-Status: N +X-KMail-EncryptionState: +X-KMail-SignatureState: +X-KMail-MDN-Sent: + +The "early client detection" mechanism must not add clients belonging +to other backbone nodes. Such clients must be reached by directly +using the LAN instead of the mesh. + +This was introduced by 30cfd02b60e1cb16f5effb0a01f826c5bb7e4c59 +("batman-adv: detect not yet announced clients") + +Reported-by: Glen Page +Signed-off-by: Antonio Quartulli +Signed-off-by: Marek Lindner +--- + net/batman-adv/translation-table.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/translation-table.c b/translation-table.c +index fec1a00..baae715 100644 +--- a/translation-table.c ++++ b/translation-table.c +@@ -2456,6 +2456,13 @@ bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, + { + bool ret = false; + ++ /* if the originator is a backbone node (meaning it belongs to the same ++ * LAN of this node) the temporary client must not be added because to ++ * reach such destination the node must use the LAN instead of the mesh ++ */ ++ if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig)) ++ goto out; ++ + if (!batadv_tt_global_add(bat_priv, orig_node, addr, + BATADV_TT_CLIENT_TEMP, + atomic_read(&orig_node->last_ttvn))) +-- +1.8.0 + diff --git a/patches/0004-batman-adv_process_broadcast_packets_in_BLA_earlier.patch b/patches/0004-batman-adv_process_broadcast_packets_in_BLA_earlier.patch new file mode 100644 index 0000000..e444bc4 --- /dev/null +++ b/patches/0004-batman-adv_process_broadcast_packets_in_BLA_earlier.patch @@ -0,0 +1,110 @@ +From ordex@autistici.org Fri Nov 16 16:49:18 2012 +X-Apparently-To: lindner_marek@yahoo.de via 188.125.84.189; Fri, 16 Nov 2012 08:50:26 +0000 +Received-SPF: pass (domain of autistici.org designates 178.255.144.35 as permitted sender) +X-YMailISG: qdh1iTQWLDs62bkFFSythfvhHaZxhfpJ5PSKnjpe7hExOA6w + 0Hc3JpktYyerT5XQmK0XpfEp9b0El16poZFQ_PqNppiGeXVbVwgYE8uvjLm1 + kNwrYEvCc0nHo78mCSQkk_ilI7QHsL0vneWF0aISE9yqNNXjqyQkimfmRRfQ + U7DiQvok4JxuXMCS9G86op0LQLt0H9_iTX8cZbvEXjERIlpIKSVn7PScRlSw + 1DwoTaTewPT5dANPP9vv5ABNNcAzPsn1krQ1_.bPyorrDCQBWScspYXaxyD5 + WogJDPx5.tpKbyvcx.ke7zNRpChO4Uu5HThhh0y8wZYSWWuo5qqXA82ZHzqT + 9ARlQ7Ipvkb18vDmUaLRuCHvsGQh5rSS_ctctbZpvvReA7kOV1y_V_itOE9X + TRJxcQZqqavJUZ0xP9ZAxWc_KiB8BFKwBc_acUbjDr7cRtYLkP89nPFESPH_ + zTku3JwOSGw0.s3vGyEqMxTxAuwLfbf.OHLsRH5eaa0FEg2QMvMDJ4rpFTAm + 8AW08y0Yas.Do1MFuaqX__dn0dOyzvh_jABfSg2mcBqO5XCgo4JG4HNdDUWN + lc8Z82D1zIRm5XZczZa97xi81_bNB8Gut7deqJLasqjpJ4q4S7NpMUaDDC.. + 5beC2z.krETtVHhB1JIQl8gOKLgvJBqEcxvxedbqGpV7lbLXSDgqZG.KobYC + j4jsdXWEJV6hBl.mJggEWlcMSAsVI.ZVPqrtOIcdGhBis3KDAwp2ULlj3Iu4 + hEwgED_.r_adAqcC1GSqAEIMNF4tvvjsN5GvEcwX2hWnEOYFZ6Kp93SilV1l + D3rXsN_d8M5jVAvbFw7qOYFZ5rCr0LXcNFuclqDJznNsY8xMkhvP0PP53lwU + bpZEVuO2UzqA.r_4SeBTHy7tcDvYXlQlW4Q16xYT6sZrE8dXVMrgSBlOKq5G + 1o6N6Xkg2I29H0w.vu2KU6b1WAJlMy2H4dcEv3Zooh5VtQmtYwtmbZDHrIQG + 8lJ381Z9jh7pIFCMsp2epxXWbAqkHd6_r6a3lxpHtnHLWI55RWFI5qNxvxQd + bTIgorpXL.WAmwiLv6MNomPSuHdRy_rHIX9R8DljaWlLKdI_uoa_lbrdjblJ + iokyPUKRSx_VKHi.eIfz9JaFOTdJQACoxmSoL391XOewRlctIBRDTvB6yOss + 7Nt9dmv0ePFvTJN9euRL +X-Originating-IP: [178.255.144.35] +Authentication-Results: mta1067.mail.ird.yahoo.com from=autistici.org; domainkeys=neutral (no sig); from=autistici.org; dkim=pass (ok) +Received: from 127.0.0.1 (EHLO contumacia.investici.org) (178.255.144.35) + by mta1067.mail.ird.yahoo.com with SMTP; Fri, 16 Nov 2012 08:50:26 +0000 +Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id D78F1E878B; + Fri, 16 Nov 2012 08:50:23 +0000 (UTC) +X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org D78F1E878B +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; + s=stigmate; t=1353055825; + bh=mBzsqJo806YwPoG1l/528KrliiW3q+mkiMzUs+PZfkI=; + h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; + b=RO+bvxnncVKR0YL3Kl8GMbrFsqGikhqR3MzXRrdYewxnNXaSfY55bVw8C9Av108Id + 0FIk7xS/FYydezTX95Ln+kRCU96uKVktfvi9+3M3k5Ht/pAaAnRr5DkQ8AbE8+NFyT + VmQUdEYEqU8x7/DlrMOsrjxyqmA5a5By+75mm5jk= +From: Antonio Quartulli +To: davem@davemloft.net +Cc: netdev@vger.kernel.org, + Simon Wunderlich , + Marek Lindner , + Sven Eckelmann , + Antonio Quartulli , + Simon Wunderlich +Subject: [PATCH] batman-adv: process broadcast packets in BLA earlier +Date: Fri, 16 Nov 2012 09:49:18 +0100 +Message-Id: <1353055758-2901-5-git-send-email-ordex@autistici.org> +X-Mailer: git-send-email 1.8.0 +In-Reply-To: <1353055758-2901-1-git-send-email-ordex@autistici.org> +References: <1353055758-2901-1-git-send-email-ordex@autistici.org> +Status: R +X-Status: N +X-KMail-EncryptionState: +X-KMail-SignatureState: +X-KMail-MDN-Sent: + +The logic in the BLA mechanism may decide to drop broadcast packets +because the node may still be in the setup phase. For this reason, +further broadcast processing like the early client detection mechanism +must be done only after the BLA check. + +This patches moves the invocation to BLA before any other broadcast +processing. + +This was introduced 30cfd02b60e1cb16f5effb0a01f826c5bb7e4c59 +("batman-adv: detect not yet announced clients") + +Reported-by: Glen Page +Signed-off-by: Simon Wunderlich +Signed-off-by: Antonio Quartulli +Signed-off-by: Marek Lindner +--- + net/batman-adv/soft-interface.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/soft-interface.c b/soft-interface.c +index b9a28d2..ce0684a 100644 +--- a/soft-interface.c ++++ b/soft-interface.c +@@ -325,6 +325,12 @@ void batadv_interface_rx(struct net_device *soft_iface, + + soft_iface->last_rx = jiffies; + ++ /* Let the bridge loop avoidance check the packet. If will ++ * not handle it, we can safely push it up. ++ */ ++ if (batadv_bla_rx(bat_priv, skb, vid, is_bcast)) ++ goto out; ++ + if (orig_node) + batadv_tt_add_temporary_global_entry(bat_priv, orig_node, + ethhdr->h_source); +@@ -332,12 +338,6 @@ void batadv_interface_rx(struct net_device *soft_iface, + if (batadv_is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest)) + goto dropped; + +- /* Let the bridge loop avoidance check the packet. If will +- * not handle it, we can safely push it up. +- */ +- if (batadv_bla_rx(bat_priv, skb, vid, is_bcast)) +- goto out; +- + netif_rx(skb); + goto out; + +-- +1.8.0 + From 7ed34a52deb71582cd45d2402bb8a916fdcd1dcb Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Mon, 26 Nov 2012 10:36:23 +0000 Subject: [PATCH 33/41] batman-adv: fix race condition between iface add and iface up Signed-off-by: Gui Iribarren Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@34385 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 3 ++- files/etc/hotplug.d/iface/99-batman-adv | 12 ++++++++++++ files/etc/hotplug.d/net/99-batman-adv | 1 - files/lib/batman-adv/config.sh | 1 - 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 files/etc/hotplug.d/iface/99-batman-adv diff --git a/Makefile b/Makefile index f782ab7..50f8a57 100644 --- a/Makefile +++ b/Makefile @@ -109,10 +109,11 @@ define Build/Clean endef define KernelPackage/batman-adv/install - $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/lib/batman-adv $(1)/usr/sbin + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv $(1)/usr/sbin $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config $(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv $(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net + $(INSTALL_BIN) ./files/etc/hotplug.d/iface/99-batman-adv $(1)/etc/hotplug.d/iface $(INSTALL_BIN) ./files/usr/sbin/batman-adv $(1)/usr/sbin $(BATCTL_INSTALL) endef diff --git a/files/etc/hotplug.d/iface/99-batman-adv b/files/etc/hotplug.d/iface/99-batman-adv new file mode 100644 index 0000000..9206c42 --- /dev/null +++ b/files/etc/hotplug.d/iface/99-batman-adv @@ -0,0 +1,12 @@ +#!/bin/sh + +. /lib/batman-adv/config.sh + +bat_load_module +config_load batman-adv + +case "$ACTION" in + ifup) + [ -d /sys/class/net/$DEVICE/batman_adv/ ] && config_foreach bat_add_interface mesh "$DEVICE" + ;; +esac diff --git a/files/etc/hotplug.d/net/99-batman-adv b/files/etc/hotplug.d/net/99-batman-adv index 42d4c29..47132c1 100644 --- a/files/etc/hotplug.d/net/99-batman-adv +++ b/files/etc/hotplug.d/net/99-batman-adv @@ -8,7 +8,6 @@ config_load batman-adv case "$ACTION" in add) [ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE" - [ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_add_interface mesh "$INTERFACE" ;; remove) [ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_del_interface mesh "$INTERFACE" diff --git a/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh index 35d61ef..313dd3a 100644 --- a/files/lib/batman-adv/config.sh +++ b/files/lib/batman-adv/config.sh @@ -48,7 +48,6 @@ bat_add_interface() local interface="$2" local interfaces - sleep 3s # some device (ath) is very lazy to start config_get interfaces $mesh interfaces for iface in $interfaces; do [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || { From 419eabba1ed455be701d551360f9280d9574d8be Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Tue, 15 Jan 2013 13:09:04 +0000 Subject: [PATCH 34/41] batman-adv: upgrade package to latest release 2013.0.0 & netifd integration Signed-off-by: Gui Iribarren Signed-off-by: Moritz Warning Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@35175 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Config.in | 7 ++ Makefile | 17 +-- files/etc/config/batman-adv | 3 +- files/etc/hotplug.d/iface/99-batman-adv | 12 -- files/etc/hotplug.d/net/99-batman-adv | 3 - files/lib/batman-adv/config.sh | 57 +++------ files/lib/netifd/proto/batadv.sh | 30 +++++ ...v_fix_tt_global_entries_flags_update.patch | 91 --------------- ..._pass_the_client_flag_on_tt_response.patch | 85 -------------- ...ts_belonging_to_other_backbone_nodes.patch | 91 --------------- ...ess_broadcast_packets_in_BLA_earlier.patch | 110 ------------------ 11 files changed, 61 insertions(+), 445 deletions(-) delete mode 100644 files/etc/hotplug.d/iface/99-batman-adv create mode 100644 files/lib/netifd/proto/batadv.sh delete mode 100644 patches/0001-batman-adv_fix_tt_global_entries_flags_update.patch delete mode 100644 patches/0002-batman-adv_correctly_pass_the_client_flag_on_tt_response.patch delete mode 100644 patches/0003-batman-adv_do_not_add_TEMP_clients_belonging_to_other_backbone_nodes.patch delete mode 100644 patches/0004-batman-adv_process_broadcast_packets_in_BLA_earlier.patch diff --git a/Config.in b/Config.in index d6d9320..08987e5 100644 --- a/Config.in +++ b/Config.in @@ -3,10 +3,17 @@ config KMOD_BATMAN_ADV_DEBUG_LOG bool "enable verbose debug logging" depends PACKAGE_kmod-batman-adv default n + config KMOD_BATMAN_ADV_BLA bool "enable bridge loop avoidance" depends PACKAGE_kmod-batman-adv default y + +config KMOD_BATMAN_ADV_DAT + bool "enable distributed arp table" + depends PACKAGE_kmod-batman-adv + default y + config KMOD_BATMAN_ADV_BATCTL bool "enable batctl" depends PACKAGE_kmod-batman-adv diff --git a/Makefile b/Makefile index 50f8a57..0c57716 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2012.4.0 -BATCTL_VERSION:=2012.4.0 -PKG_RELEASE:=2 -PKG_MD5SUM:=24e922a64a507b146c32c585538407f2 -BATCTL_MD5SUM:=79d5aa796ae8b008a9fa42c27d4da2c1 +PKG_VERSION:=2013.0.0 +BATCTL_VERSION:=2013.0.0 +PKG_RELEASE:=1 +PKG_MD5SUM:=37f4aa02f393daad3d87cead2bc28ed9 +BATCTL_MD5SUM:=6ea4bcd8a9332d586bb06b5063f882cd PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) @@ -29,7 +29,7 @@ define KernelPackage/batman-adv URL:=http://www.open-mesh.org/ MAINTAINER:=Marek Lindner SUBMENU:=Network Support - DEPENDS:=+kmod-lib-crc16 +libc + DEPENDS:=+kmod-lib-crc16 +kmod-crypto-core +kmod-crypto-crc32c +kmod-lib-crc32c +libc TITLE:=B.A.T.M.A.N. Adv FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,batman-adv) @@ -56,6 +56,7 @@ MAKE_BATMAN_ADV_ARGS += \ LINUX_VERSION="$(LINUX_VERSION)" \ CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),y,n) \ CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_KMOD_BATMAN_ADV_BLA),y,n) \ + CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_KMOD_BATMAN_ADV_DAT),y,n) \ REVISION="" all MAKE_BATCTL_ARGS += \ @@ -109,11 +110,11 @@ define Build/Clean endef define KernelPackage/batman-adv/install - $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv $(1)/usr/sbin + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv $(1)/usr/sbin $(1)/lib/netifd/proto $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config $(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv $(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net - $(INSTALL_BIN) ./files/etc/hotplug.d/iface/99-batman-adv $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./files/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto $(INSTALL_BIN) ./files/usr/sbin/batman-adv $(1)/usr/sbin $(BATCTL_INSTALL) endef diff --git a/files/etc/config/batman-adv b/files/etc/config/batman-adv index fb7b384..6a62203 100644 --- a/files/etc/config/batman-adv +++ b/files/etc/config/batman-adv @@ -1,6 +1,5 @@ config 'mesh' 'bat0' - option 'interfaces' 'mesh' option 'aggregated_ogms' option 'ap_isolation' option 'bonding' @@ -12,6 +11,8 @@ config 'mesh' 'bat0' option 'orig_interval' option 'vis_mode' option 'bridge_loop_avoidance' + option 'distributed_arp_table' + option 'hop_penalty' # yet another batX instance # config 'mesh' 'bat5' diff --git a/files/etc/hotplug.d/iface/99-batman-adv b/files/etc/hotplug.d/iface/99-batman-adv deleted file mode 100644 index 9206c42..0000000 --- a/files/etc/hotplug.d/iface/99-batman-adv +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -. /lib/batman-adv/config.sh - -bat_load_module -config_load batman-adv - -case "$ACTION" in - ifup) - [ -d /sys/class/net/$DEVICE/batman_adv/ ] && config_foreach bat_add_interface mesh "$DEVICE" - ;; -esac diff --git a/files/etc/hotplug.d/net/99-batman-adv b/files/etc/hotplug.d/net/99-batman-adv index 47132c1..f0c391f 100644 --- a/files/etc/hotplug.d/net/99-batman-adv +++ b/files/etc/hotplug.d/net/99-batman-adv @@ -9,7 +9,4 @@ case "$ACTION" in add) [ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE" ;; - remove) - [ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_del_interface mesh "$INTERFACE" - ;; esac diff --git a/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh index 313dd3a..ae102e9 100644 --- a/files/lib/batman-adv/config.sh +++ b/files/lib/batman-adv/config.sh @@ -11,67 +11,36 @@ bat_load_module() bat_config() { local mesh="$1" - local aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval hop_penalty vis_mode bridge_loop_avoidance + local aggregated_ogms ap_isolation bonding bridge_loop_avoidance distributed_arp_table fragmentation + local gw_bandwidth gw_mode gw_sel_class hop_penalty log_level orig_interval vis_mode config_get aggregated_ogms "$mesh" aggregated_ogms + config_get ap_isolation "$mesh" ap_isolation config_get bonding "$mesh" bonding + config_get bridge_loop_avoidance "$mesh" bridge_loop_avoidance + config_get distributed_arp_table "$mesh" distributed_arp_table config_get fragmentation "$mesh" fragmentation config_get gw_bandwidth "$mesh" gw_bandwidth config_get gw_mode "$mesh" gw_mode config_get gw_sel_class "$mesh" gw_sel_class + config_get hop_penalty "$mesh" hop_penalty config_get log_level "$mesh" log_level config_get orig_interval "$mesh" orig_interval - config_get hop_penalty "$mesh" hop_penalty config_get vis_mode "$mesh" vis_mode - config_get ap_isolation "$mesh" ap_isolation - config_get bridge_loop_avoidance "$mesh" bridge_loop_avoidance - + [ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv mesh $mesh does not exist - check your interface configuration" && return 1 - [ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval - [ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty - [ -n "$log_level" ] && echo $log_level > /sys/class/net/$mesh/mesh/log_level 2>&- [ -n "$aggregate_ogms" ] && echo $aggregate_ogms > /sys/class/net/$mesh/mesh/aggregate_ogms + [ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation [ -n "$bonding" ] && echo $bonding > /sys/class/net/$mesh/mesh/bonding + [ -n "$bridge_loop_avoidance" ] && echo $bridge_loop_avoidance > /sys/class/net/$mesh/mesh/bridge_loop_avoidance + [ -n "$distributed_arp_table" ] && echo $distributed_arp_table > /sys/class/net/$mesh/mesh/distributed_arp_table [ -n "$fragmentation" ] && echo $fragmentation > /sys/class/net/$mesh/mesh/fragmentation [ -n "$gw_bandwidth" ] && echo $gw_bandwidth > /sys/class/net/$mesh/mesh/gw_bandwidth [ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$mesh/mesh/gw_mode [ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class + [ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty + [ -n "$log_level" ] && echo $log_level > /sys/class/net/$mesh/mesh/log_level 2>&- + [ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval [ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode - [ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation - [ -n "$bridge_loop_avoidance" ] && echo $bridge_loop_avoidance > /sys/class/net/$mesh/mesh/bridge_loop_avoidance -} - -bat_add_interface() -{ - local mesh="$1" - local interface="$2" - local interfaces - - config_get interfaces $mesh interfaces - for iface in $interfaces; do - [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || { - iface=$(uci -q -P/var/state get network.$iface.ifname) - [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || continue - } - - [ "$iface" = "$interface" ] && echo $mesh > /sys/class/net/$iface/batman_adv/mesh_iface - done -} - -bat_del_interface() -{ - local mesh="$1" - local interface="$2" - local interfaces - - config_get interfaces $mesh interfaces - for iface in $interfaces; do - [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || { - iface=$(uci -q -P/var/state get network.$iface.ifname) - [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || continue - } - - [ "$iface" = "$interface" ] && echo none > /sys/class/net/$iface/batman_adv/mesh_iface - done } diff --git a/files/lib/netifd/proto/batadv.sh b/files/lib/netifd/proto/batadv.sh new file mode 100644 index 0000000..632a209 --- /dev/null +++ b/files/lib/netifd/proto/batadv.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +. /lib/functions.sh +. ../netifd-proto.sh +init_proto "$@" + +proto_batadv_init_config() { + proto_config_add_string "mesh" +} + +proto_batadv_setup() { + local config="$1" + local iface="$2" + + local mesh + json_get_vars mesh + + echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface" + proto_init_update "$iface" 1 + proto_send_update "$config" +} + +proto_batadv_teardown() { + local config="$1" + local iface="$2" + + echo "none" > "/sys/class/net/$iface/batman_adv/mesh_iface" || true +} + +add_protocol batadv diff --git a/patches/0001-batman-adv_fix_tt_global_entries_flags_update.patch b/patches/0001-batman-adv_fix_tt_global_entries_flags_update.patch deleted file mode 100644 index d298dce..0000000 --- a/patches/0001-batman-adv_fix_tt_global_entries_flags_update.patch +++ /dev/null @@ -1,91 +0,0 @@ -From ordex@autistici.org Fri Nov 16 16:49:15 2012 -X-Apparently-To: lindner_marek@yahoo.de via 188.125.84.188; Fri, 16 Nov 2012 08:50:20 +0000 -Received-SPF: pass (domain of autistici.org designates 178.255.144.35 as permitted sender) -X-YMailISG: LjItQMwWLDsFo9iIj9SpdJB2BfvjP1gD3E_NVQ_UwftNCcRw - mktGb.BmfJsKNd8xzk6l6Af7UUv1xLGNNu25H2xh2Qb5gkNtOz8STnhREHXW - 2wrVlJrV4N5P1GjUMi.mg0HiNw_iW.wstmwKVt21QjNLaCOFSu8oPvFbkYfI - a1bHeL4AaHEU0DrQEdLR8RQ74pEv8hqcWNNMJfG53AiFszd5zBkge1YX_Ce. - tM6HQM.mvYm3leQRAbo9ITvWqlIaaGjSWIinrbKMiIF_MeHSsGZV2vKBn7n6 - q6Afw5YPoHlvIKMLhPDHkCilJ6kL0s7d4pgxe.s9qywWqJjlQUiik_1epdgG - 7EWPJXpL7s_R.rfVjXwyIP.m45MUYOO9yqC_CRpSFikVk4kKhPpALa0dUZOb - ts_1EEStTcoclQAhj2gkxMrTwwGrV4L.thb3f8pRxEzNf._haOS7.I8EXd6a - UEqTCSWEFifITimxDl5iXOn1nov6gi5BthoGXOdf1.3ljQcyrzZnMWsplq5D - u7B_Gjk8YHeWeZma9AhXuCcvmlOBKwNRaGwNy7wI7Bx8KMei7B9cr2jryis3 - jnOGkxmyerkvMvP1e8HQrMC.ge0q718RWZJB_U5JsyNqcCEr7W4qyOggbpcw - E5igrmVqqs2YbDi5LC7.8vOqlVNKrOvfZpGK4BYDU8eVxCNv2yd40Chd2a94 - xUqzzSCq_SDsEvheC1lxOWIEFh3OXjYjp3bx3Eugx1.9gWDOX2k5BLpKkg.A - IM9CcDNqLPdfsQcPCoapHq6vOumxN9pZ8JxiNKRbDmy25ilJlOARJ9rcYTvA - lYH.22GFKzx3ggAuW89UVsw0agTkF55kT.9_84nTSfmle5cUwO5t4lEFXhq9 - V5hy3rjYs8FShSBR6UC5rav23vPHsQESjqLCE0Q4H4HYA._lGDd4qAErDqwe - lToZWLoLTW7telXC2LTnC3JeG8J7L4wJGo9PbfbPx6En.bj6GgfY5qObT0bk - q.5ZOl_vfdcdnjw5sVpMuxpIzRyASOM4Dp40Kd5VF6zajUeGuRA8bXs34Ag- -X-Originating-IP: [178.255.144.35] -Authentication-Results: mta1083.mail.ukl.yahoo.com from=autistici.org; domainkeys=neutral (no sig); from=autistici.org; dkim=pass (ok) -Received: from 127.0.0.1 (EHLO contumacia.investici.org) (178.255.144.35) - by mta1083.mail.ukl.yahoo.com with SMTP; Fri, 16 Nov 2012 08:50:19 +0000 -Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 00F60E8714; - Fri, 16 Nov 2012 08:50:17 +0000 (UTC) -X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org 00F60E8714 -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; - s=stigmate; t=1353055819; - bh=XsI1HH9Qj6JfIxg3GZGAztofUiRgq5pmBZUCGlj/oKs=; - h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; - b=ahp9/Hf4dpprZKMhl2rN3hK5FGhM61FzXZgxzMdz0KqKTvJfjcaS0Ii0a8pAVFilq - TfTcqXNuPDbRE/i6wdU6+QEY1/fkRK7Ij2rWdQECxEVe5pItj8vMCvXH+GYlhjQkcs - ys7ZMqyXXzs9dUqZRenQXLJLuTkcSwuPP7bmGsg0= -From: Antonio Quartulli -To: davem@davemloft.net -Cc: netdev@vger.kernel.org, - Simon Wunderlich , - Marek Lindner , - Sven Eckelmann , - Antonio Quartulli -Subject: [PATCH] batman-adv: fix tt_global_entries flags update -Date: Fri, 16 Nov 2012 09:49:15 +0100 -Message-Id: <1353055758-2901-2-git-send-email-ordex@autistici.org> -X-Mailer: git-send-email 1.8.0 -In-Reply-To: <1353055758-2901-1-git-send-email-ordex@autistici.org> -References: <1353055758-2901-1-git-send-email-ordex@autistici.org> -Status: R -X-Status: N -X-KMail-EncryptionState: -X-KMail-SignatureState: -X-KMail-MDN-Sent: - -Flags carried by a change_entry have to be always copied into the -client entry as they may contain important attributes (e.g. -TT_CLIENT_WIFI). - -For instance, a client added by means of the "early detection -mechanism" has no flag set at the beginning, so they must be updated once the -proper ADD event is received. - -This was introduced by 30cfd02b60e1cb16f5effb0a01f826c5bb7e4c59 -("batman-adv: detect not yet announced clients") - -Signed-off-by: Antonio Quartulli -Signed-off-by: Marek Lindner ---- - translation-table.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/translation-table.c b/translation-table.c -index 112edd3..64c0012 100644 ---- a/translation-table.c -+++ b/translation-table.c -@@ -769,6 +769,12 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv, - */ - tt_global_entry->common.flags &= ~BATADV_TT_CLIENT_TEMP; - -+ /* the change can carry possible "attribute" flags like the -+ * TT_CLIENT_WIFI, therefore they have to be copied in the -+ * client entry -+ */ -+ tt_global_entry->common.flags |= flags; -+ - /* If there is the BATADV_TT_CLIENT_ROAM flag set, there is only - * one originator left in the list and we previously received a - * delete + roaming change for this originator. --- -1.8.0 - diff --git a/patches/0002-batman-adv_correctly_pass_the_client_flag_on_tt_response.patch b/patches/0002-batman-adv_correctly_pass_the_client_flag_on_tt_response.patch deleted file mode 100644 index ceccae6..0000000 --- a/patches/0002-batman-adv_correctly_pass_the_client_flag_on_tt_response.patch +++ /dev/null @@ -1,85 +0,0 @@ -From ordex@autistici.org Fri Nov 16 16:49:16 2012 -X-Apparently-To: lindner_marek@yahoo.de via 188.125.84.191; Fri, 16 Nov 2012 08:50:21 +0000 -Received-SPF: pass (domain of autistici.org designates 178.255.144.35 as permitted sender) -X-YMailISG: fVfMssIWLDsEjVl9FTNnqLYIz03Fp5zMnBfNrwq01TpmFHMe - 4NioQil50ZX.KNrDwxWrNL7F5LVE3iFuNBiOj4vXGfU9GDPuCH8xLBGseyad - EatFIUDFeUMbfEwZPy28z_9EXlsHz5RAaq3WJlVwxlbl8HYO8KDoP.O2uPJB - f1LCApHhOzbwEorY6aey0roQgYwXheDamyypNW23KoTrKRRt2yIX_44YOEX6 - yPbmxmK2m2L048nZkBe5u1LD89PXTn2P07.Km_O95JLxjx1PCFbKa3TBNIk5 - n367Buu6KbhXuIU39l_ilvI6UWIwyDT9gyhYrjDgPn8680zLGVtcXjUO9DLw - lHybXd6kneRWA7krXtrHIxRPJrayaHbsMEztJWBGUMrwglJlJThMRvp8nhgV - nw0fVqbQI7sUiFMZx9QVMETsQ2krXG7GUVNFuELV_ej3IP_vjYBZtLBB8Aqb - Wh9yk0UByNlHv82yvc_N3B67fzOEcJkC6fsFuvC7oBsjFBU.j6ejX_BrPiyi - M7uelmPRLdOujZpZ.7K3Az1nCgdyOcWuf.F37.409a2DQJDh8EuptbFF0gJR - p4nscDuQUch1VOaYVXUzgIFpmVNQbbvV63t2PegzhrYV1xmv8TXv4DPDDmKw - 7zEqGuOok9HayiISSYrlxLiw4a2OQoaNhGPtoFzxVdWJxReku9T6yB8tedcW - ilpf3_Rf1MDCB2W1HxRspPq6RcSu2WleYAINgzrlU6Gsgks2zExjTuYVaIv0 - 9ydk8.K77fsbS11Nmj6cynKgooOZiHpao2I6ggYO5tTM4_R4slHPVZlg8hGB - feKVfKaeYKPYQ3chD99PuxjXoEup9Cn3rmRcWNDMd72ncd1Xk43HHkDyTmSI - 6OXRkTWMEkEhqA6MT7CVOuWnzRaT6AxKBybOso7XWRaiIxi1AOpEy7ihWLNW - pcQkRakzv2wqpknWLMlgHzLZs3LEPSpcCQwHBbVMkLL6S8m_moDLO4fdzz0v - i40nJUsBpxOAl49u3ZTM0G2ccDz5IJVOTuyqbGtZdeG5MBen9DJh4NCYP_No - psAEk9j1XV_1aaAakSNFXnS18XtYBtZaewE.O5KTHddFyFSBWF2VwR2dFEIf - NV9kSDSl6Gm4P2PjYWOdeXf0YiRm6cba_Q-- -X-Originating-IP: [178.255.144.35] -Authentication-Results: mta1027.mail.ukl.yahoo.com from=autistici.org; domainkeys=neutral (no sig); from=autistici.org; dkim=pass (ok) -Received: from 127.0.0.1 (EHLO contumacia.investici.org) (178.255.144.35) - by mta1027.mail.ukl.yahoo.com with SMTP; Fri, 16 Nov 2012 08:50:21 +0000 -Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id CEF29E8797; - Fri, 16 Nov 2012 08:50:19 +0000 (UTC) -X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org CEF29E8797 -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; - s=stigmate; t=1353055821; - bh=Z+GuGLsx9ZvEgtokRJqUrcaZ46uGZCSjpzl9VagyFsY=; - h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; - b=daWWrrrXRKMymNqgCbTU4Z67tlYH+UtOkzrTMpikDtsSVqGhdWuKPG/mY2+eaO+ra - ap5dS/KrwlFmxni3y16IuXKcPQo8EIANkE0mWSXZgOOqh9ps3VrYZBlWoThf8w/NYw - Mw3Bi7uuS75kwEq5akDKroDq8jufp9RVZ+ZVW3oY= -From: Antonio Quartulli -To: davem@davemloft.net -Cc: netdev@vger.kernel.org, - Simon Wunderlich , - Marek Lindner , - Sven Eckelmann , - Antonio Quartulli -Subject: [PATCH] batman-adv: correctly pass the client flag on tt_response -Date: Fri, 16 Nov 2012 09:49:16 +0100 -Message-Id: <1353055758-2901-3-git-send-email-ordex@autistici.org> -X-Mailer: git-send-email 1.8.0 -In-Reply-To: <1353055758-2901-1-git-send-email-ordex@autistici.org> -References: <1353055758-2901-1-git-send-email-ordex@autistici.org> -Status: R -X-Status: N -X-KMail-EncryptionState: -X-KMail-SignatureState: -X-KMail-MDN-Sent: - -When a TT response with the full table is sent, the client flags -should be sent as well. This patch fix the flags assignment when -populating the tt_response to send back - -This was introduced by 30cfd02b60e1cb16f5effb0a01f826c5bb7e4c59 -("batman-adv: detect not yet announced clients") - -Signed-off-by: Antonio Quartulli -Signed-off-by: Marek Lindner ---- - translation-table.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/translation-table.c b/translation-table.c -index 64c0012..fec1a00 100644 ---- a/translation-table.c -+++ b/translation-table.c -@@ -1502,7 +1502,7 @@ batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn, - - memcpy(tt_change->addr, tt_common_entry->addr, - ETH_ALEN); -- tt_change->flags = BATADV_NO_FLAGS; -+ tt_change->flags = tt_common_entry->flags; - - tt_count++; - tt_change++; --- -1.8.0 - diff --git a/patches/0003-batman-adv_do_not_add_TEMP_clients_belonging_to_other_backbone_nodes.patch b/patches/0003-batman-adv_do_not_add_TEMP_clients_belonging_to_other_backbone_nodes.patch deleted file mode 100644 index e4f1f87..0000000 --- a/patches/0003-batman-adv_do_not_add_TEMP_clients_belonging_to_other_backbone_nodes.patch +++ /dev/null @@ -1,91 +0,0 @@ -From ordex@autistici.org Fri Nov 16 16:49:17 2012 -X-Apparently-To: lindner_marek@yahoo.de via 188.125.84.191; Fri, 16 Nov 2012 08:50:23 +0000 -Received-SPF: pass (domain of autistici.org designates 178.255.144.35 as permitted sender) -X-YMailISG: 2XUGKvsWLDvGA03t6tTkIRd1IgFM3maQM0m2SA6K1X6dTDIs - 22VSgKM.DhxAYBiW3Da9K.oH5o6C953_nJPPhur2qBPO.O3cDwjef5_Ugpc9 - EToptn4WCMI_3P8HITy2vYKCSg9Ycsqx9qqZUyxR_6Q1muNYxPYlaakcwXc. - 1ohYca223PQlYfbpn4rBdIT0Hf67oGZa12E_u.UgRAk80txi2mSPmlwJi1v7 - tUv907MDZ5psHzC7gI1A8TiWoRgSe3M68t8k8V.MEHOgITRKJ2fZshNFNdca - lrgJos7q8MPEccQhwYN.VInpv9loDuyCJLgx.seZFqgkKyQ81g0VeT_lZMp. - cXmi1p0etSsdGUkOn7MFKt1dzIoq46ebW1FRMW0RBIecunHshbqZS425M5sa - 6DJ.WZpYRxXqD2osYHboWzcz6Oi02o7r.XwFwyz55p2Hq992vZ06vJd3FQF1 - OmHf014Ni4fKu4au2M8b_fy2bqaSMYNdYIWSPrOzRpVOvQmU6eNJZz9TTaWw - p.giBbKH3qDhw6sn3HtEVZwsrOjNvLiccPeRmHXXp_3cVDy9iO0a2WhEsPyG - HnjeV08RB4j2JuICHcFo68rbC5x6MHkKXc.f4bDQ9KqzmX_av7jotSW2jPHa - eqXDV0tiP1TbuZNBo9ftz367Aver9BvjM3qZOGg2VVAy2FriP4hbbLzAkK7p - oReYyFnOjkbHpXOFkgcMiEZyTYNoD3rsWT68YOLl74dgYraLrIY4Sv0e8bHJ - 5u3v1aHhPNtjKNBxnd2xSSdgblb._mebG3fP1eKBGgil_efLA0cnvskj2w_z - BOCCHWCDYadM8RIkSB3XWkKtjkDZFwzXPEco7DuNhCKvTycFnZ_ilaJTmMSg - juyzcelGzKqOftqt5f1dRKUMSg2JFIv0pwZt4W.DGS4P_SqbWLEShjrxbwEc - b7ew9lr_iukbFzL4uN49A4uFx.J8c2WaZDv1gXvRZEiIHbdkKxlHdVyTuQ05 - aLLDc7Mz9Y68Z7msdzKK8V5LdRqdtCzFogk9seViWAVYXdndAn7XT22cOgci - IhdVk8RULmZ5uouAMr0usTIH_MKtCdInt1Tn.DlGuUEeDw2M5SeSC7cKPETl - lnSu5f8p6_ei9sx7YwdIQDyOG2o_49xM4Oeekeh9x3dGq23BvAEa8Q-- -X-Originating-IP: [178.255.144.35] -Authentication-Results: mta1054.mail.ukl.yahoo.com from=autistici.org; domainkeys=neutral (no sig); from=autistici.org; dkim=pass (ok) -Received: from 127.0.0.1 (EHLO contumacia.investici.org) (178.255.144.35) - by mta1054.mail.ukl.yahoo.com with SMTP; Fri, 16 Nov 2012 08:50:23 +0000 -Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id AD953E8786; - Fri, 16 Nov 2012 08:50:21 +0000 (UTC) -X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org AD953E8786 -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; - s=stigmate; t=1353055823; - bh=Rf2TK97MqcbN9ydt5/Ur6XKfsKU31Fnc1POW6n859o4=; - h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; - b=rOZmgwiyXClabfKLMxvEs9cRsEGiS0CPOTPna1OmakChF1i9/CFcKollV1xOp8g/h - UJMy7F82OyIBYptUTcTXfvQSUD7Lh92tbrWwkAmq3/1CeqKCrcuk5DNhaQYgoKfDpT - qg6uTDtM5bFM21xzsl/0itBJUeRv6y+FQT4mOQeI= -From: Antonio Quartulli -To: davem@davemloft.net -Cc: netdev@vger.kernel.org, - Simon Wunderlich , - Marek Lindner , - Sven Eckelmann , - Antonio Quartulli -Subject: [PATCH] batman-adv: don't add TEMP clients belonging to other backbone nodes -Date: Fri, 16 Nov 2012 09:49:17 +0100 -Message-Id: <1353055758-2901-4-git-send-email-ordex@autistici.org> -X-Mailer: git-send-email 1.8.0 -In-Reply-To: <1353055758-2901-1-git-send-email-ordex@autistici.org> -References: <1353055758-2901-1-git-send-email-ordex@autistici.org> -Status: R -X-Status: N -X-KMail-EncryptionState: -X-KMail-SignatureState: -X-KMail-MDN-Sent: - -The "early client detection" mechanism must not add clients belonging -to other backbone nodes. Such clients must be reached by directly -using the LAN instead of the mesh. - -This was introduced by 30cfd02b60e1cb16f5effb0a01f826c5bb7e4c59 -("batman-adv: detect not yet announced clients") - -Reported-by: Glen Page -Signed-off-by: Antonio Quartulli -Signed-off-by: Marek Lindner ---- - net/batman-adv/translation-table.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/translation-table.c b/translation-table.c -index fec1a00..baae715 100644 ---- a/translation-table.c -+++ b/translation-table.c -@@ -2456,6 +2456,13 @@ bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, - { - bool ret = false; - -+ /* if the originator is a backbone node (meaning it belongs to the same -+ * LAN of this node) the temporary client must not be added because to -+ * reach such destination the node must use the LAN instead of the mesh -+ */ -+ if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig)) -+ goto out; -+ - if (!batadv_tt_global_add(bat_priv, orig_node, addr, - BATADV_TT_CLIENT_TEMP, - atomic_read(&orig_node->last_ttvn))) --- -1.8.0 - diff --git a/patches/0004-batman-adv_process_broadcast_packets_in_BLA_earlier.patch b/patches/0004-batman-adv_process_broadcast_packets_in_BLA_earlier.patch deleted file mode 100644 index e444bc4..0000000 --- a/patches/0004-batman-adv_process_broadcast_packets_in_BLA_earlier.patch +++ /dev/null @@ -1,110 +0,0 @@ -From ordex@autistici.org Fri Nov 16 16:49:18 2012 -X-Apparently-To: lindner_marek@yahoo.de via 188.125.84.189; Fri, 16 Nov 2012 08:50:26 +0000 -Received-SPF: pass (domain of autistici.org designates 178.255.144.35 as permitted sender) -X-YMailISG: qdh1iTQWLDs62bkFFSythfvhHaZxhfpJ5PSKnjpe7hExOA6w - 0Hc3JpktYyerT5XQmK0XpfEp9b0El16poZFQ_PqNppiGeXVbVwgYE8uvjLm1 - kNwrYEvCc0nHo78mCSQkk_ilI7QHsL0vneWF0aISE9yqNNXjqyQkimfmRRfQ - U7DiQvok4JxuXMCS9G86op0LQLt0H9_iTX8cZbvEXjERIlpIKSVn7PScRlSw - 1DwoTaTewPT5dANPP9vv5ABNNcAzPsn1krQ1_.bPyorrDCQBWScspYXaxyD5 - WogJDPx5.tpKbyvcx.ke7zNRpChO4Uu5HThhh0y8wZYSWWuo5qqXA82ZHzqT - 9ARlQ7Ipvkb18vDmUaLRuCHvsGQh5rSS_ctctbZpvvReA7kOV1y_V_itOE9X - TRJxcQZqqavJUZ0xP9ZAxWc_KiB8BFKwBc_acUbjDr7cRtYLkP89nPFESPH_ - zTku3JwOSGw0.s3vGyEqMxTxAuwLfbf.OHLsRH5eaa0FEg2QMvMDJ4rpFTAm - 8AW08y0Yas.Do1MFuaqX__dn0dOyzvh_jABfSg2mcBqO5XCgo4JG4HNdDUWN - lc8Z82D1zIRm5XZczZa97xi81_bNB8Gut7deqJLasqjpJ4q4S7NpMUaDDC.. - 5beC2z.krETtVHhB1JIQl8gOKLgvJBqEcxvxedbqGpV7lbLXSDgqZG.KobYC - j4jsdXWEJV6hBl.mJggEWlcMSAsVI.ZVPqrtOIcdGhBis3KDAwp2ULlj3Iu4 - hEwgED_.r_adAqcC1GSqAEIMNF4tvvjsN5GvEcwX2hWnEOYFZ6Kp93SilV1l - D3rXsN_d8M5jVAvbFw7qOYFZ5rCr0LXcNFuclqDJznNsY8xMkhvP0PP53lwU - bpZEVuO2UzqA.r_4SeBTHy7tcDvYXlQlW4Q16xYT6sZrE8dXVMrgSBlOKq5G - 1o6N6Xkg2I29H0w.vu2KU6b1WAJlMy2H4dcEv3Zooh5VtQmtYwtmbZDHrIQG - 8lJ381Z9jh7pIFCMsp2epxXWbAqkHd6_r6a3lxpHtnHLWI55RWFI5qNxvxQd - bTIgorpXL.WAmwiLv6MNomPSuHdRy_rHIX9R8DljaWlLKdI_uoa_lbrdjblJ - iokyPUKRSx_VKHi.eIfz9JaFOTdJQACoxmSoL391XOewRlctIBRDTvB6yOss - 7Nt9dmv0ePFvTJN9euRL -X-Originating-IP: [178.255.144.35] -Authentication-Results: mta1067.mail.ird.yahoo.com from=autistici.org; domainkeys=neutral (no sig); from=autistici.org; dkim=pass (ok) -Received: from 127.0.0.1 (EHLO contumacia.investici.org) (178.255.144.35) - by mta1067.mail.ird.yahoo.com with SMTP; Fri, 16 Nov 2012 08:50:26 +0000 -Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id D78F1E878B; - Fri, 16 Nov 2012 08:50:23 +0000 (UTC) -X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org D78F1E878B -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; - s=stigmate; t=1353055825; - bh=mBzsqJo806YwPoG1l/528KrliiW3q+mkiMzUs+PZfkI=; - h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; - b=RO+bvxnncVKR0YL3Kl8GMbrFsqGikhqR3MzXRrdYewxnNXaSfY55bVw8C9Av108Id - 0FIk7xS/FYydezTX95Ln+kRCU96uKVktfvi9+3M3k5Ht/pAaAnRr5DkQ8AbE8+NFyT - VmQUdEYEqU8x7/DlrMOsrjxyqmA5a5By+75mm5jk= -From: Antonio Quartulli -To: davem@davemloft.net -Cc: netdev@vger.kernel.org, - Simon Wunderlich , - Marek Lindner , - Sven Eckelmann , - Antonio Quartulli , - Simon Wunderlich -Subject: [PATCH] batman-adv: process broadcast packets in BLA earlier -Date: Fri, 16 Nov 2012 09:49:18 +0100 -Message-Id: <1353055758-2901-5-git-send-email-ordex@autistici.org> -X-Mailer: git-send-email 1.8.0 -In-Reply-To: <1353055758-2901-1-git-send-email-ordex@autistici.org> -References: <1353055758-2901-1-git-send-email-ordex@autistici.org> -Status: R -X-Status: N -X-KMail-EncryptionState: -X-KMail-SignatureState: -X-KMail-MDN-Sent: - -The logic in the BLA mechanism may decide to drop broadcast packets -because the node may still be in the setup phase. For this reason, -further broadcast processing like the early client detection mechanism -must be done only after the BLA check. - -This patches moves the invocation to BLA before any other broadcast -processing. - -This was introduced 30cfd02b60e1cb16f5effb0a01f826c5bb7e4c59 -("batman-adv: detect not yet announced clients") - -Reported-by: Glen Page -Signed-off-by: Simon Wunderlich -Signed-off-by: Antonio Quartulli -Signed-off-by: Marek Lindner ---- - net/batman-adv/soft-interface.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/soft-interface.c b/soft-interface.c -index b9a28d2..ce0684a 100644 ---- a/soft-interface.c -+++ b/soft-interface.c -@@ -325,6 +325,12 @@ void batadv_interface_rx(struct net_device *soft_iface, - - soft_iface->last_rx = jiffies; - -+ /* Let the bridge loop avoidance check the packet. If will -+ * not handle it, we can safely push it up. -+ */ -+ if (batadv_bla_rx(bat_priv, skb, vid, is_bcast)) -+ goto out; -+ - if (orig_node) - batadv_tt_add_temporary_global_entry(bat_priv, orig_node, - ethhdr->h_source); -@@ -332,12 +338,6 @@ void batadv_interface_rx(struct net_device *soft_iface, - if (batadv_is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest)) - goto dropped; - -- /* Let the bridge loop avoidance check the packet. If will -- * not handle it, we can safely push it up. -- */ -- if (batadv_bla_rx(bat_priv, skb, vid, is_bcast)) -- goto out; -- - netif_rx(skb); - goto out; - --- -1.8.0 - From 55e4a16241fff0e02711f3c5d02eb72383369d7f Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Sun, 27 Jan 2013 00:41:37 +0000 Subject: [PATCH 35/41] batman-adv: distributed arp table fixes Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@35324 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- ...kb-leak-in-batadv_dat_snoop_incoming.patch | 33 ++++++++++++ ...-for-more-types-of-invalid-IP-addres.patch | 36 +++++++++++++ ...r-ARP-packets-with-invalid-MAC-addre.patch | 51 +++++++++++++++++++ 4 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 patches/0001-batman-adv-fix-skb-leak-in-batadv_dat_snoop_incoming.patch create mode 100644 patches/0002-batman-adv-check-for-more-types-of-invalid-IP-addres.patch create mode 100644 patches/0003-batman-adv-filter-ARP-packets-with-invalid-MAC-addre.patch diff --git a/Makefile b/Makefile index 0c57716..6aa2c13 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PKG_NAME:=batman-adv PKG_VERSION:=2013.0.0 BATCTL_VERSION:=2013.0.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MD5SUM:=37f4aa02f393daad3d87cead2bc28ed9 BATCTL_MD5SUM:=6ea4bcd8a9332d586bb06b5063f882cd diff --git a/patches/0001-batman-adv-fix-skb-leak-in-batadv_dat_snoop_incoming.patch b/patches/0001-batman-adv-fix-skb-leak-in-batadv_dat_snoop_incoming.patch new file mode 100644 index 0000000..a6829f4 --- /dev/null +++ b/patches/0001-batman-adv-fix-skb-leak-in-batadv_dat_snoop_incoming.patch @@ -0,0 +1,33 @@ +From 977d8c6f9253ad71e4bd8e4be2705c3bee684feb Mon Sep 17 00:00:00 2001 +From: Matthias Schiffer +Date: Wed, 23 Jan 2013 18:11:53 +0100 +Subject: [PATCH 1/3] batman-adv: fix skb leak in + batadv_dat_snoop_incoming_arp_reply() + +The callers of batadv_dat_snoop_incoming_arp_reply() assume the skb has been +freed when it returns true; fix this by calling kfree_skb before returning as +it is done in batadv_dat_snoop_incoming_arp_request(). + +Signed-off-by: Matthias Schiffer +Signed-off-by: Marek Lindner +Acked-by: Antonio Quartulli +--- + distributed-arp-table.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/distributed-arp-table.c b/distributed-arp-table.c +index 7485a78..9f4cff3 100644 +--- a/distributed-arp-table.c ++++ b/distributed-arp-table.c +@@ -1012,6 +1012,8 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, + */ + ret = !batadv_is_my_client(bat_priv, hw_dst); + out: ++ if (ret) ++ kfree_skb(skb); + /* if ret == false -> packet has to be delivered to the interface */ + return ret; + } +-- +1.7.10.4 + diff --git a/patches/0002-batman-adv-check-for-more-types-of-invalid-IP-addres.patch b/patches/0002-batman-adv-check-for-more-types-of-invalid-IP-addres.patch new file mode 100644 index 0000000..ce84bac --- /dev/null +++ b/patches/0002-batman-adv-check-for-more-types-of-invalid-IP-addres.patch @@ -0,0 +1,36 @@ +From 3b24193d7cfc18f0cc005811ca4aab3479c2f1c6 Mon Sep 17 00:00:00 2001 +From: Matthias Schiffer +Date: Thu, 24 Jan 2013 18:18:26 +0100 +Subject: [PATCH 2/3] batman-adv: check for more types of invalid IP addresses + in DAT + +There are more types of IP addresses that may appear in ARP packets that we +don't want to process. While some of these should never appear in sane ARP +packets, a 0.0.0.0 source is used for duplicate address detection and thus seen +quite often. + +Signed-off-by: Matthias Schiffer +Acked-by: Antonio Quartulli +Signed-off-by: Marek Lindner +--- + distributed-arp-table.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/distributed-arp-table.c b/distributed-arp-table.c +index 9f4cff3..be3be28 100644 +--- a/distributed-arp-table.c ++++ b/distributed-arp-table.c +@@ -777,7 +777,9 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, + ip_src = batadv_arp_ip_src(skb, hdr_size); + ip_dst = batadv_arp_ip_dst(skb, hdr_size); + if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) || +- ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst)) ++ ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst) || ++ ipv4_is_zeronet(ip_src) || ipv4_is_lbcast(ip_src) || ++ ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst)) + goto out; + + type = ntohs(arphdr->ar_op); +-- +1.7.10.4 + diff --git a/patches/0003-batman-adv-filter-ARP-packets-with-invalid-MAC-addre.patch b/patches/0003-batman-adv-filter-ARP-packets-with-invalid-MAC-addre.patch new file mode 100644 index 0000000..bba3804 --- /dev/null +++ b/patches/0003-batman-adv-filter-ARP-packets-with-invalid-MAC-addre.patch @@ -0,0 +1,51 @@ +From ab361a9ccc584e7501c06bfe1c00cb0411feebaf Mon Sep 17 00:00:00 2001 +From: Matthias Schiffer +Date: Thu, 24 Jan 2013 18:18:27 +0100 +Subject: [PATCH 3/3] batman-adv: filter ARP packets with invalid MAC + addresses in DAT + +We never want multicast MAC addresses in the Distributed ARP Table, so it's +best to completely ignore ARP packets containing them where we expect unicast +addresses. + +Signed-off-by: Matthias Schiffer +Acked-by: Antonio Quartulli +Signed-off-by: Marek Lindner +--- + distributed-arp-table.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/distributed-arp-table.c b/distributed-arp-table.c +index be3be28..ea0bd31 100644 +--- a/distributed-arp-table.c ++++ b/distributed-arp-table.c +@@ -738,6 +738,7 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, + struct arphdr *arphdr; + struct ethhdr *ethhdr; + __be32 ip_src, ip_dst; ++ uint8_t *hw_src, *hw_dst; + uint16_t type = 0; + + /* pull the ethernet header */ +@@ -782,6 +783,18 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, + ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst)) + goto out; + ++ hw_src = batadv_arp_hw_src(skb, hdr_size); ++ if (is_zero_ether_addr(hw_src) || is_multicast_ether_addr(hw_src)) ++ goto out; ++ ++ /* we don't care about the destination MAC address in ARP requests */ ++ if (arphdr->ar_op != htons(ARPOP_REQUEST)) { ++ hw_dst = batadv_arp_hw_dst(skb, hdr_size); ++ if (is_zero_ether_addr(hw_dst) || ++ is_multicast_ether_addr(hw_dst)) ++ goto out; ++ } ++ + type = ntohs(arphdr->ar_op); + out: + return type; +-- +1.7.10.4 + From 349a6b4ea0d7ec5a9bb54aac97f1d6064eb4d9c6 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Sat, 16 Feb 2013 11:00:50 +0000 Subject: [PATCH 36/41] batman-adv: fix dat NULL pointer dereference Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@35609 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- ...kb-leak-in-batadv_dat_snoop_incoming.patch | 2 +- ...-for-more-types-of-invalid-IP-addres.patch | 2 +- ...r-ARP-packets-with-invalid-MAC-addre.patch | 2 +- ...ULL-pointer-dereference-in-DAT-hash-.patch | 38 +++++++++++++++++++ 5 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 patches/0004-batman-adv-Fix-NULL-pointer-dereference-in-DAT-hash-.patch diff --git a/Makefile b/Makefile index 6aa2c13..ef9bd48 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PKG_NAME:=batman-adv PKG_VERSION:=2013.0.0 BATCTL_VERSION:=2013.0.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MD5SUM:=37f4aa02f393daad3d87cead2bc28ed9 BATCTL_MD5SUM:=6ea4bcd8a9332d586bb06b5063f882cd diff --git a/patches/0001-batman-adv-fix-skb-leak-in-batadv_dat_snoop_incoming.patch b/patches/0001-batman-adv-fix-skb-leak-in-batadv_dat_snoop_incoming.patch index a6829f4..715324c 100644 --- a/patches/0001-batman-adv-fix-skb-leak-in-batadv_dat_snoop_incoming.patch +++ b/patches/0001-batman-adv-fix-skb-leak-in-batadv_dat_snoop_incoming.patch @@ -1,7 +1,7 @@ From 977d8c6f9253ad71e4bd8e4be2705c3bee684feb Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 23 Jan 2013 18:11:53 +0100 -Subject: [PATCH 1/3] batman-adv: fix skb leak in +Subject: [PATCH 1/4] batman-adv: fix skb leak in batadv_dat_snoop_incoming_arp_reply() The callers of batadv_dat_snoop_incoming_arp_reply() assume the skb has been diff --git a/patches/0002-batman-adv-check-for-more-types-of-invalid-IP-addres.patch b/patches/0002-batman-adv-check-for-more-types-of-invalid-IP-addres.patch index ce84bac..b358900 100644 --- a/patches/0002-batman-adv-check-for-more-types-of-invalid-IP-addres.patch +++ b/patches/0002-batman-adv-check-for-more-types-of-invalid-IP-addres.patch @@ -1,7 +1,7 @@ From 3b24193d7cfc18f0cc005811ca4aab3479c2f1c6 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 24 Jan 2013 18:18:26 +0100 -Subject: [PATCH 2/3] batman-adv: check for more types of invalid IP addresses +Subject: [PATCH 2/4] batman-adv: check for more types of invalid IP addresses in DAT There are more types of IP addresses that may appear in ARP packets that we diff --git a/patches/0003-batman-adv-filter-ARP-packets-with-invalid-MAC-addre.patch b/patches/0003-batman-adv-filter-ARP-packets-with-invalid-MAC-addre.patch index bba3804..1e8cb16 100644 --- a/patches/0003-batman-adv-filter-ARP-packets-with-invalid-MAC-addre.patch +++ b/patches/0003-batman-adv-filter-ARP-packets-with-invalid-MAC-addre.patch @@ -1,7 +1,7 @@ From ab361a9ccc584e7501c06bfe1c00cb0411feebaf Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 24 Jan 2013 18:18:27 +0100 -Subject: [PATCH 3/3] batman-adv: filter ARP packets with invalid MAC +Subject: [PATCH 3/4] batman-adv: filter ARP packets with invalid MAC addresses in DAT We never want multicast MAC addresses in the Distributed ARP Table, so it's diff --git a/patches/0004-batman-adv-Fix-NULL-pointer-dereference-in-DAT-hash-.patch b/patches/0004-batman-adv-Fix-NULL-pointer-dereference-in-DAT-hash-.patch new file mode 100644 index 0000000..71248f6 --- /dev/null +++ b/patches/0004-batman-adv-Fix-NULL-pointer-dereference-in-DAT-hash-.patch @@ -0,0 +1,38 @@ +From 9f1fb6914d66e282c2b1f51aa2d4a231c84df84d Mon Sep 17 00:00:00 2001 +From: Pau Koning +Date: Fri, 15 Feb 2013 00:18:56 +0100 +Subject: [PATCH 4/4] batman-adv: Fix NULL pointer dereference in DAT hash + collision avoidance + +An entry in DAT with the hashed position of 0 can cause a NULL pointer +dereference when the first entry is checked by batadv_choose_next_candidate. +This first candidate automatically has the max value of 0 and the max_orig_node +of NULL. Not checking max_orig_node for NULL in batadv_is_orig_node_eligible +will lead to a NULL pointer dereference when checking for the lowest address. + +This problem was added in 785ea1144182c341b8b85b0f8180291839d176a8 +("batman-adv: Distributed ARP Table - create DHT helper functions"). + +Signed-off-by: Pau Koning +Signed-off-by: David S. Miller +Signed-off-by: Marek Lindner +--- + distributed-arp-table.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/distributed-arp-table.c b/distributed-arp-table.c +index ea0bd31..761a590 100644 +--- a/distributed-arp-table.c ++++ b/distributed-arp-table.c +@@ -440,7 +440,7 @@ static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res, + /* this is an hash collision with the temporary selected node. Choose + * the one with the lowest address + */ +- if ((tmp_max == max) && ++ if ((tmp_max == max) && max_orig_node && + (batadv_compare_eth(candidate->orig, max_orig_node->orig) > 0)) + goto out; + +-- +1.7.10.4 + From 9e7914a367ce275e888ef885eb21bb88bcda5bfa Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Mon, 4 Mar 2013 02:12:11 +0000 Subject: [PATCH 37/41] batman-adv: upgrade package to latest release 2013.1.0 & batman-adv script removal With the netifd integration the batman-adv script broke. This script can safely be removed because '/etc/init.d/network' reloads the batman-adv interfaces as well (thanks to netifd). Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@35867 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 11 ++-- files/usr/sbin/batman-adv | 60 ------------------- ...kb-leak-in-batadv_dat_snoop_incoming.patch | 33 ---------- ...-for-more-types-of-invalid-IP-addres.patch | 36 ----------- ...r-ARP-packets-with-invalid-MAC-addre.patch | 51 ---------------- ...ULL-pointer-dereference-in-DAT-hash-.patch | 38 ------------ 6 files changed, 5 insertions(+), 224 deletions(-) delete mode 100644 files/usr/sbin/batman-adv delete mode 100644 patches/0001-batman-adv-fix-skb-leak-in-batadv_dat_snoop_incoming.patch delete mode 100644 patches/0002-batman-adv-check-for-more-types-of-invalid-IP-addres.patch delete mode 100644 patches/0003-batman-adv-filter-ARP-packets-with-invalid-MAC-addre.patch delete mode 100644 patches/0004-batman-adv-Fix-NULL-pointer-dereference-in-DAT-hash-.patch diff --git a/Makefile b/Makefile index ef9bd48..5b797d5 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2013.0.0 -BATCTL_VERSION:=2013.0.0 -PKG_RELEASE:=3 -PKG_MD5SUM:=37f4aa02f393daad3d87cead2bc28ed9 -BATCTL_MD5SUM:=6ea4bcd8a9332d586bb06b5063f882cd +PKG_VERSION:=2013.1.0 +BATCTL_VERSION:=2013.1.0 +PKG_RELEASE:=1 +PKG_MD5SUM:=fe1fd32eddde1f91575d7a7ec21d5782 +BATCTL_MD5SUM:=767bf36c77c517e1d321169bf9a7fae5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) @@ -115,7 +115,6 @@ define KernelPackage/batman-adv/install $(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv $(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net $(INSTALL_BIN) ./files/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto - $(INSTALL_BIN) ./files/usr/sbin/batman-adv $(1)/usr/sbin $(BATCTL_INSTALL) endef diff --git a/files/usr/sbin/batman-adv b/files/usr/sbin/batman-adv deleted file mode 100644 index ca9e603..0000000 --- a/files/usr/sbin/batman-adv +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# Copyright (C) 2011 OpenWrt.org - -. /lib/functions.sh -. /lib/batman-adv/config.sh - -start_mesh() { - local mesh="$1" - local ifaces=$(awk -F':' '{if (NR > 2) print $1}' /proc/net/dev) - - for iface in $ifaces; do - [ -d /sys/class/net/$iface/batman_adv/ ] && bat_add_interface "$mesh" "$iface" - done - - bat_config "$mesh" -} - -stop_mesh() { - local mesh="$1" - local ifaces=$(awk -F':' '{if (NR > 2) print $1}' /proc/net/dev) - - for iface in $ifaces; do - [ -d /sys/class/net/$iface/batman_adv/ ] && bat_del_interface "$mesh" "$iface" - done -} - -# can also be used with "batman-adv start bat0" -start() { - bat_load_module - config_load batman-adv - - if [ -n "$1" ]; then - start_mesh $1 - else - config_foreach start_mesh mesh - fi -} - -# can also be used with "batman-adv stop bat0" -stop () { - config_load batman-adv - - if [ -n "$1" ]; then - stop_mesh $1 - else - config_foreach stop_mesh mesh - fi -} - -restart() { - stop $1 - start $1 -} - -case "$1" in - start) start $2 ;; - stop) stop $2 ;; - restart) restart $2 ;; - *) echo "Usage: batman-adv [mesh instance]" -esac diff --git a/patches/0001-batman-adv-fix-skb-leak-in-batadv_dat_snoop_incoming.patch b/patches/0001-batman-adv-fix-skb-leak-in-batadv_dat_snoop_incoming.patch deleted file mode 100644 index 715324c..0000000 --- a/patches/0001-batman-adv-fix-skb-leak-in-batadv_dat_snoop_incoming.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 977d8c6f9253ad71e4bd8e4be2705c3bee684feb Mon Sep 17 00:00:00 2001 -From: Matthias Schiffer -Date: Wed, 23 Jan 2013 18:11:53 +0100 -Subject: [PATCH 1/4] batman-adv: fix skb leak in - batadv_dat_snoop_incoming_arp_reply() - -The callers of batadv_dat_snoop_incoming_arp_reply() assume the skb has been -freed when it returns true; fix this by calling kfree_skb before returning as -it is done in batadv_dat_snoop_incoming_arp_request(). - -Signed-off-by: Matthias Schiffer -Signed-off-by: Marek Lindner -Acked-by: Antonio Quartulli ---- - distributed-arp-table.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/distributed-arp-table.c b/distributed-arp-table.c -index 7485a78..9f4cff3 100644 ---- a/distributed-arp-table.c -+++ b/distributed-arp-table.c -@@ -1012,6 +1012,8 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, - */ - ret = !batadv_is_my_client(bat_priv, hw_dst); - out: -+ if (ret) -+ kfree_skb(skb); - /* if ret == false -> packet has to be delivered to the interface */ - return ret; - } --- -1.7.10.4 - diff --git a/patches/0002-batman-adv-check-for-more-types-of-invalid-IP-addres.patch b/patches/0002-batman-adv-check-for-more-types-of-invalid-IP-addres.patch deleted file mode 100644 index b358900..0000000 --- a/patches/0002-batman-adv-check-for-more-types-of-invalid-IP-addres.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 3b24193d7cfc18f0cc005811ca4aab3479c2f1c6 Mon Sep 17 00:00:00 2001 -From: Matthias Schiffer -Date: Thu, 24 Jan 2013 18:18:26 +0100 -Subject: [PATCH 2/4] batman-adv: check for more types of invalid IP addresses - in DAT - -There are more types of IP addresses that may appear in ARP packets that we -don't want to process. While some of these should never appear in sane ARP -packets, a 0.0.0.0 source is used for duplicate address detection and thus seen -quite often. - -Signed-off-by: Matthias Schiffer -Acked-by: Antonio Quartulli -Signed-off-by: Marek Lindner ---- - distributed-arp-table.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/distributed-arp-table.c b/distributed-arp-table.c -index 9f4cff3..be3be28 100644 ---- a/distributed-arp-table.c -+++ b/distributed-arp-table.c -@@ -777,7 +777,9 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, - ip_src = batadv_arp_ip_src(skb, hdr_size); - ip_dst = batadv_arp_ip_dst(skb, hdr_size); - if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) || -- ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst)) -+ ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst) || -+ ipv4_is_zeronet(ip_src) || ipv4_is_lbcast(ip_src) || -+ ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst)) - goto out; - - type = ntohs(arphdr->ar_op); --- -1.7.10.4 - diff --git a/patches/0003-batman-adv-filter-ARP-packets-with-invalid-MAC-addre.patch b/patches/0003-batman-adv-filter-ARP-packets-with-invalid-MAC-addre.patch deleted file mode 100644 index 1e8cb16..0000000 --- a/patches/0003-batman-adv-filter-ARP-packets-with-invalid-MAC-addre.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ab361a9ccc584e7501c06bfe1c00cb0411feebaf Mon Sep 17 00:00:00 2001 -From: Matthias Schiffer -Date: Thu, 24 Jan 2013 18:18:27 +0100 -Subject: [PATCH 3/4] batman-adv: filter ARP packets with invalid MAC - addresses in DAT - -We never want multicast MAC addresses in the Distributed ARP Table, so it's -best to completely ignore ARP packets containing them where we expect unicast -addresses. - -Signed-off-by: Matthias Schiffer -Acked-by: Antonio Quartulli -Signed-off-by: Marek Lindner ---- - distributed-arp-table.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/distributed-arp-table.c b/distributed-arp-table.c -index be3be28..ea0bd31 100644 ---- a/distributed-arp-table.c -+++ b/distributed-arp-table.c -@@ -738,6 +738,7 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, - struct arphdr *arphdr; - struct ethhdr *ethhdr; - __be32 ip_src, ip_dst; -+ uint8_t *hw_src, *hw_dst; - uint16_t type = 0; - - /* pull the ethernet header */ -@@ -782,6 +783,18 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, - ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst)) - goto out; - -+ hw_src = batadv_arp_hw_src(skb, hdr_size); -+ if (is_zero_ether_addr(hw_src) || is_multicast_ether_addr(hw_src)) -+ goto out; -+ -+ /* we don't care about the destination MAC address in ARP requests */ -+ if (arphdr->ar_op != htons(ARPOP_REQUEST)) { -+ hw_dst = batadv_arp_hw_dst(skb, hdr_size); -+ if (is_zero_ether_addr(hw_dst) || -+ is_multicast_ether_addr(hw_dst)) -+ goto out; -+ } -+ - type = ntohs(arphdr->ar_op); - out: - return type; --- -1.7.10.4 - diff --git a/patches/0004-batman-adv-Fix-NULL-pointer-dereference-in-DAT-hash-.patch b/patches/0004-batman-adv-Fix-NULL-pointer-dereference-in-DAT-hash-.patch deleted file mode 100644 index 71248f6..0000000 --- a/patches/0004-batman-adv-Fix-NULL-pointer-dereference-in-DAT-hash-.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 9f1fb6914d66e282c2b1f51aa2d4a231c84df84d Mon Sep 17 00:00:00 2001 -From: Pau Koning -Date: Fri, 15 Feb 2013 00:18:56 +0100 -Subject: [PATCH 4/4] batman-adv: Fix NULL pointer dereference in DAT hash - collision avoidance - -An entry in DAT with the hashed position of 0 can cause a NULL pointer -dereference when the first entry is checked by batadv_choose_next_candidate. -This first candidate automatically has the max value of 0 and the max_orig_node -of NULL. Not checking max_orig_node for NULL in batadv_is_orig_node_eligible -will lead to a NULL pointer dereference when checking for the lowest address. - -This problem was added in 785ea1144182c341b8b85b0f8180291839d176a8 -("batman-adv: Distributed ARP Table - create DHT helper functions"). - -Signed-off-by: Pau Koning -Signed-off-by: David S. Miller -Signed-off-by: Marek Lindner ---- - distributed-arp-table.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/distributed-arp-table.c b/distributed-arp-table.c -index ea0bd31..761a590 100644 ---- a/distributed-arp-table.c -+++ b/distributed-arp-table.c -@@ -440,7 +440,7 @@ static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res, - /* this is an hash collision with the temporary selected node. Choose - * the one with the lowest address - */ -- if ((tmp_max == max) && -+ if ((tmp_max == max) && max_orig_node && - (batadv_compare_eth(candidate->orig, max_orig_node->orig) > 0)) - goto out; - --- -1.7.10.4 - From feae499d314ac5fe77d54c00e69943ab261ce544 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Sat, 9 Mar 2013 10:13:46 +0000 Subject: [PATCH 38/41] batman-adv: verify tt len does not exceed packet len Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@35906 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- ...fy-tt-len-does-not-exceed-packet-len.patch | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 patches/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch diff --git a/Makefile b/Makefile index 5b797d5..efe7ed6 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PKG_NAME:=batman-adv PKG_VERSION:=2013.1.0 BATCTL_VERSION:=2013.1.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MD5SUM:=fe1fd32eddde1f91575d7a7ec21d5782 BATCTL_MD5SUM:=767bf36c77c517e1d321169bf9a7fae5 diff --git a/patches/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch b/patches/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch new file mode 100644 index 0000000..37c6532 --- /dev/null +++ b/patches/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch @@ -0,0 +1,42 @@ +From e56c79f4e863436d0fc6c48fed0db09b7a49e565 Mon Sep 17 00:00:00 2001 +From: Marek Lindner +Date: Mon, 4 Mar 2013 10:39:49 +0800 +Subject: [PATCH] batman-adv: verify tt len does not exceed packet len + +batadv_iv_ogm_process() accesses the packet using the tt_num_changes +attribute regardless of the real packet len (assuming the length check +was done before). Therefore a length check is needed to avoid reading +random memory. + +Signed-off-by: Marek Lindner +--- + bat_iv_ogm.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c +index 72fe1bb..d5be889 100644 +--- a/bat_iv_ogm.c ++++ b/bat_iv_ogm.c +@@ -1292,7 +1292,8 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb, + batadv_ogm_packet = (struct batadv_ogm_packet *)packet_buff; + + /* unpack the aggregated packets and process them one by one */ +- do { ++ while (batadv_iv_ogm_aggr_packet(buff_pos, packet_len, ++ batadv_ogm_packet->tt_num_changes)) { + tt_buff = packet_buff + buff_pos + BATADV_OGM_HLEN; + + batadv_iv_ogm_process(ethhdr, batadv_ogm_packet, tt_buff, +@@ -1303,8 +1304,7 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb, + + packet_pos = packet_buff + buff_pos; + batadv_ogm_packet = (struct batadv_ogm_packet *)packet_pos; +- } while (batadv_iv_ogm_aggr_packet(buff_pos, packet_len, +- batadv_ogm_packet->tt_num_changes)); ++ } + + kfree_skb(skb); + return NET_RX_SUCCESS; +-- +1.7.10.4 + From fea65971624e52ee798149535310f234a8210d55 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Tue, 16 Apr 2013 14:47:47 +0000 Subject: [PATCH 39/41] batman-adv: make is_my_mac() check for the current mesh only Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@36347 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 2 +- ...fy-tt-len-does-not-exceed-packet-len.patch | 2 +- ...op-the-node-parameter-from-iterators.patch | 1462 +++++++++++++++++ ...is_my_mac-check-for-the-current-mesh.patch | 250 +++ 4 files changed, 1714 insertions(+), 2 deletions(-) create mode 100644 patches/0002-batman-adv-hlist-drop-the-node-parameter-from-iterators.patch create mode 100644 patches/0003-batman-adv-make-is_my_mac-check-for-the-current-mesh.patch diff --git a/Makefile b/Makefile index efe7ed6..cbb7aac 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PKG_NAME:=batman-adv PKG_VERSION:=2013.1.0 BATCTL_VERSION:=2013.1.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MD5SUM:=fe1fd32eddde1f91575d7a7ec21d5782 BATCTL_MD5SUM:=767bf36c77c517e1d321169bf9a7fae5 diff --git a/patches/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch b/patches/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch index 37c6532..46b2c8d 100644 --- a/patches/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch +++ b/patches/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch @@ -1,7 +1,7 @@ From e56c79f4e863436d0fc6c48fed0db09b7a49e565 Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Mon, 4 Mar 2013 10:39:49 +0800 -Subject: [PATCH] batman-adv: verify tt len does not exceed packet len +Subject: [PATCH 1/3] batman-adv: verify tt len does not exceed packet len batadv_iv_ogm_process() accesses the packet using the tt_num_changes attribute regardless of the real packet len (assuming the length check diff --git a/patches/0002-batman-adv-hlist-drop-the-node-parameter-from-iterators.patch b/patches/0002-batman-adv-hlist-drop-the-node-parameter-from-iterators.patch new file mode 100644 index 0000000..71af36a --- /dev/null +++ b/patches/0002-batman-adv-hlist-drop-the-node-parameter-from-iterators.patch @@ -0,0 +1,1462 @@ +From c506b113c82319c43478ff31c933c4e98f0084d7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Feb 2013 17:06:00 -0800 +Subject: [PATCH 2/3] hlist: drop the node parameter from iterators + +I'm not sure why, but the hlist for each entry iterators were conceived + + list_for_each_entry(pos, head, member) + +The hlist ones were greedy and wanted an extra parameter: + + hlist_for_each_entry(tpos, pos, head, member) + +Why did they need an extra pos parameter? I'm not quite sure. Not only +they don't really need it, it also prevents the iterator from looking +exactly like the list iterator, which is unfortunate. + +Besides the semantic patch, there was some manual work required: + + - Fix up the actual hlist iterators in linux/list.h + - Fix up the declaration of other iterators based on the hlist ones. + - A very small amount of places were using the 'node' parameter, this + was modified to use 'obj->member' instead. + - Coccinelle didn't handle the hlist_for_each_entry_safe iterator + properly, so those had to be fixed up manually. + +The semantic patch which is mostly the work of Peter Senna Tschudin is here: + +@@ +iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host; + +type T; +expression a,c,d,e; +identifier b; +statement S; +@@ + +-T b; + <+... when != b +( +hlist_for_each_entry(a, +- b, +c, d) S +| +hlist_for_each_entry_continue(a, +- b, +c) S +| +hlist_for_each_entry_from(a, +- b, +c) S +| +hlist_for_each_entry_rcu(a, +- b, +c, d) S +| +hlist_for_each_entry_rcu_bh(a, +- b, +c, d) S +| +hlist_for_each_entry_continue_rcu_bh(a, +- b, +c) S +| +for_each_busy_worker(a, c, +- b, +d) S +| +ax25_uid_for_each(a, +- b, +c) S +| +ax25_for_each(a, +- b, +c) S +| +inet_bind_bucket_for_each(a, +- b, +c) S +| +sctp_for_each_hentry(a, +- b, +c) S +| +sk_for_each(a, +- b, +c) S +| +sk_for_each_rcu(a, +- b, +c) S +| +sk_for_each_from +-(a, b) ++(a) +S ++ sk_for_each_from(a) S +| +sk_for_each_safe(a, +- b, +c, d) S +| +sk_for_each_bound(a, +- b, +c) S +| +hlist_for_each_entry_safe(a, +- b, +c, d, e) S +| +hlist_for_each_entry_continue_rcu(a, +- b, +c) S +| +nr_neigh_for_each(a, +- b, +c) S +| +nr_neigh_for_each_safe(a, +- b, +c, d) S +| +nr_node_for_each(a, +- b, +c) S +| +nr_node_for_each_safe(a, +- b, +c, d) S +| +- for_each_gfn_sp(a, c, d, b) S ++ for_each_gfn_sp(a, c, d) S +| +- for_each_gfn_indirect_valid_sp(a, c, d, b) S ++ for_each_gfn_indirect_valid_sp(a, c, d) S +| +for_each_host(a, +- b, +c) S +| +for_each_host_safe(a, +- b, +c, d) S +| +for_each_mesh_entry(a, +- b, +c, d) S +) + ...+> + +[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c] +[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c] +[akpm@linux-foundation.org: checkpatch fixes] +[akpm@linux-foundation.org: fix warnings] +[akpm@linux-foudnation.org: redo intrusive kvm changes] +Tested-by: Peter Senna Tschudin +Acked-by: Paul E. McKenney +Signed-off-by: Sasha Levin +Cc: Wu Fengguang +Cc: Marcelo Tosatti +Cc: Gleb Natapov +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Marek Lindner +--- + bat_iv_ogm.c | 12 +++---- + bridge_loop_avoidance.c | 39 +++++++++------------- + compat.h | 23 +++++++++++++ + distributed-arp-table.c | 15 ++++----- + gateway_client.c | 13 +++----- + main.c | 6 ++-- + originator.c | 31 ++++++++---------- + originator.h | 3 +- + routing.c | 6 ++-- + send.c | 6 ++-- + translation-table.c | 82 ++++++++++++++++++++--------------------------- + vis.c | 38 +++++++++------------- + 12 files changed, 125 insertions(+), 149 deletions(-) + +diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c +index d5be889..a5bb0a7 100644 +--- a/bat_iv_ogm.c ++++ b/bat_iv_ogm.c +@@ -487,7 +487,6 @@ static void batadv_iv_ogm_queue_add(struct batadv_priv *bat_priv, + */ + struct batadv_forw_packet *forw_packet_aggr = NULL; + struct batadv_forw_packet *forw_packet_pos = NULL; +- struct hlist_node *tmp_node; + struct batadv_ogm_packet *batadv_ogm_packet; + bool direct_link; + unsigned long max_aggregation_jiffies; +@@ -500,7 +499,7 @@ static void batadv_iv_ogm_queue_add(struct batadv_priv *bat_priv, + spin_lock_bh(&bat_priv->forw_bat_list_lock); + /* own packets are not to be aggregated */ + if ((atomic_read(&bat_priv->aggregated_ogms)) && (!own_packet)) { +- hlist_for_each_entry(forw_packet_pos, tmp_node, ++ hlist_for_each_entry(forw_packet_pos, + &bat_priv->forw_bat_list, list) { + if (batadv_iv_ogm_can_aggregate(batadv_ogm_packet, + bat_priv, packet_len, +@@ -655,7 +654,6 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, + struct batadv_neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL; + struct batadv_neigh_node *router = NULL; + struct batadv_orig_node *orig_node_tmp; +- struct hlist_node *node; + int if_num; + uint8_t sum_orig, sum_neigh; + uint8_t *neigh_addr; +@@ -665,7 +663,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, + "update_originator(): Searching and updating originator entry of received packet\n"); + + rcu_read_lock(); +- hlist_for_each_entry_rcu(tmp_neigh_node, node, ++ hlist_for_each_entry_rcu(tmp_neigh_node, + &orig_node->neigh_list, list) { + neigh_addr = tmp_neigh_node->addr; + if (batadv_compare_eth(neigh_addr, ethhdr->h_source) && +@@ -801,7 +799,6 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, + { + struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface); + struct batadv_neigh_node *neigh_node = NULL, *tmp_neigh_node; +- struct hlist_node *node; + uint8_t total_count; + uint8_t orig_eq_count, neigh_rq_count, neigh_rq_inv, tq_own; + unsigned int neigh_rq_inv_cube, neigh_rq_max_cube; +@@ -810,7 +807,7 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, + + /* find corresponding one hop neighbor */ + rcu_read_lock(); +- hlist_for_each_entry_rcu(tmp_neigh_node, node, ++ hlist_for_each_entry_rcu(tmp_neigh_node, + &orig_neigh_node->neigh_list, list) { + if (!batadv_compare_eth(tmp_neigh_node->addr, + orig_neigh_node->orig)) +@@ -920,7 +917,6 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, + struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface); + struct batadv_orig_node *orig_node; + struct batadv_neigh_node *tmp_neigh_node; +- struct hlist_node *node; + int is_duplicate = 0; + int32_t seq_diff; + int need_update = 0; +@@ -943,7 +939,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, + goto out; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(tmp_neigh_node, node, ++ hlist_for_each_entry_rcu(tmp_neigh_node, + &orig_node->neigh_list, list) { + is_duplicate |= batadv_test_bit(tmp_neigh_node->real_bits, + orig_node->last_real_seqno, +diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c +index 30f4652..6a4f728 100644 +--- a/bridge_loop_avoidance.c ++++ b/bridge_loop_avoidance.c +@@ -144,7 +144,6 @@ static struct batadv_bla_claim + { + struct batadv_hashtable *hash = bat_priv->bla.claim_hash; + struct hlist_head *head; +- struct hlist_node *node; + struct batadv_bla_claim *claim; + struct batadv_bla_claim *claim_tmp = NULL; + int index; +@@ -156,7 +155,7 @@ static struct batadv_bla_claim + head = &hash->table[index]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(claim, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(claim, head, hash_entry) { + if (!batadv_compare_claim(&claim->hash_entry, data)) + continue; + +@@ -185,7 +184,6 @@ batadv_backbone_hash_find(struct batadv_priv *bat_priv, + { + struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; + struct hlist_head *head; +- struct hlist_node *node; + struct batadv_bla_backbone_gw search_entry, *backbone_gw; + struct batadv_bla_backbone_gw *backbone_gw_tmp = NULL; + int index; +@@ -200,7 +198,7 @@ batadv_backbone_hash_find(struct batadv_priv *bat_priv, + head = &hash->table[index]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { + if (!batadv_compare_backbone_gw(&backbone_gw->hash_entry, + &search_entry)) + continue; +@@ -221,7 +219,7 @@ static void + batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw) + { + struct batadv_hashtable *hash; +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + struct hlist_head *head; + struct batadv_bla_claim *claim; + int i; +@@ -236,13 +234,13 @@ batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw) + list_lock = &hash->list_locks[i]; + + spin_lock_bh(list_lock); +- hlist_for_each_entry_safe(claim, node, node_tmp, ++ hlist_for_each_entry_safe(claim, node_tmp, + head, hash_entry) { + if (claim->backbone_gw != backbone_gw) + continue; + + batadv_claim_free_ref(claim); +- hlist_del_rcu(node); ++ hlist_del_rcu(&claim->hash_entry); + } + spin_unlock_bh(list_lock); + } +@@ -460,7 +458,6 @@ static void batadv_bla_answer_request(struct batadv_priv *bat_priv, + struct batadv_hard_iface *primary_if, + short vid) + { +- struct hlist_node *node; + struct hlist_head *head; + struct batadv_hashtable *hash; + struct batadv_bla_claim *claim; +@@ -481,7 +478,7 @@ static void batadv_bla_answer_request(struct batadv_priv *bat_priv, + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(claim, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(claim, head, hash_entry) { + /* only own claims are interesting */ + if (claim->backbone_gw != backbone_gw) + continue; +@@ -958,7 +955,7 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, + static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now) + { + struct batadv_bla_backbone_gw *backbone_gw; +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + struct hlist_head *head; + struct batadv_hashtable *hash; + spinlock_t *list_lock; /* protects write access to the hash lists */ +@@ -973,7 +970,7 @@ static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now) + list_lock = &hash->list_locks[i]; + + spin_lock_bh(list_lock); +- hlist_for_each_entry_safe(backbone_gw, node, node_tmp, ++ hlist_for_each_entry_safe(backbone_gw, node_tmp, + head, hash_entry) { + if (now) + goto purge_now; +@@ -992,7 +989,7 @@ purge_now: + + batadv_bla_del_backbone_claims(backbone_gw); + +- hlist_del_rcu(node); ++ hlist_del_rcu(&backbone_gw->hash_entry); + batadv_backbone_gw_free_ref(backbone_gw); + } + spin_unlock_bh(list_lock); +@@ -1013,7 +1010,6 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv, + int now) + { + struct batadv_bla_claim *claim; +- struct hlist_node *node; + struct hlist_head *head; + struct batadv_hashtable *hash; + int i; +@@ -1026,7 +1022,7 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv, + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(claim, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(claim, head, hash_entry) { + if (now) + goto purge_now; + if (!batadv_compare_eth(claim->backbone_gw->orig, +@@ -1062,7 +1058,6 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, + struct batadv_hard_iface *oldif) + { + struct batadv_bla_backbone_gw *backbone_gw; +- struct hlist_node *node; + struct hlist_head *head; + struct batadv_hashtable *hash; + __be16 group; +@@ -1086,7 +1081,7 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { + /* own orig still holds the old value. */ + if (!batadv_compare_eth(backbone_gw->orig, + oldif->net_dev->dev_addr)) +@@ -1112,7 +1107,6 @@ static void batadv_bla_periodic_work(struct work_struct *work) + struct delayed_work *delayed_work; + struct batadv_priv *bat_priv; + struct batadv_priv_bla *priv_bla; +- struct hlist_node *node; + struct hlist_head *head; + struct batadv_bla_backbone_gw *backbone_gw; + struct batadv_hashtable *hash; +@@ -1140,7 +1134,7 @@ static void batadv_bla_periodic_work(struct work_struct *work) + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { + if (!batadv_compare_eth(backbone_gw->orig, + primary_if->net_dev->dev_addr)) + continue; +@@ -1322,7 +1316,6 @@ int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig) + { + struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; + struct hlist_head *head; +- struct hlist_node *node; + struct batadv_bla_backbone_gw *backbone_gw; + int i; + +@@ -1336,7 +1329,7 @@ int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig) + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { + if (batadv_compare_eth(backbone_gw->orig, orig)) { + rcu_read_unlock(); + return 1; +@@ -1607,7 +1600,6 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) + struct batadv_hashtable *hash = bat_priv->bla.claim_hash; + struct batadv_bla_claim *claim; + struct batadv_hard_iface *primary_if; +- struct hlist_node *node; + struct hlist_head *head; + uint32_t i; + bool is_own; +@@ -1628,7 +1620,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(claim, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(claim, head, hash_entry) { + is_own = batadv_compare_eth(claim->backbone_gw->orig, + primary_addr); + seq_printf(seq, " * %pM on % 5d by %pM [%c] (%#.4x)\n", +@@ -1652,7 +1644,6 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) + struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; + struct batadv_bla_backbone_gw *backbone_gw; + struct batadv_hard_iface *primary_if; +- struct hlist_node *node; + struct hlist_head *head; + int secs, msecs; + uint32_t i; +@@ -1674,7 +1665,7 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) { + msecs = jiffies_to_msecs(jiffies - + backbone_gw->lasttime); + secs = msecs / 1000; +diff --git a/compat.h b/compat.h +index e21b310..22ab781 100644 +--- a/compat.h ++++ b/compat.h +@@ -211,6 +211,29 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) \ + }\ + static int __batadv_interface_set_mac_addr(x, y) + ++#define hlist_entry_safe(ptr, type, member) \ ++ (ptr) ? hlist_entry(ptr, type, member) : NULL ++ ++#undef hlist_for_each_entry ++#define hlist_for_each_entry(pos, head, member) \ ++ for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\ ++ pos; \ ++ pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) ++ ++#undef hlist_for_each_entry_rcu ++#define hlist_for_each_entry_rcu(pos, head, member) \ ++ for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\ ++ typeof(*(pos)), member); \ ++ pos; \ ++ pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\ ++ &(pos)->member)), typeof(*(pos)), member)) ++ ++#undef hlist_for_each_entry_safe ++#define hlist_for_each_entry_safe(pos, n, head, member) \ ++ for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\ ++ pos && ({ n = pos->member.next; 1; }); \ ++ pos = hlist_entry_safe(n, typeof(*pos), member)) ++ + #endif /* < KERNEL_VERSION(3, 9, 0) */ + + #endif /* _NET_BATMAN_ADV_COMPAT_H_ */ +diff --git a/distributed-arp-table.c b/distributed-arp-table.c +index 761a590..d54188a 100644 +--- a/distributed-arp-table.c ++++ b/distributed-arp-table.c +@@ -83,7 +83,7 @@ static void __batadv_dat_purge(struct batadv_priv *bat_priv, + { + spinlock_t *list_lock; /* protects write access to the hash lists */ + struct batadv_dat_entry *dat_entry; +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + struct hlist_head *head; + uint32_t i; + +@@ -95,7 +95,7 @@ static void __batadv_dat_purge(struct batadv_priv *bat_priv, + list_lock = &bat_priv->dat.hash->list_locks[i]; + + spin_lock_bh(list_lock); +- hlist_for_each_entry_safe(dat_entry, node, node_tmp, head, ++ hlist_for_each_entry_safe(dat_entry, node_tmp, head, + hash_entry) { + /* if an helper function has been passed as parameter, + * ask it if the entry has to be purged or not +@@ -103,7 +103,7 @@ static void __batadv_dat_purge(struct batadv_priv *bat_priv, + if (to_purge && !to_purge(dat_entry)) + continue; + +- hlist_del_rcu(node); ++ hlist_del_rcu(&dat_entry->hash_entry); + batadv_dat_entry_free_ref(dat_entry); + } + spin_unlock_bh(list_lock); +@@ -235,7 +235,6 @@ static struct batadv_dat_entry * + batadv_dat_entry_hash_find(struct batadv_priv *bat_priv, __be32 ip) + { + struct hlist_head *head; +- struct hlist_node *node; + struct batadv_dat_entry *dat_entry, *dat_entry_tmp = NULL; + struct batadv_hashtable *hash = bat_priv->dat.hash; + uint32_t index; +@@ -247,7 +246,7 @@ batadv_dat_entry_hash_find(struct batadv_priv *bat_priv, __be32 ip) + head = &hash->table[index]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(dat_entry, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(dat_entry, head, hash_entry) { + if (dat_entry->ip != ip) + continue; + +@@ -465,7 +464,6 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv, + batadv_dat_addr_t max = 0, tmp_max = 0; + struct batadv_orig_node *orig_node, *max_orig_node = NULL; + struct batadv_hashtable *hash = bat_priv->orig_hash; +- struct hlist_node *node; + struct hlist_head *head; + int i; + +@@ -481,7 +479,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv, + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(orig_node, head, hash_entry) { + /* the dht space is a ring and addresses are unsigned */ + tmp_max = BATADV_DAT_ADDR_MAX - orig_node->dat_addr + + ip_key; +@@ -686,7 +684,6 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset) + struct batadv_hashtable *hash = bat_priv->dat.hash; + struct batadv_dat_entry *dat_entry; + struct batadv_hard_iface *primary_if; +- struct hlist_node *node; + struct hlist_head *head; + unsigned long last_seen_jiffies; + int last_seen_msecs, last_seen_secs, last_seen_mins; +@@ -704,7 +701,7 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset) + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(dat_entry, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(dat_entry, head, hash_entry) { + last_seen_jiffies = jiffies - dat_entry->last_update; + last_seen_msecs = jiffies_to_msecs(last_seen_jiffies); + last_seen_mins = last_seen_msecs / 60000; +diff --git a/gateway_client.c b/gateway_client.c +index 074107f..34f99a4 100644 +--- a/gateway_client.c ++++ b/gateway_client.c +@@ -114,7 +114,6 @@ static struct batadv_gw_node * + batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv) + { + struct batadv_neigh_node *router; +- struct hlist_node *node; + struct batadv_gw_node *gw_node, *curr_gw = NULL; + uint32_t max_gw_factor = 0, tmp_gw_factor = 0; + uint32_t gw_divisor; +@@ -127,7 +126,7 @@ batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv) + gw_divisor *= 64; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw.list, list) { ++ hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) { + if (gw_node->deleted) + continue; + +@@ -344,7 +343,6 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv, + struct batadv_orig_node *orig_node, + uint8_t new_gwflags) + { +- struct hlist_node *node; + struct batadv_gw_node *gw_node, *curr_gw; + + /* Note: We don't need a NULL check here, since curr_gw never gets +@@ -355,7 +353,7 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv, + curr_gw = batadv_gw_get_selected_gw_node(bat_priv); + + rcu_read_lock(); +- hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw.list, list) { ++ hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) { + if (gw_node->orig_node != orig_node) + continue; + +@@ -403,7 +401,7 @@ void batadv_gw_node_delete(struct batadv_priv *bat_priv, + void batadv_gw_node_purge(struct batadv_priv *bat_priv) + { + struct batadv_gw_node *gw_node, *curr_gw; +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + unsigned long timeout = msecs_to_jiffies(2 * BATADV_PURGE_TIMEOUT); + int do_deselect = 0; + +@@ -411,7 +409,7 @@ void batadv_gw_node_purge(struct batadv_priv *bat_priv) + + spin_lock_bh(&bat_priv->gw.list_lock); + +- hlist_for_each_entry_safe(gw_node, node, node_tmp, ++ hlist_for_each_entry_safe(gw_node, node_tmp, + &bat_priv->gw.list, list) { + if (((!gw_node->deleted) || + (time_before(jiffies, gw_node->deleted + timeout))) && +@@ -476,7 +474,6 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) + struct batadv_priv *bat_priv = netdev_priv(net_dev); + struct batadv_hard_iface *primary_if; + struct batadv_gw_node *gw_node; +- struct hlist_node *node; + int gw_count = 0; + + primary_if = batadv_seq_print_text_primary_if_get(seq); +@@ -490,7 +487,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) + primary_if->net_dev->dev_addr, net_dev->name); + + rcu_read_lock(); +- hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw.list, list) { ++ hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) { + if (gw_node->deleted) + continue; + +diff --git a/main.c b/main.c +index 21fe698..0488d70 100644 +--- a/main.c ++++ b/main.c +@@ -345,9 +345,8 @@ void batadv_recv_handler_unregister(uint8_t packet_type) + static struct batadv_algo_ops *batadv_algo_get(char *name) + { + struct batadv_algo_ops *bat_algo_ops = NULL, *bat_algo_ops_tmp; +- struct hlist_node *node; + +- hlist_for_each_entry(bat_algo_ops_tmp, node, &batadv_algo_list, list) { ++ hlist_for_each_entry(bat_algo_ops_tmp, &batadv_algo_list, list) { + if (strcmp(bat_algo_ops_tmp->name, name) != 0) + continue; + +@@ -411,11 +410,10 @@ out: + int batadv_algo_seq_print_text(struct seq_file *seq, void *offset) + { + struct batadv_algo_ops *bat_algo_ops; +- struct hlist_node *node; + + seq_printf(seq, "Available routing algorithms:\n"); + +- hlist_for_each_entry(bat_algo_ops, node, &batadv_algo_list, list) { ++ hlist_for_each_entry(bat_algo_ops, &batadv_algo_list, list) { + seq_printf(seq, "%s\n", bat_algo_ops->name); + } + +diff --git a/originator.c b/originator.c +index 457ea44..96fb80b 100644 +--- a/originator.c ++++ b/originator.c +@@ -118,7 +118,7 @@ out: + + static void batadv_orig_node_free_rcu(struct rcu_head *rcu) + { +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + struct batadv_neigh_node *neigh_node, *tmp_neigh_node; + struct batadv_orig_node *orig_node; + +@@ -134,7 +134,7 @@ static void batadv_orig_node_free_rcu(struct rcu_head *rcu) + } + + /* for all neighbors towards this originator ... */ +- hlist_for_each_entry_safe(neigh_node, node, node_tmp, ++ hlist_for_each_entry_safe(neigh_node, node_tmp, + &orig_node->neigh_list, list) { + hlist_del_rcu(&neigh_node->list); + batadv_neigh_node_free_ref(neigh_node); +@@ -161,7 +161,7 @@ void batadv_orig_node_free_ref(struct batadv_orig_node *orig_node) + void batadv_originator_free(struct batadv_priv *bat_priv) + { + struct batadv_hashtable *hash = bat_priv->orig_hash; +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + struct hlist_head *head; + spinlock_t *list_lock; /* spinlock to protect write access */ + struct batadv_orig_node *orig_node; +@@ -179,9 +179,9 @@ void batadv_originator_free(struct batadv_priv *bat_priv) + list_lock = &hash->list_locks[i]; + + spin_lock_bh(list_lock); +- hlist_for_each_entry_safe(orig_node, node, node_tmp, ++ hlist_for_each_entry_safe(orig_node, node_tmp, + head, hash_entry) { +- hlist_del_rcu(node); ++ hlist_del_rcu(&orig_node->hash_entry); + batadv_orig_node_free_ref(orig_node); + } + spin_unlock_bh(list_lock); +@@ -274,7 +274,7 @@ batadv_purge_orig_neighbors(struct batadv_priv *bat_priv, + struct batadv_orig_node *orig_node, + struct batadv_neigh_node **best_neigh_node) + { +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + struct batadv_neigh_node *neigh_node; + bool neigh_purged = false; + unsigned long last_seen; +@@ -285,7 +285,7 @@ batadv_purge_orig_neighbors(struct batadv_priv *bat_priv, + spin_lock_bh(&orig_node->neigh_list_lock); + + /* for all neighbors towards this originator ... */ +- hlist_for_each_entry_safe(neigh_node, node, node_tmp, ++ hlist_for_each_entry_safe(neigh_node, node_tmp, + &orig_node->neigh_list, list) { + last_seen = neigh_node->last_seen; + if_incoming = neigh_node->if_incoming; +@@ -348,7 +348,7 @@ static bool batadv_purge_orig_node(struct batadv_priv *bat_priv, + static void _batadv_purge_orig(struct batadv_priv *bat_priv) + { + struct batadv_hashtable *hash = bat_priv->orig_hash; +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + struct hlist_head *head; + spinlock_t *list_lock; /* spinlock to protect write access */ + struct batadv_orig_node *orig_node; +@@ -363,13 +363,13 @@ static void _batadv_purge_orig(struct batadv_priv *bat_priv) + list_lock = &hash->list_locks[i]; + + spin_lock_bh(list_lock); +- hlist_for_each_entry_safe(orig_node, node, node_tmp, ++ hlist_for_each_entry_safe(orig_node, node_tmp, + head, hash_entry) { + if (batadv_purge_orig_node(bat_priv, orig_node)) { + if (orig_node->gw_flags) + batadv_gw_node_delete(bat_priv, + orig_node); +- hlist_del_rcu(node); ++ hlist_del_rcu(&orig_node->hash_entry); + batadv_orig_node_free_ref(orig_node); + continue; + } +@@ -408,7 +408,6 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) + struct net_device *net_dev = (struct net_device *)seq->private; + struct batadv_priv *bat_priv = netdev_priv(net_dev); + struct batadv_hashtable *hash = bat_priv->orig_hash; +- struct hlist_node *node, *node_tmp; + struct hlist_head *head; + struct batadv_hard_iface *primary_if; + struct batadv_orig_node *orig_node; +@@ -434,7 +433,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(orig_node, head, hash_entry) { + neigh_node = batadv_orig_node_get_router(orig_node); + if (!neigh_node) + continue; +@@ -453,7 +452,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) + neigh_node->addr, + neigh_node->if_incoming->net_dev->name); + +- hlist_for_each_entry_rcu(neigh_node_tmp, node_tmp, ++ hlist_for_each_entry_rcu(neigh_node_tmp, + &orig_node->neigh_list, list) { + seq_printf(seq, " %pM (%3i)", + neigh_node_tmp->addr, +@@ -511,7 +510,6 @@ int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface, + { + struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); + struct batadv_hashtable *hash = bat_priv->orig_hash; +- struct hlist_node *node; + struct hlist_head *head; + struct batadv_orig_node *orig_node; + uint32_t i; +@@ -524,7 +522,7 @@ int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface, + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(orig_node, head, hash_entry) { + spin_lock_bh(&orig_node->ogm_cnt_lock); + ret = batadv_orig_node_add_if(orig_node, max_if_num); + spin_unlock_bh(&orig_node->ogm_cnt_lock); +@@ -595,7 +593,6 @@ int batadv_orig_hash_del_if(struct batadv_hard_iface *hard_iface, + { + struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); + struct batadv_hashtable *hash = bat_priv->orig_hash; +- struct hlist_node *node; + struct hlist_head *head; + struct batadv_hard_iface *hard_iface_tmp; + struct batadv_orig_node *orig_node; +@@ -609,7 +606,7 @@ int batadv_orig_hash_del_if(struct batadv_hard_iface *hard_iface, + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(orig_node, head, hash_entry) { + spin_lock_bh(&orig_node->ogm_cnt_lock); + ret = batadv_orig_node_del_if(orig_node, max_if_num, + hard_iface->if_num); +diff --git a/originator.h b/originator.h +index 286bf74..7df48fa 100644 +--- a/originator.h ++++ b/originator.h +@@ -68,7 +68,6 @@ batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data) + { + struct batadv_hashtable *hash = bat_priv->orig_hash; + struct hlist_head *head; +- struct hlist_node *node; + struct batadv_orig_node *orig_node, *orig_node_tmp = NULL; + int index; + +@@ -79,7 +78,7 @@ batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data) + head = &hash->table[index]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(orig_node, head, hash_entry) { + if (!batadv_compare_eth(orig_node, data)) + continue; + +diff --git a/routing.c b/routing.c +index 60ba03f..5ee21ce 100644 +--- a/routing.c ++++ b/routing.c +@@ -37,7 +37,6 @@ void batadv_slide_own_bcast_window(struct batadv_hard_iface *hard_iface) + { + struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); + struct batadv_hashtable *hash = bat_priv->orig_hash; +- struct hlist_node *node; + struct hlist_head *head; + struct batadv_orig_node *orig_node; + unsigned long *word; +@@ -49,7 +48,7 @@ void batadv_slide_own_bcast_window(struct batadv_hard_iface *hard_iface) + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(orig_node, head, hash_entry) { + spin_lock_bh(&orig_node->ogm_cnt_lock); + word_index = hard_iface->if_num * BATADV_NUM_WORDS; + word = &(orig_node->bcast_own[word_index]); +@@ -146,7 +145,6 @@ out: + void batadv_bonding_candidate_add(struct batadv_orig_node *orig_node, + struct batadv_neigh_node *neigh_node) + { +- struct hlist_node *node; + struct batadv_neigh_node *tmp_neigh_node, *router = NULL; + uint8_t interference_candidate = 0; + +@@ -169,7 +167,7 @@ void batadv_bonding_candidate_add(struct batadv_orig_node *orig_node, + * interface. If we do, we won't select this candidate because of + * possible interference. + */ +- hlist_for_each_entry_rcu(tmp_neigh_node, node, ++ hlist_for_each_entry_rcu(tmp_neigh_node, + &orig_node->neigh_list, list) { + if (tmp_neigh_node == neigh_node) + continue; +diff --git a/send.c b/send.c +index 80ca65f..a67cffd 100644 +--- a/send.c ++++ b/send.c +@@ -316,7 +316,7 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv, + const struct batadv_hard_iface *hard_iface) + { + struct batadv_forw_packet *forw_packet; +- struct hlist_node *tmp_node, *safe_tmp_node; ++ struct hlist_node *safe_tmp_node; + bool pending; + + if (hard_iface) +@@ -329,7 +329,7 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv, + + /* free bcast list */ + spin_lock_bh(&bat_priv->forw_bcast_list_lock); +- hlist_for_each_entry_safe(forw_packet, tmp_node, safe_tmp_node, ++ hlist_for_each_entry_safe(forw_packet, safe_tmp_node, + &bat_priv->forw_bcast_list, list) { + /* if purge_outstanding_packets() was called with an argument + * we delete only packets belonging to the given interface +@@ -355,7 +355,7 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv, + + /* free batman packet list */ + spin_lock_bh(&bat_priv->forw_bat_list_lock); +- hlist_for_each_entry_safe(forw_packet, tmp_node, safe_tmp_node, ++ hlist_for_each_entry_safe(forw_packet, safe_tmp_node, + &bat_priv->forw_bat_list, list) { + /* if purge_outstanding_packets() was called with an argument + * we delete only packets belonging to the given interface +diff --git a/translation-table.c b/translation-table.c +index d44672f..98a66a0 100644 +--- a/translation-table.c ++++ b/translation-table.c +@@ -56,7 +56,6 @@ static struct batadv_tt_common_entry * + batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data) + { + struct hlist_head *head; +- struct hlist_node *node; + struct batadv_tt_common_entry *tt_common_entry; + struct batadv_tt_common_entry *tt_common_entry_tmp = NULL; + uint32_t index; +@@ -68,7 +67,7 @@ batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data) + head = &hash->table[index]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(tt_common_entry, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(tt_common_entry, head, hash_entry) { + if (!batadv_compare_eth(tt_common_entry, data)) + continue; + +@@ -257,7 +256,6 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, + struct batadv_tt_local_entry *tt_local; + struct batadv_tt_global_entry *tt_global; + struct hlist_head *head; +- struct hlist_node *node; + struct batadv_tt_orig_list_entry *orig_entry; + int hash_added; + bool roamed_back = false; +@@ -339,7 +337,7 @@ check_roaming: + /* These node are probably going to update their tt table */ + head = &tt_global->orig_list; + rcu_read_lock(); +- hlist_for_each_entry_rcu(orig_entry, node, head, list) { ++ hlist_for_each_entry_rcu(orig_entry, head, list) { + batadv_send_roam_adv(bat_priv, tt_global->common.addr, + orig_entry->orig_node); + } +@@ -470,7 +468,6 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) + struct batadv_tt_common_entry *tt_common_entry; + struct batadv_tt_local_entry *tt_local; + struct batadv_hard_iface *primary_if; +- struct hlist_node *node; + struct hlist_head *head; + uint32_t i; + int last_seen_secs; +@@ -494,7 +491,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(tt_common_entry, node, ++ hlist_for_each_entry_rcu(tt_common_entry, + head, hash_entry) { + tt_local = container_of(tt_common_entry, + struct batadv_tt_local_entry, +@@ -605,9 +602,9 @@ static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv, + { + struct batadv_tt_local_entry *tt_local_entry; + struct batadv_tt_common_entry *tt_common_entry; +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + +- hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, head, ++ hlist_for_each_entry_safe(tt_common_entry, node_tmp, head, + hash_entry) { + tt_local_entry = container_of(tt_common_entry, + struct batadv_tt_local_entry, +@@ -651,7 +648,7 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) + spinlock_t *list_lock; /* protects write access to the hash lists */ + struct batadv_tt_common_entry *tt_common_entry; + struct batadv_tt_local_entry *tt_local; +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + struct hlist_head *head; + uint32_t i; + +@@ -665,9 +662,9 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) + list_lock = &hash->list_locks[i]; + + spin_lock_bh(list_lock); +- hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, ++ hlist_for_each_entry_safe(tt_common_entry, node_tmp, + head, hash_entry) { +- hlist_del_rcu(node); ++ hlist_del_rcu(&tt_common_entry->hash_entry); + tt_local = container_of(tt_common_entry, + struct batadv_tt_local_entry, + common); +@@ -724,11 +721,10 @@ batadv_tt_global_orig_entry_find(const struct batadv_tt_global_entry *entry, + { + struct batadv_tt_orig_list_entry *tmp_orig_entry, *orig_entry = NULL; + const struct hlist_head *head; +- struct hlist_node *node; + + rcu_read_lock(); + head = &entry->orig_list; +- hlist_for_each_entry_rcu(tmp_orig_entry, node, head, list) { ++ hlist_for_each_entry_rcu(tmp_orig_entry, head, list) { + if (tmp_orig_entry->orig_node != orig_node) + continue; + if (!atomic_inc_not_zero(&tmp_orig_entry->refcount)) +@@ -940,12 +936,11 @@ batadv_transtable_best_orig(struct batadv_tt_global_entry *tt_global_entry) + { + struct batadv_neigh_node *router = NULL; + struct hlist_head *head; +- struct hlist_node *node; + struct batadv_tt_orig_list_entry *orig_entry, *best_entry = NULL; + int best_tq = 0; + + head = &tt_global_entry->orig_list; +- hlist_for_each_entry_rcu(orig_entry, node, head, list) { ++ hlist_for_each_entry_rcu(orig_entry, head, list) { + router = batadv_orig_node_get_router(orig_entry->orig_node); + if (!router) + continue; +@@ -973,7 +968,6 @@ batadv_tt_global_print_entry(struct batadv_tt_global_entry *tt_global_entry, + struct seq_file *seq) + { + struct hlist_head *head; +- struct hlist_node *node; + struct batadv_tt_orig_list_entry *orig_entry, *best_entry; + struct batadv_tt_common_entry *tt_common_entry; + uint16_t flags; +@@ -997,7 +991,7 @@ batadv_tt_global_print_entry(struct batadv_tt_global_entry *tt_global_entry, + + head = &tt_global_entry->orig_list; + +- hlist_for_each_entry_rcu(orig_entry, node, head, list) { ++ hlist_for_each_entry_rcu(orig_entry, head, list) { + if (best_entry == orig_entry) + continue; + +@@ -1020,7 +1014,6 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) + struct batadv_tt_common_entry *tt_common_entry; + struct batadv_tt_global_entry *tt_global; + struct batadv_hard_iface *primary_if; +- struct hlist_node *node; + struct hlist_head *head; + uint32_t i; + +@@ -1039,7 +1032,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(tt_common_entry, node, ++ hlist_for_each_entry_rcu(tt_common_entry, + head, hash_entry) { + tt_global = container_of(tt_common_entry, + struct batadv_tt_global_entry, +@@ -1059,13 +1052,13 @@ static void + batadv_tt_global_del_orig_list(struct batadv_tt_global_entry *tt_global_entry) + { + struct hlist_head *head; +- struct hlist_node *node, *safe; ++ struct hlist_node *safe; + struct batadv_tt_orig_list_entry *orig_entry; + + spin_lock_bh(&tt_global_entry->list_lock); + head = &tt_global_entry->orig_list; +- hlist_for_each_entry_safe(orig_entry, node, safe, head, list) { +- hlist_del_rcu(node); ++ hlist_for_each_entry_safe(orig_entry, safe, head, list) { ++ hlist_del_rcu(&orig_entry->list); + batadv_tt_orig_list_entry_free_ref(orig_entry); + } + spin_unlock_bh(&tt_global_entry->list_lock); +@@ -1078,18 +1071,18 @@ batadv_tt_global_del_orig_entry(struct batadv_priv *bat_priv, + const char *message) + { + struct hlist_head *head; +- struct hlist_node *node, *safe; ++ struct hlist_node *safe; + struct batadv_tt_orig_list_entry *orig_entry; + + spin_lock_bh(&tt_global_entry->list_lock); + head = &tt_global_entry->orig_list; +- hlist_for_each_entry_safe(orig_entry, node, safe, head, list) { ++ hlist_for_each_entry_safe(orig_entry, safe, head, list) { + if (orig_entry->orig_node == orig_node) { + batadv_dbg(BATADV_DBG_TT, bat_priv, + "Deleting %pM from global tt entry %pM: %s\n", + orig_node->orig, + tt_global_entry->common.addr, message); +- hlist_del_rcu(node); ++ hlist_del_rcu(&orig_entry->list); + batadv_tt_orig_list_entry_free_ref(orig_entry); + } + } +@@ -1108,7 +1101,6 @@ batadv_tt_global_del_roaming(struct batadv_priv *bat_priv, + { + bool last_entry = true; + struct hlist_head *head; +- struct hlist_node *node; + struct batadv_tt_orig_list_entry *orig_entry; + + /* no local entry exists, case 1: +@@ -1117,7 +1109,7 @@ batadv_tt_global_del_roaming(struct batadv_priv *bat_priv, + + rcu_read_lock(); + head = &tt_global_entry->orig_list; +- hlist_for_each_entry_rcu(orig_entry, node, head, list) { ++ hlist_for_each_entry_rcu(orig_entry, head, list) { + if (orig_entry->orig_node != orig_node) { + last_entry = false; + break; +@@ -1202,7 +1194,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, + struct batadv_tt_common_entry *tt_common_entry; + uint32_t i; + struct batadv_hashtable *hash = bat_priv->tt.global_hash; +- struct hlist_node *node, *safe; ++ struct hlist_node *safe; + struct hlist_head *head; + spinlock_t *list_lock; /* protects write access to the hash lists */ + +@@ -1214,7 +1206,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, + list_lock = &hash->list_locks[i]; + + spin_lock_bh(list_lock); +- hlist_for_each_entry_safe(tt_common_entry, node, safe, ++ hlist_for_each_entry_safe(tt_common_entry, safe, + head, hash_entry) { + tt_global = container_of(tt_common_entry, + struct batadv_tt_global_entry, +@@ -1227,7 +1219,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, + batadv_dbg(BATADV_DBG_TT, bat_priv, + "Deleting global tt entry %pM: %s\n", + tt_global->common.addr, message); +- hlist_del_rcu(node); ++ hlist_del_rcu(&tt_common_entry->hash_entry); + batadv_tt_global_entry_free_ref(tt_global); + } + } +@@ -1262,7 +1254,7 @@ static void batadv_tt_global_purge(struct batadv_priv *bat_priv) + { + struct batadv_hashtable *hash = bat_priv->tt.global_hash; + struct hlist_head *head; +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + spinlock_t *list_lock; /* protects write access to the hash lists */ + uint32_t i; + char *msg = NULL; +@@ -1274,7 +1266,7 @@ static void batadv_tt_global_purge(struct batadv_priv *bat_priv) + list_lock = &hash->list_locks[i]; + + spin_lock_bh(list_lock); +- hlist_for_each_entry_safe(tt_common, node, node_tmp, head, ++ hlist_for_each_entry_safe(tt_common, node_tmp, head, + hash_entry) { + tt_global = container_of(tt_common, + struct batadv_tt_global_entry, +@@ -1287,7 +1279,7 @@ static void batadv_tt_global_purge(struct batadv_priv *bat_priv) + "Deleting global tt entry (%pM): %s\n", + tt_global->common.addr, msg); + +- hlist_del_rcu(node); ++ hlist_del_rcu(&tt_common->hash_entry); + + batadv_tt_global_entry_free_ref(tt_global); + } +@@ -1301,7 +1293,7 @@ static void batadv_tt_global_table_free(struct batadv_priv *bat_priv) + spinlock_t *list_lock; /* protects write access to the hash lists */ + struct batadv_tt_common_entry *tt_common_entry; + struct batadv_tt_global_entry *tt_global; +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + struct hlist_head *head; + uint32_t i; + +@@ -1315,9 +1307,9 @@ static void batadv_tt_global_table_free(struct batadv_priv *bat_priv) + list_lock = &hash->list_locks[i]; + + spin_lock_bh(list_lock); +- hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, ++ hlist_for_each_entry_safe(tt_common_entry, node_tmp, + head, hash_entry) { +- hlist_del_rcu(node); ++ hlist_del_rcu(&tt_common_entry->hash_entry); + tt_global = container_of(tt_common_entry, + struct batadv_tt_global_entry, + common); +@@ -1397,7 +1389,6 @@ static uint16_t batadv_tt_global_crc(struct batadv_priv *bat_priv, + struct batadv_hashtable *hash = bat_priv->tt.global_hash; + struct batadv_tt_common_entry *tt_common; + struct batadv_tt_global_entry *tt_global; +- struct hlist_node *node; + struct hlist_head *head; + uint32_t i; + int j; +@@ -1406,7 +1397,7 @@ static uint16_t batadv_tt_global_crc(struct batadv_priv *bat_priv, + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(tt_common, head, hash_entry) { + tt_global = container_of(tt_common, + struct batadv_tt_global_entry, + common); +@@ -1449,7 +1440,6 @@ static uint16_t batadv_tt_local_crc(struct batadv_priv *bat_priv) + uint16_t total = 0, total_one; + struct batadv_hashtable *hash = bat_priv->tt.local_hash; + struct batadv_tt_common_entry *tt_common; +- struct hlist_node *node; + struct hlist_head *head; + uint32_t i; + int j; +@@ -1458,7 +1448,7 @@ static uint16_t batadv_tt_local_crc(struct batadv_priv *bat_priv) + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(tt_common, head, hash_entry) { + /* not yet committed clients have not to be taken into + * account while computing the CRC + */ +@@ -1597,7 +1587,6 @@ batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn, + struct batadv_tt_common_entry *tt_common_entry; + struct batadv_tt_query_packet *tt_response; + struct batadv_tt_change *tt_change; +- struct hlist_node *node; + struct hlist_head *head; + struct sk_buff *skb = NULL; + uint16_t tt_tot, tt_count; +@@ -1627,7 +1616,7 @@ batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn, + for (i = 0; i < hash->size; i++) { + head = &hash->table[i]; + +- hlist_for_each_entry_rcu(tt_common_entry, node, ++ hlist_for_each_entry_rcu(tt_common_entry, + head, hash_entry) { + if (tt_count == tt_tot) + break; +@@ -2307,7 +2296,6 @@ static uint16_t batadv_tt_set_flags(struct batadv_hashtable *hash, + uint32_t i; + uint16_t changed_num = 0; + struct hlist_head *head; +- struct hlist_node *node; + struct batadv_tt_common_entry *tt_common_entry; + + if (!hash) +@@ -2317,7 +2305,7 @@ static uint16_t batadv_tt_set_flags(struct batadv_hashtable *hash, + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(tt_common_entry, node, ++ hlist_for_each_entry_rcu(tt_common_entry, + head, hash_entry) { + if (enable) { + if ((tt_common_entry->flags & flags) == flags) +@@ -2342,7 +2330,7 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) + struct batadv_hashtable *hash = bat_priv->tt.local_hash; + struct batadv_tt_common_entry *tt_common; + struct batadv_tt_local_entry *tt_local; +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + struct hlist_head *head; + spinlock_t *list_lock; /* protects write access to the hash lists */ + uint32_t i; +@@ -2355,7 +2343,7 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) + list_lock = &hash->list_locks[i]; + + spin_lock_bh(list_lock); +- hlist_for_each_entry_safe(tt_common, node, node_tmp, head, ++ hlist_for_each_entry_safe(tt_common, node_tmp, head, + hash_entry) { + if (!(tt_common->flags & BATADV_TT_CLIENT_PENDING)) + continue; +@@ -2365,7 +2353,7 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) + tt_common->addr); + + atomic_dec(&bat_priv->tt.local_entry_num); +- hlist_del_rcu(node); ++ hlist_del_rcu(&tt_common->hash_entry); + tt_local = container_of(tt_common, + struct batadv_tt_local_entry, + common); +diff --git a/vis.c b/vis.c +index 22d2785..c053244 100644 +--- a/vis.c ++++ b/vis.c +@@ -97,7 +97,6 @@ batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data) + { + struct batadv_hashtable *hash = bat_priv->vis.hash; + struct hlist_head *head; +- struct hlist_node *node; + struct batadv_vis_info *vis_info, *vis_info_tmp = NULL; + uint32_t index; + +@@ -108,8 +107,8 @@ batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data) + head = &hash->table[index]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(vis_info, node, head, hash_entry) { +- if (!batadv_vis_info_cmp(node, data)) ++ hlist_for_each_entry_rcu(vis_info, head, hash_entry) { ++ if (!batadv_vis_info_cmp(&vis_info->hash_entry, data)) + continue; + + vis_info_tmp = vis_info; +@@ -128,9 +127,8 @@ static void batadv_vis_data_insert_interface(const uint8_t *interface, + bool primary) + { + struct batadv_vis_if_list_entry *entry; +- struct hlist_node *pos; + +- hlist_for_each_entry(entry, pos, if_list, list) { ++ hlist_for_each_entry(entry, if_list, list) { + if (batadv_compare_eth(entry->addr, interface)) + return; + } +@@ -148,9 +146,8 @@ static void batadv_vis_data_read_prim_sec(struct seq_file *seq, + const struct hlist_head *if_list) + { + struct batadv_vis_if_list_entry *entry; +- struct hlist_node *pos; + +- hlist_for_each_entry(entry, pos, if_list, list) { ++ hlist_for_each_entry(entry, if_list, list) { + if (entry->primary) + seq_printf(seq, "PRIMARY, "); + else +@@ -198,9 +195,8 @@ static void batadv_vis_data_read_entries(struct seq_file *seq, + { + int i; + struct batadv_vis_if_list_entry *entry; +- struct hlist_node *pos; + +- hlist_for_each_entry(entry, pos, list, list) { ++ hlist_for_each_entry(entry, list, list) { + seq_printf(seq, "%pM,", entry->addr); + + for (i = 0; i < packet->entries; i++) +@@ -218,17 +214,16 @@ static void batadv_vis_data_read_entries(struct seq_file *seq, + static void batadv_vis_seq_print_text_bucket(struct seq_file *seq, + const struct hlist_head *head) + { +- struct hlist_node *node; + struct batadv_vis_info *info; + struct batadv_vis_packet *packet; + uint8_t *entries_pos; + struct batadv_vis_info_entry *entries; + struct batadv_vis_if_list_entry *entry; +- struct hlist_node *pos, *n; ++ struct hlist_node *n; + + HLIST_HEAD(vis_if_list); + +- hlist_for_each_entry_rcu(info, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(info, head, hash_entry) { + packet = (struct batadv_vis_packet *)info->skb_packet->data; + entries_pos = (uint8_t *)packet + sizeof(*packet); + entries = (struct batadv_vis_info_entry *)entries_pos; +@@ -240,7 +235,7 @@ static void batadv_vis_seq_print_text_bucket(struct seq_file *seq, + batadv_vis_data_read_entries(seq, &vis_if_list, packet, + entries); + +- hlist_for_each_entry_safe(entry, pos, n, &vis_if_list, list) { ++ hlist_for_each_entry_safe(entry, n, &vis_if_list, list) { + hlist_del(&entry->list); + kfree(entry); + } +@@ -519,7 +514,6 @@ static int batadv_find_best_vis_server(struct batadv_priv *bat_priv, + { + struct batadv_hashtable *hash = bat_priv->orig_hash; + struct batadv_neigh_node *router; +- struct hlist_node *node; + struct hlist_head *head; + struct batadv_orig_node *orig_node; + struct batadv_vis_packet *packet; +@@ -532,7 +526,7 @@ static int batadv_find_best_vis_server(struct batadv_priv *bat_priv, + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(orig_node, head, hash_entry) { + router = batadv_orig_node_get_router(orig_node); + if (!router) + continue; +@@ -571,7 +565,6 @@ static bool batadv_vis_packet_full(const struct batadv_vis_info *info) + static int batadv_generate_vis_packet(struct batadv_priv *bat_priv) + { + struct batadv_hashtable *hash = bat_priv->orig_hash; +- struct hlist_node *node; + struct hlist_head *head; + struct batadv_orig_node *orig_node; + struct batadv_neigh_node *router; +@@ -605,7 +598,7 @@ static int batadv_generate_vis_packet(struct batadv_priv *bat_priv) + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(orig_node, head, hash_entry) { + router = batadv_orig_node_get_router(orig_node); + if (!router) + continue; +@@ -644,7 +637,7 @@ next: + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(tt_common_entry, node, head, ++ hlist_for_each_entry_rcu(tt_common_entry, head, + hash_entry) { + packet_pos = skb_put(info->skb_packet, sizeof(*entry)); + entry = (struct batadv_vis_info_entry *)packet_pos; +@@ -673,14 +666,14 @@ static void batadv_purge_vis_packets(struct batadv_priv *bat_priv) + { + uint32_t i; + struct batadv_hashtable *hash = bat_priv->vis.hash; +- struct hlist_node *node, *node_tmp; ++ struct hlist_node *node_tmp; + struct hlist_head *head; + struct batadv_vis_info *info; + + for (i = 0; i < hash->size; i++) { + head = &hash->table[i]; + +- hlist_for_each_entry_safe(info, node, node_tmp, ++ hlist_for_each_entry_safe(info, node_tmp, + head, hash_entry) { + /* never purge own data. */ + if (info == bat_priv->vis.my_info) +@@ -688,7 +681,7 @@ static void batadv_purge_vis_packets(struct batadv_priv *bat_priv) + + if (batadv_has_timed_out(info->first_seen, + BATADV_VIS_TIMEOUT)) { +- hlist_del(node); ++ hlist_del(&info->hash_entry); + batadv_send_list_del(info); + kref_put(&info->refcount, batadv_free_info); + } +@@ -700,7 +693,6 @@ static void batadv_broadcast_vis_packet(struct batadv_priv *bat_priv, + struct batadv_vis_info *info) + { + struct batadv_hashtable *hash = bat_priv->orig_hash; +- struct hlist_node *node; + struct hlist_head *head; + struct batadv_orig_node *orig_node; + struct batadv_vis_packet *packet; +@@ -715,7 +707,7 @@ static void batadv_broadcast_vis_packet(struct batadv_priv *bat_priv, + head = &hash->table[i]; + + rcu_read_lock(); +- hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { ++ hlist_for_each_entry_rcu(orig_node, head, hash_entry) { + /* if it's a vis server and reachable, send it. */ + if (!(orig_node->flags & BATADV_VIS_SERVER)) + continue; +-- +1.7.10.4 + diff --git a/patches/0003-batman-adv-make-is_my_mac-check-for-the-current-mesh.patch b/patches/0003-batman-adv-make-is_my_mac-check-for-the-current-mesh.patch new file mode 100644 index 0000000..a8dc69a --- /dev/null +++ b/patches/0003-batman-adv-make-is_my_mac-check-for-the-current-mesh.patch @@ -0,0 +1,250 @@ +From 647d23f3e358d9fa4b1a8f0bb67a3e6bff30d4a1 Mon Sep 17 00:00:00 2001 +From: Antonio Quartulli +Date: Wed, 3 Apr 2013 19:10:26 +0200 +Subject: [PATCH 3/3] batman-adv: make is_my_mac() check for the current mesh + only + +On a multi-mesh node (a node running more than one batman-adv +virtual interface) batadv_is_my_mac() has to check MAC +addresses of hard interfaces belonging to the current mesh +only. + +Signed-off-by: Antonio Quartulli +Signed-off-by: Marek Lindner +--- + main.c | 5 ++++- + main.h | 2 +- + routing.c | 38 ++++++++++++++++++++------------------ + translation-table.c | 2 +- + vis.c | 4 ++-- + 5 files changed, 28 insertions(+), 23 deletions(-) + +diff --git a/main.c b/main.c +index 0488d70..fa563e4 100644 +--- a/main.c ++++ b/main.c +@@ -169,7 +169,7 @@ void batadv_mesh_free(struct net_device *soft_iface) + atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE); + } + +-int batadv_is_my_mac(const uint8_t *addr) ++int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr) + { + const struct batadv_hard_iface *hard_iface; + +@@ -178,6 +178,9 @@ int batadv_is_my_mac(const uint8_t *addr) + if (hard_iface->if_status != BATADV_IF_ACTIVE) + continue; + ++ if (hard_iface->soft_iface != bat_priv->soft_iface) ++ continue; ++ + if (batadv_compare_eth(hard_iface->net_dev->dev_addr, addr)) { + rcu_read_unlock(); + return 1; +diff --git a/main.h b/main.h +index 08c5dd1..fcb5d65 100644 +--- a/main.h ++++ b/main.h +@@ -164,7 +164,7 @@ extern struct workqueue_struct *batadv_event_workqueue; + + int batadv_mesh_init(struct net_device *soft_iface); + void batadv_mesh_free(struct net_device *soft_iface); +-int batadv_is_my_mac(const uint8_t *addr); ++int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr); + struct batadv_hard_iface * + batadv_seq_print_text_primary_if_get(struct seq_file *seq); + int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev, +diff --git a/routing.c b/routing.c +index 5ee21ce..319f290 100644 +--- a/routing.c ++++ b/routing.c +@@ -402,7 +402,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, + goto out; + + /* not for me */ +- if (!batadv_is_my_mac(ethhdr->h_dest)) ++ if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest)) + goto out; + + icmp_packet = (struct batadv_icmp_packet_rr *)skb->data; +@@ -416,7 +416,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, + } + + /* packet for me */ +- if (batadv_is_my_mac(icmp_packet->dst)) ++ if (batadv_is_my_mac(bat_priv, icmp_packet->dst)) + return batadv_recv_my_icmp_packet(bat_priv, skb, hdr_size); + + /* TTL exceeded */ +@@ -548,7 +548,8 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig, + return router; + } + +-static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size) ++static int batadv_check_unicast_packet(struct batadv_priv *bat_priv, ++ struct sk_buff *skb, int hdr_size) + { + struct ethhdr *ethhdr; + +@@ -567,7 +568,7 @@ static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size) + return -1; + + /* not for me */ +- if (!batadv_is_my_mac(ethhdr->h_dest)) ++ if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest)) + return -1; + + return 0; +@@ -582,7 +583,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if) + char tt_flag; + size_t packet_size; + +- if (batadv_check_unicast_packet(skb, hdr_size) < 0) ++ if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0) + return NET_RX_DROP; + + /* I could need to modify it */ +@@ -614,7 +615,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if) + case BATADV_TT_RESPONSE: + batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); + +- if (batadv_is_my_mac(tt_query->dst)) { ++ if (batadv_is_my_mac(bat_priv, tt_query->dst)) { + /* packet needs to be linearized to access the TT + * changes + */ +@@ -657,14 +658,15 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if) + struct batadv_roam_adv_packet *roam_adv_packet; + struct batadv_orig_node *orig_node; + +- if (batadv_check_unicast_packet(skb, sizeof(*roam_adv_packet)) < 0) ++ if (batadv_check_unicast_packet(bat_priv, skb, ++ sizeof(*roam_adv_packet)) < 0) + goto out; + + batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); + + roam_adv_packet = (struct batadv_roam_adv_packet *)skb->data; + +- if (!batadv_is_my_mac(roam_adv_packet->dst)) ++ if (!batadv_is_my_mac(bat_priv, roam_adv_packet->dst)) + return batadv_route_unicast_packet(skb, recv_if); + + /* check if it is a backbone gateway. we don't accept +@@ -967,7 +969,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, + * last time) the packet had an updated information or not + */ + curr_ttvn = (uint8_t)atomic_read(&bat_priv->tt.vn); +- if (!batadv_is_my_mac(unicast_packet->dest)) { ++ if (!batadv_is_my_mac(bat_priv, unicast_packet->dest)) { + orig_node = batadv_orig_hash_find(bat_priv, + unicast_packet->dest); + /* if it is not possible to find the orig_node representing the +@@ -1044,14 +1046,14 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, + if (is4addr) + hdr_size = sizeof(*unicast_4addr_packet); + +- if (batadv_check_unicast_packet(skb, hdr_size) < 0) ++ if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0) + return NET_RX_DROP; + + if (!batadv_check_unicast_ttvn(bat_priv, skb)) + return NET_RX_DROP; + + /* packet for me */ +- if (batadv_is_my_mac(unicast_packet->dest)) { ++ if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) { + if (is4addr) { + batadv_dat_inc_counter(bat_priv, + unicast_4addr_packet->subtype); +@@ -1088,7 +1090,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb, + struct sk_buff *new_skb = NULL; + int ret; + +- if (batadv_check_unicast_packet(skb, hdr_size) < 0) ++ if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0) + return NET_RX_DROP; + + if (!batadv_check_unicast_ttvn(bat_priv, skb)) +@@ -1097,7 +1099,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb, + unicast_packet = (struct batadv_unicast_frag_packet *)skb->data; + + /* packet for me */ +- if (batadv_is_my_mac(unicast_packet->dest)) { ++ if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) { + ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb); + + if (ret == NET_RX_DROP) +@@ -1151,13 +1153,13 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, + goto out; + + /* ignore broadcasts sent by myself */ +- if (batadv_is_my_mac(ethhdr->h_source)) ++ if (batadv_is_my_mac(bat_priv, ethhdr->h_source)) + goto out; + + bcast_packet = (struct batadv_bcast_packet *)skb->data; + + /* ignore broadcasts originated by myself */ +- if (batadv_is_my_mac(bcast_packet->orig)) ++ if (batadv_is_my_mac(bat_priv, bcast_packet->orig)) + goto out; + + if (bcast_packet->header.ttl < 2) +@@ -1243,14 +1245,14 @@ int batadv_recv_vis_packet(struct sk_buff *skb, + ethhdr = (struct ethhdr *)skb_mac_header(skb); + + /* not for me */ +- if (!batadv_is_my_mac(ethhdr->h_dest)) ++ if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest)) + return NET_RX_DROP; + + /* ignore own packets */ +- if (batadv_is_my_mac(vis_packet->vis_orig)) ++ if (batadv_is_my_mac(bat_priv, vis_packet->vis_orig)) + return NET_RX_DROP; + +- if (batadv_is_my_mac(vis_packet->sender_orig)) ++ if (batadv_is_my_mac(bat_priv, vis_packet->sender_orig)) + return NET_RX_DROP; + + switch (vis_packet->vis_type) { +diff --git a/translation-table.c b/translation-table.c +index 98a66a0..7abee19 100644 +--- a/translation-table.c ++++ b/translation-table.c +@@ -1953,7 +1953,7 @@ out: + bool batadv_send_tt_response(struct batadv_priv *bat_priv, + struct batadv_tt_query_packet *tt_request) + { +- if (batadv_is_my_mac(tt_request->dst)) { ++ if (batadv_is_my_mac(bat_priv, tt_request->dst)) { + /* don't answer backbone gws! */ + if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_request->src)) + return true; +diff --git a/vis.c b/vis.c +index c053244..6a1e646 100644 +--- a/vis.c ++++ b/vis.c +@@ -477,7 +477,7 @@ void batadv_receive_client_update_packet(struct batadv_priv *bat_priv, + + /* Are we the target for this VIS packet? */ + if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC && +- batadv_is_my_mac(vis_packet->target_orig)) ++ batadv_is_my_mac(bat_priv, vis_packet->target_orig)) + are_target = 1; + + spin_lock_bh(&bat_priv->vis.hash_lock); +@@ -496,7 +496,7 @@ void batadv_receive_client_update_packet(struct batadv_priv *bat_priv, + batadv_send_list_add(bat_priv, info); + + /* ... we're not the recipient (and thus need to forward). */ +- } else if (!batadv_is_my_mac(packet->target_orig)) { ++ } else if (!batadv_is_my_mac(bat_priv, packet->target_orig)) { + batadv_send_list_add(bat_priv, info); + } + +-- +1.7.10.4 + From 2beb6f5fdbdbb29931f4a9b15c9398d920209255 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 18 Apr 2013 12:04:54 +0000 Subject: [PATCH 40/41] packages: consistently use 'depends on' instead of 'depends' make the syntax more compatible with kernel menuconfig Signed-off-by: Felix Fietkau git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@36357 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Config.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Config.in b/Config.in index 08987e5..b47104f 100644 --- a/Config.in +++ b/Config.in @@ -1,22 +1,22 @@ config KMOD_BATMAN_ADV_DEBUG_LOG bool "enable verbose debug logging" - depends PACKAGE_kmod-batman-adv + depends on PACKAGE_kmod-batman-adv default n config KMOD_BATMAN_ADV_BLA bool "enable bridge loop avoidance" - depends PACKAGE_kmod-batman-adv + depends on PACKAGE_kmod-batman-adv default y config KMOD_BATMAN_ADV_DAT bool "enable distributed arp table" - depends PACKAGE_kmod-batman-adv + depends on PACKAGE_kmod-batman-adv default y config KMOD_BATMAN_ADV_BATCTL bool "enable batctl" - depends PACKAGE_kmod-batman-adv + depends on PACKAGE_kmod-batman-adv default y help batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced. From a0e2bb6a79893b9fa91c916363708c06e176fca1 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 18 Apr 2013 18:54:15 +0200 Subject: [PATCH 41/41] move batman-adv files to subdirectory --- Config.in => batman-adv/Config.in | 0 Makefile => batman-adv/Makefile | 0 {files => batman-adv/files}/etc/config/batman-adv | 0 {files => batman-adv/files}/etc/hotplug.d/net/99-batman-adv | 0 {files => batman-adv/files}/lib/batman-adv/config.sh | 0 {files => batman-adv/files}/lib/netifd/proto/batadv.sh | 0 ...0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch | 0 ...-batman-adv-hlist-drop-the-node-parameter-from-iterators.patch | 0 ...003-batman-adv-make-is_my_mac-check-for-the-current-mesh.patch | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename Config.in => batman-adv/Config.in (100%) rename Makefile => batman-adv/Makefile (100%) rename {files => batman-adv/files}/etc/config/batman-adv (100%) rename {files => batman-adv/files}/etc/hotplug.d/net/99-batman-adv (100%) rename {files => batman-adv/files}/lib/batman-adv/config.sh (100%) rename {files => batman-adv/files}/lib/netifd/proto/batadv.sh (100%) rename {patches => batman-adv/patches}/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch (100%) rename {patches => batman-adv/patches}/0002-batman-adv-hlist-drop-the-node-parameter-from-iterators.patch (100%) rename {patches => batman-adv/patches}/0003-batman-adv-make-is_my_mac-check-for-the-current-mesh.patch (100%) diff --git a/Config.in b/batman-adv/Config.in similarity index 100% rename from Config.in rename to batman-adv/Config.in diff --git a/Makefile b/batman-adv/Makefile similarity index 100% rename from Makefile rename to batman-adv/Makefile diff --git a/files/etc/config/batman-adv b/batman-adv/files/etc/config/batman-adv similarity index 100% rename from files/etc/config/batman-adv rename to batman-adv/files/etc/config/batman-adv diff --git a/files/etc/hotplug.d/net/99-batman-adv b/batman-adv/files/etc/hotplug.d/net/99-batman-adv similarity index 100% rename from files/etc/hotplug.d/net/99-batman-adv rename to batman-adv/files/etc/hotplug.d/net/99-batman-adv diff --git a/files/lib/batman-adv/config.sh b/batman-adv/files/lib/batman-adv/config.sh similarity index 100% rename from files/lib/batman-adv/config.sh rename to batman-adv/files/lib/batman-adv/config.sh diff --git a/files/lib/netifd/proto/batadv.sh b/batman-adv/files/lib/netifd/proto/batadv.sh similarity index 100% rename from files/lib/netifd/proto/batadv.sh rename to batman-adv/files/lib/netifd/proto/batadv.sh diff --git a/patches/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch b/batman-adv/patches/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch similarity index 100% rename from patches/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch rename to batman-adv/patches/0001-batman-adv-verify-tt-len-does-not-exceed-packet-len.patch diff --git a/patches/0002-batman-adv-hlist-drop-the-node-parameter-from-iterators.patch b/batman-adv/patches/0002-batman-adv-hlist-drop-the-node-parameter-from-iterators.patch similarity index 100% rename from patches/0002-batman-adv-hlist-drop-the-node-parameter-from-iterators.patch rename to batman-adv/patches/0002-batman-adv-hlist-drop-the-node-parameter-from-iterators.patch diff --git a/patches/0003-batman-adv-make-is_my_mac-check-for-the-current-mesh.patch b/batman-adv/patches/0003-batman-adv-make-is_my_mac-check-for-the-current-mesh.patch similarity index 100% rename from patches/0003-batman-adv-make-is_my_mac-check-for-the-current-mesh.patch rename to batman-adv/patches/0003-batman-adv-make-is_my_mac-check-for-the-current-mesh.patch