batman-adv: update to version 2021.2
authorSven Eckelmann <sven@narfation.org>
Fri, 20 Aug 2021 09:31:19 +0000 (11:31 +0200)
committerSven Eckelmann <sven@narfation.org>
Fri, 20 Aug 2021 11:14:22 +0000 (13:14 +0200)
* support latest kernels (4.4 - 5.14)
* coding style cleanups and refactoring
* add MRD + routable IPv4 multicast with bridges support
* rewrite of broadcast queuing
* bugs squashed:

  - avoid kernel warnings on timing related checks

Signed-off-by: Sven Eckelmann <sven@narfation.org>
batman-adv/Makefile
batman-adv/patches/0001-Revert-batman-adv-genetlink-move-to-smaller-ops-wher.patch
batman-adv/patches/0002-Revert-batman-adv-Add-new-include-for-min-max-helper.patch
batman-adv/patches/0003-batman-adv-Fix-build-of-multicast-code-against-Linux.patch
batman-adv/patches/0004-batman-adv-Always-send-iface-index-name-in-genlmsg.patch [deleted file]
batman-adv/src/compat-hacks.h

index 78a04566ab6d6fb79793c793f206b88e95aa4f31..d92d6e8e9aa8cf092a41e3db1a1f5363ce60d20f 100644 (file)
@@ -3,12 +3,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=batman-adv
-PKG_VERSION:=2021.1
+PKG_VERSION:=2021.2
 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:=bf77843d8dead75342d673ce7021e4ad037447ce18c64056ae1e3202039934d0
+PKG_HASH:=7a380a193b543b0cd1e30bb697f03d967776192ca0ebd2e433a63ad48ff26d8b
 PKG_EXTMOD_SUBDIRS:=net/batman-adv
 
 PKG_MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
index c6c94bb3ee09ea65a6736cbd00e9fa46636734fa..667ef41675fbe784c11544370f2bbbc49e4cc0a4 100644 (file)
@@ -107,10 +107,10 @@ index 56a9ab22c062b1d0d01ef9d09ce796075d3d6df7..8f542bef10dc0f2682ab2d428c90df9a
  
  #endif /* _NET_BATMAN_ADV_COMPAT_NET_GENETLINK_H_ */
 diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
-index f317d206b411d87b4da2f57e35c3fb78cedfb160..bdac5dbd899a9540d58052fd32c8c89520927390 100644
+index b6cc746e01a641bfb75eba219ffa0c29b1b20dd5..e7822d72fe2ccf7d50dc0351fb8530db8e740afd 100644
 --- a/net/batman-adv/netlink.c
 +++ b/net/batman-adv/netlink.c
-@@ -1351,7 +1351,7 @@ static void batadv_post_doit(const struct genl_ops *ops, struct sk_buff *skb,
+@@ -1359,7 +1359,7 @@ static void batadv_post_doit(const struct genl_ops *ops, struct sk_buff *skb,
        }
  }
  
@@ -119,7 +119,7 @@ index f317d206b411d87b4da2f57e35c3fb78cedfb160..bdac5dbd899a9540d58052fd32c8c895
        {
                .cmd = BATADV_CMD_GET_MESH,
                .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
-@@ -1485,8 +1485,8 @@ struct genl_family batadv_netlink_family __ro_after_init = {
+@@ -1493,8 +1493,8 @@ struct genl_family batadv_netlink_family __ro_after_init = {
        .pre_doit = batadv_pre_doit,
        .post_doit = batadv_post_doit,
        .module = THIS_MODULE,
index 95ba35218d75f7eb1697decc5b185087e5eabda8..6d1577d3a45503a6ebf20384469100f98350da14 100644 (file)
@@ -36,7 +36,7 @@ index 9b7269e8a760361c1650b947c77702f0bdcd73d9..00000000000000000000000000000000
 -
 -#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_MINMAX_H_ */
 diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
-index e1ca2b8c315235f234c9061fc73cde2c1b76aa46..eeb3f6d00d8541b377c9703837ef76b05e8d061e 100644
+index b98aea958e3d6999d7eaf065230182d539384c3b..fd7f30f5f3033fd1a9e21518a71e66b557212374 100644
 --- a/net/batman-adv/bat_v.c
 +++ b/net/batman-adv/bat_v.c
 @@ -15,7 +15,6 @@
@@ -86,10 +86,10 @@ index a5d9d800082bade3a1d52cc040557e41f963fac3..96873d47fac5cb9b4fbfa217eedf1f92
  #include <linux/skbuff.h>
  #include <linux/slab.h>
 diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
-index 4a6a25d551a83b1723e80a349e1a655a2152b0ac..eabde547d308438257622879e77d84c24daa2199 100644
+index 55d97e18aa4a9540692618c458d0ae2a743be6bb..3f97c1218908b7ba16a0707d7e54c589ca1a36a5 100644
 --- a/net/batman-adv/hard-interface.c
 +++ b/net/batman-adv/hard-interface.c
-@@ -18,7 +18,6 @@
+@@ -17,7 +17,6 @@
  #include <linux/kref.h>
  #include <linux/limits.h>
  #include <linux/list.h>
@@ -110,7 +110,7 @@ index 3ddd66e4c29ef532de33c7182cc0cc470b33fd4f..c552bc4168d0abd7bf6d23e570d58380
  #include <linux/netdevice.h>
  #include <linux/printk.h>
 diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
-index bdac5dbd899a9540d58052fd32c8c89520927390..b6a703ddd8e97e6a02e8d73c5728802f090ab419 100644
+index e7822d72fe2ccf7d50dc0351fb8530db8e740afd..27f78f0c4aea025b964301e20f972031ab8ad478 100644
 --- a/net/batman-adv/netlink.c
 +++ b/net/batman-adv/netlink.c
 @@ -23,7 +23,6 @@
index cf311d7449750ea047cd3057e320f11ec05d6296..7a290db248b293c890ba4aa543868edf789a038e 100644 (file)
@@ -6,10 +6,10 @@ Fixes: 007b4c4b031f ("batman-adv: convert ifmcaddr6 to RCU")
 Signed-off-by: Sven Eckelmann <sven@narfation.org>
 
 diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
-index 1d63c8cbbfe7b16e360e91bcf3bb77ec7b12893b..ece9fb5dd81bfadbdbe15363dfd8fd257dbe942f 100644
+index 923e2197c2db008ba1cd9b80422ec8481c6a8185..004dc67de076d524784988d2fc8ec7396a00042b 100644
 --- a/net/batman-adv/multicast.c
 +++ b/net/batman-adv/multicast.c
-@@ -454,9 +454,14 @@ batadv_mcast_mla_softif_get_ipv6(struct net_device *dev,
+@@ -423,9 +423,14 @@ batadv_mcast_mla_softif_get_ipv6(struct net_device *dev,
                return 0;
        }
  
@@ -24,7 +24,7 @@ index 1d63c8cbbfe7b16e360e91bcf3bb77ec7b12893b..ece9fb5dd81bfadbdbe15363dfd8fd25
                if (IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) <
                    IPV6_ADDR_SCOPE_LINKLOCAL)
                        continue;
-@@ -485,6 +490,9 @@ batadv_mcast_mla_softif_get_ipv6(struct net_device *dev,
+@@ -454,6 +459,9 @@ batadv_mcast_mla_softif_get_ipv6(struct net_device *dev,
                hlist_add_head(&new->list, mcast_list);
                ret++;
        }
diff --git a/batman-adv/patches/0004-batman-adv-Always-send-iface-index-name-in-genlmsg.patch b/batman-adv/patches/0004-batman-adv-Always-send-iface-index-name-in-genlmsg.patch
deleted file mode 100644 (file)
index 22d630b..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-From: Sven Eckelmann <sven@narfation.org>
-Date: Mon, 10 May 2021 15:05:42 +0200
-Subject: batman-adv: Always send iface index+name in genlmsg
-
-The batman-adv netlink messages often contain the interface index and
-interface name in the same message. This makes it easy for the receiver to
-operate on the incoming data when it either needs to print something or
-needs to operate on the interface index.
-
-But one of the attributes was missing for:
-
-* neighbor table dumps
-* originator table dumps
-* gateway list dumps
-* query of hardif information
-* query of vid information
-
-The userspace therefore had to implement special workarounds using
-SIOCGIFNAME or SIOCGIFINDEX depending on what was actually provided.
-Providing both information simplifies the userspace code massively without
-adding a lot of extra overhead in the kernel portion.
-
-Signed-off-by: Sven Eckelmann <sven@narfation.org>
-Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/77c7d62618259f22f36427eaa62668e6e1c43090
-
-diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
-index 789f257be24f36ace3e63628a3381a6d46dcccd9..680def809838097a9949de1dc9861923911f3d04 100644
---- a/net/batman-adv/bat_iv_ogm.c
-+++ b/net/batman-adv/bat_iv_ogm.c
-@@ -1849,6 +1849,8 @@ batadv_iv_ogm_orig_dump_subentry(struct sk_buff *msg, u32 portid, u32 seq,
-                   orig_node->orig) ||
-           nla_put(msg, BATADV_ATTR_NEIGH_ADDRESS, ETH_ALEN,
-                   neigh_node->addr) ||
-+          nla_put_string(msg, BATADV_ATTR_HARD_IFNAME,
-+                         neigh_node->if_incoming->net_dev->name) ||
-           nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
-                       neigh_node->if_incoming->net_dev->ifindex) ||
-           nla_put_u8(msg, BATADV_ATTR_TQ, tq_avg) ||
-@@ -2078,6 +2080,8 @@ batadv_iv_ogm_neigh_dump_neigh(struct sk_buff *msg, u32 portid, u32 seq,
-       if (nla_put(msg, BATADV_ATTR_NEIGH_ADDRESS, ETH_ALEN,
-                   hardif_neigh->addr) ||
-+          nla_put_string(msg, BATADV_ATTR_HARD_IFNAME,
-+                         hardif_neigh->if_incoming->net_dev->name) ||
-           nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
-                       hardif_neigh->if_incoming->net_dev->ifindex) ||
-           nla_put_u32(msg, BATADV_ATTR_LAST_SEEN_MSECS,
-@@ -2459,6 +2463,8 @@ static int batadv_iv_gw_dump_entry(struct sk_buff *msg, u32 portid,
-                   router->addr) ||
-           nla_put_string(msg, BATADV_ATTR_HARD_IFNAME,
-                          router->if_incoming->net_dev->name) ||
-+          nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
-+                      router->if_incoming->net_dev->ifindex) ||
-           nla_put_u32(msg, BATADV_ATTR_BANDWIDTH_DOWN,
-                       gw_node->bandwidth_down) ||
-           nla_put_u32(msg, BATADV_ATTR_BANDWIDTH_UP,
-diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
-index eeb3f6d00d8541b377c9703837ef76b05e8d061e..fd7f30f5f3033fd1a9e21518a71e66b557212374 100644
---- a/net/batman-adv/bat_v.c
-+++ b/net/batman-adv/bat_v.c
-@@ -145,6 +145,8 @@ batadv_v_neigh_dump_neigh(struct sk_buff *msg, u32 portid, u32 seq,
-       if (nla_put(msg, BATADV_ATTR_NEIGH_ADDRESS, ETH_ALEN,
-                   hardif_neigh->addr) ||
-+          nla_put_string(msg, BATADV_ATTR_HARD_IFNAME,
-+                         hardif_neigh->if_incoming->net_dev->name) ||
-           nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
-                       hardif_neigh->if_incoming->net_dev->ifindex) ||
-           nla_put_u32(msg, BATADV_ATTR_LAST_SEEN_MSECS,
-@@ -297,6 +299,8 @@ batadv_v_orig_dump_subentry(struct sk_buff *msg, u32 portid, u32 seq,
-       if (nla_put(msg, BATADV_ATTR_ORIG_ADDRESS, ETH_ALEN, orig_node->orig) ||
-           nla_put(msg, BATADV_ATTR_NEIGH_ADDRESS, ETH_ALEN,
-                   neigh_node->addr) ||
-+          nla_put_string(msg, BATADV_ATTR_HARD_IFNAME,
-+                         neigh_node->if_incoming->net_dev->name) ||
-           nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
-                       neigh_node->if_incoming->net_dev->ifindex) ||
-           nla_put_u32(msg, BATADV_ATTR_THROUGHPUT, throughput) ||
-@@ -738,6 +742,12 @@ static int batadv_v_gw_dump_entry(struct sk_buff *msg, u32 portid,
-               goto out;
-       }
-+      if (nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
-+                      router->if_incoming->net_dev->ifindex)) {
-+              genlmsg_cancel(msg, hdr);
-+              goto out;
-+      }
-+
-       if (nla_put_u32(msg, BATADV_ATTR_BANDWIDTH_DOWN,
-                       gw_node->bandwidth_down)) {
-               genlmsg_cancel(msg, hdr);
-diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
-index b6a703ddd8e97e6a02e8d73c5728802f090ab419..27f78f0c4aea025b964301e20f972031ab8ad478 100644
---- a/net/batman-adv/netlink.c
-+++ b/net/batman-adv/netlink.c
-@@ -813,6 +813,10 @@ static int batadv_netlink_hardif_fill(struct sk_buff *msg,
-                       bat_priv->soft_iface->ifindex))
-               goto nla_put_failure;
-+      if (nla_put_string(msg, BATADV_ATTR_MESH_IFNAME,
-+                         bat_priv->soft_iface->name))
-+              goto nla_put_failure;
-+
-       if (nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
-                       net_dev->ifindex) ||
-           nla_put_string(msg, BATADV_ATTR_HARD_IFNAME,
-@@ -1044,6 +1048,10 @@ static int batadv_netlink_vlan_fill(struct sk_buff *msg,
-                       bat_priv->soft_iface->ifindex))
-               goto nla_put_failure;
-+      if (nla_put_string(msg, BATADV_ATTR_MESH_IFNAME,
-+                         bat_priv->soft_iface->name))
-+              goto nla_put_failure;
-+
-       if (nla_put_u32(msg, BATADV_ATTR_VLANID, vlan->vid & VLAN_VID_MASK))
-               goto nla_put_failure;
index 32730a344c4c507e0b5cc59b81b0bd427ac43f66..21c13f7c8fc992e9065976f878d6e407d848ebae 100644 (file)
@@ -49,6 +49,48 @@ inline void __batadv_br_ip_list_check(void)
 
 #endif /* LINUX_VERSION_IS_LESS(5, 10, 0) */
 
+#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) */
+
 /* <DECLARE_EWMA> */
 
 #include <linux/version.h>