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: refactor tt_global_del() to avoid misalignment
@ 2011-12-22 12:33 Marek Lindner
  2011-12-22 14:42 ` Antonio Quartulli
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Lindner @ 2011-12-22 12:33 UTC (permalink / raw)
  To: b.a.t.m.a.n

From: Sven Eckelmann <sven@narfation.org>

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 translation-table.c |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/translation-table.c b/translation-table.c
index d542b9d..a1be7ef 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -657,29 +657,31 @@ void tt_global_del(struct bat_priv *bat_priv,
 	struct tt_local_entry *tt_local_entry = NULL;
 
 	tt_global_entry = tt_global_hash_find(bat_priv, addr);
-	if (!tt_global_entry)
+	if (!tt_global_entry || tt_global_entry->orig_node != orig_node)
 		goto out;
 
-	if (tt_global_entry->orig_node == orig_node) {
-		if (roaming) {
-			/* if we are deleting a global entry due to a roam
-			 * event, there are two possibilities:
-			 * 1) the client roamed from node A to node B => we mark
-			 *    it with TT_CLIENT_ROAM, we start a timer and we
-			 *    wait for node B to claim it. In case of timeout
-			 *    the entry is purged.
-			 * 2) the client roamed to us => we can directly delete
-			 *    the global entry, since it is useless now. */
-			tt_local_entry = tt_local_hash_find(bat_priv,
-						tt_global_entry->common.addr);
-			if (!tt_local_entry) {
-				tt_global_entry->common.flags |= TT_CLIENT_ROAM;
-				tt_global_entry->roam_at = jiffies;
-				goto out;
-			}
-		}
-		_tt_global_del(bat_priv, tt_global_entry, message);
+	if (!roaming)
+		goto out_del;
+
+	/* if we are deleting a global entry due to a roam
+	 * event, there are two possibilities:
+	 * 1) the client roamed from node A to node B => we mark
+	 *    it with TT_CLIENT_ROAM, we start a timer and we
+	 *    wait for node B to claim it. In case of timeout
+	 *    the entry is purged.
+	 * 2) the client roamed to us => we can directly delete
+	 *    the global entry, since it is useless now. */
+	tt_local_entry = tt_local_hash_find(bat_priv,
+					    tt_global_entry->common.addr);
+	if (!tt_local_entry) {
+		tt_global_entry->common.flags |= TT_CLIENT_ROAM;
+		tt_global_entry->roam_at = jiffies;
+		goto out;
 	}
+
+out_del:
+	_tt_global_del(bat_priv, tt_global_entry, message);
+
 out:
 	if (tt_global_entry)
 		tt_global_entry_free_ref(tt_global_entry);
-- 
1.7.5.4


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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: refactor tt_global_del() to avoid misalignment
  2011-12-22 12:33 [B.A.T.M.A.N.] [PATCH] batman-adv: refactor tt_global_del() to avoid misalignment Marek Lindner
@ 2011-12-22 14:42 ` Antonio Quartulli
  2011-12-24 13:59   ` Marek Lindner
  0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2011-12-22 14:42 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Thu, Dec 22, 2011 at 08:33:42PM +0800, Marek Lindner wrote:
> From: Sven Eckelmann <sven@narfation.org>
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>

Since this is a part of the code I wrote, I gave it a look in order to be
sure that nothing has been messed up.

Acked-by: Antonio Quartulli <ordex@autistici.org>


-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: refactor tt_global_del() to avoid misalignment
  2011-12-22 14:42 ` Antonio Quartulli
@ 2011-12-24 13:59   ` Marek Lindner
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Lindner @ 2011-12-24 13:59 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Thursday, December 22, 2011 22:42:24 Antonio Quartulli wrote:
> On Thu, Dec 22, 2011 at 08:33:42PM +0800, Marek Lindner wrote:
> > From: Sven Eckelmann <sven@narfation.org>
> >
> > 
> >
> > Signed-off-by: Sven Eckelmann <sven@narfation.org>
> 
> Since this is a part of the code I wrote, I gave it a look in order to be
> sure that nothing has been messed up.
> 
> Acked-by: Antonio Quartulli <ordex@autistici.org>


Applied in revision e2b9917.

Thanks,
Marek

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

end of thread, other threads:[~2011-12-24 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-22 12:33 [B.A.T.M.A.N.] [PATCH] batman-adv: refactor tt_global_del() to avoid misalignment Marek Lindner
2011-12-22 14:42 ` Antonio Quartulli
2011-12-24 13:59   ` 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).