diff mbox

[net] batman-adv: select an internet gateway if none was chosen

Message ID 1344089606-9573-1-git-send-email-ordex@autistici.org
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Antonio Quartulli Aug. 4, 2012, 2:13 p.m. UTC
From: Marek Lindner <lindner_marek@yahoo.de>

This is a regression introduced by: 2265c141086474bbae55a5bb3afa1ebb78ccaa7c

Reported-by: Nicolás Echániz <nicoechaniz@codigosur.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/gateway_client.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

David Miller Aug. 6, 2012, 8:28 p.m. UTC | #1
From: Antonio Quartulli <ordex@autistici.org>
Date: Sat,  4 Aug 2012 16:13:26 +0200

> From: Marek Lindner <lindner_marek@yahoo.de>
> 
> This is a regression introduced by: 2265c141086474bbae55a5bb3afa1ebb78ccaa7c
> 
> Reported-by: Nicolás Echániz <nicoechaniz@codigosur.org>
> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
> Acked-by: Antonio Quartulli <ordex@autistici.org>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>

Applied.

Please, when referencing commits in a log message, provide the commit
header text ("LIKE THIS").  Otherwise in trees where the SHA1 IDs are
different, it will ambiguous what commit you are referencing.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index b421cc4..fc866f2 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -200,11 +200,11 @@  void batadv_gw_election(struct batadv_priv *bat_priv)
 	if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_CLIENT)
 		goto out;
 
-	if (!batadv_atomic_dec_not_zero(&bat_priv->gw_reselect))
-		goto out;
-
 	curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
 
+	if (!batadv_atomic_dec_not_zero(&bat_priv->gw_reselect) && curr_gw)
+		goto out;
+
 	next_gw = batadv_gw_get_best_gw_node(bat_priv);
 
 	if (curr_gw == next_gw)