batman-adv: bump version

This commit is contained in:
coolsnowwolf 2024-01-26 20:16:26 +08:00
parent 160eae1216
commit 3aefda75ae
9 changed files with 56 additions and 469 deletions

View File

@ -3,12 +3,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=batman-adv
PKG_VERSION:=2022.3
PKG_RELEASE:=$(AUTORELEASE)
PKG_VERSION:=2023.3
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
PKG_HASH:=218ffb534fead1c9b5b0d90ec1b2fba688209cdf00e861bece1cbf469fe69953
PKG_HASH:=f7c6c53e59343c162642cb9b44f1016765d4bf513e039002be612b7a6c1ea36c
PKG_EXTMOD_SUBDIRS:=net/batman-adv
PKG_MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>

View File

@ -117,10 +117,10 @@ This reverts commit 043ae5634bdfd4c4dd8b95a22890752495080bb5.
#include <linux/gfp.h>
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -9,12 +9,12 @@
@@ -10,12 +10,12 @@
#include <linux/atomic.h>
#include <linux/byteorder/generic.h>
#include <linux/compiler.h>
-#include <linux/container_of.h>
#include <linux/errno.h>
#include <linux/gfp.h>

View File

@ -1,34 +0,0 @@
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
@@ -431,9 +431,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;
@@ -462,6 +467,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;

View File

@ -1,19 +0,0 @@
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>

View File

@ -0,0 +1,19 @@
From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Date: Thu, 6 Apr 2023 18:05:50 -0500
Subject: fix batadv_is_cfg80211_netdev
Replace CONFIG_CFG80211 with CPTCFG_CFG80211, which is the correct
macro to use when building under backports.
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -308,8 +308,7 @@ static bool batadv_is_cfg80211_netdev(st
{
if (!net_device)
return false;
-
-#if IS_ENABLED(CONFIG_CFG80211)
+#if IS_ENABLED(CPTCFG_CFG80211)
/* cfg80211 drivers have to set ieee80211_ptr */
if (net_device->ieee80211_ptr)
return true;

View File

@ -1,19 +0,0 @@
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"

View File

@ -1,168 +0,0 @@
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,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

View File

@ -1,111 +0,0 @@
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/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -15,7 +15,9 @@
#include <linux/jiffies.h>
#include <linux/kref.h>
#include <linux/list.h>
+#if LINUX_VERSION_IS_GEQ(5, 10, 0)
#include <linux/minmax.h>
+#endif
#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,9 @@
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/kref.h>
+#if LINUX_VERSION_IS_GEQ(5, 10, 0)
#include <linux/minmax.h>
+#endif
#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,9 @@
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/lockdep.h>
+#if LINUX_VERSION_IS_GEQ(5, 10, 0)
#include <linux/minmax.h>
+#endif
#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,13 @@
#include <linux/gfp.h>
#include <linux/if_ether.h>
#include <linux/jiffies.h>
+#if LINUX_VERSION_IS_LESS(5, 10, 0)
+#include <linux/kernel.h>
+#endif
#include <linux/lockdep.h>
+#if LINUX_VERSION_IS_GEQ(5, 10, 0)
#include <linux/minmax.h>
+#endif
#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,9 @@
#include <linux/kref.h>
#include <linux/limits.h>
#include <linux/list.h>
+#if LINUX_VERSION_IS_GEQ(5, 10, 0)
#include <linux/minmax.h>
+#endif
#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,9 @@
#include <linux/kobject.h>
#include <linux/kref.h>
#include <linux/list.h>
+#if LINUX_VERSION_IS_GEQ(5, 10, 0)
#include <linux/minmax.h>
+#endif
#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,9 @@
#include <linux/kernel.h>
#include <linux/limits.h>
#include <linux/list.h>
+#if LINUX_VERSION_IS_GEQ(5, 10, 0)
#include <linux/minmax.h>
+#endif
#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,9 @@
#include <linux/kthread.h>
#include <linux/limits.h>
#include <linux/list.h>
+#if LINUX_VERSION_IS_GEQ(5, 10, 0)
#include <linux/minmax.h>
+#endif
#include <linux/netdevice.h>
#include <linux/param.h>
#include <linux/printk.h>

View File

@ -5,119 +5,6 @@
#include <linux/version.h> /* LINUX_VERSION_CODE */
#include <linux/types.h>
#if LINUX_VERSION_IS_LESS(5, 10, 0)
#include <linux/if_bridge.h>
struct batadv_br_ip {
union {
__be32 ip4;
#if IS_ENABLED(CONFIG_IPV6)
struct in6_addr ip6;
#endif
} dst;
__be16 proto;
__u16 vid;
};
struct batadv_br_ip_list {
struct list_head list;
struct batadv_br_ip addr;
};
#if 0
/* "static" dropped to force compiler to evaluate it as part of multicast.c
* might need to be added again and then called in some kind of dummy
* compat.c in case this header is included in multiple files.
*/
inline void __batadv_br_ip_list_check(void)
{
BUILD_BUG_ON(sizeof(struct batadv_br_ip_list) != sizeof(struct br_ip_list));
BUILD_BUG_ON(offsetof(struct batadv_br_ip_list, list) != offsetof(struct br_ip_list, list));
BUILD_BUG_ON(offsetof(struct batadv_br_ip_list, addr) != offsetof(struct br_ip_list, addr));
BUILD_BUG_ON(sizeof(struct batadv_br_ip) != sizeof(struct br_ip));
BUILD_BUG_ON(offsetof(struct batadv_br_ip, dst.ip4) != offsetof(struct br_ip, u.ip4));
BUILD_BUG_ON(offsetof(struct batadv_br_ip, dst.ip6) != offsetof(struct br_ip, u.ip6));
BUILD_BUG_ON(offsetof(struct batadv_br_ip, proto) != offsetof(struct br_ip, proto));
BUILD_BUG_ON(offsetof(struct batadv_br_ip, vid) != offsetof(struct br_ip, vid));
}
#endif
#define br_ip batadv_br_ip
#define br_ip_list batadv_br_ip_list
#endif /* LINUX_VERSION_IS_LESS(5, 10, 0) */
#if LINUX_VERSION_IS_LESS(5, 14, 0)
#include <linux/if_bridge.h>
#include <net/addrconf.h>
#if IS_ENABLED(CONFIG_IPV6)
static inline bool
br_multicast_has_router_adjacent(struct net_device *dev, int proto)
{
struct list_head bridge_mcast_list = LIST_HEAD_INIT(bridge_mcast_list);
struct br_ip_list *br_ip_entry, *tmp;
int ret;
if (proto != ETH_P_IPV6)
return true;
ret = br_multicast_list_adjacent(dev, &bridge_mcast_list);
if (ret < 0)
return true;
ret = false;
list_for_each_entry_safe(br_ip_entry, tmp, &bridge_mcast_list, list) {
if (br_ip_entry->addr.proto == htons(ETH_P_IPV6) &&
ipv6_addr_is_ll_all_routers(&br_ip_entry->addr.dst.ip6))
ret = true;
list_del(&br_ip_entry->list);
kfree(br_ip_entry);
}
return ret;
}
#else
static inline bool
br_multicast_has_router_adjacent(struct net_device *dev, int proto)
{
return true;
}
#endif
#endif /* LINUX_VERSION_IS_LESS(5, 14, 0) */
#if LINUX_VERSION_IS_LESS(5, 15, 0)
static inline void batadv_eth_hw_addr_set(struct net_device *dev,
const u8 *addr)
{
ether_addr_copy(dev->dev_addr, addr);
}
#define eth_hw_addr_set batadv_eth_hw_addr_set
#endif /* LINUX_VERSION_IS_LESS(5, 15, 0) */
#if LINUX_VERSION_IS_LESS(5, 18, 0)
#include <linux/netdevice.h>
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) */
#if LINUX_VERSION_IS_LESS(6, 0, 0)
#define __vstring(item, fmt, ap) __dynamic_array(char, item, 256)
@ -126,6 +13,38 @@ static inline int batadv_netif_rx(struct sk_buff *skb)
#endif /* LINUX_VERSION_IS_LESS(6, 0, 0) */
#if LINUX_VERSION_IS_LESS(6, 2, 0)
#include <linux/random.h>
#define genl_split_ops genl_ops
static inline u32 batadv_get_random_u32_below(u32 ep_ro)
{
return prandom_u32_max(ep_ro);
}
#define get_random_u32_below batadv_get_random_u32_below
#endif /* LINUX_VERSION_IS_LESS(6, 2, 0) */
#if LINUX_VERSION_IS_LESS(6, 4, 0) && \
!(LINUX_VERSION_IS_GEQ(5, 10, 205) && LINUX_VERSION_IS_LESS(5, 11, 0)) && \
!(LINUX_VERSION_IS_GEQ(5, 15, 144) && LINUX_VERSION_IS_LESS(5, 16, 0)) && \
!(LINUX_VERSION_IS_GEQ(6, 1, 69) && LINUX_VERSION_IS_LESS(6, 2, 0))
#include <linux/if_vlan.h>
/* Prefer this version in TX path, instead of
* skb_reset_mac_header() + vlan_eth_hdr()
*/
static inline struct vlan_ethhdr *skb_vlan_eth_hdr(const struct sk_buff *skb)
{
return (struct vlan_ethhdr *)skb->data;
}
#endif /* LINUX_VERSION_IS_LESS(6, 4, 0) */
/* <DECLARE_EWMA> */
#include <linux/version.h>