From patchwork Mon May 30 07:22:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 1120 Return-Path: Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id 507EA154436 for ; Mon, 30 May 2011 09:23:15 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@narfation.org; dkim-adsp=pass Received: from sven-desktop.home.narfation.org (bathseba.informatik.tu-chemnitz.de [134.109.192.185]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 280CE940EC; Mon, 30 May 2011 09:23:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=narfation.org; s=mail; t=1306740220; bh=EfOCJ0jpUi6b67sfuNKIB5wej96xDvecYrgxyR+9jw0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=eQQuOaK52KTl+7iroclHUg+e10MlwOYMsGiwGSzv8uOwOG1MGXS3ypzZqo1QzS0xw L2nI3vX9LS1WWXB+PItYe72vvPbGrEPuo27HuoSpnaAitWDfFQ0izgMwq2FbITagpQ CgNYKDHrXoQIemZA1Oy21+waxq9Kh/NQBjyYFWvI= From: Sven Eckelmann To: davem@davemloft.net Date: Mon, 30 May 2011 09:22:46 +0200 Message-Id: <1306740182-2665-2-git-send-email-sven@narfation.org> X-Mailer: git-send-email 1.7.5.3 In-Reply-To: <1306740182-2665-1-git-send-email-sven@narfation.org> References: <1306740182-2665-1-git-send-email-sven@narfation.org> Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org Subject: [B.A.T.M.A.N.] [PATCH 01/17] batman-adv: move neigh_node->if_incoming->if_status check in find_router() 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: Mon, 30 May 2011 07:23:15 -0000 From: Antonio Quartulli Every time that find_router() is invoked, if_status has to be compared with IF_ACTIVE. Moving this comparison inside find_router() will avoid to write it each time. Signed-off-by: Antonio Quartulli Signed-off-by: Sven Eckelmann --- net/batman-adv/routing.c | 3 +++ net/batman-adv/unicast.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index bb1c3ec..8c403ce 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -1240,6 +1240,9 @@ struct neigh_node *find_router(struct bat_priv *bat_priv, router = find_ifalter_router(primary_orig_node, recv_if); return_router: + if (router && router->if_incoming->if_status != IF_ACTIVE) + goto err_unlock; + rcu_read_unlock(); return router; err_unlock: diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index 19c3daf..bab6076 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c @@ -314,9 +314,6 @@ find_router: if (!neigh_node) goto out; - if (neigh_node->if_incoming->if_status != IF_ACTIVE) - goto out; - if (my_skb_head_push(skb, sizeof(struct unicast_packet)) < 0) goto out;