From: Simon Wunderlich <sw@simonwunderlich.de>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Simon Wunderlich <simon.wunderlich@open-mesh.com>
Subject: [PATCH 4/7] batman-adv: don't add loop detect macs to TT
Date: Wed, 25 Jan 2017 17:43:00 +0100 [thread overview]
Message-ID: <20170125164303.14268-5-sw@simonwunderlich.de> (raw)
In-Reply-To: <20170125164303.14268-1-sw@simonwunderlich.de>
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 1ae93e46fb98..2827cd3c13d2 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
+ *
+ * Return: 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 60516bbb7e83..4e447bf17332 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.11.0
next prev parent reply other threads:[~2017-01-25 16:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 16:42 [PATCH 0/7] pull request for net-next: batman-adv 2017-01-25 Simon Wunderlich
[not found] ` <20170125164303.14268-1-sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
2017-01-25 16:42 ` [PATCH 1/7] batman-adv: Start new development cycle Simon Wunderlich
2017-01-25 16:42 ` [PATCH 2/7] batman-adv: Treat NET_XMIT_CN as transmit successfully Simon Wunderlich
2017-01-26 3:56 ` David Miller
2017-01-25 16:42 ` [PATCH 3/7] batman-adv: Remove one condition check in batadv_route_unicast_packet Simon Wunderlich
2017-01-25 16:43 ` Simon Wunderlich [this message]
2017-01-25 16:43 ` [PATCH 5/7] uapi: install batman_adv.h header Simon Wunderlich
2017-01-25 16:43 ` [PATCH 6/7] batman-adv: update copyright years for 2017 Simon Wunderlich
2017-01-25 16:43 ` [PATCH 7/7] batman-adv: Remove unused variable in batadv_tt_local_set_flags Simon Wunderlich
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=20170125164303.14268-5-sw@simonwunderlich.de \
--to=sw@simonwunderlich.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=simon.wunderlich@open-mesh.com \
/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).