[PATCH batadv] batman-adv: compat: drop support for Linux < 5.15

Sven Eckelmann <[email protected]>
Newsgroups org.open-mesh.lists.batman
Message-ID <[email protected]>
Linux 5.10.261 added commit 676457fe5ad1 ("mld: convert ifmcaddr6 to RCU")
to backport the mld access behavior from Linux 5.13. But this fixes/stable
backport version cannot be represented in the LINUX_VERSION_CODE. It is
therefore hard to identify this version when trying to compile batman-adv
against it. Supporting this versions is therefore unnecessary hard.

This LTS kernel will be EoL at the end of the year anyway. There is not a
big loss in dropping the support for this kernel version already with this
batman-adv version.

Signed-off-by: Sven Eckelmann <[email protected]>
---
 README.external.rst                |  2 +-
 compat-include/linux/etherdevice.h | 20 --------
 compat-include/linux/if_bridge.h   | 51 ---------------------
 compat-include/linux/if_vlan.h     |  1 -
 compat-include/linux/kstrtox.h     | 14 ------
 compat-include/linux/netdevice.h   | 22 ---------
 compat-include/linux/stdarg.h      | 13 ------
 compat-include/net/addrconf.h      | 94 --------------------------------------
 net/batman-adv/multicast.c         |  3 +-
 9 files changed, 2 insertions(+), 218 deletions(-)

diff --git a/README.external.rst b/README.external.rst
index f988986f..0b1bef15 100644
--- a/README.external.rst
+++ b/README.external.rst
@@ -12,7 +12,7 @@ and as an external module. The external  module   allows  to  get
 new    features without  upgrading  to  a  newer  kernel  version
 and to get batman-adv specific bug fixes for  kernels  that   are
 not   supported   anymore.  It compiles  against  and should work
-with  Linux 5.10  -   7.2.  Supporting  older  versions  is   not
+with  Linux 5.15  -   7.2.  Supporting  older  versions  is   not
 planned,  but it's probably easy to backport it. If you work on a
 backport, feel free to contact us.  :-)
 
diff --git a/compat-include/linux/etherdevice.h b/compat-include/linux/etherdevice.h
deleted file mode 100644
index 1e2fdafb..00000000
--- a/compat-include/linux/etherdevice.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_ETHERDEVICE_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_ETHERDEVICE_H_
-
-#include <linux/version.h>
-#include_next <linux/etherdevice.h>
-
-#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) */
-
-#endif	/* _NET_BATMAN_ADV_COMPAT_LINUX_ETHERDEVICE_H_ */
diff --git a/compat-include/linux/if_bridge.h b/compat-include/linux/if_bridge.h
deleted file mode 100644
index 50aa0608..00000000
--- a/compat-include/linux/if_bridge.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_IF_BRIDGE_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_IF_BRIDGE_H_
-
-#include <linux/version.h>
-#include_next <linux/if_bridge.h>
-
-#if LINUX_VERSION_IS_LESS(5, 14, 0)
-
-#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) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_IF_BRIDGE_H_ */
diff --git a/compat-include/linux/if_vlan.h b/compat-include/linux/if_vlan.h
index b56b2ac1..db8d473c 100644
--- a/compat-include/linux/if_vlan.h
+++ b/compat-include/linux/if_vlan.h
@@ -7,7 +7,6 @@
 #include_next <linux/if_vlan.h>
 
 #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))
 
diff --git a/compat-include/linux/kstrtox.h b/compat-include/linux/kstrtox.h
deleted file mode 100644
index 800341a8..00000000
--- a/compat-include/linux/kstrtox.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_KSTRTOX_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_KSTRTOX_H_
-
-#include <linux/version.h>
-#if (LINUX_VERSION_IS_GEQ(5, 10, 185) && LINUX_VERSION_IS_LESS(5, 11, 0)) || \
-    LINUX_VERSION_IS_GEQ(5, 14, 0)
-#include_next <linux/kstrtox.h>
-#else
-#include <linux/kernel.h>
-#endif
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_KSTRTOX_H_ */
diff --git a/compat-include/linux/netdevice.h b/compat-include/linux/netdevice.h
index 6963e12d..a31d0168 100644
--- a/compat-include/linux/netdevice.h
+++ b/compat-include/linux/netdevice.h
@@ -6,28 +6,6 @@
 #include <linux/version.h>
 #include_next <linux/netdevice.h>
 
-#if LINUX_VERSION_IS_LESS(5, 15, 0)
-
-static inline void batadv_dev_put(struct net_device *dev)
-{
-	if (!dev)
-		return;
-
-	dev_put(dev);
-}
-#define dev_put batadv_dev_put
-
-static inline void batadv_dev_hold(struct net_device *dev)
-{
-	if (!dev)
-		return;
-
-	dev_hold(dev);
-}
-#define dev_hold batadv_dev_hold
-
-#endif /* LINUX_VERSION_IS_LESS(5, 15, 0) */
-
 #if LINUX_VERSION_IS_LESS(5, 17, 0)
 
 typedef struct {} netdevice_tracker;
diff --git a/compat-include/linux/stdarg.h b/compat-include/linux/stdarg.h
deleted file mode 100644
index 3137c428..00000000
--- a/compat-include/linux/stdarg.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_STDARG_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_STDARG_H_
-
-#include <linux/version.h>
-#if LINUX_VERSION_IS_GEQ(5, 15, 0)
-#include_next <linux/stdarg.h>
-#else
-#include <stdarg.h>
-#endif
-
-#endif
diff --git a/compat-include/net/addrconf.h b/compat-include/net/addrconf.h
deleted file mode 100644
index 7b166c80..00000000
--- a/compat-include/net/addrconf.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_NET_ADDRCONF_H_
-#define _NET_BATMAN_ADV_COMPAT_NET_ADDRCONF_H_
-
-#include <linux/version.h>
-#include_next <net/addrconf.h>
-
-#if LINUX_VERSION_IS_LESS(5, 13, 0)
-
-static bool batadv_mcast_mla_is_duplicate(u8 *mcast_addr,
-					  struct hlist_head *mcast_list);
-
-static inline int
-compat_batadv_mcast_mla_meshif_get_ipv6(struct net_device *dev,
-				 struct hlist_head *mcast_list,
-				 struct batadv_mcast_mla_flags *flags,
-				 u8 *mcast_addr,
-				struct batadv_hw_addr *new,
-				struct inet6_dev *in6_dev)
-
-{
-	struct ifmcaddr6 *pmc6;
-	int ret = 0;
-
-	if (flags->tvlv_flags & BATADV_MCAST_WANT_ALL_IPV6)
-		return 0;
-
-	rcu_read_lock();
-
-	in6_dev = __in6_dev_get(dev);
-	if (!in6_dev) {
-		rcu_read_unlock();
-		return 0;
-	}
-
-	read_lock_bh(&in6_dev->lock);
-	for (pmc6 = in6_dev->mc_list; pmc6; pmc6 = pmc6->next) {
-		if (IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) <
-		    IPV6_ADDR_SCOPE_LINKLOCAL)
-			continue;
-
-		if (flags->tvlv_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES &&
-		    ipv6_addr_is_ll_all_nodes(&pmc6->mca_addr))
-			continue;
-
-		if (!(flags->tvlv_flags & BATADV_MCAST_WANT_NO_RTR6) &&
-		    IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) >
-		    IPV6_ADDR_SCOPE_LINKLOCAL)
-			continue;
-
-		ipv6_eth_mc_map(&pmc6->mca_addr, mcast_addr);
-
-		if (batadv_mcast_mla_is_duplicate(mcast_addr, mcast_list))
-			continue;
-
-		new = kmalloc_obj(*new, GFP_ATOMIC);
-		if (!new) {
-			ret = -ENOMEM;
-			break;
-		}
-
-		ether_addr_copy(new->addr, mcast_addr);
-		hlist_add_head(&new->list, mcast_list);
-		ret++;
-	}
-	read_unlock_bh(&in6_dev->lock);
-	rcu_read_unlock();
-
-	return ret;
-}
-
-#define ifmcaddr6 \
-		net_device *orig_dev = dev; \
-		return compat_batadv_mcast_mla_meshif_get_ipv6(orig_dev, \
-							       mcast_list, \
-							       flags, \
-							       mcast_addr, \
-							       new = NULL, \
-							       in6_dev = NULL); \
-	} \
-	static inline int \
-	__unused_batadv_mcast_mla_meshif_get_ipv6(struct net_device *dev, \
-					     struct hlist_head *mcast_list, \
-					     struct batadv_mcast_mla_flags *flags) \
-	{ \
-		struct batadv_hw_addr *new; \
-		struct inet6_dev *in6_dev; \
-		u8 mcast_addr[ETH_ALEN]; \
-		struct ifmcaddr6
-
-#endif /* LINUX_VERSION_IS_LESS(5, 13, 0) */
-
-#endif	/* _NET_BATMAN_ADV_COMPAT_NET_ADDRCONF_H_ */
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index 61410364..155592ab 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -133,8 +133,7 @@ static u8 batadv_mcast_mla_rtr_flags_meshif_get_ipv6(struct net_device *dev)
 {
 	struct inet6_dev *in6_dev = __in6_dev_get(dev);
 
-#if (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 */ \
+#if (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))

---
base-commit: 6ff21902725ca4c437f6d60774e903ecdca2e645
change-id: 20260808-compat-5-14-removal-9c8520d9cce5

Best regards,
--  
Sven Eckelmann <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.