[v2] batman-adv: in case of roaming mark the client with TT_CLIENT_ROAM

Message ID 1322998010-19221-1-git-send-email-ordex@autistici.org (mailing list archive)
State Accepted, archived
Headers

Commit Message

Antonio Quartulli Dec. 4, 2011, 11:26 a.m. UTC
  In case of a client roaming from node A to node B, the latter have to mark the
corresponding global entry with TT_CLIENT_ROAM (instead of TT_CLIENT_PENDING).

Marking a global entry with TT_CLIENT_PENDING will end up in keeping such entry
forever (because this flag is only meant to be used with local entries and it is
never checked on global ones).

In the worst case (all the clients roaming to the same node A) the local and the
global table will contain exactly the same clients. Batman-adv will continue to
work, but the memory usage is duplicated.

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

* commit message improved

 translation-table.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
  

Comments

Marek Lindner Dec. 5, 2011, 5:04 p.m. UTC | #1
On Sunday, December 04, 2011 19:26:50 Antonio Quartulli wrote:
> In case of a client roaming from node A to node B, the latter have to mark
> the corresponding global entry with TT_CLIENT_ROAM (instead of
> TT_CLIENT_PENDING).
> 
> Marking a global entry with TT_CLIENT_PENDING will end up in keeping such
> entry forever (because this flag is only meant to be used with local
> entries and it is never checked on global ones).
> 
> In the worst case (all the clients roaming to the same node A) the local
> and the global table will contain exactly the same clients. Batman-adv
> will continue to work, but the memory usage is duplicated.

Applied in revision 913c412.

Thanks,
Marek
  

Patch

diff --git a/translation-table.c b/translation-table.c
index 7a7df4a..cf3e2c2 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -242,9 +242,11 @@  void tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
 	if (tt_global_entry) {
 		/* This node is probably going to update its tt table */
 		tt_global_entry->orig_node->tt_poss_change = true;
-		/* The global entry has to be marked as PENDING and has to be
+		/* The global entry has to be marked as ROAMING and has to be
 		 * kept for consistency purpose */
-		tt_global_entry->common.flags |= TT_CLIENT_PENDING;
+		tt_global_entry->common.flags |= TT_CLIENT_ROAM;
+		tt_global_entry->roam_at = jiffies;
+
 		send_roam_adv(bat_priv, tt_global_entry->common.addr,
 			      tt_global_entry->orig_node);
 	}