* [B.A.T.M.A.N.] [PATCH] batman-adv: don't add loop detect macs to TT
@ 2016-11-24 15:11 Simon Wunderlich
2016-12-16 9:11 ` Sven Eckelmann
0 siblings, 1 reply; 2+ messages in thread
From: Simon Wunderlich @ 2016-11-24 15:11 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Simon Wunderlich
From: Simon Wunderlich <simon.wunderlich@open-mesh.com>
The bridge loop avoidance (BLA) feature of batman-adv sends packets to
probe for Mesh/LAN packet loops. Those packets are not sent by real
clients and should therefore not be added to the translation table (TT).
Signed-off-by: Simon Wunderlich <simon.wunderlich@open-mesh.com>
---
net/batman-adv/bridge_loop_avoidance.h | 18 ++++++++++++++++++
net/batman-adv/soft-interface.c | 3 ++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h
index 1ae93e4..af550d8 100644
--- a/net/batman-adv/bridge_loop_avoidance.h
+++ b/net/batman-adv/bridge_loop_avoidance.h
@@ -20,6 +20,8 @@
#include "main.h"
+#include <linux/compiler.h>
+#include <linux/stddef.h>
#include <linux/types.h>
struct net_device;
@@ -27,6 +29,22 @@ struct netlink_callback;
struct seq_file;
struct sk_buff;
+/**
+ * batadv_bla_is_loopdetect_mac - check if the mac address is from a loop detect
+ * frame sent by bridge loop avoidance
+ * @mac: mac address to check
+ *
+ * Returns true if the it looks like a loop detect frame
+ * (mac starts with BA:BE), false otherwise
+ */
+static inline bool batadv_bla_is_loopdetect_mac(const uint8_t *mac)
+{
+ if (mac[0] == 0xba && mac[1] == 0xbe)
+ return true;
+
+ return false;
+}
+
#ifdef CONFIG_BATMAN_ADV_BLA
bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
unsigned short vid, bool is_bcast);
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 7b3494a..1f55b4b 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -258,7 +258,8 @@ static int batadv_interface_tx(struct sk_buff *skb,
ethhdr = eth_hdr(skb);
/* Register the client MAC in the transtable */
- if (!is_multicast_ether_addr(ethhdr->h_source)) {
+ if (!is_multicast_ether_addr(ethhdr->h_source) &&
+ !batadv_bla_is_loopdetect_mac(ethhdr->h_source)) {
client_added = batadv_tt_local_add(soft_iface, ethhdr->h_source,
vid, skb->skb_iif,
skb->mark);
--
2.10.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: don't add loop detect macs to TT
2016-11-24 15:11 [B.A.T.M.A.N.] [PATCH] batman-adv: don't add loop detect macs to TT Simon Wunderlich
@ 2016-12-16 9:11 ` Sven Eckelmann
0 siblings, 0 replies; 2+ messages in thread
From: Sven Eckelmann @ 2016-12-16 9:11 UTC (permalink / raw)
To: b.a.t.m.a.n
[-- Attachment #1: Type: text/plain, Size: 775 bytes --]
On Donnerstag, 24. November 2016 16:11:01 CET Simon Wunderlich wrote:
> From: Simon Wunderlich <simon.wunderlich@open-mesh.com>
>
> The bridge loop avoidance (BLA) feature of batman-adv sends packets to
> probe for Mesh/LAN packet loops. Those packets are not sent by real
> clients and should therefore not be added to the translation table (TT).
>
> Signed-off-by: Simon Wunderlich <simon.wunderlich@open-mesh.com>
> ---
> net/batman-adv/bridge_loop_avoidance.h | 18 ++++++++++++++++++
> net/batman-adv/soft-interface.c | 3 ++-
> 2 files changed, 20 insertions(+), 1 deletion(-)
Applied in 447df986b83630a92ca9d33903023b7e1b2917f3 [1].
Kind regards,
Sven
[1] https://git.open-mesh.org/batman-adv.git/commit/447df986b83630a92ca9d33903023b7e1b2917f3
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-16 9:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-24 15:11 [B.A.T.M.A.N.] [PATCH] batman-adv: don't add loop detect macs to TT Simon Wunderlich
2016-12-16 9:11 ` Sven Eckelmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox