From b65a8ca03aecb5ebe018aa86f373a15fd05e9f8c Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Fri, 6 May 2022 21:51:41 +0200 Subject: [PATCH] batman-adv: update to version 2022.1 * support latest kernels (4.9 - 5.18) * bugs squashed: - resolve "time-of-check-time-of-use" race condition when checking the network namespace of a lower device - fix sanity check of network devices in different namespaces with colliding IDs - prevent transmission errors after splitting large GRO packets into smaller fragments Signed-off-by: Sven Eckelmann --- batman-adv/Makefile | 4 +- ...uild-of-multicast-code-against-Linux.patch | 4 +- ...-adv-Migrate-to-linux-container_of.h.patch | 269 ++++++++++++++++++ ...batman-adv-make-mc_forwarding-atomic.patch | 27 -- ...t-Add-atomic-mc_fowarding-support-fo.patch | 23 -- batman-adv/src/compat-hacks.h | 13 + 6 files changed, 286 insertions(+), 54 deletions(-) create mode 100644 batman-adv/patches/0004-Revert-batman-adv-Migrate-to-linux-container_of.h.patch delete mode 100644 batman-adv/patches/0004-batman-adv-make-mc_forwarding-atomic.patch delete mode 100644 batman-adv/patches/0005-batman-adv-compat-Add-atomic-mc_fowarding-support-fo.patch diff --git a/batman-adv/Makefile b/batman-adv/Makefile index 3ec2321..55468d3 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -3,12 +3,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2022.0 +PKG_VERSION:=2022.1 PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) -PKG_HASH:=49338705bc207709ac84d766688e702571009c827c0a320788ea51fb887714aa +PKG_HASH:=6d041d3530abd4b249abf5a96fc2a2e241431bf9443b547fdb25a2d8fd329a40 PKG_EXTMOD_SUBDIRS:=net/batman-adv PKG_MAINTAINER:=Simon Wunderlich diff --git a/batman-adv/patches/0001-batman-adv-Fix-build-of-multicast-code-against-Linux.patch b/batman-adv/patches/0001-batman-adv-Fix-build-of-multicast-code-against-Linux.patch index 6fecb6c..4a84f5f 100644 --- a/batman-adv/patches/0001-batman-adv-Fix-build-of-multicast-code-against-Linux.patch +++ b/batman-adv/patches/0001-batman-adv-Fix-build-of-multicast-code-against-Linux.patch @@ -7,7 +7,7 @@ Signed-off-by: Sven Eckelmann --- a/net/batman-adv/multicast.c +++ b/net/batman-adv/multicast.c -@@ -422,9 +422,14 @@ batadv_mcast_mla_softif_get_ipv6(struct +@@ -431,9 +431,14 @@ batadv_mcast_mla_softif_get_ipv6(struct return 0; } @@ -22,7 +22,7 @@ Signed-off-by: Sven Eckelmann if (IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) < IPV6_ADDR_SCOPE_LINKLOCAL) continue; -@@ -453,6 +458,9 @@ batadv_mcast_mla_softif_get_ipv6(struct +@@ -462,6 +467,9 @@ batadv_mcast_mla_softif_get_ipv6(struct hlist_add_head(&new->list, mcast_list); ret++; } diff --git a/batman-adv/patches/0004-Revert-batman-adv-Migrate-to-linux-container_of.h.patch b/batman-adv/patches/0004-Revert-batman-adv-Migrate-to-linux-container_of.h.patch new file mode 100644 index 0000000..a217ba6 --- /dev/null +++ b/batman-adv/patches/0004-Revert-batman-adv-Migrate-to-linux-container_of.h.patch @@ -0,0 +1,269 @@ +From: Sven Eckelmann +Date: Fri, 6 May 2022 22:03:29 +0200 +Subject: Revert "batman-adv: Migrate to linux/container_of.h" + +This reverts commit 043ae5634bdfd4c4dd8b95a22890752495080bb5. + +--- a/compat-include/linux/container_of.h ++++ /dev/null +@@ -1,20 +0,0 @@ +-/* SPDX-License-Identifier: GPL-2.0 */ +-/* Copyright (C) B.A.T.M.A.N. contributors: +- * +- * Marek Lindner, Simon Wunderlich +- * +- * This file contains macros for maintaining compatibility with older versions +- * of the Linux kernel. +- */ +- +-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_CONTAINER_OF_H_ +-#define _NET_BATMAN_ADV_COMPAT_LINUX_CONTAINER_OF_H_ +- +-#include +-#if LINUX_VERSION_IS_GEQ(5, 16, 0) +-#include_next +-#else +-#include +-#endif +- +-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_CONTAINER_OF_H_ */ +--- a/net/batman-adv/bat_iv_ogm.c ++++ b/net/batman-adv/bat_iv_ogm.c +@@ -13,13 +13,13 @@ + #include + #include + #include +-#include + #include + #include + #include + #include + #include + #include ++#include + #include + #include + #include +--- a/net/batman-adv/bat_v_elp.c ++++ b/net/batman-adv/bat_v_elp.c +@@ -10,13 +10,13 @@ + #include + #include + #include +-#include + #include + #include + #include + #include + #include + #include ++#include + #include + #include + #include +--- a/net/batman-adv/bat_v_ogm.c ++++ b/net/batman-adv/bat_v_ogm.c +@@ -9,12 +9,12 @@ + + #include + #include +-#include + #include + #include + #include + #include + #include ++#include + #include + #include + #include +--- a/net/batman-adv/bridge_loop_avoidance.c ++++ b/net/batman-adv/bridge_loop_avoidance.c +@@ -10,7 +10,6 @@ + #include + #include + #include +-#include + #include + #include + #include +--- a/net/batman-adv/distributed-arp-table.c ++++ b/net/batman-adv/distributed-arp-table.c +@@ -11,7 +11,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -21,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +--- a/net/batman-adv/gateway_client.c ++++ b/net/batman-adv/gateway_client.c +@@ -9,7 +9,6 @@ + + #include + #include +-#include + #include + #include + #include +--- a/net/batman-adv/hard-interface.c ++++ b/net/batman-adv/hard-interface.c +@@ -9,11 +9,11 @@ + + #include + #include +-#include + #include + #include + #include + #include ++#include + #include + #include + #include +--- a/net/batman-adv/main.c ++++ b/net/batman-adv/main.c +@@ -9,7 +9,6 @@ + #include + #include + #include +-#include + #include + #include + #include +--- a/net/batman-adv/multicast.c ++++ b/net/batman-adv/multicast.c +@@ -11,7 +11,6 @@ + #include + #include + #include +-#include + #include + #include + #include +--- a/net/batman-adv/network-coding.c ++++ b/net/batman-adv/network-coding.c +@@ -11,7 +11,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -20,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +--- a/net/batman-adv/originator.c ++++ b/net/batman-adv/originator.c +@@ -8,11 +8,11 @@ + #include "main.h" + + #include +-#include + #include + #include + #include + #include ++#include + #include + #include + #include +--- a/net/batman-adv/send.c ++++ b/net/batman-adv/send.c +@@ -10,13 +10,13 @@ + #include + #include + #include +-#include + #include + #include + #include + #include + #include + #include ++#include + #include + #include + #include +--- a/net/batman-adv/soft-interface.c ++++ b/net/batman-adv/soft-interface.c +@@ -11,7 +11,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -20,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +--- a/net/batman-adv/tp_meter.c ++++ b/net/batman-adv/tp_meter.c +@@ -12,13 +12,13 @@ + #include + #include + #include +-#include + #include + #include + #include + #include + #include + #include ++#include + #include + #include + #include +--- a/net/batman-adv/translation-table.c ++++ b/net/batman-adv/translation-table.c +@@ -13,7 +13,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -22,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include +--- a/net/batman-adv/tvlv.c ++++ b/net/batman-adv/tvlv.c +@@ -7,10 +7,10 @@ + #include "main.h" + + #include +-#include + #include + #include + #include ++#include + #include + #include + #include diff --git a/batman-adv/patches/0004-batman-adv-make-mc_forwarding-atomic.patch b/batman-adv/patches/0004-batman-adv-make-mc_forwarding-atomic.patch deleted file mode 100644 index d72882e..0000000 --- a/batman-adv/patches/0004-batman-adv-make-mc_forwarding-atomic.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Eric Dumazet -Date: Wed, 2 Mar 2022 20:05:13 +0100 -Subject: batman-adv: make mc_forwarding atomic - -This fixes minor data-races in ip6_mc_input() and -batadv_mcast_mla_rtr_flags_softif_get_ipv6() - -Signed-off-by: Eric Dumazet -Signed-off-by: David S. Miller -[sven@narfation.org: Add ugly hack to get it building with old kernels] -Signed-off-by: Sven Eckelmann -Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/56db7c0540e733a1f063ccd6bab1b537a80857eb - ---- a/net/batman-adv/multicast.c -+++ b/net/batman-adv/multicast.c -@@ -134,7 +134,11 @@ static u8 batadv_mcast_mla_rtr_flags_sof - { - struct inet6_dev *in6_dev = __in6_dev_get(dev); - -+#if LINUX_VERSION_IS_GEQ(5, 18, 0) // UGLY_HACK_NEW -+ if (in6_dev && atomic_read(&in6_dev->cnf.mc_forwarding)) -+#else // UGLY_HACK_OLD - if (in6_dev && in6_dev->cnf.mc_forwarding) -+#endif // UGLY_HACK_STOP - return BATADV_NO_FLAGS; - else - return BATADV_MCAST_WANT_NO_RTR6; diff --git a/batman-adv/patches/0005-batman-adv-compat-Add-atomic-mc_fowarding-support-fo.patch b/batman-adv/patches/0005-batman-adv-compat-Add-atomic-mc_fowarding-support-fo.patch deleted file mode 100644 index 9d5f0ac..0000000 --- a/batman-adv/patches/0005-batman-adv-compat-Add-atomic-mc_fowarding-support-fo.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Sven Eckelmann -Date: Fri, 15 Apr 2022 15:12:45 +0200 -Subject: batman-adv: compat: Add atomic mc_fowarding support for stable kernels - -Fixes: 56db7c0540e7 ("batman-adv: make mc_forwarding atomic") -Signed-off-by: Sven Eckelmann -Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/350adcaec82fbaa358a2406343b6130ac8dad126 - ---- a/net/batman-adv/multicast.c -+++ b/net/batman-adv/multicast.c -@@ -134,7 +134,11 @@ static u8 batadv_mcast_mla_rtr_flags_sof - { - struct inet6_dev *in6_dev = __in6_dev_get(dev); - --#if LINUX_VERSION_IS_GEQ(5, 18, 0) // UGLY_HACK_NEW -+#if (LINUX_VERSION_IS_GEQ(5, 4, 189) && LINUX_VERSION_IS_LESS(5, 5, 0)) || /* UGLY_HACK */ \ -+ (LINUX_VERSION_IS_GEQ(5, 10, 111) && LINUX_VERSION_IS_LESS(5, 11, 0)) || /* UGLY_HACK */ \ -+ (LINUX_VERSION_IS_GEQ(5, 15, 34) && LINUX_VERSION_IS_LESS(5, 16, 0)) || /* UGLY_HACK */ \ -+ (LINUX_VERSION_IS_GEQ(5, 16, 20) && LINUX_VERSION_IS_LESS(5, 17, 0)) || /* UGLY_HACK */ \ -+ LINUX_VERSION_IS_GEQ(5, 17, 3) // UGLY_HACK_NEW - if (in6_dev && atomic_read(&in6_dev->cnf.mc_forwarding)) - #else // UGLY_HACK_OLD - if (in6_dev && in6_dev->cnf.mc_forwarding) diff --git a/batman-adv/src/compat-hacks.h b/batman-adv/src/compat-hacks.h index 74107b6..8b8ac53 100644 --- a/batman-adv/src/compat-hacks.h +++ b/batman-adv/src/compat-hacks.h @@ -59,6 +59,19 @@ static inline void batadv_eth_hw_addr_set(struct net_device *dev, #endif /* LINUX_VERSION_IS_LESS(5, 15, 0) */ +#if LINUX_VERSION_IS_LESS(5, 18, 0) + +static inline int batadv_netif_rx(struct sk_buff *skb) +{ + if (in_interrupt()) + return netif_rx(skb); + else + return netif_rx_ni(skb); +} +#define netif_rx batadv_netif_rx + +#endif /* LINUX_VERSION_IS_LESS(5, 18, 0) */ + /* */ #include -- 2.30.2