batman-adv: add patches from 2016.4-maint 2016-12-02
authorSven Eckelmann <sven@narfation.org>
Wed, 30 Nov 2016 08:47:47 +0000 (09:47 +0100)
committerSven Eckelmann <sven@narfation.org>
Fri, 2 Dec 2016 14:48:18 +0000 (15:48 +0100)
 * batman-adv: Install module in $INSTALL_MOD_DIR/updates/net/batman-adv
 * batman-adv: Revert "fix splat on disabling an interface"
 * batman-adv: Detect missing primaryif during tp_send as error
 * batman-adv: Check for alloc errors when preparing TT local data

Signed-off-by: Sven Eckelmann <sven@narfation.org>
batman-adv/Makefile
batman-adv/patches/0001-batman-adv-Install-module-in-INSTALL_MOD_DIR-updates.patch [new file with mode: 0644]
batman-adv/patches/0002-batman-adv-Revert-fix-splat-on-disabling-an-interfac.patch [new file with mode: 0644]
batman-adv/patches/0003-batman-adv-Detect-missing-primaryif-during-tp_send-a.patch [new file with mode: 0644]
batman-adv/patches/0004-batman-adv-Check-for-alloc-errors-when-preparing-TT-.patch [new file with mode: 0644]

index 23b2f74..55f41fb 100644 (file)
@@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=batman-adv
 
 PKG_VERSION:=2016.4
-PKG_RELEASE:=0
+PKG_RELEASE:=1
 PKG_MD5SUM:=1ed28d02ad86050d1518023e354737b6
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
diff --git a/batman-adv/patches/0001-batman-adv-Install-module-in-INSTALL_MOD_DIR-updates.patch b/batman-adv/patches/0001-batman-adv-Install-module-in-INSTALL_MOD_DIR-updates.patch
new file mode 100644 (file)
index 0000000..e5072e2
--- /dev/null
@@ -0,0 +1,71 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Mon, 31 Oct 2016 08:27:19 +0100
+Subject: [PATCH] batman-adv: Install module in $INSTALL_MOD_DIR/updates/net/batman-adv
+
+depmod may skip the batman-adv.ko module in the $INSTALL_MOD_DIR/update/
+folder when it contains the word "build" as directory name.
+
+Avoid this extra directory "build" in the installation path by making the
+obj-y dir relative to build/ in the source directory.
+
+Reported-by: Jean-Jacques Sarton <jj.sarton@t-online.de>
+Fixes: 66ac14a09445 ("batman-adv: Introduce compat-patches support")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Tested-by: Martin Weinelt <martin@darmstadt.freifunk.net>
+---
+ Makefile | 16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 7ef2569..b852a17 100644
+--- a/Makefile
++++ b/Makefile
+@@ -46,6 +46,7 @@ MKDIR := mkdir -p
+ PATCH_FLAGS = --batch --fuzz=0 --forward --strip=1 --unified --version-control=never -g0 --remove-empty-files --no-backup-if-mismatch --reject-file=-
+ PATCH := patch $(PATCH_FLAGS) -i
+ CP := cp -fpR
++LN := ln -sf
+ SOURCE = $(wildcard net/batman-adv/*.[ch]) net/batman-adv/Makefile
+ SOURCE_BUILD = $(wildcard $(BUILD_DIR)/net/batman-adv/*.[ch]) $(BUILD_DIR)/net/batman-adv/Makefile
+@@ -55,25 +56,25 @@ REVISION= $(shell  if [ -d "$(PWD)/.git" ]; then \
+                               echo $$(git --git-dir="$(PWD)/.git" describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \
+                       fi)
+ NOSTDINC_FLAGS += \
+-      -I$(PWD)/compat-include/ \
+-      -I$(PWD)/include/ \
+-      -include $(PWD)/compat.h \
++      -I$(PWD)/../compat-include/ \
++      -I$(PWD)/../include/ \
++      -include $(PWD)/../compat.h \
+       $(CFLAGS)
+ ifneq ($(REVISION),)
+ NOSTDINC_FLAGS += -DBATADV_SOURCE_VERSION=\"$(REVISION)\"
+ endif
+-include $(PWD)/compat-sources/Makefile
++-include $(PWD)/../compat-sources/Makefile
+-obj-y += build/net/batman-adv/
++obj-y += net/batman-adv/
+ export batman-adv-y
+ BUILD_FLAGS := \
+-      M=$(PWD) \
+-      PWD=$(PWD) \
++      M=$(BUILD_DIR) \
++      PWD=$(BUILD_DIR) \
+       REVISION=$(REVISION) \
+       CONFIG_BATMAN_ADV=m \
+       CONFIG_BATMAN_ADV_DEBUG=$(CONFIG_BATMAN_ADV_DEBUG) \
+@@ -101,6 +102,7 @@ config:
+ $(SOURCE_STAMP): $(SOURCE) compat-patches/* compat-patches/replacements.sh
+       $(MKDIR) $(BUILD_DIR)/net/batman-adv/
++      @$(LN) ../Makefile $(BUILD_DIR)/Makefile
+       @$(RM) $(SOURCE_BUILD)
+       @$(CP) $(SOURCE) $(BUILD_DIR)/net/batman-adv/
+       @set -e; \
diff --git a/batman-adv/patches/0002-batman-adv-Revert-fix-splat-on-disabling-an-interfac.patch b/batman-adv/patches/0002-batman-adv-Revert-fix-splat-on-disabling-an-interfac.patch
new file mode 100644 (file)
index 0000000..46d2779
--- /dev/null
@@ -0,0 +1,32 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Wed, 2 Nov 2016 18:14:43 +0100
+Subject: [PATCH] batman-adv: Revert "fix splat on disabling an interface"
+
+The commit bac7733d06fa ("batman-adv: fix splat on disabling an interface")
+fixed a warning but at the same time broke the rtnl function add_slave for
+devices which were temporarily removed.
+
+batadv_softif_slave_add requires soft_iface of and hard_iface to be NULL
+before it is allowed to be enslaved. But this resetting of soft_iface to
+NULL in batadv_hardif_disable_interface was removed with the aforementioned
+commit.
+
+Reported-by: Julian Labus <julian@freifunk-rtk.de>
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Acked-by: Linus L├╝ssing <linus.luessing@c0d3.blue>
+---
+ net/batman-adv/hard-interface.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
+index e034afb..08ce361 100644
+--- a/net/batman-adv/hard-interface.c
++++ b/net/batman-adv/hard-interface.c
+@@ -652,6 +652,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
+                       batadv_softif_destroy_sysfs(hard_iface->soft_iface);
+       }
++      hard_iface->soft_iface = NULL;
+       batadv_hardif_put(hard_iface);
+ out:
diff --git a/batman-adv/patches/0003-batman-adv-Detect-missing-primaryif-during-tp_send-a.patch b/batman-adv/patches/0003-batman-adv-Detect-missing-primaryif-during-tp_send-a.patch
new file mode 100644 (file)
index 0000000..37c676d
--- /dev/null
@@ -0,0 +1,28 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sat, 29 Oct 2016 09:18:43 +0200
+Subject: [PATCH] batman-adv: Detect missing primaryif during tp_send as error
+
+The throughput meter detects different situations as problems for the
+current test. It stops the test after these and reports it to userspace.
+This also has to be done when the primary interface disappeared during the
+test.
+
+Fixes: 98d7a766b645 ("batman-adv: throughput meter implementation")
+Reported-by: Joe Perches <joe@perches.com>
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+---
+ net/batman-adv/tp_meter.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c
+index 2333777..8af1611 100644
+--- a/net/batman-adv/tp_meter.c
++++ b/net/batman-adv/tp_meter.c
+@@ -837,6 +837,7 @@ static int batadv_tp_send(void *arg)
+       primary_if = batadv_primary_if_get_selected(bat_priv);
+       if (unlikely(!primary_if)) {
+               err = BATADV_TP_REASON_DST_UNREACHABLE;
++              tp_vars->reason = err;
+               goto out;
+       }
diff --git a/batman-adv/patches/0004-batman-adv-Check-for-alloc-errors-when-preparing-TT-.patch b/batman-adv/patches/0004-batman-adv-Check-for-alloc-errors-when-preparing-TT-.patch
new file mode 100644 (file)
index 0000000..bf6478c
--- /dev/null
@@ -0,0 +1,39 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Wed, 30 Nov 2016 21:47:09 +0100
+Subject: [PATCH] batman-adv: Check for alloc errors when preparing TT local data
+
+batadv_tt_prepare_tvlv_local_data can fail to allocate the memory for the
+new TVLV block. The caller is informed about this problem with the returned
+length of 0. Not checking this value results in an invalid memory access
+when either tt_data or tt_change is accessed.
+
+Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
+Fixes: 21a57f6e7a3b ("batman-adv: make the TT CRC logic VLAN specific")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
+---
+ net/batman-adv/translation-table.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
+index 7f66309..0dc85eb 100644
+--- a/net/batman-adv/translation-table.c
++++ b/net/batman-adv/translation-table.c
+@@ -3282,7 +3282,7 @@ static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv,
+                                                            &tvlv_tt_data,
+                                                            &tt_change,
+                                                            &tt_len);
+-              if (!tt_len)
++              if (!tt_len || !tvlv_len)
+                       goto unlock;
+               /* Copy the last orig_node's OGM buffer */
+@@ -3300,7 +3300,7 @@ static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv,
+                                                            &tvlv_tt_data,
+                                                            &tt_change,
+                                                            &tt_len);
+-              if (!tt_len)
++              if (!tt_len || !tvlv_len)
+                       goto out;
+               /* fill the rest of the tvlv with the real TT entries */