From patchwork Sun Feb 26 14:39:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1599 Return-Path: Received: from confino.investici.org (investici.nine.ch [217.150.252.179]) by open-mesh.org (Postfix) with ESMTPS id AEE41600748 for ; Sun, 26 Feb 2012 15:40:50 +0100 (CET) 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 CE729C865D; Sun, 26 Feb 2012 14:40:49 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 confino.investici.org CE729C865D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1330267250; bh=f0bKa+Z75G1qG3zQzq25p4U2dRC72nVGzFslAEglsMc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=W6PAEVlD9wp05EFb3NKvp0FPFF73n++3HUh2KjEcBYGOAFcBFRl8on+BaoNB9UXEf QfI0IN33r0FsRUcXchh9FkTF/+bnybgnmyEG9LTsN36E4ElJBUNkj+1mIbilnhvw+7 EUg+KF6gT5ZuiAI7amCE7RqaosrYM3awBPYD3GUE= From: Antonio Quartulli To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 26 Feb 2012 15:39:42 +0100 Message-Id: <1330267182-15607-2-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1330267182-15607-1-git-send-email-ordex@autistici.org> References: <1330267182-15607-1-git-send-email-ordex@autistici.org> Subject: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: skip the window protection test when the originator has no neighbours 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: Sun, 26 Feb 2012 14:40:50 -0000 When we receive an OGM from from a node for the first time, the last_real_seqno field of the orig_node structure has not been initialised yet. The value of this field is used to compute the current ogm-seqno window and therefore the protection mechanism will probably drop the packet due to an out-of-window error. To avoid this situation this patch adds a check to skip the window protection mechanism if no neighbour nodes have already been added. When the first neighbour node is added, the last_real_seqno field is initialised too. Reported-by: Marek Lindner Signed-off-by: Antonio Quartulli --- bat_iv_ogm.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c index c42e030..d9195b3 100644 --- a/bat_iv_ogm.c +++ b/bat_iv_ogm.c @@ -869,7 +869,8 @@ static int bat_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, seq_diff = batman_ogm_packet->seqno - orig_node->last_real_seqno; /* signalize caller that the packet is to be dropped. */ - if (window_protected(bat_priv, seq_diff, + if (!hlist_empty(&orig_node->neigh_list) && + window_protected(bat_priv, seq_diff, &orig_node->batman_seqno_reset)) goto out;