During an OGM interval (time between two successive OGM sendings) a client could be deleted (e.g. due to roaming) and then be re-added immediately after. After the deletion, the client is marked with the TT_CLIENT_PENDING flag. Therefore, in case of re-addition, the latter flag has to be reset
Signed-off-by: Antonio Quartulli ordex@autistici.org --- translation-table.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/translation-table.c b/translation-table.c index 438b786..fa1ac3a 100644 --- a/translation-table.c +++ b/translation-table.c @@ -248,15 +248,26 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr, tt_local_entry->common.flags |= TT_CLIENT_WIFI; atomic_set(&tt_local_entry->common.refcount, 2); tt_local_entry->last_seen = jiffies; + tt_local_entry->common.added_at = tt_local_entry->last_seen; +
/* the batman interface mac address should never be purged */ if (compare_eth(addr, soft_iface->dev_addr)) tt_local_entry->common.flags |= TT_CLIENT_NOPURGE;
- /* The local entry has to be marked as NEW to avoid to send it in - * a full table response going out before the next ttvn increment - * (consistency check) */ - tt_local_entry->common.flags |= TT_CLIENT_NEW; + /* if the client is marked as PENDING means that it has been marked for + * deletion during THIS OGM interval and the event has not been + * announced yet. Therefore we can simply unset the flag. The event from + * the event queue will be automatically be removed from the queue. + * Otherwise we can set the NEW flag */ + if (tt_local_entry->common.flags & TT_CLIENT_PENDING) + tt_local_entry->common.flags &= ~TT_CLIENT_PENDING; + else + /* The local entry has to be marked as NEW to avoid to send it + * in a full table response going out before the next ttvn + * increment (consistency check) */ + tt_local_entry->common.flags |= TT_CLIENT_NEW; +
hash_added = hash_add(bat_priv->tt_local_hash, compare_tt, choose_orig, &tt_local_entry->common,