diff options
| author | Christian Marangi | 2025-03-29 12:12:44 +0000 |
|---|---|---|
| committer | Christian Marangi | 2025-03-30 14:52:10 +0000 |
| commit | 40393881491aa5fd23e715d0bedf591e3b152ddd (patch) | |
| tree | 9c5eff818b628112affde3ae9ac2b51a6ec2eb8a | |
| parent | 8b27e60c58a6b78826b53093c7b79159265af7ae (diff) | |
| download | openwrt-40393881491aa5fd23e715d0bedf591e3b152ddd.tar.gz | |
mac80211: fix compilation error for old stable kernel version
Fix compilation error for old stable version caused by
genlmsg_multicast_allns backport fix pushed middle version.
Version 5.15 version 0-169, 6.1 version 0-115, 6.6 version 0-58 have the
old genlmsg_multicast_allns version with flags variable.
Compiling backport project with these version result in a compilation
error. To handle this, introduce a backport function for the affected
kernel version.
Link: https://github.com/openwrt/openwrt/pull/18373
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
| -rw-r--r-- | package/kernel/mac80211/patches/build/300-backports-handle-genlmsg_multicast_allns-upstream-ba.patch | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/build/300-backports-handle-genlmsg_multicast_allns-upstream-ba.patch b/package/kernel/mac80211/patches/build/300-backports-handle-genlmsg_multicast_allns-upstream-ba.patch new file mode 100644 index 0000000000..5ab6bb736d --- /dev/null +++ b/package/kernel/mac80211/patches/build/300-backports-handle-genlmsg_multicast_allns-upstream-ba.patch @@ -0,0 +1,121 @@ +From 8dc94a59cfad70ec3a808add56718255eee39ab2 Mon Sep 17 00:00:00 2001 +From: Christian Marangi <ansuelsmth@gmail.com> +Date: Sat, 29 Mar 2025 12:50:55 +0100 +Subject: [PATCH] backports: handle genlmsg_multicast_allns upstream backport + changes + +Better handle genlmsg_multicast_allns upstream backport changes that +dropped a flag to the function middle version. Use a backport function +if backports project is tried to be built on older kernel version. + +Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> +--- + backport-include/net/genetlink.h | 11 +++++ + compat/Makefile | 3 +- + compat/backport-genetlink.c | 60 +++++++++++++++++++++++ + 3 files changed, 73 insertions(+), 1 deletion(-) + +--- a/backport-include/net/genetlink.h ++++ b/backport-include/net/genetlink.h +@@ -172,4 +172,15 @@ static inline int genlmsg_parse(const st + } + #endif /* LINUX_VERSION_IS_LESS(5,2,0) */ + ++#if LINUX_VERSION_IN_RANGE(5,15,0,5,15,169) || \ ++ LINUX_VERSION_IN_RANGE(6,1,0,6,1,115) || \ ++ LINUX_VERSION_IN_RANGE(6,6,0,6,6,58) ++#define genlmsg_multicast_allns LINUX_BACKPORT(genlmsg_multicast_allns) ++int backport_genlmsg_multicast_allns(const struct genl_family *family, ++ struct sk_buff *skb, u32 portid, ++ unsigned int group); ++#endif /* LINUX_VERSION_IN_RANGE(5,15,0,5,15,169) || ++ LINUX_VERSION_IN_RANGE(6,1,0,6,1,115) || ++ LINUX_VERSION_IN_RANGE(6,6,0,6,6,58) */ ++ + #endif /* __BACKPORT_NET_GENETLINK_H */ +--- a/compat/Makefile ++++ b/compat/Makefile +@@ -16,7 +16,8 @@ compat-$(CPTCFG_KERNEL_5_9) += backport- + compat-$(CPTCFG_KERNEL_5_10) += backport-5.10.o + compat-$(CPTCFG_KERNEL_5_11) += backport-5.11.o + compat-$(CPTCFG_KERNEL_5_13) += backport-5.13.o +-compat-$(CPTCFG_KERNEL_5_15) += backport-5.15.o ++compat-$(CPTCFG_KERNEL_5_15) += backport-5.15.o backport-genetlink.o ++compat-$(CPTCFG_KERNEL_6_1) += backport-genetlink.o + compat-$(CPTCFG_KERNEL_6_4) += backport-6.4.o + + compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_LIB_ARC4) += lib-crypto-arc4.o +--- a/compat/backport-genetlink.c ++++ b/compat/backport-genetlink.c +@@ -17,6 +17,7 @@ + #include <net/netlink.h> + #include <net/sock.h> + ++#if LINUX_VERSION_IS_LESS(5,2,0) + static const struct genl_family *find_family_real_ops(const struct genl_ops **ops) + { + const struct genl_family *family; +@@ -249,3 +250,63 @@ int backport_genlmsg_multicast_allns(con + return genlmsg_mcast(skb, portid, group); + } + EXPORT_SYMBOL_GPL(backport_genlmsg_multicast_allns); ++#endif /* LINUX_VERSION_IS_LESS(5,2,0) */ ++ ++#if LINUX_VERSION_IN_RANGE(5,15,0,5,15,169) || \ ++ LINUX_VERSION_IN_RANGE(6,1,0,6,1,115) || \ ++ LINUX_VERSION_IN_RANGE(6,6,0,6,6,58) ++static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group) ++{ ++ struct sk_buff *tmp; ++ struct net *net, *prev = NULL; ++ bool delivered = false; ++ int err; ++ ++ rcu_read_lock(); ++ for_each_net_rcu(net) { ++ if (prev) { ++ tmp = skb_clone(skb, GFP_ATOMIC); ++ if (!tmp) { ++ err = -ENOMEM; ++ goto error; ++ } ++ err = nlmsg_multicast(prev->genl_sock, tmp, ++ portid, group, GFP_ATOMIC); ++ if (!err) ++ delivered = true; ++ else if (err != -ESRCH) ++ goto error; ++ } ++ ++ prev = net; ++ } ++ err = nlmsg_multicast(prev->genl_sock, skb, portid, group, GFP_ATOMIC); ++ ++ rcu_read_unlock(); ++ ++ if (!err) ++ delivered = true; ++ else if (err != -ESRCH) ++ return err; ++ return delivered ? 0 : -ESRCH; ++ error: ++ rcu_read_unlock(); ++ ++ kfree_skb(skb); ++ return err; ++} ++ ++int backport_genlmsg_multicast_allns(const struct genl_family *family, ++ struct sk_buff *skb, u32 portid, ++ unsigned int group) ++{ ++ if (WARN_ON_ONCE(group >= family->n_mcgrps)) ++ return -EINVAL; ++ ++ group = family->mcgrp_offset + group; ++ return genlmsg_mcast(skb, portid, group); ++} ++EXPORT_SYMBOL_GPL(backport_genlmsg_multicast_allns); ++#endif /* LINUX_VERSION_IN_RANGE(5,15,0,5,15,169) || ++ LINUX_VERSION_IN_RANGE(6,1,0,6,1,115) || ++ LINUX_VERSION_IN_RANGE(6,6,0,6,6,58) */ |