From c244e3f5320f384962544536061f85ba42ec3608 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Sun, 17 Apr 2022 13:36:52 +0200 Subject: [PATCH 1/7] batman-adv: Drop unused compat patches The minimal kernel version in OpenWrt is now Linux 5.10.111. It already provides various thing which needed special patches on older versions. Signed-off-by: Sven Eckelmann --- ...v-genetlink-move-to-smaller-ops-wher.patch | 128 ------------------ ...ild-of-multicast-code-against-Linux.patch} | 0 ...v-Add-new-include-for-min-max-helper.patch | 116 ---------------- ...v-Switch-to-kstrtox.h-for-kstrtou64.patch} | 0 ...ert-batman-adv-use-Linux-s-stdarg.h.patch} | 0 ...atman-adv-make-mc_forwarding-atomic.patch} | 0 ...-Add-atomic-mc_fowarding-support-fo.patch} | 0 7 files changed, 244 deletions(-) delete mode 100644 batman-adv/patches/0001-Revert-batman-adv-genetlink-move-to-smaller-ops-wher.patch rename batman-adv/patches/{0003-batman-adv-Fix-build-of-multicast-code-against-Linux.patch => 0001-batman-adv-Fix-build-of-multicast-code-against-Linux.patch} (100%) delete mode 100644 batman-adv/patches/0002-Revert-batman-adv-Add-new-include-for-min-max-helper.patch rename batman-adv/patches/{0004-Revert-batman-adv-Switch-to-kstrtox.h-for-kstrtou64.patch => 0002-Revert-batman-adv-Switch-to-kstrtox.h-for-kstrtou64.patch} (100%) rename batman-adv/patches/{0005-Revert-batman-adv-use-Linux-s-stdarg.h.patch => 0003-Revert-batman-adv-use-Linux-s-stdarg.h.patch} (100%) rename batman-adv/patches/{0006-batman-adv-make-mc_forwarding-atomic.patch => 0004-batman-adv-make-mc_forwarding-atomic.patch} (100%) rename batman-adv/patches/{0007-batman-adv-compat-Add-atomic-mc_fowarding-support-fo.patch => 0005-batman-adv-compat-Add-atomic-mc_fowarding-support-fo.patch} (100%) diff --git a/batman-adv/patches/0001-Revert-batman-adv-genetlink-move-to-smaller-ops-wher.patch b/batman-adv/patches/0001-Revert-batman-adv-genetlink-move-to-smaller-ops-wher.patch deleted file mode 100644 index 68187b0..0000000 --- a/batman-adv/patches/0001-Revert-batman-adv-genetlink-move-to-smaller-ops-wher.patch +++ /dev/null @@ -1,128 +0,0 @@ -From: Sven Eckelmann -Date: Sat, 24 Oct 2020 22:51:23 +0200 -Subject: Revert "batman-adv: genetlink: move to smaller ops wherever possible" - -The netlink genl_ops interface was splitted into two parts for Linux 5.10. -The batman-adv code changed to the new one because it doesn't use the more -complex policy handling of genl_ops. But the backports-5.8-1 version in -OpenWrt doesn't yet support the new genl_small_ops. - -This patch must be dropped directly when OpenWrt switches to backports-5.10 -or newer - otherwise it will not work as expected. - -This reverts commit 725b4ef5be840cfcd0ca33b9393c14dee40c10f7. - ---- a/compat-include/net/genetlink.h -+++ b/compat-include/net/genetlink.h -@@ -31,17 +31,15 @@ void batadv_genl_dump_check_consistent(s - #endif /* LINUX_VERSION_IS_LESS(4, 15, 0) */ - - --#if LINUX_VERSION_IS_LESS(5, 10, 0) -- - #if LINUX_VERSION_IS_LESS(5, 2, 0) -+ - enum genl_validate_flags { - GENL_DONT_VALIDATE_STRICT = BIT(0), - GENL_DONT_VALIDATE_DUMP = BIT(1), - GENL_DONT_VALIDATE_DUMP_STRICT = BIT(2), - }; --#endif /* LINUX_VERSION_IS_LESS(5, 2, 0) */ - --struct batadv_genl_small_ops { -+struct batadv_genl_ops { - int (*doit)(struct sk_buff *skb, - struct genl_info *info); - int (*dumpit)(struct sk_buff *skb, -@@ -70,9 +68,9 @@ struct batadv_genl_family { - struct genl_info *info); - void (*post_doit)(const struct genl_ops *ops, struct sk_buff *skb, - struct genl_info *info); -- const struct batadv_genl_small_ops *small_ops; -+ const struct batadv_genl_ops *ops; - const struct genl_multicast_group *mcgrps; -- unsigned int n_small_ops; -+ unsigned int n_ops; - unsigned int n_mcgrps; - struct module *module; - -@@ -96,32 +94,24 @@ static inline int batadv_genl_register_f - family->family.pre_doit = family->pre_doit; - family->family.post_doit = family->post_doit; - family->family.mcgrps = family->mcgrps; -- family->family.n_ops = family->n_small_ops; -+ family->family.n_ops = family->n_ops; - family->family.n_mcgrps = family->n_mcgrps; - family->family.module = family->module; - -- ops = kzalloc(sizeof(*ops) * family->n_small_ops, GFP_KERNEL); -+ ops = kzalloc(sizeof(*ops) * family->n_ops, GFP_KERNEL); - if (!ops) - return -ENOMEM; - - for (i = 0; i < family->family.n_ops; i++) { -- ops[i].doit = family->small_ops[i].doit; -- ops[i].dumpit = family->small_ops[i].dumpit; -- ops[i].done = family->small_ops[i].done; -- ops[i].cmd = family->small_ops[i].cmd; -- ops[i].internal_flags = family->small_ops[i].internal_flags; -- ops[i].flags = family->small_ops[i].flags; --#if LINUX_VERSION_IS_GEQ(5, 2, 0) -- ops[i].validate = family->small_ops[i].validate; --#else -+ ops[i].doit = family->ops[i].doit; -+ ops[i].dumpit = family->ops[i].dumpit; -+ ops[i].done = family->ops[i].done; -+ ops[i].cmd = family->ops[i].cmd; -+ ops[i].internal_flags = family->ops[i].internal_flags; -+ ops[i].flags = family->ops[i].flags; - ops[i].policy = family->policy; --#endif - } - --#if LINUX_VERSION_IS_GEQ(5, 2, 0) -- family->family.policy = family->policy; --#endif -- - family->family.ops = ops; - family->copy_ops = ops; - -@@ -136,7 +126,7 @@ typedef struct genl_ops batadv_genl_ops_ - #define batadv_post_doit(__x, __y, __z) \ - batadv_post_doit(const batadv_genl_ops_old *ops, __y, __z) - --#define genl_small_ops batadv_genl_small_ops -+#define genl_ops batadv_genl_ops - #define genl_family batadv_genl_family - - #define genl_register_family(family) \ -@@ -160,6 +150,6 @@ batadv_genl_unregister_family(struct bat - genlmsg_multicast_netns(&(_family)->family, _net, _skb, _portid, \ - _group, _flags) - --#endif /* LINUX_VERSION_IS_LESS(5, 10, 0) */ -+#endif /* LINUX_VERSION_IS_LESS(5, 2, 0) */ - - #endif /* _NET_BATMAN_ADV_COMPAT_NET_GENETLINK_H_ */ ---- a/net/batman-adv/netlink.c -+++ b/net/batman-adv/netlink.c -@@ -1357,7 +1357,7 @@ static void batadv_post_doit(const struc - } - } - --static const struct genl_small_ops batadv_netlink_ops[] = { -+static const struct genl_ops batadv_netlink_ops[] = { - { - .cmd = BATADV_CMD_GET_MESH, - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -@@ -1491,8 +1491,8 @@ struct genl_family batadv_netlink_family - .pre_doit = batadv_pre_doit, - .post_doit = batadv_post_doit, - .module = THIS_MODULE, -- .small_ops = batadv_netlink_ops, -- .n_small_ops = ARRAY_SIZE(batadv_netlink_ops), -+ .ops = batadv_netlink_ops, -+ .n_ops = ARRAY_SIZE(batadv_netlink_ops), - .mcgrps = batadv_netlink_mcgrps, - .n_mcgrps = ARRAY_SIZE(batadv_netlink_mcgrps), - }; diff --git a/batman-adv/patches/0003-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 similarity index 100% rename from batman-adv/patches/0003-batman-adv-Fix-build-of-multicast-code-against-Linux.patch rename to batman-adv/patches/0001-batman-adv-Fix-build-of-multicast-code-against-Linux.patch diff --git a/batman-adv/patches/0002-Revert-batman-adv-Add-new-include-for-min-max-helper.patch b/batman-adv/patches/0002-Revert-batman-adv-Add-new-include-for-min-max-helper.patch deleted file mode 100644 index 6f4b56f..0000000 --- a/batman-adv/patches/0002-Revert-batman-adv-Add-new-include-for-min-max-helper.patch +++ /dev/null @@ -1,116 +0,0 @@ -From: Sven Eckelmann -Date: Thu, 28 Jan 2021 21:06:51 +0100 -Subject: Revert "batman-adv: Add new include for min/max helpers" - -The OpenWrt kernel sources and backports sources are currently missing this -header. - -This reverts commit 1810de05310d5c5e9140f870ac21052f38bc06b8. - -Signed-off-by: Sven Eckelmann - ---- a/compat-include/linux/minmax.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_MINMAX_H_ --#define _NET_BATMAN_ADV_COMPAT_LINUX_MINMAX_H_ -- --#include --#if LINUX_VERSION_IS_GEQ(5, 10, 0) --#include_next --#else --#include --#endif -- --#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_MINMAX_H_ */ ---- a/net/batman-adv/bat_v.c -+++ b/net/batman-adv/bat_v.c -@@ -15,7 +15,6 @@ - #include - #include - #include --#include - #include - #include - #include ---- a/net/batman-adv/bat_v_elp.c -+++ b/net/batman-adv/bat_v_elp.c -@@ -18,7 +18,6 @@ - #include - #include - #include --#include - #include - #include - #include ---- a/net/batman-adv/bat_v_ogm.c -+++ b/net/batman-adv/bat_v_ogm.c -@@ -18,7 +18,6 @@ - #include - #include - #include --#include - #include - #include - #include ---- a/net/batman-adv/fragmentation.c -+++ b/net/batman-adv/fragmentation.c -@@ -14,8 +14,8 @@ - #include - #include - #include -+#include - #include --#include - #include - #include - #include ---- a/net/batman-adv/hard-interface.c -+++ b/net/batman-adv/hard-interface.c -@@ -17,7 +17,6 @@ - #include - #include - #include --#include - #include - #include - #include ---- a/net/batman-adv/main.c -+++ b/net/batman-adv/main.c -@@ -23,7 +23,6 @@ - #include - #include - #include --#include - #include - #include - #include ---- a/net/batman-adv/netlink.c -+++ b/net/batman-adv/netlink.c -@@ -23,7 +23,6 @@ - #include - #include - #include --#include - #include - #include - #include ---- a/net/batman-adv/tp_meter.c -+++ b/net/batman-adv/tp_meter.c -@@ -23,7 +23,6 @@ - #include - #include - #include --#include - #include - #include - #include diff --git a/batman-adv/patches/0004-Revert-batman-adv-Switch-to-kstrtox.h-for-kstrtou64.patch b/batman-adv/patches/0002-Revert-batman-adv-Switch-to-kstrtox.h-for-kstrtou64.patch similarity index 100% rename from batman-adv/patches/0004-Revert-batman-adv-Switch-to-kstrtox.h-for-kstrtou64.patch rename to batman-adv/patches/0002-Revert-batman-adv-Switch-to-kstrtox.h-for-kstrtou64.patch diff --git a/batman-adv/patches/0005-Revert-batman-adv-use-Linux-s-stdarg.h.patch b/batman-adv/patches/0003-Revert-batman-adv-use-Linux-s-stdarg.h.patch similarity index 100% rename from batman-adv/patches/0005-Revert-batman-adv-use-Linux-s-stdarg.h.patch rename to batman-adv/patches/0003-Revert-batman-adv-use-Linux-s-stdarg.h.patch diff --git a/batman-adv/patches/0006-batman-adv-make-mc_forwarding-atomic.patch b/batman-adv/patches/0004-batman-adv-make-mc_forwarding-atomic.patch similarity index 100% rename from batman-adv/patches/0006-batman-adv-make-mc_forwarding-atomic.patch rename to batman-adv/patches/0004-batman-adv-make-mc_forwarding-atomic.patch diff --git a/batman-adv/patches/0007-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 similarity index 100% rename from batman-adv/patches/0007-batman-adv-compat-Add-atomic-mc_fowarding-support-fo.patch rename to batman-adv/patches/0005-batman-adv-compat-Add-atomic-mc_fowarding-support-fo.patch From d7e8be6c8e594de3931a6f288794c4dad2383d14 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Fri, 6 May 2022 21:51:41 +0200 Subject: [PATCH 2/7] 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 99a1bb3..0f8fac8 100644 --- a/batman-adv/src/compat-hacks.h +++ b/batman-adv/src/compat-hacks.h @@ -103,6 +103,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 From 95fa02543ac03932214b980192bb3c7380d37265 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 12 May 2022 14:29:10 +0200 Subject: [PATCH 3/7] batman-adv: Fix build with kernel 5.15.38 The build failed in this kernel due to some missing implicit includes: build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/batman-adv-2022.1/compat-hacks.h:64:42: warning: 'struct sk_buff' declared inside parameter list will not be visible outside of this definition or declaration 64 | static inline int batadv_netif_rx(struct sk_buff *skb) | ^~~~~~~ build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/batman-adv-2022.1/compat-hacks.h: In function 'batadv_netif_rx': build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/batman-adv-2022.1/compat-hacks.h:66:13: error: implicit declaration of function 'in_interrupt' [-Werror=implicit-function-declaration] 66 | if (in_interrupt()) | ^~~~~~~~~~~~ build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/batman-adv-2022.1/compat-hacks.h:67:24: error: implicit declaration of function 'netif_rx' [-Werror=implicit-function-declaration] 67 | return netif_rx(skb); | ^~~~~~~~ build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/batman-adv-2022.1/compat-hacks.h:69:24: error: implicit declaration of function 'netif_rx_ni' [-Werror=implicit-function-declaration] 69 | return netif_rx_ni(skb); | ^~~~~~~~~~~ In file included from : ./include/linux/netdevice.h: At top level: build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/batman-adv-2022.1/compat-hacks.h:71:18: error: conflicting types for 'batadv_netif_rx'; have 'int(struct sk_buff *)' 71 | #define netif_rx batadv_netif_rx | ^~~~~~~~~~~~~~~ ./include/linux/netdevice.h:4029:5: note: in expansion of macro 'netif_rx' 4029 | int netif_rx(struct sk_buff *skb); | ^~~~~~~~ build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/batman-adv-2022.1/compat-hacks.h:64:19: note: previous definition of 'batadv_netif_rx' with type 'int(struct sk_buff *)' 64 | static inline int batadv_netif_rx(struct sk_buff *skb) | ^~~~~~~~~~~~~~~ cc1: some warnings being treated as errors Reported-by: Chen Minqiang Fixes: b65a8ca03aec ("batman-adv: update to version 2022.1") Signed-off-by: Sven Eckelmann --- batman-adv/src/compat-hacks.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/batman-adv/src/compat-hacks.h b/batman-adv/src/compat-hacks.h index 0f8fac8..237a12a 100644 --- a/batman-adv/src/compat-hacks.h +++ b/batman-adv/src/compat-hacks.h @@ -105,6 +105,8 @@ static inline void batadv_eth_hw_addr_set(struct net_device *dev, #if LINUX_VERSION_IS_LESS(5, 18, 0) +#include + static inline int batadv_netif_rx(struct sk_buff *skb) { if (in_interrupt()) From c5cd57d0d17e77b421b3d36d8662ea9d719a91d0 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Tue, 26 Jul 2022 21:55:40 +0200 Subject: [PATCH 4/7] batman-adv: update to version 2022.2 * support latest kernels (4.9 - 5.19) Signed-off-by: Sven Eckelmann --- batman-adv/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/batman-adv/Makefile b/batman-adv/Makefile index 55468d3..b2367b9 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -3,12 +3,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2022.1 +PKG_VERSION:=2022.2 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:=6d041d3530abd4b249abf5a96fc2a2e241431bf9443b547fdb25a2d8fd329a40 +PKG_HASH:=8aca27c6f168b137a7ed7031d58169396c1a97f958c2ea95b9c30a9b92576fe0 PKG_EXTMOD_SUBDIRS:=net/batman-adv PKG_MAINTAINER:=Simon Wunderlich From 4f841799cff6563bf18ec2f4092258cdf1f04466 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Sun, 23 Oct 2022 09:56:15 +0200 Subject: [PATCH 5/7] batman-adv: Rebuild on CONFIG_BATMAN_ADV_* changes The buildsystem doesn't know that the KernelPackage/*/config kconfig symbols are related to the batman-adv package build. It is necessary to explicitly define it via PKG_CONFIG_DEPENDS. Fixes: 522ce8dfdb7f ("batman-adv: rename folder name to match project & package name") Signed-off-by: Sven Eckelmann --- batman-adv/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/batman-adv/Makefile b/batman-adv/Makefile index b2367b9..8b96177 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -19,6 +19,15 @@ PKG_BUILD_PARALLEL:=1 STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h +PKG_CONFIG_DEPENDS += \ + CONFIG_BATMAN_ADV_BATMAN_V \ + CONFIG_BATMAN_ADV_BLA \ + CONFIG_BATMAN_ADV_DAT \ + CONFIG_BATMAN_ADV_NC \ + CONFIG_BATMAN_ADV_MCAST \ + CONFIG_BATMAN_ADV_DEBUG \ + CONFIG_BATMAN_ADV_TRACING + include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk From 9911ec2012a417cf4d4fecc6606b9c5a650f5061 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 10 Nov 2022 21:14:42 +0100 Subject: [PATCH 6/7] batman-adv: update to version 2022.3 * support latest kernels (4.9 - 6.1) * coding style cleanups and refactoring * bugs squashed: - limit the minimum MTU of hard-interface to avoid "Forced to purge local tt entries" errors Signed-off-by: Sven Eckelmann --- batman-adv/Makefile | 4 ++-- ...evert-batman-adv-Migrate-to-linux-container_of.h.patch | 3 ++- batman-adv/src/compat-hacks.h | 8 ++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/batman-adv/Makefile b/batman-adv/Makefile index 8b96177..1ef5706 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -3,12 +3,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2022.2 +PKG_VERSION:=2022.3 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:=8aca27c6f168b137a7ed7031d58169396c1a97f958c2ea95b9c30a9b92576fe0 +PKG_HASH:=218ffb534fead1c9b5b0d90ec1b2fba688209cdf00e861bece1cbf469fe69953 PKG_EXTMOD_SUBDIRS:=net/batman-adv PKG_MAINTAINER:=Simon Wunderlich 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 index a217ba6..fbf1ef6 100644 --- 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 @@ -117,11 +117,12 @@ This reverts commit 043ae5634bdfd4c4dd8b95a22890752495080bb5. #include --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c -@@ -9,11 +9,11 @@ +@@ -9,12 +9,12 @@ #include #include -#include + #include #include #include #include diff --git a/batman-adv/src/compat-hacks.h b/batman-adv/src/compat-hacks.h index 237a12a..201656f 100644 --- a/batman-adv/src/compat-hacks.h +++ b/batman-adv/src/compat-hacks.h @@ -118,6 +118,14 @@ static inline int batadv_netif_rx(struct sk_buff *skb) #endif /* LINUX_VERSION_IS_LESS(5, 18, 0) */ +#if LINUX_VERSION_IS_LESS(6, 0, 0) + +#define __vstring(item, fmt, ap) __dynamic_array(char, item, 256) +#define __assign_vstr(dst, fmt, va) \ + WARN_ON_ONCE(vsnprintf(__get_dynamic_array(dst), 256, fmt, *va) >= 256) + +#endif /* LINUX_VERSION_IS_LESS(6, 0, 0) */ + /* */ #include From 422aca11320aabfa4ec554a163dd0bf24d6991ec Mon Sep 17 00:00:00 2001 From: 1054009064 <44148148+1054009064@users.noreply.github.com> Date: Sat, 26 Nov 2022 11:28:32 +0800 Subject: [PATCH 7/7] batman-adv: fix build on 5.4 --- ...v-genetlink-move-to-smaller-ops-wher.patch | 168 ++++++++++++++++++ ...uild-of-multicast-code-against-Linux.patch | 111 ++++++++++++ 2 files changed, 279 insertions(+) create mode 100644 batman-adv/patches/998-Revert-batman-adv-genetlink-move-to-smaller-ops-wher.patch create mode 100644 batman-adv/patches/999-batman-adv-Fix-build-of-multicast-code-against-Linux.patch diff --git a/batman-adv/patches/998-Revert-batman-adv-genetlink-move-to-smaller-ops-wher.patch b/batman-adv/patches/998-Revert-batman-adv-genetlink-move-to-smaller-ops-wher.patch new file mode 100644 index 0000000..c2c1025 --- /dev/null +++ b/batman-adv/patches/998-Revert-batman-adv-genetlink-move-to-smaller-ops-wher.patch @@ -0,0 +1,168 @@ +From: Sven Eckelmann +Date: Sat, 24 Oct 2020 22:51:23 +0200 +Subject: Revert "batman-adv: genetlink: move to smaller ops wherever possible" + +The netlink genl_ops interface was splitted into two parts for Linux 5.10. +The batman-adv code changed to the new one because it doesn't use the more +complex policy handling of genl_ops. But the backports-5.8-1 version in +OpenWrt doesn't yet support the new genl_small_ops. + +This patch must be dropped directly when OpenWrt switches to backports-5.10 +or newer - otherwise it will not work as expected. + +This reverts commit 725b4ef5be840cfcd0ca33b9393c14dee40c10f7. + +--- a/compat-include/net/genetlink.h ++++ b/compat-include/net/genetlink.h +@@ -31,17 +31,28 @@ void batadv_genl_dump_check_consistent(s + #endif /* LINUX_VERSION_IS_LESS(4, 15, 0) */ + + ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #if LINUX_VERSION_IS_LESS(5, 10, 0) + ++#endif + #if LINUX_VERSION_IS_LESS(5, 2, 0) ++#if LINUX_VERSION_IS_LESS(5, 10, 0) ++ ++#endif + enum genl_validate_flags { + GENL_DONT_VALIDATE_STRICT = BIT(0), + GENL_DONT_VALIDATE_DUMP = BIT(1), + GENL_DONT_VALIDATE_DUMP_STRICT = BIT(2), + }; ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #endif /* LINUX_VERSION_IS_LESS(5, 2, 0) */ ++#endif + ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + struct batadv_genl_small_ops { ++#else ++struct batadv_genl_ops { ++#endif + int (*doit)(struct sk_buff *skb, + struct genl_info *info); + int (*dumpit)(struct sk_buff *skb, +@@ -70,9 +68,17 @@ struct batadv_genl_family { + struct genl_info *info); + void (*post_doit)(const struct genl_ops *ops, struct sk_buff *skb, + struct genl_info *info); ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + const struct batadv_genl_small_ops *small_ops; ++#else ++ const struct batadv_genl_ops *ops; ++#endif + const struct genl_multicast_group *mcgrps; ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + unsigned int n_small_ops; ++#else ++ unsigned int n_ops; ++#endif + unsigned int n_mcgrps; + struct module *module; + +@@ -96,32 +94,53 @@ static inline int batadv_genl_register_f + family->family.pre_doit = family->pre_doit; + family->family.post_doit = family->post_doit; + family->family.mcgrps = family->mcgrps; ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + family->family.n_ops = family->n_small_ops; ++#else ++ family->family.n_ops = family->n_ops; ++#endif + family->family.n_mcgrps = family->n_mcgrps; + family->family.module = family->module; + ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + ops = kzalloc(sizeof(*ops) * family->n_small_ops, GFP_KERNEL); ++#else ++ ops = kzalloc(sizeof(*ops) * family->n_ops, GFP_KERNEL); ++#endif + if (!ops) + return -ENOMEM; + + for (i = 0; i < family->family.n_ops; i++) { ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + ops[i].doit = family->small_ops[i].doit; + ops[i].dumpit = family->small_ops[i].dumpit; + ops[i].done = family->small_ops[i].done; + ops[i].cmd = family->small_ops[i].cmd; + ops[i].internal_flags = family->small_ops[i].internal_flags; + ops[i].flags = family->small_ops[i].flags; + #if LINUX_VERSION_IS_GEQ(5, 2, 0) + ops[i].validate = family->small_ops[i].validate; + #else ++#else ++ ops[i].doit = family->ops[i].doit; ++ ops[i].dumpit = family->ops[i].dumpit; ++ ops[i].done = family->ops[i].done; ++ ops[i].cmd = family->ops[i].cmd; ++ ops[i].internal_flags = family->ops[i].internal_flags; ++ ops[i].flags = family->ops[i].flags; ++#endif + ops[i].policy = family->policy; ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #endif ++#endif + } + ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #if LINUX_VERSION_IS_GEQ(5, 2, 0) + family->family.policy = family->policy; + #endif + ++#endif + family->family.ops = ops; + family->copy_ops = ops; + +@@ -136,7 +126,11 @@ typedef struct genl_ops batadv_genl_ops_ + #define batadv_post_doit(__x, __y, __z) \ + batadv_post_doit(const batadv_genl_ops_old *ops, __y, __z) + ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #define genl_small_ops batadv_genl_small_ops ++#else ++#define genl_ops batadv_genl_ops ++#endif + #define genl_family batadv_genl_family + + #define genl_register_family(family) \ +@@ -160,6 +150,10 @@ batadv_genl_unregister_family(struct bat + genlmsg_multicast_netns(&(_family)->family, _net, _skb, _portid, \ + _group, _flags) + ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #endif /* LINUX_VERSION_IS_LESS(5, 10, 0) */ ++#else ++#endif /* LINUX_VERSION_IS_LESS(5, 2, 0) */ ++#endif + + #endif /* _NET_BATMAN_ADV_COMPAT_NET_GENETLINK_H_ */ +--- a/net/batman-adv/netlink.c ++++ b/net/batman-adv/netlink.c +@@ -1357,7 +1357,11 @@ static void batadv_post_doit(const struc + } + } + ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + static const struct genl_small_ops batadv_netlink_ops[] = { ++#else ++static const struct genl_ops batadv_netlink_ops[] = { ++#endif + { + .cmd = BATADV_CMD_GET_MESH, + .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, +@@ -1491,8 +1491,13 @@ struct genl_family batadv_netlink_family + .pre_doit = batadv_pre_doit, + .post_doit = batadv_post_doit, + .module = THIS_MODULE, ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + .small_ops = batadv_netlink_ops, + .n_small_ops = ARRAY_SIZE(batadv_netlink_ops), ++#else ++ .ops = batadv_netlink_ops, ++ .n_ops = ARRAY_SIZE(batadv_netlink_ops), ++#endif + #if LINUX_VERSION_IS_GEQ(6, 1, 0) // UGLY_HACK_NEW + .resv_start_op = BATADV_CMD_SET_VLAN + 1, + #endif // UGLY_HACK_STOP diff --git a/batman-adv/patches/999-batman-adv-Fix-build-of-multicast-code-against-Linux.patch b/batman-adv/patches/999-batman-adv-Fix-build-of-multicast-code-against-Linux.patch new file mode 100644 index 0000000..6a3abc4 --- /dev/null +++ b/batman-adv/patches/999-batman-adv-Fix-build-of-multicast-code-against-Linux.patch @@ -0,0 +1,111 @@ +From: Sven Eckelmann +Date: Thu, 28 Jan 2021 21:06:51 +0100 +Subject: Revert "batman-adv: Add new include for min/max helpers" + +The OpenWrt kernel sources and backports sources are currently missing this +header. + +This reverts commit 1810de05310d5c5e9140f870ac21052f38bc06b8. + +Signed-off-by: Sven Eckelmann + +--- a/net/batman-adv/bat_v.c ++++ b/net/batman-adv/bat_v.c +@@ -15,7 +15,9 @@ + #include + #include + #include ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #include ++#endif + #include + #include + #include +--- a/net/batman-adv/bat_v_elp.c ++++ b/net/batman-adv/bat_v_elp.c +@@ -18,7 +18,9 @@ + #include + #include + #include ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #include ++#endif + #include + #include + #include +--- a/net/batman-adv/bat_v_ogm.c ++++ b/net/batman-adv/bat_v_ogm.c +@@ -18,7 +18,9 @@ + #include + #include + #include ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #include ++#endif + #include + #include + #include +--- a/net/batman-adv/fragmentation.c ++++ b/net/batman-adv/fragmentation.c +@@ -14,8 +14,13 @@ + #include + #include + #include ++#if LINUX_VERSION_IS_LESS(5, 10, 0) ++#include ++#endif + #include ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #include ++#endif + #include + #include + #include +--- a/net/batman-adv/hard-interface.c ++++ b/net/batman-adv/hard-interface.c +@@ -17,7 +17,9 @@ + #include + #include + #include ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #include ++#endif + #include + #include + #include +--- a/net/batman-adv/main.c ++++ b/net/batman-adv/main.c +@@ -23,7 +23,9 @@ + #include + #include + #include ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #include ++#endif + #include + #include + #include +--- a/net/batman-adv/netlink.c ++++ b/net/batman-adv/netlink.c +@@ -23,7 +23,9 @@ + #include + #include + #include ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #include ++#endif + #include + #include + #include +--- a/net/batman-adv/tp_meter.c ++++ b/net/batman-adv/tp_meter.c +@@ -23,7 +23,9 @@ + #include + #include + #include ++#if LINUX_VERSION_IS_GEQ(5, 10, 0) + #include ++#endif + #include + #include + #include