batman-adv: fix OGM counting on x86 OpenWrt images
authorMarek Lindner <lindner_marek@yahoo.de>
Sun, 9 Sep 2012 09:46:55 +0000 (09:46 +0000)
committerMarek Lindner <lindner_marek@yahoo.de>
Sun, 9 Sep 2012 09:46:55 +0000 (09:46 +0000)
More info: https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2012-September/007978.html

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@33339 3c298f89-4303-0410-b956-a3cf2f4a3e73

Makefile
patches/0001-batman-adv-make-batadv_test_bit-return-0-or-1-only.patch [new file with mode: 0644]

index 2416c4221291ab19ddceed474f82effce37e495c..516e71a0a792c6b78f950b82835127d7ef62d0c7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ PKG_NAME:=batman-adv
 
 PKG_VERSION:=2012.3.0
 BATCTL_VERSION:=2012.3.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_MD5SUM:=9f2d0bb2792fe0db012203d502e2085c
 BATCTL_MD5SUM:=fe9e6a3994539037b48afc5e3d31628c
 
diff --git a/patches/0001-batman-adv-make-batadv_test_bit-return-0-or-1-only.patch b/patches/0001-batman-adv-make-batadv_test_bit-return-0-or-1-only.patch
new file mode 100644 (file)
index 0000000..e069fa7
--- /dev/null
@@ -0,0 +1,50 @@
+From 716c8c9a8bb7ac1e30e959e50ed74caa7dabe60a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@web.de>
+Date: Mon, 3 Sep 2012 22:20:31 +0200
+Subject: [PATCH] batman-adv: make batadv_test_bit() return 0 or 1 only
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+On some architectures test_bit() can return other values than 0 or 1:
+
+With a generic x86 OpenWrt image in a kvm setup (batadv_)test_bit()
+frequently returns -1 for me, leading to batadv_iv_ogm_update_seqnos()
+wrongly signaling a protected seqno window.
+
+This patch tries to fix this issue by making batadv_test_bit() return 0
+or 1 only.
+
+Signed-off-by: Linus Lüssing <linus.luessing@web.de>
+Acked-by: Sven Eckelmann <sven@narfation.org>
+---
+ bitarray.h |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/bitarray.h b/bitarray.h
+index a081ce1..cebaae7 100644
+--- a/bitarray.h
++++ b/bitarray.h
+@@ -20,8 +20,8 @@
+ #ifndef _NET_BATMAN_ADV_BITARRAY_H_
+ #define _NET_BATMAN_ADV_BITARRAY_H_
+-/* returns true if the corresponding bit in the given seq_bits indicates true
+- * and curr_seqno is within range of last_seqno
++/* Returns 1 if the corresponding bit in the given seq_bits indicates true
++ * and curr_seqno is within range of last_seqno. Otherwise returns 0.
+  */
+ static inline int batadv_test_bit(const unsigned long *seq_bits,
+                                 uint32_t last_seqno, uint32_t curr_seqno)
+@@ -32,7 +32,7 @@ static inline int batadv_test_bit(const unsigned long *seq_bits,
+       if (diff < 0 || diff >= BATADV_TQ_LOCAL_WINDOW_SIZE)
+               return 0;
+       else
+-              return  test_bit(diff, seq_bits);
++              return test_bit(diff, seq_bits) != 0;
+ }
+ /* turn corresponding bit on, so we can remember that we got the packet */
+-- 
+1.7.9.1
+