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