Subject: batman-adv: compat: Add atomic mc_fowarding support for stable kernels
From: Sven Eckelmann <[email-masked]>
Date: Fri, 15 Apr 2022 15:12:45 +0200

Fixes: 56db7c0540e7 ("batman-adv: make mc_forwarding atomic")
Signed-off-by: Sven Eckelmann <[email-masked]>
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)