From patchwork Thu Jul 7 13:25:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1225 Return-Path: Received: from confino.investici.org (investici.nine.ch [217.150.252.179]) by open-mesh.org (Postfix) with ESMTPS id B60E1154455 for ; Thu, 7 Jul 2011 15:25:53 +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 0FD5BC8660; Thu, 7 Jul 2011 13:25:53 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 confino.investici.org 0FD5BC8660 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1310045153; bh=8Km5J/rDOJ81sEM/kt03iWDdN2Sn7oNeSjbU713k0+8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=Tv69v7vdn2tq8TiriAulJQiO6biI0P/3AVrN1WetZ9PfnHWBkr2RFj90vyn9nCucW GKG2c2ySa8l2PZnTWIfX8Xa0x+mWsX8guFqsEeJ8AjvqSiI6XAqfb2dZTpl7AUvl/d dg7d5ggBNsi6iJFKFDWLC8QBQ9xefrlN2ezuFG5I= From: Antonio Quartulli To: "B.A.T.M.A.N" Date: Thu, 7 Jul 2011 15:25:05 +0200 Message-Id: <1310045106-23202-4-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1310045106-23202-1-git-send-email-ordex@autistici.org> References: <1310045106-23202-1-git-send-email-ordex@autistici.org> Subject: [B.A.T.M.A.N.] [PATCHv3 3/4] batman-adv: keep global table consistency in case of roaming 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: Thu, 07 Jul 2011 13:25:53 -0000 To keep consistency of other originator tables, new clients detected as roamed, are kept in the global table but are marked as TT_CLIENT_PENDING They are purged only when the new ttvn is received by the corresponding originator. Moreover they need to be considered as removed in case of global transtable lookup. Signed-off-by: Antonio Quartulli --- translation-table.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/translation-table.c b/translation-table.c index 7cc67c0..fb6931d 100644 --- a/translation-table.c +++ b/translation-table.c @@ -230,8 +230,9 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr) if (tt_global_entry) { /* This node is probably going to update its tt table */ tt_global_entry->orig_node->tt_poss_change = true; - _tt_global_del(bat_priv, tt_global_entry, - "local tt received"); + /* The global entry has to be marked as PENDING and has to be + * kept for consistency purpose */ + tt_global_entry->flags |= TT_CLIENT_PENDING; send_roam_adv(bat_priv, tt_global_entry->addr, tt_global_entry->orig_node); } @@ -787,6 +788,11 @@ struct orig_node *transtable_search(struct bat_priv *bat_priv, if (!atomic_inc_not_zero(&tt_global_entry->orig_node->refcount)) goto free_tt; + /* A global client marked as PENDING has already moved from that + * originator */ + if (tt_global_entry->flags & TT_CLIENT_PENDING) + goto free_tt; + orig_node = tt_global_entry->orig_node; free_tt: