[2/5] batman-adv: clear the PENDING flag in case of client re-addition
Commit Message
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(-)
Comments
On Tue, Apr 03, 2012 at 11:50:19 +0200, Antonio Quartulli wrote:
> 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>
> ---
> + /* 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;
>
mh..When I wrote this patch "batman-adv: unset the TT_CLIENT_PENDING flag if
the new local entry already exists" was not applied yet, therefore this patch
must be reviewed.
Please wait before considering committing this patchset.
Cheers,
@@ -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,