b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: gw_node_update() now adds a new gw_node if no curr_gw is selected
@ 2011-04-25  9:18 Antonio Quartulli
  2011-04-25  9:23 ` [B.A.T.M.A.N.] [PATCHv2] " Antonio Quartulli
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Antonio Quartulli @ 2011-04-25  9:18 UTC (permalink / raw)
  To: B.A.T.M.A.N

gw_node_update() doesn't add a new gw_node in case of empty curr_gw.
This means that at the beginning no gw_node is added, leading to an
empty gateway list.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 gateway_client.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/gateway_client.c b/gateway_client.c
index 2acd7a6..db4468c 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -311,10 +311,10 @@ void gw_node_update(struct bat_priv *bat_priv,
 	struct gw_node *gw_node, *curr_gw;
 
 	curr_gw = gw_get_selected_gw_node(bat_priv);
+	rcu_read_lock();
 	if (!curr_gw)
-		goto out;
+		goto gw_node_add;
 
-	rcu_read_lock();
 	hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) {
 		if (gw_node->orig_node != orig_node)
 			continue;
@@ -340,6 +340,7 @@ void gw_node_update(struct bat_priv *bat_priv,
 		goto unlock;
 	}
 
+gw_node_add:
 	if (new_gwflags == 0)
 		goto unlock;
 
@@ -350,7 +351,7 @@ deselect:
 	gw_deselect(bat_priv);
 unlock:
 	rcu_read_unlock();
-out:
+
 	if (curr_gw)
 		gw_node_free_ref(curr_gw);
 }
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [B.A.T.M.A.N.] [PATCHv2] batman-adv: gw_node_update() now adds a new gw_node if no curr_gw is selected
  2011-04-25  9:18 [B.A.T.M.A.N.] [PATCH] batman-adv: gw_node_update() now adds a new gw_node if no curr_gw is selected Antonio Quartulli
@ 2011-04-25  9:23 ` Antonio Quartulli
  2011-04-25 20:43 ` [B.A.T.M.A.N.] [PATCHv3] batman-adv: fix gw_node_update() and gw_election() selected Antonio Quartulli
  2011-04-25 20:44 ` [B.A.T.M.A.N.] [PATCHv4] batman-adv: fix gw_node_update() and gw_election() Antonio Quartulli
  2 siblings, 0 replies; 5+ messages in thread
From: Antonio Quartulli @ 2011-04-25  9:23 UTC (permalink / raw)
  To: B.A.T.M.A.N

This is a regression from 8ffdea813e32cee3c60be36fb9e6a5e077e51ea0

gw_node_update() doesn't add a new gw_node in case of empty curr_gw.
This means that at the beginning no gw_node is added, leading to an
empty gateway list.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 gateway_client.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/gateway_client.c b/gateway_client.c
index 2acd7a6..d8adacd 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -311,8 +311,6 @@ void gw_node_update(struct bat_priv *bat_priv,
 	struct gw_node *gw_node, *curr_gw;
 
 	curr_gw = gw_get_selected_gw_node(bat_priv);
-	if (!curr_gw)
-		goto out;
 
 	rcu_read_lock();
 	hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) {
@@ -350,7 +348,7 @@ deselect:
 	gw_deselect(bat_priv);
 unlock:
 	rcu_read_unlock();
-out:
+
 	if (curr_gw)
 		gw_node_free_ref(curr_gw);
 }
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [B.A.T.M.A.N.] [PATCHv3] batman-adv: fix gw_node_update() and gw_election() selected
  2011-04-25  9:18 [B.A.T.M.A.N.] [PATCH] batman-adv: gw_node_update() now adds a new gw_node if no curr_gw is selected Antonio Quartulli
  2011-04-25  9:23 ` [B.A.T.M.A.N.] [PATCHv2] " Antonio Quartulli
@ 2011-04-25 20:43 ` Antonio Quartulli
  2011-04-25 20:44 ` [B.A.T.M.A.N.] [PATCHv4] batman-adv: fix gw_node_update() and gw_election() Antonio Quartulli
  2 siblings, 0 replies; 5+ messages in thread
From: Antonio Quartulli @ 2011-04-25 20:43 UTC (permalink / raw)
  To: B.A.T.M.A.N

This is a regression from 8ffdea813e32cee3c60be36fb9e6a5e077e51ea0

- gw_node_update() doesn't add a new gw_node in case of empty curr_gw.
This means that at the beginning no gw_node is added, leading to an
empty gateway list.

- gw_election() is terminating in case of curr_gw == NULL. It has to
terminate in case of curr_gw != NULL

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 gateway_client.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/gateway_client.c b/gateway_client.c
index 2acd7a6..4b4f71b 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -127,7 +127,7 @@ void gw_election(struct bat_priv *bat_priv)
 		return;
 
 	curr_gw = gw_get_selected_gw_node(bat_priv);
-	if (!curr_gw)
+	if (curr_gw)
 		goto out;
 
 	rcu_read_lock();
@@ -311,8 +311,6 @@ void gw_node_update(struct bat_priv *bat_priv,
 	struct gw_node *gw_node, *curr_gw;
 
 	curr_gw = gw_get_selected_gw_node(bat_priv);
-	if (!curr_gw)
-		goto out;
 
 	rcu_read_lock();
 	hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) {
@@ -350,7 +348,7 @@ deselect:
 	gw_deselect(bat_priv);
 unlock:
 	rcu_read_unlock();
-out:
+
 	if (curr_gw)
 		gw_node_free_ref(curr_gw);
 }
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [B.A.T.M.A.N.] [PATCHv4] batman-adv: fix gw_node_update() and gw_election()
  2011-04-25  9:18 [B.A.T.M.A.N.] [PATCH] batman-adv: gw_node_update() now adds a new gw_node if no curr_gw is selected Antonio Quartulli
  2011-04-25  9:23 ` [B.A.T.M.A.N.] [PATCHv2] " Antonio Quartulli
  2011-04-25 20:43 ` [B.A.T.M.A.N.] [PATCHv3] batman-adv: fix gw_node_update() and gw_election() selected Antonio Quartulli
@ 2011-04-25 20:44 ` Antonio Quartulli
  2011-04-25 23:57   ` Marek Lindner
  2 siblings, 1 reply; 5+ messages in thread
From: Antonio Quartulli @ 2011-04-25 20:44 UTC (permalink / raw)
  To: B.A.T.M.A.N

This is a regression from 8ffdea813e32cee3c60be36fb9e6a5e077e51ea0

- gw_node_update() doesn't add a new gw_node in case of empty curr_gw.
This means that at the beginning no gw_node is added, leading to an
empty gateway list.

- gw_election() is terminating in case of curr_gw == NULL. It has to
terminate in case of curr_gw != NULL

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 gateway_client.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/gateway_client.c b/gateway_client.c
index 2acd7a6..4b4f71b 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -127,7 +127,7 @@ void gw_election(struct bat_priv *bat_priv)
 		return;
 
 	curr_gw = gw_get_selected_gw_node(bat_priv);
-	if (!curr_gw)
+	if (curr_gw)
 		goto out;
 
 	rcu_read_lock();
@@ -311,8 +311,6 @@ void gw_node_update(struct bat_priv *bat_priv,
 	struct gw_node *gw_node, *curr_gw;
 
 	curr_gw = gw_get_selected_gw_node(bat_priv);
-	if (!curr_gw)
-		goto out;
 
 	rcu_read_lock();
 	hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) {
@@ -350,7 +348,7 @@ deselect:
 	gw_deselect(bat_priv);
 unlock:
 	rcu_read_unlock();
-out:
+
 	if (curr_gw)
 		gw_node_free_ref(curr_gw);
 }
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv4] batman-adv: fix gw_node_update() and gw_election()
  2011-04-25 20:44 ` [B.A.T.M.A.N.] [PATCHv4] batman-adv: fix gw_node_update() and gw_election() Antonio Quartulli
@ 2011-04-25 23:57   ` Marek Lindner
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Lindner @ 2011-04-25 23:57 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Monday 25 April 2011 22:44:32 Antonio Quartulli wrote:
> This is a regression from 8ffdea813e32cee3c60be36fb9e6a5e077e51ea0
> 
> - gw_node_update() doesn't add a new gw_node in case of empty curr_gw.
> This means that at the beginning no gw_node is added, leading to an
> empty gateway list.
> 
> - gw_election() is terminating in case of curr_gw == NULL. It has to
> terminate in case of curr_gw != NULL

Applied in revision 66b5d57.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-04-25 23:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-25  9:18 [B.A.T.M.A.N.] [PATCH] batman-adv: gw_node_update() now adds a new gw_node if no curr_gw is selected Antonio Quartulli
2011-04-25  9:23 ` [B.A.T.M.A.N.] [PATCHv2] " Antonio Quartulli
2011-04-25 20:43 ` [B.A.T.M.A.N.] [PATCHv3] batman-adv: fix gw_node_update() and gw_election() selected Antonio Quartulli
2011-04-25 20:44 ` [B.A.T.M.A.N.] [PATCHv4] batman-adv: fix gw_node_update() and gw_election() Antonio Quartulli
2011-04-25 23:57   ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).