From: Antonio Quartulli <ordex@autistici.org>
To: "B.A.T.M.A.N" <b.a.t.m.a.n@lists.open-mesh.org>
Subject: [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: implement AP-isolation on the receiver side
Date: Sun, 5 Jun 2011 23:01:04 +0200 [thread overview]
Message-ID: <1307307664-19910-4-git-send-email-ordex@autistici.org> (raw)
In-Reply-To: <1307307664-19910-1-git-send-email-ordex@autistici.org>
When a node receives a unicast packet it checks if the source and the
destination client can communicate or not due to the AP isolation
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
soft-interface.c | 3 +++
translation-table.c | 30 ++++++++++++++++++++++++++++++
translation-table.h | 1 +
3 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/soft-interface.c b/soft-interface.c
index 6489665..714a2af 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -733,6 +733,9 @@ void interface_rx(struct net_device *soft_iface,
soft_iface->last_rx = jiffies;
+ if (is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest))
+ goto dropped;
+
netif_rx(skb);
goto out;
diff --git a/translation-table.c b/translation-table.c
index e0c5945..24e48e7 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -1683,3 +1683,33 @@ void tt_free(struct bat_priv *bat_priv)
kfree(bat_priv->tt_buff);
}
+
+bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst)
+{
+ struct tt_local_entry *tt_local_entry = NULL;
+ struct tt_global_entry *tt_global_entry = NULL;
+ bool ret = true;
+
+ if (!atomic_read(&bat_priv->ap_isolation))
+ return false;
+
+ tt_local_entry = tt_local_hash_find(bat_priv, dst);
+ if (!tt_local_entry)
+ goto out;
+
+ tt_global_entry = tt_global_hash_find(bat_priv, src);
+ if (!tt_global_entry)
+ goto out;
+
+ if (_is_ap_isolated(tt_local_entry, tt_global_entry))
+ goto out;
+
+ ret = false;
+
+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 ret;
+}
diff --git a/translation-table.h b/translation-table.h
index 3055b8b..8080153 100644
--- a/translation-table.h
+++ b/translation-table.h
@@ -67,5 +67,6 @@ void handle_tt_response(struct bat_priv *bat_priv,
struct tt_query_packet *tt_response);
void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
struct orig_node *orig_node);
+bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst);
#endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */
--
1.7.3.4
next prev parent reply other threads:[~2011-06-05 21:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-05 21:01 [B.A.T.M.A.N.] [PATCH 0/3] Implement the AP-Isolation mechanism Antonio Quartulli
2011-06-05 21:01 ` [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: detect clients connected through a 802.11 device Antonio Quartulli
2011-06-05 21:42 ` Andrew Lunn
2011-06-05 22:01 ` Antonio Quartulli
2011-06-05 23:22 ` Antonio Quartulli
2011-06-15 21:28 ` Marek Lindner
2011-06-15 22:43 ` Antonio Quartulli
2011-06-16 10:12 ` Marek Lindner
2011-06-05 21:01 ` [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: implement AP-isolation on the sender side Antonio Quartulli
2011-06-05 21:50 ` Andrew Lunn
2011-06-15 21:38 ` Marek Lindner
2011-06-05 21:01 ` Antonio Quartulli [this message]
2011-06-05 21:55 ` [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: implement AP-isolation on the receiver side Andrew Lunn
2011-06-05 22:16 ` Antonio Quartulli
2011-06-15 21:42 ` Marek Lindner
2011-06-15 22:45 ` Antonio Quartulli
2011-06-26 21:00 ` [B.A.T.M.A.N.] [PATCHv2 1/4] batman-adv: detect clients connected through a 802.11 device Antonio Quartulli
2011-06-26 21:00 ` [B.A.T.M.A.N.] [PATCHv2 2/4] batman-adv: implement AP-isolation on the receiver side Antonio Quartulli
2011-06-26 21:00 ` [B.A.T.M.A.N.] [PATCHv2 3/4] batman-adv: implement AP-isolation on the sender side Antonio Quartulli
2011-06-26 21:00 ` [B.A.T.M.A.N.] [PATCHv2 4/4] batman-adv: print client flags in the local/global transtables output Antonio Quartulli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1307307664-19910-4-git-send-email-ordex@autistici.org \
--to=ordex@autistici.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).