From patchwork Thu Mar 11 21:19:06 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: 45 Return-Path: Received: from fmmailgate02.web.de (fmmailgate02.web.de [217.72.192.227]) by open-mesh.net (Postfix) with ESMTP id 174BE154311 for ; Thu, 11 Mar 2010 22:19:16 +0100 (CET) Received: from smtp07.web.de (fmsmtp07.dlan.cinetic.de [172.20.5.215]) by fmmailgate02.web.de (Postfix) with ESMTP id 38459153A1B60 for ; Thu, 11 Mar 2010 22:19:15 +0100 (CET) Received: from [92.224.147.159] (helo=localhost) by smtp07.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.110 #314) id 1Nppmk-0001UE-00; Thu, 11 Mar 2010 22:19:14 +0100 From: =?UTF-8?q?Linus=20L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 11 Mar 2010 22:19:06 +0100 Message-Id: <1268342346-13713-1-git-send-email-linus.luessing@web.de> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1268325529-10998-1-git-send-email-linus.luessing@web.de> References: <1268325529-10998-1-git-send-email-linus.luessing@web.de> MIME-Version: 1.0 Sender: linus.luessing@web.de X-Sender: linus.luessing@web.de X-Provags-ID: V01U2FsdGVkX18Zt8isllOMtd2xZFN6JBB3gm0jBg2r2wkYEdvv a2BfahqtRdd2W5bZqOjFaRNfB4As3JVRR3zGVGp2Hu6YQaclo7 ZKXIgDaW7qZxTL2rfpuA== Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: Fixing wrap-around bug in vis 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: Thu, 11 Mar 2010 21:19:16 -0000 When the seqno for a vis packet had a wrap around from i.e. 255 to 0, add_packet() would falsely claim the older packet with the seqno 255 as newer as the one with the seqno of 0 and would therefore ignore the new packet. This happens with all following vis packets until the old vis packet expires after 180 seconds timeout. This patch fixes this issue and gets rid of these highly undesired 3min. breaks for the vis-server. Signed-off-by: Linus Lüssing --- batman-adv-kernelland/vis.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/batman-adv-kernelland/vis.c b/batman-adv-kernelland/vis.c index fa8a487..5735a6a 100644 --- a/batman-adv-kernelland/vis.c +++ b/batman-adv-kernelland/vis.c @@ -213,7 +213,8 @@ static struct vis_info *add_packet(struct vis_packet *vis_packet, old_info = hash_find(vis_hash, &search_elem); if (old_info != NULL) { - if (vis_packet->seqno - old_info->packet.seqno <= 0) { + if (vis_packet->seqno - old_info->packet.seqno + <= 1 << 7 * sizeof(vis_packet->seqno)) { if (old_info->packet.seqno == vis_packet->seqno) { recv_list_add(&old_info->recv_list, vis_packet->sender_orig);