batman-adv: 2015.0 bugfixes & stability updates

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
This commit is contained in:
Marek Lindner 2015-07-07 16:51:36 +08:00
parent 0ead547ab9
commit 96867471b7
17 changed files with 255 additions and 13 deletions

View file

@ -1,7 +1,7 @@
From f63c54bba31d2c86269982fd8efdfb618f1daabe Mon Sep 17 00:00:00 2001 From f63c54bba31d2c86269982fd8efdfb618f1daabe Mon Sep 17 00:00:00 2001
From: Ruben Wisniewski <ruben@freifunk-nrw.de> From: Ruben Wisniewski <ruben@freifunk-nrw.de>
Date: Tue, 26 May 2015 18:34:27 +0200 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 The gateway selection based on fast connections is using a single value
calculated from the average tq (0-255) and the download bandwidth (in calculated from the average tq (0-255) and the download bandwidth (in

View file

@ -1,7 +1,7 @@
From 9bbd794030657fe0d38590cd67d4801b989cebf9 Mon Sep 17 00:00:00 2001 From 9bbd794030657fe0d38590cd67d4801b989cebf9 Mon Sep 17 00:00:00 2001
From: Antonio Quartulli <antonio@meshcoding.com> From: Antonio Quartulli <antonio@meshcoding.com>
Date: Mon, 1 Jun 2015 17:29:57 +0200 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 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 first time, it is likely that this node will request the ARP entry

View file

@ -1,7 +1,7 @@
From bfd0fbaef270ac4ed8e4457a38ef8d91190c0540 Mon Sep 17 00:00:00 2001 From bfd0fbaef270ac4ed8e4457a38ef8d91190c0540 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue> From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Tue, 16 Jun 2015 17:10:22 +0200 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 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit

View file

@ -1,7 +1,7 @@
From 586df9e2537b51c0df7ce99576c3cee1681b64de Mon Sep 17 00:00:00 2001 From 586df9e2537b51c0df7ce99576c3cee1681b64de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue> From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Tue, 16 Jun 2015 17:10:23 +0200 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 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit

View file

@ -1,7 +1,7 @@
From a51fa16ecf3f079518baaa56bffae343bd5694f0 Mon Sep 17 00:00:00 2001 From a51fa16ecf3f079518baaa56bffae343bd5694f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue> From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Tue, 16 Jun 2015 17:10:24 +0200 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 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit

View file

@ -1,7 +1,7 @@
From 201a54ba710ab7f40b82ad3c109f702c47d0761f Mon Sep 17 00:00:00 2001 From 201a54ba710ab7f40b82ad3c109f702c47d0761f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue> From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Tue, 16 Jun 2015 17:10:25 +0200 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 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit

View file

@ -1,7 +1,7 @@
From 7f220ed1f063be00833bd34a013c8f3f45884031 Mon Sep 17 00:00:00 2001 From 7f220ed1f063be00833bd34a013c8f3f45884031 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue> From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Tue, 16 Jun 2015 17:10:26 +0200 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 mcast tvlv handler
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8

View file

@ -1,7 +1,7 @@
From 256776ef8562744f90ac9379364df4cf88291b49 Mon Sep 17 00:00:00 2001 From 256776ef8562744f90ac9379364df4cf88291b49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue> From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
Date: Thu, 18 Jun 2015 06:47:19 +0200 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 feature
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8

View file

@ -1,7 +1,7 @@
From 2c2dfd886a400057ccbc66f1507c94ed909d2a89 Mon Sep 17 00:00:00 2001 From 2c2dfd886a400057ccbc66f1507c94ed909d2a89 Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch> From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Tue, 9 Jun 2015 21:24:36 +0800 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 batadv_softif_vlan_get() may return NULL which has to be verified
by the caller. by the caller.

View file

@ -1,7 +1,7 @@
From af912d77181f252e6fdd324592d006e30bc82909 Mon Sep 17 00:00:00 2001 From af912d77181f252e6fdd324592d006e30bc82909 Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch> From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Wed, 17 Jun 2015 20:01:36 +0800 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 delete events
The tt_local_entry deletion performed in batadv_tt_local_remove() was neither The tt_local_entry deletion performed in batadv_tt_local_remove() was neither

View file

@ -1,7 +1,7 @@
From 9bac35c1e4fab662522371f81147963e19693409 Mon Sep 17 00:00:00 2001 From 9bac35c1e4fab662522371f81147963e19693409 Mon Sep 17 00:00:00 2001
From: Marek Lindner <mareklindner@neomailbox.ch> From: Marek Lindner <mareklindner@neomailbox.ch>
Date: Mon, 22 Jun 2015 00:36:28 +0800 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 The list_del() calls were changed to list_del_init() to prevent
an accidental double deletion in batadv_tt_req_node_new(). an accidental double deletion in batadv_tt_req_node_new().

View file

@ -1,7 +1,7 @@
From 3c92b633715b7eca80dc7a2347e0e4dbcce1f018 Mon Sep 17 00:00:00 2001 From 3c92b633715b7eca80dc7a2347e0e4dbcce1f018 Mon Sep 17 00:00:00 2001
From: Simon Wunderlich <simon@open-mesh.com> From: Simon Wunderlich <simon@open-mesh.com>
Date: Wed, 24 Jun 2015 14:50:19 +0200 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 gateway
Without this initialization, gateways which actually announce up/down Without this initialization, gateways which actually announce up/down

View file

@ -1,7 +1,7 @@
From 07bec2d4dec83f024baf166b95cf037be3a7eca5 Mon Sep 17 00:00:00 2001 From 07bec2d4dec83f024baf166b95cf037be3a7eca5 Mon Sep 17 00:00:00 2001
From: Simon Wunderlich <simon@open-mesh.com> From: Simon Wunderlich <simon@open-mesh.com>
Date: Wed, 24 Jun 2015 14:50:20 +0200 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 purged outgoing if
When an interface is purged, the broadcast packets scheduled for this When an interface is purged, the broadcast packets scheduled for this

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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