[v3,1/3] batman-adv: Disallow mcast src address for data frames

Message ID 1470495863-22251-1-git-send-email-sven@narfation.org (mailing list archive)
State Accepted, archived
Delegated to: Simon Wunderlich
Headers

Commit Message

Sven Eckelmann Aug. 6, 2016, 3:04 p.m. UTC
  The routing checks are validating the source mac address of the outer
ethernet header. They reject every source mac address which is a broadcast
address. But they also have to reject and multicast mac addresses.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v3:
 - Fix patch subject
v2:
 - clarify in commit message that only the outer ethernet header is
   affected
   (thanks Linus)
 - split in patch 1/2
 - Allow zero mac address as source address in outer header as requested by
   Linus
---
 net/batman-adv/routing.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
  

Comments

Simon Wunderlich Oct. 24, 2016, 10:10 a.m. UTC | #1
On Saturday, August 6, 2016 5:04:21 PM CEST Sven Eckelmann wrote:
> The routing checks are validating the source mac address of the outer
> ethernet header. They reject every source mac address which is a broadcast
> address. But they also have to reject and multicast mac addresses.
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>

Applied this series in 3868d9b..bca103c.

Thanks,
     Simon
  

Patch

diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 610f2c4..913ab51 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -357,8 +357,8 @@  int batadv_recv_icmp_packet(struct sk_buff *skb,
 	if (is_broadcast_ether_addr(ethhdr->h_dest))
 		goto out;
 
-	/* packet with broadcast sender address */
-	if (is_broadcast_ether_addr(ethhdr->h_source))
+	/* packet with broadcast/multicast sender address */
+	if (is_multicast_ether_addr(ethhdr->h_source))
 		goto out;
 
 	/* not for me */
@@ -449,8 +449,8 @@  static int batadv_check_unicast_packet(struct batadv_priv *bat_priv,
 	if (is_broadcast_ether_addr(ethhdr->h_dest))
 		return -EBADR;
 
-	/* packet with broadcast sender address */
-	if (is_broadcast_ether_addr(ethhdr->h_source))
+	/* packet with broadcast/multicast sender address */
+	if (is_multicast_ether_addr(ethhdr->h_source))
 		return -EBADR;
 
 	/* not for me */
@@ -1091,8 +1091,8 @@  int batadv_recv_bcast_packet(struct sk_buff *skb,
 	if (!is_broadcast_ether_addr(ethhdr->h_dest))
 		goto out;
 
-	/* packet with broadcast sender address */
-	if (is_broadcast_ether_addr(ethhdr->h_source))
+	/* packet with broadcast/multicast sender address */
+	if (is_multicast_ether_addr(ethhdr->h_source))
 		goto out;
 
 	/* ignore broadcasts sent by myself */