From patchwork Tue Apr 3 21:50:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1644 Return-Path: Received: from confino.investici.org (investici.nine.ch [217.150.252.179]) by open-mesh.org (Postfix) with ESMTPS id A2CF4600759 for ; Tue, 3 Apr 2012 23:49:29 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [217.150.252.179] (confino [217.150.252.179]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 06FC1C8656; Tue, 3 Apr 2012 21:49:28 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 confino.investici.org 06FC1C8656 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1333489769; bh=2Rrq2MZLCzJynshqplL2Tk8fERxBgFrvhact21/Sv8c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=IjnfhEGCtbmwAHCImzkOjsuErv2GaAsf2K5hF98jJHIRF5k/ug+494Uhe7vUTyAco YkDza6ZPZUwRbPdmP0h06/b+iX6lWL0hQD5dGnZ9kuwtOKYieK9U1vpN2RyU0wq6Ed gztoUOGKQi5pRbUDL0VtLAFwjgLvhVMF3Tz1LagI= From: Antonio Quartulli To: b.a.t.m.a.n@lists.open-mesh.org Date: Tue, 3 Apr 2012 23:50:19 +0200 Message-Id: <1333489822-27692-3-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.9.4 In-Reply-To: <1333489822-27692-1-git-send-email-ordex@autistici.org> References: <1333489822-27692-1-git-send-email-ordex@autistici.org> Subject: [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: clear the PENDING flag in case of client re-addition X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2012 21:49:29 -0000 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 --- 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,