summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/translation-table.c
diff options
context:
space:
mode:
authorAntonio Quartulli2011-07-07 15:35:37 +0200
committerMarek Lindner2011-08-22 15:16:21 +0200
commit3d393e47321062dbf9078a66a7cc1c2a52bafecc (patch)
treef8e5675fd58984db15571fdc361655fbe6674241 /net/batman-adv/translation-table.c
parentbatman-adv: implement AP-isolation on the receiver side (diff)
downloadkernel-qcow2-linux-3d393e47321062dbf9078a66a7cc1c2a52bafecc.tar.gz
kernel-qcow2-linux-3d393e47321062dbf9078a66a7cc1c2a52bafecc.tar.xz
kernel-qcow2-linux-3d393e47321062dbf9078a66a7cc1c2a52bafecc.zip
batman-adv: implement AP-isolation on the sender side
If a node has to send a packet issued by a WIFI client to another WIFI client, the packet is dropped. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r--net/batman-adv/translation-table.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index d0ed931ad2e7..1f128e1656a7 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -794,29 +794,43 @@ static bool _is_ap_isolated(struct tt_local_entry *tt_local_entry,
}
struct orig_node *transtable_search(struct bat_priv *bat_priv,
- const uint8_t *addr)
+ const uint8_t *src, const uint8_t *addr)
{
- struct tt_global_entry *tt_global_entry;
+ struct tt_local_entry *tt_local_entry = NULL;
+ struct tt_global_entry *tt_global_entry = NULL;
struct orig_node *orig_node = NULL;
- tt_global_entry = tt_global_hash_find(bat_priv, addr);
+ if (src && atomic_read(&bat_priv->ap_isolation)) {
+ tt_local_entry = tt_local_hash_find(bat_priv, src);
+ if (!tt_local_entry)
+ goto out;
+ }
+ tt_global_entry = tt_global_hash_find(bat_priv, addr);
if (!tt_global_entry)
goto out;
+ /* check whether the clients should not communicate due to AP
+ * isolation */
+ if (tt_local_entry && _is_ap_isolated(tt_local_entry, tt_global_entry))
+ goto out;
+
if (!atomic_inc_not_zero(&tt_global_entry->orig_node->refcount))
- goto free_tt;
+ goto out;
/* A global client marked as PENDING has already moved from that
* originator */
if (tt_global_entry->flags & TT_CLIENT_PENDING)
- goto free_tt;
+ goto out;
orig_node = tt_global_entry->orig_node;
-free_tt:
- tt_global_entry_free_ref(tt_global_entry);
out:
+ if (tt_global_entry)
+ tt_global_entry_free_ref(tt_global_entry);
+ if (tt_local_entry)
+ tt_local_entry_free_ref(tt_local_entry);
+
return orig_node;
}