in various scenarios it would be possible that a node receives an ADD event for
a client it already knows to belong to the advertiser. In this case the node has
to update the global entry ttvn with the one carried by the OGM.

Signed-off-by: Antonio Quartulli <or...@autistici.org>
---
 translation-table.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/translation-table.c b/translation-table.c
index cd6c2dd..ab295ee 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -593,6 +593,7 @@ int tt_global_add(struct bat_priv *bat_priv, struct 
orig_node *orig_node,
                  bool wifi)
 {
        struct tt_global_entry *tt_global_entry = NULL;
+       struct tt_orig_list_entry *orig_entry;
        int ret = 0;
        int hash_added;
 
@@ -640,9 +641,17 @@ int tt_global_add(struct bat_priv *bat_priv, struct 
orig_node *orig_node,
                        tt_global_entry->roam_at = 0;
                }
 
-               if (!tt_global_entry_has_orig(tt_global_entry, orig_node))
+               orig_entry = tt_global_entry_has_orig(tt_global_entry,
+                                                     orig_node);
+               if (!orig_entry)
                        tt_global_add_orig_entry(tt_global_entry, orig_node,
                                                 ttvn);
+               else
+                       /* if we are "adding" global entry, we may want to
+                        * update the ttvn anyway. Perhaps the global entry is
+                        * here with a wrong ttvn because it was temporary added
+                        * before */
+                       orig_entry->ttvn = ttvn;
        }
 
        if (wifi)
-- 
1.7.9.4

Reply via email to