diff --git a/batman-adv/Makefile b/batman-adv/Makefile index 71e98e2..e390670 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -3,12 +3,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv -PKG_VERSION:=2023.3 -PKG_RELEASE:=3 +PKG_VERSION:=2023.0 +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:=f7c6c53e59343c162642cb9b44f1016765d4bf513e039002be612b7a6c1ea36c +PKG_HASH:=2ce4ec04063252e7bfec3a2b3fa2a61b3b42c7b04d698ba60132bfab1d60a5cd 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 new file mode 100644 index 0000000..4a84f5f --- /dev/null +++ b/batman-adv/patches/0001-batman-adv-Fix-build-of-multicast-code-against-Linux.patch @@ -0,0 +1,34 @@ +From: Sven Eckelmann +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 + +--- 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; diff --git a/batman-adv/patches/0002-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 new file mode 100644 index 0000000..8a2c0e2 --- /dev/null +++ b/batman-adv/patches/0002-Revert-batman-adv-Switch-to-kstrtox.h-for-kstrtou64.patch @@ -0,0 +1,19 @@ +From: Sven Eckelmann +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 + #include + #include +-#include ++#include + #include + #include + #include diff --git a/batman-adv/patches/0003-Revert-batman-adv-use-Linux-s-stdarg.h.patch b/batman-adv/patches/0003-Revert-batman-adv-use-Linux-s-stdarg.h.patch new file mode 100644 index 0000000..ce2df71 --- /dev/null +++ b/batman-adv/patches/0003-Revert-batman-adv-use-Linux-s-stdarg.h.patch @@ -0,0 +1,19 @@ +From: Sven Eckelmann +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 ++#include + + #include "trace.h" + diff --git a/batman-adv/patches/0001-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 similarity index 99% rename from batman-adv/patches/0001-Revert-batman-adv-Migrate-to-linux-container_of.h.patch rename to batman-adv/patches/0004-Revert-batman-adv-Migrate-to-linux-container_of.h.patch index 466ce1a..fbf1ef6 100644 --- a/batman-adv/patches/0001-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,10 +117,10 @@ This reverts commit 043ae5634bdfd4c4dd8b95a22890752495080bb5. #include --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c -@@ -10,12 +10,12 @@ +@@ -9,12 +9,12 @@ + #include #include - #include -#include #include #include diff --git a/batman-adv/patches/0002-fix-batadv_is_cfg80211_netdev.patch b/batman-adv/patches/0005-fix-batadv_is_cfg80211_netdev.patch similarity index 89% rename from batman-adv/patches/0002-fix-batadv_is_cfg80211_netdev.patch rename to batman-adv/patches/0005-fix-batadv_is_cfg80211_netdev.patch index ae70c85..9ac66b8 100644 --- a/batman-adv/patches/0002-fix-batadv_is_cfg80211_netdev.patch +++ b/batman-adv/patches/0005-fix-batadv_is_cfg80211_netdev.patch @@ -7,7 +7,7 @@ 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 +@@ -307,8 +307,7 @@ static bool batadv_is_cfg80211_netdev(st { if (!net_device) return false; 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 diff --git a/batman-adv/src/compat-hacks.h b/batman-adv/src/compat-hacks.h index 364e312..4d61d39 100644 --- a/batman-adv/src/compat-hacks.h +++ b/batman-adv/src/compat-hacks.h @@ -5,6 +5,93 @@ #include /* LINUX_VERSION_CODE */ #include +#if LINUX_VERSION_IS_LESS(5, 10, 0) + +#include + +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 +#include + +#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(6, 0, 0) #define __vstring(item, fmt, ap) __dynamic_array(char, item, 256) @@ -28,23 +115,6 @@ static inline u32 batadv_get_random_u32_below(u32 ep_ro) #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 - -/* 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) */ - /* */ #include