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;