From patchwork Sat Sep 8 16:02:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Wunderlich X-Patchwork-Id: 2289 Return-Path: Received: from cora.hrz.tu-chemnitz.de (cora.hrz.tu-chemnitz.de [134.109.228.40]) by open-mesh.org (Postfix) with ESMTPS id 336CF6007F9 for ; Sat, 8 Sep 2012 18:02:54 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass reason="1024-bit key; insecure key" header.i=@tu-chemnitz.de header.b=Op4HTCnb; dkim-adsp=none (insecure policy); dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tu-chemnitz.de; s=dkim2010; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=bHNGXgAZ1ZYYE4sDni8x54bTLtO5YH/QHEk/PpCxRS0=; b=Op4HTCnbT2nuJTCHcrLDFU+D71RRhGQVPpXJpa9pXtLKdVHU5ka+KsdzlZsMIh0ZI3hEfB9Ulxqa2LZx/mgeAbSSTJ7VzP8+ywtFLLXYjW+A5IlckGtqxjlIUC8631/GpM3k4F2XklK95Lgeako6DpuydbOKojz/TczCgOb42zA=; Received: from p57aa057e.dip0.t-ipconnect.de ([87.170.5.126] helo=pandem0nium) by cora.hrz.tu-chemnitz.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.80) (envelope-from ) id 1TANUj-0001by-FG; Sat, 08 Sep 2012 18:02:53 +0200 Received: from dotslash by pandem0nium with local (Exim 4.72) (envelope-from ) id 1TANUx-0007hq-AR; Sat, 08 Sep 2012 18:03:07 +0200 From: Simon Wunderlich To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 8 Sep 2012 18:02:54 +0200 Message-Id: <1347120174-29589-2-git-send-email-siwu@hrz.tu-chemnitz.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1347120174-29589-1-git-send-email-siwu@hrz.tu-chemnitz.de> References: <1347120174-29589-1-git-send-email-siwu@hrz.tu-chemnitz.de> X-purgate: clean X-purgate-type: clean X-purgate-ID: 154106::1347120173-000004ED-6B1EA66C/0-0/0-0 X-Scan-AV: cora.hrz.tu-chemnitz.de; 2012-09-08 18:02:53; 24f96f98bd3055c5228bddd6938e2c55 X-Scan-SA: cora.hrz.tu-chemnitz.de; 2012-09-08 18:02:53; 2ba1f14a1a22771a7813981093528aad X-Spam-Score: -1.0 (-) X-Spam-Report: --- Textanalyse SpamAssassin 3.3.1 (-1.0 Punkte) Fragen an/questions to: Postmaster TU Chemnitz * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP --- Ende Textanalyse Cc: Simon Wunderlich Subject: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: allow bla traffic only after first worker period X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 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, 08 Sep 2012 16:02:54 -0000 When adding a backbone gateway for the first time, it might not yet be known in the backbone, and therefore we should not forward broadcasts yet. This behaviour is the same as when sending a request to another backbone gw because of a CRC mismatch. The backbone gw will operate normal after the next periodic bla work. Signed-off-by: Simon Wunderlich --- bridge_loop_avoidance.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c index c522bdf..073dd15 100644 --- a/bridge_loop_avoidance.c +++ b/bridge_loop_avoidance.c @@ -410,9 +410,14 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig, batadv_orig_node_free_ref(orig_node); } - if (own_backbone) + if (own_backbone) { batadv_bla_send_announce(bat_priv, entry); + /* this will be decreased in the worker thread */ + atomic_inc(&entry->request_sent); + atomic_inc(&bat_priv->bla.num_requests); + } + return entry; } @@ -1146,6 +1151,18 @@ static void batadv_bla_periodic_work(struct work_struct *work) backbone_gw->lasttime = jiffies; batadv_bla_send_announce(bat_priv, backbone_gw); + + /* request_sent is only set after creation to avoid + * problems when we are not yet known as backbone gw + * in the backbone. + * + * We can reset this now and allow traffic again. */ + + if (atomic_read(&backbone_gw->request_sent) == 0) + continue; + + atomic_dec(&backbone_gw->bat_priv->bla.num_requests); + atomic_set(&backbone_gw->request_sent, 0); } rcu_read_unlock(); }