All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <ordex@autistici.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: clear the PENDING flag in case of client re-addition
Date: Tue,  3 Apr 2012 23:50:19 +0200	[thread overview]
Message-ID: <1333489822-27692-3-git-send-email-ordex@autistici.org> (raw)
In-Reply-To: <1333489822-27692-1-git-send-email-ordex@autistici.org>

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,
-- 
1.7.9.4


  parent reply	other threads:[~2012-04-03 21:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-03 21:50 [B.A.T.M.A.N.] [PATCH 0/5] batman-adv: tt code fixes and temporary client detection Antonio Quartulli
2012-04-03 21:50 ` [B.A.T.M.A.N.] [PATCH 1/5] batman-adv: clear ADD+DEL (and viceversa) events in the same orig-interval Antonio Quartulli
2012-04-03 21:50 ` Antonio Quartulli [this message]
2012-04-04 10:09   ` [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: clear the PENDING flag in case of client re-addition Antonio Quartulli
2012-04-03 21:50 ` [B.A.T.M.A.N.] [PATCH 3/5] batman-adv: beautify tt_global_add() argument list Antonio Quartulli
2012-04-03 21:50 ` [B.A.T.M.A.N.] [PATCH 4/5] batman-adv: let tt_global_entry_has_orig() return the orig_entry or NULL instead of 1 or 0 only Antonio Quartulli
2012-04-03 21:50 ` [B.A.T.M.A.N.] [PATCH 5/5] batman-adv: enable nodes to detect not yet announced clients Antonio Quartulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1333489822-27692-3-git-send-email-ordex@autistici.org \
    --to=ordex@autistici.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.