public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: delete global entry in case of roaming
@ 2011-12-04 21:38 Antonio Quartulli
  2011-12-05 18:41 ` Marek Lindner
  0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2011-12-04 21:38 UTC (permalink / raw)
  To: b.a.t.m.a.n

When receiving a DEL change for a client due to a roaming event (change is
marked with TT_CLIENT_ROAM), each node  has to check if the client roamed
to itself or somewhere else.

In the latter case the global entry is kept to avoid having no route at all
otherwise we can safely delete the global entry

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

diff --git a/translation-table.c b/translation-table.c
index cf3e2c2..6e01079 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -663,6 +663,7 @@ void tt_global_del(struct bat_priv *bat_priv,
 		   const char *message, bool roaming)
 {
 	struct tt_global_entry *tt_global_entry = NULL;
+	struct tt_local_entry *tt_local_entry = NULL
 
 	tt_global_entry = tt_global_hash_find(bat_priv, addr);
 	if (!tt_global_entry)
@@ -670,15 +671,29 @@ void tt_global_del(struct bat_priv *bat_priv,
 
 	if (tt_global_entry->orig_node == orig_node) {
 		if (roaming) {
-			tt_global_entry->common.flags |= TT_CLIENT_ROAM;
-			tt_global_entry->roam_at = jiffies;
-			goto out;
+			/* 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->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);
 	}
 out:
 	if (tt_global_entry)
 		tt_global_entry_free_ref(tt_global_entry);
+	if (tt_local_entry)
+		tt_local_entry_free_ref(tt_local_entry);
 }
 
 void tt_global_del_orig(struct bat_priv *bat_priv,
-- 
1.7.3.4


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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: delete global entry in case of roaming
  2011-12-04 21:38 [B.A.T.M.A.N.] [PATCH] batman-adv: delete global entry in case of roaming Antonio Quartulli
@ 2011-12-05 18:41 ` Marek Lindner
  2011-12-05 23:33   ` Antonio Quartulli
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Lindner @ 2011-12-05 18:41 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Monday, December 05, 2011 05:38:27 Antonio Quartulli wrote:
> diff --git a/translation-table.c b/translation-table.c
> index cf3e2c2..6e01079 100644
> --- a/translation-table.c
> +++ b/translation-table.c
> @@ -663,6 +663,7 @@ void tt_global_del(struct bat_priv *bat_priv,
>  		   const char *message, bool roaming)
>  {
>  	struct tt_global_entry *tt_global_entry = NULL;
> +	struct tt_local_entry *tt_local_entry = NULL

Please make sure that your patch at least(!) compiles before you send it to 
the list. It also would be nice if the patches destined for the maint branch 
were based on based on this very branch. Saves some time and (merge) hair ..
 
Applied in revision db10af5.

Thanks,
Marek

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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: delete global entry in case of roaming
  2011-12-05 18:41 ` Marek Lindner
@ 2011-12-05 23:33   ` Antonio Quartulli
  0 siblings, 0 replies; 3+ messages in thread
From: Antonio Quartulli @ 2011-12-05 23:33 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Tue, Dec 06, 2011 at 02:41:59AM +0800, Marek Lindner wrote:
> Please make sure that your patch at least(!) compiles before you send it to 
> the list. It also would be nice if the patches destined for the maint branch 
> were based on based on this very branch. Saves some time and (merge) hair ..

Woops, I overlooked too many stuff this time! Thank you for your patience!
Ehm..I'm sorry for your hair!

>  
> Applied in revision db10af5.
> 

Thanks.


Cheers,


-- 
Antonio Quartulli

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

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

end of thread, other threads:[~2011-12-05 23:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-04 21:38 [B.A.T.M.A.N.] [PATCH] batman-adv: delete global entry in case of roaming Antonio Quartulli
2011-12-05 18:41 ` Marek Lindner
2011-12-05 23:33   ` Antonio Quartulli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox