public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: avoid ap_isolated check for broadcast packet
@ 2012-03-05  7:51 Antonio Quartulli
  2012-03-05 19:52 ` Marek Lindner
  0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2012-03-05  7:51 UTC (permalink / raw)
  To: b.a.t.m.a.n

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 <ordex@autistici.org>
---

- 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;
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: avoid ap_isolated check for broadcast packet
  2012-03-05  7:51 [B.A.T.M.A.N.] [PATCH] batman-adv: avoid ap_isolated check for broadcast packet Antonio Quartulli
@ 2012-03-05 19:52 ` Marek Lindner
  2012-03-05 23:11   ` Antonio Quartulli
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Lindner @ 2012-03-05 19:52 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Monday, March 05, 2012 15:51:51 Antonio Quartulli wrote:
> 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

How about also checking the source address ? You probably also should add 
similar checks for tt_local_add() ? Or do we have "legal" cases in which we 
announce multicast addresses ?

Cheers,
Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: avoid ap_isolated check for broadcast packet
  2012-03-05 19:52 ` Marek Lindner
@ 2012-03-05 23:11   ` Antonio Quartulli
  0 siblings, 0 replies; 3+ messages in thread
From: Antonio Quartulli @ 2012-03-05 23:11 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

On Tue, Mar 06, 2012 at 03:52:46AM +0800, Marek Lindner wrote:
> On Monday, March 05, 2012 15:51:51 Antonio Quartulli wrote:
> > 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
> 
> How about also checking the source address ?

Actually I assumed that "legal" data only is passed to this function and so
there should be no need to check for the source address as well.

But I think this assumption is wrong, right? Actually the "internal" data of a
unicast/broadcast packet is never checked and so I should not assume that the
addresses passed to this function are legal.

> You probably also should add similar checks for tt_local_add() ?

Yep, we probably want to have the same checks in tt_local_add() because a wired
client could send any spoofed packet and we should protect our tables from them.

> Or do we have "legal" cases in which we announce multicast addresses ?

Not that I know (right now)


Cheers,
and greetings from Bruxelles

-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-05 23:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-05  7:51 [B.A.T.M.A.N.] [PATCH] batman-adv: avoid ap_isolated check for broadcast packet Antonio Quartulli
2012-03-05 19:52 ` Marek Lindner
2012-03-05 23:11   ` Antonio Quartulli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox