From patchwork Mon Mar 5 07:51:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1576 Return-Path: Received: from confino.investici.org (investici.nine.ch [217.150.252.179]) by open-mesh.org (Postfix) with ESMTPS id DB760600780 for ; Mon, 5 Mar 2012 08:53:02 +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 AC47EC864F; Mon, 5 Mar 2012 07:53:01 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 confino.investici.org AC47EC864F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1330933982; bh=01TY9uMH4aKBEl/Q7cGoA10kBG//cF6oWrz8v8JSugQ=; h=From:To:Cc:Subject:Date:Message-Id; b=pUNdMvq5Sgg7Jk+K0TeCdomJL0Ev2aua3D13I8VkfG9yEGVvN+vKiKazOoo4Tc/bn Mx7t3QGUyxbzDWEFyK27oRHjM2ME1lvRyPUxav9VpCCTgLFZ+TMLXQLx2uS8yXBBwX 7e4uhcJMltiio/9GJac8MUkvDC66tFUN+BugJ+Uc= From: Antonio Quartulli To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 5 Mar 2012 08:51:51 +0100 Message-Id: <1330933911-6320-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: avoid ap_isolated check for broadcast packet 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, 05 Mar 2012 07:53:03 -0000 in case of a broadcast packet, the result of the ap_isolated check is always false (since we have no ff:ff:ff:ff:ff:ff client to check for TT_CLIENT_WIFI), therefore we can avoid searching the translation table and we can return false directly Signed-off-by: Antonio Quartulli --- - Yes, it's just an optimisation that aims to avoid accessing the hash table when we already know that it is not needed. translation-table.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/translation-table.c b/translation-table.c index 9a07882..2e16882 100644 --- a/translation-table.c +++ b/translation-table.c @@ -2034,6 +2034,11 @@ bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst) if (!atomic_read(&bat_priv->ap_isolation)) return false; + /* if we are dealing with a broadcast packet, we can avoid to search the + * translation table */ + if (is_broadcast_ether_addr(dst)) + return false; + tt_local_entry = tt_local_hash_find(bat_priv, dst); if (!tt_local_entry) goto out;