From patchwork Tue Feb 28 11:32:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1585 Return-Path: Received: from nm5.bullet.mail.ukl.yahoo.com (nm5.bullet.mail.ukl.yahoo.com [217.146.182.226]) by open-mesh.org (Postfix) with SMTP id 459316008D4 for ; Tue, 28 Feb 2012 12:34:14 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.217] by nm5.bullet.mail.ukl.yahoo.com with NNFMP; 28 Feb 2012 11:34:14 -0000 Received: from [77.238.184.63] by tm10.bullet.mail.ukl.yahoo.com with NNFMP; 28 Feb 2012 11:34:14 -0000 Received: from [127.0.0.1] by smtp132.mail.ukl.yahoo.com with NNFMP; 28 Feb 2012 11:34:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1330428854; bh=wH3HEJKXeQHIIY64cAYdZozd5qVg4CL2wGTVpdKG5YI=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=lTiJim2sDWFgideLKcKfUbty3RdDbj9h8hPGaNo0heCFgARG9ofX6ruqPAnPDUgKS0M7ndDIMnCWgO/F0hhPUkV5tu8qKt3ymRjwoJYMwO0gDzO+npRnYtjHmvorEUA4ca7LyWey0LhNDWKkNKJfpRpF7Y5RzC9H5EXBuzYSeiQ= X-Yahoo-Newman-Id: 100442.43484.bm@smtp132.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: dkBFjlYVM1lLj3iExfeNWDToQHqmyngpCYTohgYq5b5AjiP 3cMbq7oaGulR0OJSPBBjC3QUH6Vdy9mnelcdTaSHnuNy1cf7dfqmsj0zQF7j FdEsjp8WVGBRLW7bCsJhEHpfn6pdi8B8R7cDWySSUTAVMFOjo3q3GhgnsoOG U1Bm_4WuQVOX2VX4unEuJocJaEyGbwvFnUcapod.8LlqBrOBUcwVUjKeyL7P 92t4RDEDv71fL5e11LwaRYVEsoaAIqessj5ZUV4caM5jsTXhgOprh.zvAKyx LG46co3axKELvYkx3zHeHupDg20C2V7VW1lu3kJDWl3OnxKtaPkhWo3.ME4x z5WHaUqVKtpvzRpCqy4p8gwqlFL22A4NVySWF3YHr4k7jVR.aHUdYxLsAFyp uXgymAOF_4Yk- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@119.236.110.45 with plain) by smtp132.mail.ukl.yahoo.com with SMTP; 28 Feb 2012 11:34:09 +0000 GMT From: Marek Lindner To: davem@davemloft.net Date: Tue, 28 Feb 2012 19:32:22 +0800 Message-Id: <1330428748-23137-3-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1330428748-23137-1-git-send-email-lindner_marek@yahoo.de> References: <1330428748-23137-1-git-send-email-lindner_marek@yahoo.de> Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 2/8] batman-adv: refactor tt_global_del() to avoid misalignment 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, 28 Feb 2012 11:34:14 -0000 From: Sven Eckelmann Signed-off-by: Sven Eckelmann Acked-by: Antonio Quartulli Signed-off-by: Marek Lindner --- net/batman-adv/translation-table.c | 42 ++++++++++++++++++----------------- 1 files changed, 22 insertions(+), 20 deletions(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index ff9a1b3..30c2d1b 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -657,29 +657,31 @@ void tt_global_del(struct bat_priv *bat_priv, struct tt_local_entry *tt_local_entry = NULL; tt_global_entry = tt_global_hash_find(bat_priv, addr); - if (!tt_global_entry) + if (!tt_global_entry || tt_global_entry->orig_node != orig_node) goto out; - if (tt_global_entry->orig_node == orig_node) { - if (roaming) { - /* if we are deleting a global entry due to a roam - * event, there are two possibilities: - * 1) the client roamed from node A to node B => we mark - * it with TT_CLIENT_ROAM, we start a timer and we - * wait for node B to claim it. In case of timeout - * the entry is purged. - * 2) the client roamed to us => we can directly delete - * the global entry, since it is useless now. */ - tt_local_entry = tt_local_hash_find(bat_priv, - tt_global_entry->common.addr); - if (!tt_local_entry) { - tt_global_entry->common.flags |= TT_CLIENT_ROAM; - tt_global_entry->roam_at = jiffies; - goto out; - } - } - _tt_global_del(bat_priv, tt_global_entry, message); + if (!roaming) + goto out_del; + + /* if we are deleting a global entry due to a roam + * event, there are two possibilities: + * 1) the client roamed from node A to node B => we mark + * it with TT_CLIENT_ROAM, we start a timer and we + * wait for node B to claim it. In case of timeout + * the entry is purged. + * 2) the client roamed to us => we can directly delete + * the global entry, since it is useless now. */ + tt_local_entry = tt_local_hash_find(bat_priv, + tt_global_entry->common.addr); + if (!tt_local_entry) { + tt_global_entry->common.flags |= TT_CLIENT_ROAM; + tt_global_entry->roam_at = jiffies; + goto out; } + +out_del: + _tt_global_del(bat_priv, tt_global_entry, message); + out: if (tt_global_entry) tt_global_entry_free_ref(tt_global_entry);