From patchwork Sat Jun 19 15:24:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Linus_L=C3=BCssing?= X-Patchwork-Id: 257 Return-Path: Received: from fmmailgate02.web.de (fmmailgate02.web.de [217.72.192.227]) by open-mesh.net (Postfix) with ESMTP id 7B786154361 for ; Sat, 19 Jun 2010 17:25:04 +0200 (CEST) Received: from smtp07.web.de ( [172.20.5.215]) by fmmailgate02.web.de (Postfix) with ESMTP id 9F4F3167FEEC4 for ; Sat, 19 Jun 2010 17:25:03 +0200 (CEST) Received: from [92.224.97.225] (helo=localhost) by smtp07.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.110 #4) id 1OPzup-0004Jb-00; Sat, 19 Jun 2010 17:25:03 +0200 From: =?UTF-8?q?Linus=20L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 19 Jun 2010 17:24:34 +0200 Message-Id: <1276961074-3223-1-git-send-email-linus.luessing@web.de> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 Sender: linus.luessing@web.de X-Sender: linus.luessing@web.de X-Provags-ID: V01U2FsdGVkX19ZYlsQyXT7KUwa2fXq2fgo7D1E2S6Zqz5AUC1l H/Vp36W5Edvk0XBQ3S/7ynLwqSko6VVXAscHhBdEbm4p1tQijw XDgtwSkTOpC7+jGvnh9Q== Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: Avoid rounding issues for local hna timeout X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.11 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: Sat, 19 Jun 2010 15:25:04 -0000 With the current default values, this patch is not critical, as LOCAL_HNA_TIMEOUT is a multiple of 1000 anyway. However, if someone would like to change this #define, the person could have some unexpected rounding issues. Therefore doing the multiplication before the division now. Signed-off-by: Linus Lüssing --- translation-table.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/translation-table.c b/translation-table.c index 619a9a8..cf37cc4 100644 --- a/translation-table.c +++ b/translation-table.c @@ -259,7 +259,7 @@ static void hna_local_purge(struct work_struct *work) hna_local_entry = hashit.bucket->data; timeout = hna_local_entry->last_seen + - ((LOCAL_HNA_TIMEOUT / 1000) * HZ); + ((LOCAL_HNA_TIMEOUT * HZ) / 1000); if ((!hna_local_entry->never_purge) && time_after(jiffies, timeout)) hna_local_del(hna_local_entry, "address timed out");