From patchwork Tue Jul 5 15:23:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1245 Return-Path: Received: from latitanza.investici.org (latitanza.investici.org [82.94.249.234]) by open-mesh.org (Postfix) with ESMTPS id C72DE1544C7 for ; Tue, 5 Jul 2011 17:24:07 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [82.94.249.234] (latitanza [82.94.249.234]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id F321198393; Tue, 5 Jul 2011 15:24:06 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 latitanza.investici.org F321198393 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1309879447; bh=r2aWy9FofECFdqR4R2ck4yAmw+zG3k6eGLAXg2fl64I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ZYL6MDr0AOEhbw2H4BkaZ+NRB74iFwdN+dwjBOwXVUAMy7zyM6de0f3JgWnKrvtHr 8EM1WCyf0+/oVZ+92Rfjf+YnvyQM3zqMaR/0VJBriV7CVRfsJPzLH5VO6ix0bw14Vl 76FmAO7U6DHXAsZU+v+KEK2fWzIpxd55o8DI2bk8= From: Antonio Quartulli To: "B.A.T.M.A.N" Date: Tue, 5 Jul 2011 17:23:03 +0200 Message-Id: <1309879385-21224-5-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1309879385-21224-1-git-send-email-ordex@autistici.org> References: <1309879385-21224-1-git-send-email-ordex@autistici.org> Subject: [B.A.T.M.A.N.] [PATCH 4/6] batman-adv: mark local entry as PENDING in case of deletion 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, 05 Jul 2011 15:24:08 -0000 In case of deletion of a local entry, it has to be merked as "pending to be removed" but has to be kept in the table in order to send it within a full table response issued before the next ttvn increment. Signed-off-by: Antonio Quartulli --- packet.h | 3 ++- translation-table.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packet.h b/packet.h index 590e4a6..87b371d 100644 --- a/packet.h +++ b/packet.h @@ -84,7 +84,8 @@ enum tt_query_flags { enum tt_client_flags { TT_CLIENT_DEL = 1 << 0, TT_CLIENT_ROAM = 1 << 1, - TT_CLIENT_NOPURGE = 1 << 8 + TT_CLIENT_NOPURGE = 1 << 8, + TT_CLIENT_PENDING = 1 << 9 }; struct batman_packet { diff --git a/translation-table.c b/translation-table.c index 5570e58..cf26ee3 100644 --- a/translation-table.c +++ b/translation-table.c @@ -386,10 +386,11 @@ void tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, tt_local_event(bat_priv, tt_local_entry->addr, tt_local_entry->flags | TT_CLIENT_DEL | (roaming ? TT_CLIENT_ROAM : NO_FLAGS)); - tt_local_del(bat_priv, tt_local_entry, message); -out: - if (tt_local_entry) - tt_local_entry_free_ref(tt_local_entry); + + /* The local client has to be merked as "pending to be removed" but has + * to be kept in the table in order to send it in an full tables + * response issued before the net ttvn increment (consistency check) */ + tt_local_entry->flags |= TT_CLIENT_PENDING; } static void tt_local_purge(struct bat_priv *bat_priv) @@ -1411,6 +1412,10 @@ bool is_my_client(struct bat_priv *bat_priv, const uint8_t *addr) tt_local_entry = tt_local_hash_find(bat_priv, addr); if (!tt_local_entry) goto out; + /* Check if the client has been logically deleted (but is kept for + * consistency purpose) */ + if (tt_local_entry->flags & TT_CLIENT_PENDING) + goto out; ret = true; out: if (tt_local_entry)