From patchwork Sun Jun 26 13:31:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1144 Return-Path: Received: from nm12-vm0.bullet.mail.ukl.yahoo.com (nm12-vm0.bullet.mail.ukl.yahoo.com [217.146.183.246]) by open-mesh.org (Postfix) with SMTP id 4ABD51542BB for ; Sun, 26 Jun 2011 15:31:52 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.180] by nm12.bullet.mail.ukl.yahoo.com with NNFMP; 26 Jun 2011 13:31:51 -0000 Received: from [77.238.184.72] by tm11.bullet.mail.ukl.yahoo.com with NNFMP; 26 Jun 2011 13:31:51 -0000 Received: from [127.0.0.1] by smtp141.mail.ukl.yahoo.com with NNFMP; 26 Jun 2011 13:31:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1309095111; bh=XDu5wRP1V4Trr31AcdTPbX+MWZ1xPj+QwkJ5pmtPobk=; 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; b=FXGjbmGxqIo/kbsz45yeAqpmGD3CGy3ddbgYweDU9qZDgPuklnNJdc8xOrZiUJr3vKNLMw9aQFgPHPfeCpr+iXCd3k6k4TFsroRftb6PHpZRr32JeSRBiO/4Cvj5daZnMtGD++VwEDl6h/PRHgUF9i454jR1WlHdFiXmMjCP/LM= X-Yahoo-Newman-Id: 788133.1226.bm@smtp141.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: .bXQgmwVM1lgwM8KSKyUttHI6EGaNE0o3yiW9SXkImjkS.Y DiwjgsxZgtSKavY_AIPTnOX_ADEqRp2WvNWYS5smZ6EiR_YqzvYhvGcG7FC1 3yA.5bWma7l9lnkOHiQ.0breypEz_JCUUfOsj_I5b4b694GnPTgYZOuquCDV eaOUge68ERvpEE4O1GDaERR9P4DMQ3Nx0ZPuP2aYjKQ15W6VXkh_d8x9Izzo C6TTWQwsXW6gxyTetGZkSo9IJQSZrk6t.JyBnBir0RFj3Nx5qw6J3Ln.3DPU eSqh2zmS24JkTOzqcSXq_oeFcwsZPU0FgRDh.iy8jSWgfjtsUUv1grg-- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@90.61.150.39 with plain) by smtp141.mail.ukl.yahoo.com with SMTP; 26 Jun 2011 13:31:51 +0000 GMT From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 26 Jun 2011 15:31:39 +0200 Message-Id: <1309095099-14532-1-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.5.3 Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: broadcast primary OGM on all active hard-interfaces 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 Jun 2011 13:31:52 -0000 The primary interface OGM has to be broadcasted on all hard-interfaces even if the primary interface is not the first interface (if_num = 0). Therefore the code has to compare the originating interface with the primary interface instead of checking the if_num. Reported-by: Linus Luessing Signed-off-by: Marek Lindner --- send.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/send.c b/send.c index 2f62b2e..4b8e11b 100644 --- a/send.c +++ b/send.c @@ -163,6 +163,7 @@ static void send_packet(struct forw_packet *forw_packet) struct hard_iface *hard_iface; struct net_device *soft_iface; struct bat_priv *bat_priv; + struct hard_iface *primary_if = NULL; struct batman_packet *batman_packet = (struct batman_packet *)(forw_packet->skb->data); int directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0); @@ -170,19 +171,23 @@ static void send_packet(struct forw_packet *forw_packet) if (!forw_packet->if_incoming) { pr_err("Error - can't forward packet: incoming iface not " "specified\n"); - return; + goto out; } soft_iface = forw_packet->if_incoming->soft_iface; bat_priv = netdev_priv(soft_iface); if (forw_packet->if_incoming->if_status != IF_ACTIVE) - return; + goto out; + + primary_if = primary_if_get_selected(bat_priv); + if (!primary_if) + goto out; /* multihomed peer assumed */ /* non-primary OGMs are only broadcasted on their interface */ if ((directlink && (batman_packet->ttl == 1)) || - (forw_packet->own && (forw_packet->if_incoming->if_num > 0))) { + (forw_packet->own && (forw_packet->if_incoming != primary_if))) { /* FIXME: what about aggregated packets ? */ bat_dbg(DBG_BATMAN, bat_priv, @@ -199,7 +204,7 @@ static void send_packet(struct forw_packet *forw_packet) broadcast_addr); forw_packet->skb = NULL; - return; + goto out; } /* broadcast on every interface */ @@ -211,6 +216,10 @@ static void send_packet(struct forw_packet *forw_packet) send_packet_to_if(forw_packet, hard_iface); } rcu_read_unlock(); + +out: + if (primary_if) + hardif_free_ref(primary_if); } static void realloc_packet_buffer(struct hard_iface *hard_iface,