batman-adv: upgrade package to latest release 2017.0
authorSven Eckelmann <sven@narfation.org>
Tue, 28 Feb 2017 18:25:27 +0000 (19:25 +0100)
committerSven Eckelmann <sven@narfation.org>
Tue, 28 Feb 2017 18:35:09 +0000 (19:35 +0100)
 * support latest kernels (3.2 - 4.11)
 * remove bridge loop avoidance addresses from translation table
 * allow to build B.A.T.M.A.N. V without cfg80211 integration on Linux <
 * 3.16
 * coding style cleanups and refactoring
 * bugs squashed:
   - fix interface reference counter on fragmentation errors
   - avoid double free on fragment merge error
   - fix support for up to 16 fragments
   - fix build of multicast compatibility code on some architectures

Signed-off-by: Sven Eckelmann <sven@narfation.org>
batman-adv/Makefile
batman-adv/files/compat-hacks.h
batman-adv/patches/0001-Add-compat-fallback-for-batadv_getlink_net.patch [deleted file]
batman-adv/patches/0002-batman-adv-Decrease-hardif-refcnt-on-fragmentation-s.patch [deleted file]
batman-adv/patches/0003-batman-adv-Fix-double-free-during-fragment-merge-err.patch [deleted file]
batman-adv/patches/0004-batman-adv-Fix-transmission-of-final-16th-fragment.patch [deleted file]

index d3e916e..0ba7310 100644 (file)
@@ -10,10 +10,10 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=batman-adv
 
-PKG_VERSION:=2016.5
-PKG_RELEASE:=4
-PKG_MD5SUM:=6717a933a08dd2a01b00df30cb9f16a8
-PKG_HASH:=d0a0fc90c4f410b57d043215e253bb0b855efa5edbe165d87c17bfdcfafd0db7
+PKG_VERSION:=2017.0
+PKG_RELEASE:=0
+PKG_MD5SUM:=1b3121f0baa8771ff6d8ad172c95904f
+PKG_HASH:=65df01222bc51ec788fb1b6dc63feaf69d393f2d0a96e347d55de83b1602c509
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
index af91f41..6c98a98 100644 (file)
 
 #endif /* < KERNEL_VERSION(4, 5, 0) */
 
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
+
+/* wild hack for batadv_getlink_net only */
+#define get_link_net get_xstats_size || 1 ? fallback_net : (struct net*)netdev->rtnl_link_ops->get_xstats_size
+
+#endif /* < KERNEL_VERSION(4, 0, 0) */
+
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
 
 struct sk_buff *skb_checksum_trimmed(struct sk_buff *skb,
diff --git a/batman-adv/patches/0001-Add-compat-fallback-for-batadv_getlink_net.patch b/batman-adv/patches/0001-Add-compat-fallback-for-batadv_getlink_net.patch
deleted file mode 100644 (file)
index c641828..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-From: Sven Eckelmann <sven@narfation.org>
-Date: Fri, 23 Sep 2016 14:55:38 +0200
-Subject: [PATCH] Add compat fallback for batadv_getlink_net
----
- net/batman-adv/hard-interface.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
-index 61a431a9..6969f580 100644
---- a/net/batman-adv/hard-interface.c
-+++ b/net/batman-adv/hard-interface.c
-@@ -95,6 +95,9 @@ out:
- static struct net *batadv_getlink_net(const struct net_device *netdev,
-                                     struct net *fallback_net)
- {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
-+      return fallback_net;
-+#else
-       if (!netdev->rtnl_link_ops)
-               return fallback_net;
-@@ -102,6 +105,7 @@ static struct net *batadv_getlink_net(const struct net_device *netdev,
-               return fallback_net;
-       return netdev->rtnl_link_ops->get_link_net(netdev);
-+#endif
- }
- /**
diff --git a/batman-adv/patches/0002-batman-adv-Decrease-hardif-refcnt-on-fragmentation-s.patch b/batman-adv/patches/0002-batman-adv-Decrease-hardif-refcnt-on-fragmentation-s.patch
deleted file mode 100644 (file)
index 92da394..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-From: Sven Eckelmann <sven@narfation.org>
-Date: Tue, 27 Dec 2016 08:51:17 +0100
-Subject: [PATCH] batman-adv: Decrease hardif refcnt on fragmentation send error
-
-An error before the hardif is found has to free the skb. But every error
-after that has to free the skb + put the hard interface.
-
-Fixes: 8b4132b1447a ("batman-adv: Consume skb in batadv_frag_send_packet")
-Signed-off-by: Sven Eckelmann <sven@narfation.org>
-Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
----
- net/batman-adv/fragmentation.c | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
-index 9c561e6..0854ebd 100644
---- a/net/batman-adv/fragmentation.c
-+++ b/net/batman-adv/fragmentation.c
-@@ -474,7 +474,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
-       primary_if = batadv_primary_if_get_selected(bat_priv);
-       if (!primary_if) {
-               ret = -EINVAL;
--              goto put_primary_if;
-+              goto free_skb;
-       }
-       /* Create one header to be copied to all fragments */
-@@ -502,7 +502,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
-               skb_fragment = batadv_frag_create(skb, &frag_header, mtu);
-               if (!skb_fragment) {
-                       ret = -ENOMEM;
--                      goto free_skb;
-+                      goto put_primary_if;
-               }
-               batadv_inc_counter(bat_priv, BATADV_CNT_FRAG_TX);
-@@ -511,7 +511,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
-               ret = batadv_send_unicast_skb(skb_fragment, neigh_node);
-               if (ret != NET_XMIT_SUCCESS) {
-                       ret = NET_XMIT_DROP;
--                      goto free_skb;
-+                      goto put_primary_if;
-               }
-               frag_header.no++;
-@@ -519,7 +519,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
-               /* The initial check in this function should cover this case */
-               if (frag_header.no == BATADV_FRAG_MAX_FRAGMENTS - 1) {
-                       ret = -EINVAL;
--                      goto free_skb;
-+                      goto put_primary_if;
-               }
-       }
-@@ -527,7 +527,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
-       if (batadv_skb_head_push(skb, header_size) < 0 ||
-           pskb_expand_head(skb, header_size + ETH_HLEN, 0, GFP_ATOMIC) < 0) {
-               ret = -ENOMEM;
--              goto free_skb;
-+              goto put_primary_if;
-       }
-       memcpy(skb->data, &frag_header, header_size);
diff --git a/batman-adv/patches/0003-batman-adv-Fix-double-free-during-fragment-merge-err.patch b/batman-adv/patches/0003-batman-adv-Fix-double-free-during-fragment-merge-err.patch
deleted file mode 100644 (file)
index f4baf46..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-From: Sven Eckelmann <sven@narfation.org>
-Date: Sun, 12 Feb 2017 11:26:33 +0100
-Subject: [PATCH] batman-adv: Fix double free during fragment merge error
-
-The function batadv_frag_skb_buffer was supposed not to consume the skbuff
-on errors. This was followed in the helper function
-batadv_frag_insert_packet when the skb would potentially be inserted in the
-fragment queue. But it could happen that the next helper function
-batadv_frag_merge_packets would try to merge the fragments and fail. This
-results in a kfree_skb of all the enqueued fragments (including the just
-inserted one). batadv_recv_frag_packet would detect the error in
-batadv_frag_skb_buffer and try to free the skb again.
-
-The behavior of batadv_frag_skb_buffer (and its helper
-batadv_frag_insert_packet) must therefore be changed to always consume the
-skbuff to have a common behavior and avoid the double kfree_skb.
-
-Fixes: 9b3eab61754d ("batman-adv: Receive fragmented packets and merge")
-Signed-off-by: Sven Eckelmann <sven@narfation.org>
-
-Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/e3bab02816097f860545d9ce9ae0808c69d7c92f
----
- net/batman-adv/fragmentation.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
-index 0854ebd8..31e97e9a 100644
---- a/net/batman-adv/fragmentation.c
-+++ b/net/batman-adv/fragmentation.c
-@@ -239,8 +239,10 @@ err_unlock:
-       spin_unlock_bh(&chain->lock);
- err:
--      if (!ret)
-+      if (!ret) {
-               kfree(frag_entry_new);
-+              kfree_skb(skb);
-+      }
-       return ret;
- }
-@@ -313,7 +315,7 @@ free:
-  *
-  * There are three possible outcomes: 1) Packet is merged: Return true and
-  * set *skb to merged packet; 2) Packet is buffered: Return true and set *skb
-- * to NULL; 3) Error: Return false and leave skb as is.
-+ * to NULL; 3) Error: Return false and free skb.
-  *
-  * Return: true when packet is merged or buffered, false when skb is not not
-  * used.
-@@ -338,9 +340,9 @@ bool batadv_frag_skb_buffer(struct sk_buff **skb,
-               goto out_err;
- out:
--      *skb = skb_out;
-       ret = true;
- out_err:
-+      *skb = skb_out;
-       return ret;
- }
diff --git a/batman-adv/patches/0004-batman-adv-Fix-transmission-of-final-16th-fragment.patch b/batman-adv/patches/0004-batman-adv-Fix-transmission-of-final-16th-fragment.patch
deleted file mode 100644 (file)
index 6dec0f6..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-From: Linus Lüssing <linus.luessing@c0d3.blue>
-Date: Mon, 13 Feb 2017 20:44:31 +0100
-Subject: [PATCH] batman-adv: Fix transmission of final, 16th fragment
-
-Trying to split and transmit a unicast packet in 16 parts will fail for
-the final fragment: After having sent the 15th one with a frag_packet.no
-index of 14, we will increase the the index to 15 - and return with an
-error code immediately, even though one more fragment is due for
-transmission and allowed.
-
-Fixing this issue by moving the check before incrementing the index.
-
-While at it, adding an unlikely(), because the check is actually more of
-an assertion.
-
-Fixes: db56e4ecf5c2 ("batman-adv: Fragment and send skbs larger than mtu")
-Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
-Signed-off-by: Sven Eckelmann <sven@narfation.org>
-
-Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/464eff3b1768ff190466a453a57ac140ea5cb756
----
- net/batman-adv/fragmentation.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
-index 31e97e9a..11149e5b 100644
---- a/net/batman-adv/fragmentation.c
-+++ b/net/batman-adv/fragmentation.c
-@@ -501,6 +501,12 @@ int batadv_frag_send_packet(struct sk_buff *skb,
-       /* Eat and send fragments from the tail of skb */
-       while (skb->len > max_fragment_size) {
-+              /* The initial check in this function should cover this case */
-+              if (unlikely(frag_header.no == BATADV_FRAG_MAX_FRAGMENTS - 1)) {
-+                      ret = -EINVAL;
-+                      goto put_primary_if;
-+              }
-+
-               skb_fragment = batadv_frag_create(skb, &frag_header, mtu);
-               if (!skb_fragment) {
-                       ret = -ENOMEM;
-@@ -517,12 +523,6 @@ int batadv_frag_send_packet(struct sk_buff *skb,
-               }
-               frag_header.no++;
--
--              /* The initial check in this function should cover this case */
--              if (frag_header.no == BATADV_FRAG_MAX_FRAGMENTS - 1) {
--                      ret = -EINVAL;
--                      goto put_primary_if;
--              }
-       }
-       /* Make room for the fragment header. */