+++ /dev/null
-From: Sven Eckelmann <sven@narfation.org>
-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),
- };
--- /dev/null
+From: Sven Eckelmann <sven@narfation.org>
+Date: Fri, 14 May 2021 19:34:35 +0200
+Subject: batman-adv: Fix build of multicast code against Linux < 5.13
+
+Fixes: 007b4c4b031f ("batman-adv: convert ifmcaddr6 to RCU")
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+
+--- a/net/batman-adv/multicast.c
++++ b/net/batman-adv/multicast.c
+@@ -422,9 +422,14 @@ batadv_mcast_mla_softif_get_ipv6(struct
+ return 0;
+ }
+
++#if LINUX_VERSION_IS_LESS(5, 13, 0)
++ read_lock_bh(&in6_dev->lock);
++ for (pmc6 = in6_dev->mc_list; pmc6; pmc6 = pmc6->next) {
++#else
+ for (pmc6 = rcu_dereference(in6_dev->mc_list);
+ pmc6;
+ pmc6 = rcu_dereference(pmc6->next)) {
++#endif
+ if (IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) <
+ IPV6_ADDR_SCOPE_LINKLOCAL)
+ continue;
+@@ -453,6 +458,9 @@ batadv_mcast_mla_softif_get_ipv6(struct
+ hlist_add_head(&new->list, mcast_list);
+ ret++;
+ }
++#if LINUX_VERSION_IS_LESS(5, 13, 0)
++ read_unlock_bh(&in6_dev->lock);
++#endif
+ rcu_read_unlock();
+
+ return ret;
+++ /dev/null
-From: Sven Eckelmann <sven@narfation.org>
-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 <sven@narfation.org>
-
---- 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 <linux/version.h>
--#if LINUX_VERSION_IS_GEQ(5, 10, 0)
--#include_next <linux/minmax.h>
--#else
--#include <linux/kernel.h>
--#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 <linux/jiffies.h>
- #include <linux/kref.h>
- #include <linux/list.h>
--#include <linux/minmax.h>
- #include <linux/netdevice.h>
- #include <linux/netlink.h>
- #include <linux/rculist.h>
---- a/net/batman-adv/bat_v_elp.c
-+++ b/net/batman-adv/bat_v_elp.c
-@@ -18,7 +18,6 @@
- #include <linux/jiffies.h>
- #include <linux/kernel.h>
- #include <linux/kref.h>
--#include <linux/minmax.h>
- #include <linux/netdevice.h>
- #include <linux/nl80211.h>
- #include <linux/prandom.h>
---- a/net/batman-adv/bat_v_ogm.c
-+++ b/net/batman-adv/bat_v_ogm.c
-@@ -18,7 +18,6 @@
- #include <linux/kref.h>
- #include <linux/list.h>
- #include <linux/lockdep.h>
--#include <linux/minmax.h>
- #include <linux/mutex.h>
- #include <linux/netdevice.h>
- #include <linux/prandom.h>
---- a/net/batman-adv/fragmentation.c
-+++ b/net/batman-adv/fragmentation.c
-@@ -14,8 +14,8 @@
- #include <linux/gfp.h>
- #include <linux/if_ether.h>
- #include <linux/jiffies.h>
-+#include <linux/kernel.h>
- #include <linux/lockdep.h>
--#include <linux/minmax.h>
- #include <linux/netdevice.h>
- #include <linux/skbuff.h>
- #include <linux/slab.h>
---- a/net/batman-adv/hard-interface.c
-+++ b/net/batman-adv/hard-interface.c
-@@ -17,7 +17,6 @@
- #include <linux/kref.h>
- #include <linux/limits.h>
- #include <linux/list.h>
--#include <linux/minmax.h>
- #include <linux/mutex.h>
- #include <linux/netdevice.h>
- #include <linux/printk.h>
---- a/net/batman-adv/main.c
-+++ b/net/batman-adv/main.c
-@@ -23,7 +23,6 @@
- #include <linux/kobject.h>
- #include <linux/kref.h>
- #include <linux/list.h>
--#include <linux/minmax.h>
- #include <linux/module.h>
- #include <linux/netdevice.h>
- #include <linux/printk.h>
---- a/net/batman-adv/netlink.c
-+++ b/net/batman-adv/netlink.c
-@@ -23,7 +23,6 @@
- #include <linux/kernel.h>
- #include <linux/limits.h>
- #include <linux/list.h>
--#include <linux/minmax.h>
- #include <linux/netdevice.h>
- #include <linux/netlink.h>
- #include <linux/printk.h>
---- a/net/batman-adv/tp_meter.c
-+++ b/net/batman-adv/tp_meter.c
-@@ -23,7 +23,6 @@
- #include <linux/kthread.h>
- #include <linux/limits.h>
- #include <linux/list.h>
--#include <linux/minmax.h>
- #include <linux/netdevice.h>
- #include <linux/param.h>
- #include <linux/printk.h>
--- /dev/null
+From: Sven Eckelmann <sven@narfation.org>
+Date: Tue, 14 Sep 2021 21:02:10 +0200
+Subject: Revert "batman-adv: Switch to kstrtox.h for kstrtou64"
+
+This header is only available after Linux 5.14
+
+This reverts commit c9a69cb4048ebef3a4d91835669011a26d9b7dab.
+
+--- a/net/batman-adv/gateway_common.c
++++ b/net/batman-adv/gateway_common.c
+@@ -10,7 +10,7 @@
+ #include <linux/atomic.h>
+ #include <linux/byteorder/generic.h>
+ #include <linux/errno.h>
+-#include <linux/kstrtox.h>
++#include <linux/kernel.h>
+ #include <linux/limits.h>
+ #include <linux/math64.h>
+ #include <linux/netdevice.h>
--- /dev/null
+From: Sven Eckelmann <sven@narfation.org>
+Date: Tue, 14 Sep 2021 21:07:34 +0200
+Subject: Revert "batman-adv: use Linux's stdarg.h"
+
+This header is only available since Linux 5.15
+
+This reverts commit 36d059797a14f0e373fdc3c79df7b467435925ad.
+
+--- a/net/batman-adv/log.c
++++ b/net/batman-adv/log.c
+@@ -7,7 +7,7 @@
+ #include "log.h"
+ #include "main.h"
+
+-#include <linux/stdarg.h>
++#include <stdarg.h>
+
+ #include "trace.h"
+
+++ /dev/null
-From: Sven Eckelmann <sven@narfation.org>
-Date: Fri, 14 May 2021 19:34:35 +0200
-Subject: batman-adv: Fix build of multicast code against Linux < 5.13
-
-Fixes: 007b4c4b031f ("batman-adv: convert ifmcaddr6 to RCU")
-Signed-off-by: Sven Eckelmann <sven@narfation.org>
-
---- a/net/batman-adv/multicast.c
-+++ b/net/batman-adv/multicast.c
-@@ -422,9 +422,14 @@ batadv_mcast_mla_softif_get_ipv6(struct
- return 0;
- }
-
-+#if LINUX_VERSION_IS_LESS(5, 13, 0)
-+ read_lock_bh(&in6_dev->lock);
-+ for (pmc6 = in6_dev->mc_list; pmc6; pmc6 = pmc6->next) {
-+#else
- for (pmc6 = rcu_dereference(in6_dev->mc_list);
- pmc6;
- pmc6 = rcu_dereference(pmc6->next)) {
-+#endif
- if (IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) <
- IPV6_ADDR_SCOPE_LINKLOCAL)
- continue;
-@@ -453,6 +458,9 @@ batadv_mcast_mla_softif_get_ipv6(struct
- hlist_add_head(&new->list, mcast_list);
- ret++;
- }
-+#if LINUX_VERSION_IS_LESS(5, 13, 0)
-+ read_unlock_bh(&in6_dev->lock);
-+#endif
- rcu_read_unlock();
-
- return ret;
+++ /dev/null
-From: Sven Eckelmann <sven@narfation.org>
-Date: Tue, 14 Sep 2021 21:02:10 +0200
-Subject: Revert "batman-adv: Switch to kstrtox.h for kstrtou64"
-
-This header is only available after Linux 5.14
-
-This reverts commit c9a69cb4048ebef3a4d91835669011a26d9b7dab.
-
---- a/net/batman-adv/gateway_common.c
-+++ b/net/batman-adv/gateway_common.c
-@@ -10,7 +10,7 @@
- #include <linux/atomic.h>
- #include <linux/byteorder/generic.h>
- #include <linux/errno.h>
--#include <linux/kstrtox.h>
-+#include <linux/kernel.h>
- #include <linux/limits.h>
- #include <linux/math64.h>
- #include <linux/netdevice.h>
--- /dev/null
+From: Eric Dumazet <edumazet@google.com>
+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 <edumazet@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+[sven@narfation.org: Add ugly hack to get it building with old kernels]
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+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;
+++ /dev/null
-From: Sven Eckelmann <sven@narfation.org>
-Date: Tue, 14 Sep 2021 21:07:34 +0200
-Subject: Revert "batman-adv: use Linux's stdarg.h"
-
-This header is only available since Linux 5.15
-
-This reverts commit 36d059797a14f0e373fdc3c79df7b467435925ad.
-
---- a/net/batman-adv/log.c
-+++ b/net/batman-adv/log.c
-@@ -7,7 +7,7 @@
- #include "log.h"
- #include "main.h"
-
--#include <linux/stdarg.h>
-+#include <stdarg.h>
-
- #include "trace.h"
-
--- /dev/null
+From: Sven Eckelmann <sven@narfation.org>
+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 <sven@narfation.org>
+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)
+++ /dev/null
-From: Eric Dumazet <edumazet@google.com>
-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 <edumazet@google.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-[sven@narfation.org: Add ugly hack to get it building with old kernels]
-Signed-off-by: Sven Eckelmann <sven@narfation.org>
-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;
+++ /dev/null
-From: Sven Eckelmann <sven@narfation.org>
-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 <sven@narfation.org>
-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)