batman-adv: 2015.0 bugfixes & stability updates
authorMarek Lindner <mareklindner@neomailbox.ch>
Tue, 7 Jul 2015 08:51:36 +0000 (16:51 +0800)
committerMarek Lindner <mareklindner@neomailbox.ch>
Tue, 7 Jul 2015 08:51:36 +0000 (16:51 +0800)
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
17 files changed:
batman-adv/patches/0001-batman-adv-Avoid-u32-overflow-during-gateway-select.patch
batman-adv/patches/0002-batman-adv-avoid-DAT-to-mess-up-LAN-state.patch
batman-adv/patches/0003-batman-adv-Make-DAT-capability-changes-atomic.patch
batman-adv/patches/0004-batman-adv-Make-NC-capability-changes-atomic.patch
batman-adv/patches/0005-batman-adv-Make-TT-capability-changes-atomic.patch
batman-adv/patches/0006-batman-adv-Make-MCAST-capability-changes-atomic.patch
batman-adv/patches/0007-batman-adv-Fix-potential-synchronization-issues-in-m.patch
batman-adv/patches/0008-batman-adv-Fix-compile-error-on-deactivated-MCAST-fe.patch
batman-adv/patches/0009-batman-adv-fix-kernel-crash-due-to-missing-NULL-chec.patch
batman-adv/patches/0010-batman-adv-protect-tt_local_entry-from-concurrent-de.patch
batman-adv/patches/0011-batman-adv-protect-tt-request-from-double-deletion.patch
batman-adv/patches/0012-batman-adv-initialize-up-down-values-when-adding-a-g.patch
batman-adv/patches/0013-batman-adv-remove-broadcast-packets-scheduled-for-pu.patch
batman-adv/patches/0014-batman-adv-Fix-broken-DAT-capability-check.patch [new file with mode: 0644]
batman-adv/patches/0015-batman-adv-Fix-broken-NC-capability-check.patch [new file with mode: 0644]
batman-adv/patches/0016-batman-adv-Fix-broken-TT-capability-check.patch [new file with mode: 0644]
batman-adv/patches/0017-batman-adv-Fix-broken-MCAST-capability-check.patch [new file with mode: 0644]

index 19eb2fbac23e99197a3c3eb6145451b23c248f8d..b7232e7ed12b2e927883cb4f1fe96bf9e292a35e 100644 (file)
@@ -1,7 +1,7 @@
 From f63c54bba31d2c86269982fd8efdfb618f1daabe Mon Sep 17 00:00:00 2001
 From: Ruben Wisniewski <ruben@freifunk-nrw.de>
 Date: Tue, 26 May 2015 18:34:27 +0200
 From f63c54bba31d2c86269982fd8efdfb618f1daabe Mon Sep 17 00:00:00 2001
 From: Ruben Wisniewski <ruben@freifunk-nrw.de>
 Date: Tue, 26 May 2015 18:34:27 +0200
-Subject: [PATCH 01/13] batman-adv: Avoid u32 overflow during gateway select
+Subject: [PATCH 01/17] batman-adv: Avoid u32 overflow during gateway select
 
 The gateway selection based on fast connections is using a single value
 calculated from the average tq (0-255) and the download bandwidth (in
 
 The gateway selection based on fast connections is using a single value
 calculated from the average tq (0-255) and the download bandwidth (in
index 082c097ff69e7d7899ac1694e8686fbe90f3d8b6..b335f4fd946b3aceabb81f09fecffad5c49debe8 100644 (file)
@@ -1,7 +1,7 @@
 From 9bbd794030657fe0d38590cd67d4801b989cebf9 Mon Sep 17 00:00:00 2001
 From: Antonio Quartulli <antonio@meshcoding.com>
 Date: Mon, 1 Jun 2015 17:29:57 +0200
 From 9bbd794030657fe0d38590cd67d4801b989cebf9 Mon Sep 17 00:00:00 2001
 From: Antonio Quartulli <antonio@meshcoding.com>
 Date: Mon, 1 Jun 2015 17:29:57 +0200
-Subject: [PATCH 02/13] batman-adv: avoid DAT to mess up LAN state
+Subject: [PATCH 02/17] batman-adv: avoid DAT to mess up LAN state
 
 When a node running DAT receives an ARP request from the LAN for the
 first time, it is likely that this node will request the ARP entry
 
 When a node running DAT receives an ARP request from the LAN for the
 first time, it is likely that this node will request the ARP entry
index 0f6ce8c135f3d1ed4293db12576688a5c2b0dcc5..4152a52e631f6f7c62c7e33be36b7a76b754628b 100644 (file)
@@ -1,7 +1,7 @@
 From bfd0fbaef270ac4ed8e4457a38ef8d91190c0540 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
 Date: Tue, 16 Jun 2015 17:10:22 +0200
 From bfd0fbaef270ac4ed8e4457a38ef8d91190c0540 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
 Date: Tue, 16 Jun 2015 17:10:22 +0200
-Subject: [PATCH 03/13] batman-adv: Make DAT capability changes atomic
+Subject: [PATCH 03/17] batman-adv: Make DAT capability changes atomic
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
index e69178ee61b14da5715303199d73d94d0114fa8b..935a6cd20d0f30038288c30b2a0081c523067439 100644 (file)
@@ -1,7 +1,7 @@
 From 586df9e2537b51c0df7ce99576c3cee1681b64de Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
 Date: Tue, 16 Jun 2015 17:10:23 +0200
 From 586df9e2537b51c0df7ce99576c3cee1681b64de Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
 Date: Tue, 16 Jun 2015 17:10:23 +0200
-Subject: [PATCH 04/13] batman-adv: Make NC capability changes atomic
+Subject: [PATCH 04/17] batman-adv: Make NC capability changes atomic
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
index f41b7753026e3766945861de2974e84de78ae64b..c6e907822172e3c3baaca83f0356ce219fdaa400 100644 (file)
@@ -1,7 +1,7 @@
 From a51fa16ecf3f079518baaa56bffae343bd5694f0 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
 Date: Tue, 16 Jun 2015 17:10:24 +0200
 From a51fa16ecf3f079518baaa56bffae343bd5694f0 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
 Date: Tue, 16 Jun 2015 17:10:24 +0200
-Subject: [PATCH 05/13] batman-adv: Make TT capability changes atomic
+Subject: [PATCH 05/17] batman-adv: Make TT capability changes atomic
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
index 99f90386d8b3d5e3317ac3e11b47db18abbfe380..d1d7beb1267ac186034d6a6037722c2b0fd46724 100644 (file)
@@ -1,7 +1,7 @@
 From 201a54ba710ab7f40b82ad3c109f702c47d0761f Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
 Date: Tue, 16 Jun 2015 17:10:25 +0200
 From 201a54ba710ab7f40b82ad3c109f702c47d0761f Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
 Date: Tue, 16 Jun 2015 17:10:25 +0200
-Subject: [PATCH 06/13] batman-adv: Make MCAST capability changes atomic
+Subject: [PATCH 06/17] batman-adv: Make MCAST capability changes atomic
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
index 2a2496e37c6a1f7a9cde878de10d222e09bf1d4e..66d61b3d175d1d2d9afd360d6846a7f2632fab6d 100644 (file)
@@ -1,7 +1,7 @@
 From 7f220ed1f063be00833bd34a013c8f3f45884031 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
 Date: Tue, 16 Jun 2015 17:10:26 +0200
 From 7f220ed1f063be00833bd34a013c8f3f45884031 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
 Date: Tue, 16 Jun 2015 17:10:26 +0200
-Subject: [PATCH 07/13] batman-adv: Fix potential synchronization issues in
+Subject: [PATCH 07/17] batman-adv: Fix potential synchronization issues in
  mcast tvlv handler
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
  mcast tvlv handler
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
index eff82493120255562aa7318a638482bbce65ba8c..c854522413c8e07e3c1d356a02a5e1b9c528dfbe 100644 (file)
@@ -1,7 +1,7 @@
 From 256776ef8562744f90ac9379364df4cf88291b49 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
 Date: Thu, 18 Jun 2015 06:47:19 +0200
 From 256776ef8562744f90ac9379364df4cf88291b49 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
 Date: Thu, 18 Jun 2015 06:47:19 +0200
-Subject: [PATCH 08/13] batman-adv: Fix compile error on deactivated MCAST
+Subject: [PATCH 08/17] batman-adv: Fix compile error on deactivated MCAST
  feature
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
  feature
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
index c217a93aed21f9eab0f6763ca0a41024bc541eb6..3e19c0e81399e72f68eb81b8d98ed3b748c74c03 100644 (file)
@@ -1,7 +1,7 @@
 From 2c2dfd886a400057ccbc66f1507c94ed909d2a89 Mon Sep 17 00:00:00 2001
 From: Marek Lindner <mareklindner@neomailbox.ch>
 Date: Tue, 9 Jun 2015 21:24:36 +0800
 From 2c2dfd886a400057ccbc66f1507c94ed909d2a89 Mon Sep 17 00:00:00 2001
 From: Marek Lindner <mareklindner@neomailbox.ch>
 Date: Tue, 9 Jun 2015 21:24:36 +0800
-Subject: [PATCH 09/13] batman-adv: fix kernel crash due to missing NULL checks
+Subject: [PATCH 09/17] batman-adv: fix kernel crash due to missing NULL checks
 
 batadv_softif_vlan_get() may return NULL which has to be verified
 by the caller.
 
 batadv_softif_vlan_get() may return NULL which has to be verified
 by the caller.
index 7dc83a7f99c87af76ee61c6a09abe8c468195697..5cc27ee9921aaaf70b9e1f868f4b2b878c27acdf 100644 (file)
@@ -1,7 +1,7 @@
 From af912d77181f252e6fdd324592d006e30bc82909 Mon Sep 17 00:00:00 2001
 From: Marek Lindner <mareklindner@neomailbox.ch>
 Date: Wed, 17 Jun 2015 20:01:36 +0800
 From af912d77181f252e6fdd324592d006e30bc82909 Mon Sep 17 00:00:00 2001
 From: Marek Lindner <mareklindner@neomailbox.ch>
 Date: Wed, 17 Jun 2015 20:01:36 +0800
-Subject: [PATCH 10/13] batman-adv: protect tt_local_entry from concurrent
+Subject: [PATCH 10/17] batman-adv: protect tt_local_entry from concurrent
  delete events
 
 The tt_local_entry deletion performed in batadv_tt_local_remove() was neither
  delete events
 
 The tt_local_entry deletion performed in batadv_tt_local_remove() was neither
index 61da936cc5bdd2340c22099d3ff276e0febccef9..dd0e26f9bfdc79c10a5a923b377f90d1029408b1 100644 (file)
@@ -1,7 +1,7 @@
 From 9bac35c1e4fab662522371f81147963e19693409 Mon Sep 17 00:00:00 2001
 From: Marek Lindner <mareklindner@neomailbox.ch>
 Date: Mon, 22 Jun 2015 00:36:28 +0800
 From 9bac35c1e4fab662522371f81147963e19693409 Mon Sep 17 00:00:00 2001
 From: Marek Lindner <mareklindner@neomailbox.ch>
 Date: Mon, 22 Jun 2015 00:36:28 +0800
-Subject: [PATCH 11/13] batman-adv: protect tt request from double deletion
+Subject: [PATCH 11/17] batman-adv: protect tt request from double deletion
 
 The list_del() calls were changed to list_del_init() to prevent
 an accidental double deletion in batadv_tt_req_node_new().
 
 The list_del() calls were changed to list_del_init() to prevent
 an accidental double deletion in batadv_tt_req_node_new().
index 6338edc5aa39d7576e223e922f15ffb8305cc859..04b3758f129cbc62a50468707e69320b5d6ace1e 100644 (file)
@@ -1,7 +1,7 @@
 From 3c92b633715b7eca80dc7a2347e0e4dbcce1f018 Mon Sep 17 00:00:00 2001
 From: Simon Wunderlich <simon@open-mesh.com>
 Date: Wed, 24 Jun 2015 14:50:19 +0200
 From 3c92b633715b7eca80dc7a2347e0e4dbcce1f018 Mon Sep 17 00:00:00 2001
 From: Simon Wunderlich <simon@open-mesh.com>
 Date: Wed, 24 Jun 2015 14:50:19 +0200
-Subject: [PATCH 12/13] batman-adv: initialize up/down values when adding a
+Subject: [PATCH 12/17] batman-adv: initialize up/down values when adding a
  gateway
 
 Without this initialization, gateways which actually announce up/down
  gateway
 
 Without this initialization, gateways which actually announce up/down
index da455e17c20269d7ac41d7119002f5f77dab15e1..b7a27efb04cce2f513dcd261d512330a96ccc43e 100644 (file)
@@ -1,7 +1,7 @@
 From 07bec2d4dec83f024baf166b95cf037be3a7eca5 Mon Sep 17 00:00:00 2001
 From: Simon Wunderlich <simon@open-mesh.com>
 Date: Wed, 24 Jun 2015 14:50:20 +0200
 From 07bec2d4dec83f024baf166b95cf037be3a7eca5 Mon Sep 17 00:00:00 2001
 From: Simon Wunderlich <simon@open-mesh.com>
 Date: Wed, 24 Jun 2015 14:50:20 +0200
-Subject: [PATCH 13/13] batman-adv: remove broadcast packets scheduled for
+Subject: [PATCH 13/17] batman-adv: remove broadcast packets scheduled for
  purged outgoing if
 
 When an interface is purged, the broadcast packets scheduled for this
  purged outgoing if
 
 When an interface is purged, the broadcast packets scheduled for this
diff --git a/batman-adv/patches/0014-batman-adv-Fix-broken-DAT-capability-check.patch b/batman-adv/patches/0014-batman-adv-Fix-broken-DAT-capability-check.patch
new file mode 100644 (file)
index 0000000..bffabb3
--- /dev/null
@@ -0,0 +1,53 @@
+From de4666781c5a64cd55aa6688f77de95f8f66b2c0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
+Date: Fri, 3 Jul 2015 18:29:56 +0200
+Subject: [PATCH 14/17] batman-adv: Fix broken DAT capability check
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The introduction of set_bit() and clear_bit() calls in batman-adv
+wrongly passed bitmasks and not the bit numbers to these functions.
+This leads to broken capability checks.
+
+Fixing this by making the capability enum a non-bitmasked one and by
+that passing non-masked values to set_bit()/clear_bit().
+
+Fixes: bfd0fbaef270 ("batman-adv: Make DAT capability changes atomic")
+Reported-by: Def <def@laposte.net>
+Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+---
+ distributed-arp-table.c | 2 +-
+ types.h                 | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/distributed-arp-table.c b/distributed-arp-table.c
+index b2cc19b..c0c514d 100644
+--- a/distributed-arp-table.c
++++ b/distributed-arp-table.c
+@@ -422,7 +422,7 @@ static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res,
+       int j;
+       /* check if orig node candidate is running DAT */
+-      if (!(candidate->capabilities & BATADV_ORIG_CAPA_HAS_DAT))
++      if (!(test_bit(BATADV_ORIG_CAPA_HAS_DAT, &candidate->capabilities)))
+               goto out;
+       /* Check if this node has already been selected... */
+diff --git a/types.h b/types.h
+index 65dc6bf..08a6343 100644
+--- a/types.h
++++ b/types.h
+@@ -299,7 +299,7 @@ struct batadv_orig_node {
+  *  (= orig node announces a tvlv of type BATADV_TVLV_MCAST)
+  */
+ enum batadv_orig_capabilities {
+-      BATADV_ORIG_CAPA_HAS_DAT = BIT(0),
++      BATADV_ORIG_CAPA_HAS_DAT,
+       BATADV_ORIG_CAPA_HAS_NC = BIT(1),
+       BATADV_ORIG_CAPA_HAS_TT = BIT(2),
+       BATADV_ORIG_CAPA_HAS_MCAST = BIT(3),
+-- 
+2.1.4
+
diff --git a/batman-adv/patches/0015-batman-adv-Fix-broken-NC-capability-check.patch b/batman-adv/patches/0015-batman-adv-Fix-broken-NC-capability-check.patch
new file mode 100644 (file)
index 0000000..86ecd92
--- /dev/null
@@ -0,0 +1,53 @@
+From dfb27e75b5586e356e88b9d827d772a6cbdf3cc1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
+Date: Fri, 3 Jul 2015 18:29:57 +0200
+Subject: [PATCH 15/17] batman-adv: Fix broken NC capability check
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The introduction of set_bit() and clear_bit() calls in batman-adv
+wrongly passed bitmasks and not the bit numbers to these functions.
+This leads to broken capability checks.
+
+Fixing this by making the capability enum a non-bitmasked one and by
+that passing non-masked values to set_bit()/clear_bit().
+
+Fixes: 586df9e2537b ("batman-adv: Make NC capability changes atomic")
+Reported-by: Def <def@laposte.net>
+Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+---
+ network-coding.c | 2 +-
+ types.h          | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/network-coding.c b/network-coding.c
+index 3ce493e..0309c2c 100644
+--- a/network-coding.c
++++ b/network-coding.c
+@@ -871,7 +871,7 @@ void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
+               goto out;
+       /* check if orig node is network coding enabled */
+-      if (!(orig_node->capabilities & BATADV_ORIG_CAPA_HAS_NC))
++      if (!(test_bit(BATADV_ORIG_CAPA_HAS_NC, &orig_node->capabilities)))
+               goto out;
+       /* accept ogms from 'good' neighbors and single hop neighbors */
+diff --git a/types.h b/types.h
+index 08a6343..cb7ccb1 100644
+--- a/types.h
++++ b/types.h
+@@ -300,7 +300,7 @@ struct batadv_orig_node {
+  */
+ enum batadv_orig_capabilities {
+       BATADV_ORIG_CAPA_HAS_DAT,
+-      BATADV_ORIG_CAPA_HAS_NC = BIT(1),
++      BATADV_ORIG_CAPA_HAS_NC,
+       BATADV_ORIG_CAPA_HAS_TT = BIT(2),
+       BATADV_ORIG_CAPA_HAS_MCAST = BIT(3),
+ };
+-- 
+2.1.4
+
diff --git a/batman-adv/patches/0016-batman-adv-Fix-broken-TT-capability-check.patch b/batman-adv/patches/0016-batman-adv-Fix-broken-TT-capability-check.patch
new file mode 100644 (file)
index 0000000..5295026
--- /dev/null
@@ -0,0 +1,54 @@
+From a4824ffaa200050a0b3e68101ebe074a7c45b7d5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
+Date: Fri, 3 Jul 2015 18:29:58 +0200
+Subject: [PATCH 16/17] batman-adv: Fix broken TT capability check
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The introduction of set_bit() and clear_bit() calls in batman-adv
+wrongly passed bitmasks and not the bit numbers to these functions.
+This leads to broken capability checks.
+
+Fixing this by making the capability enum a non-bitmasked one and by
+that passing non-masked values to set_bit()/clear_bit().
+
+Fixes: a51fa16ecf3f ("batman-adv: Make TT capability changes atomic")
+Reported-by: Def <def@laposte.net>
+Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+---
+ translation-table.c | 3 ++-
+ types.h             | 2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/translation-table.c b/translation-table.c
+index b6c0f52..d73b103 100644
+--- a/translation-table.c
++++ b/translation-table.c
+@@ -3323,7 +3323,8 @@ static void batadv_tt_update_orig(struct batadv_priv *bat_priv,
+       bool has_tt_init;
+       tt_vlan = (struct batadv_tvlv_tt_vlan_data *)tt_buff;
+-      has_tt_init = orig_node->capa_initialized & BATADV_ORIG_CAPA_HAS_TT;
++      has_tt_init = test_bit(BATADV_ORIG_CAPA_HAS_TT,
++                             &orig_node->capa_initialized);
+       /* orig table not initialised AND first diff is in the OGM OR the ttvn
+        * increased by one -> we can apply the attached changes
+diff --git a/types.h b/types.h
+index cb7ccb1..6f4486c 100644
+--- a/types.h
++++ b/types.h
+@@ -301,7 +301,7 @@ struct batadv_orig_node {
+ enum batadv_orig_capabilities {
+       BATADV_ORIG_CAPA_HAS_DAT,
+       BATADV_ORIG_CAPA_HAS_NC,
+-      BATADV_ORIG_CAPA_HAS_TT = BIT(2),
++      BATADV_ORIG_CAPA_HAS_TT,
+       BATADV_ORIG_CAPA_HAS_MCAST = BIT(3),
+ };
+-- 
+2.1.4
+
diff --git a/batman-adv/patches/0017-batman-adv-Fix-broken-MCAST-capability-check.patch b/batman-adv/patches/0017-batman-adv-Fix-broken-MCAST-capability-check.patch
new file mode 100644 (file)
index 0000000..8930543
--- /dev/null
@@ -0,0 +1,82 @@
+From 1798ad3fb6ba72f8c6f96024b27ad27193648787 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
+Date: Fri, 3 Jul 2015 18:29:59 +0200
+Subject: [PATCH 17/17] batman-adv: Fix broken MCAST capability check
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The introduction of set_bit() and clear_bit() calls in batman-adv
+wrongly passed bitmasks and not the bit numbers to these functions.
+This leads to broken capability checks.
+
+Fixing this by making the capability enum a non-bitmasked one and by
+that passing non-masked values to set_bit()/clear_bit().
+
+Fixes: 201a54ba710a ("batman-adv: Make MCAST capability changes atomic")
+Reported-by: Def <def@laposte.net>
+Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
+Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
+---
+ multicast.c | 11 ++++++-----
+ types.h     |  2 +-
+ 2 files changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/multicast.c b/multicast.c
+index b75bcc3..ee8317f 100644
+--- a/multicast.c
++++ b/multicast.c
+@@ -709,14 +709,15 @@ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
+               mcast_flags = *(uint8_t *)tvlv_value;
+       spin_lock_bh(&orig->mcast_handler_lock);
+-      orig_initialized = orig->capa_initialized & BATADV_ORIG_CAPA_HAS_MCAST;
++      orig_initialized = test_bit(BATADV_ORIG_CAPA_HAS_MCAST,
++                                  &orig->capa_initialized);
+       /* If mcast support is turned on decrease the disabled mcast node
+        * counter only if we had increased it for this node before. If this
+        * is a completely new orig_node no need to decrease the counter.
+        */
+       if (orig_mcast_enabled &&
+-          !(orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST)) {
++          !(test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities))) {
+               if (orig_initialized)
+                       atomic_dec(&bat_priv->mcast.num_disabled);
+               set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities);
+@@ -725,7 +726,7 @@ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
+        * node counter.
+        */
+       } else if (!orig_mcast_enabled &&
+-                 (orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST ||
++                 (test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities) ||
+                   !orig_initialized)) {
+               atomic_inc(&bat_priv->mcast.num_disabled);
+               clear_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities);
+@@ -774,8 +775,8 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig)
+       spin_lock_bh(&orig->mcast_handler_lock);
+-      if (!(orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST) &&
+-          orig->capa_initialized & BATADV_ORIG_CAPA_HAS_MCAST)
++      if (!(test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) &&
++          test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capa_initialized))
+               atomic_dec(&bat_priv->mcast.num_disabled);
+       batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS);
+diff --git a/types.h b/types.h
+index 6f4486c..3baf595 100644
+--- a/types.h
++++ b/types.h
+@@ -302,7 +302,7 @@ enum batadv_orig_capabilities {
+       BATADV_ORIG_CAPA_HAS_DAT,
+       BATADV_ORIG_CAPA_HAS_NC,
+       BATADV_ORIG_CAPA_HAS_TT,
+-      BATADV_ORIG_CAPA_HAS_MCAST = BIT(3),
++      BATADV_ORIG_CAPA_HAS_MCAST,
+ };
+ /**
+-- 
+2.1.4
+