Commit 3c3769e6 authored by Linus Lüssing's avatar Linus Lüssing Committed by David S. Miller

bridge: apply multicast snooping to IPv6 link-local, too

The multicast snooping code should have matured enough to be safely
applicable to IPv6 link-local multicast addresses (excluding the
link-local all nodes address, ff02::1), too.
Signed-off-by: default avatarLinus Lüssing <linus.luessing@web.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8fad9c39
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <net/netlink.h> #include <net/netlink.h>
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
#include <net/ipv6.h> #include <net/ipv6.h>
#include <net/addrconf.h>
#endif #endif
#include "br_private.h" #include "br_private.h"
...@@ -254,7 +255,7 @@ static bool is_valid_mdb_entry(struct br_mdb_entry *entry) ...@@ -254,7 +255,7 @@ static bool is_valid_mdb_entry(struct br_mdb_entry *entry)
return false; return false;
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
} else if (entry->addr.proto == htons(ETH_P_IPV6)) { } else if (entry->addr.proto == htons(ETH_P_IPV6)) {
if (!ipv6_is_transient_multicast(&entry->addr.u.ip6)) if (ipv6_addr_is_ll_all_nodes(&entry->addr.u.ip6))
return false; return false;
#endif #endif
} else } else
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <net/ipv6.h> #include <net/ipv6.h>
#include <net/mld.h> #include <net/mld.h>
#include <net/ip6_checksum.h> #include <net/ip6_checksum.h>
#include <net/addrconf.h>
#endif #endif
#include "br_private.h" #include "br_private.h"
...@@ -723,7 +724,7 @@ static int br_ip6_multicast_add_group(struct net_bridge *br, ...@@ -723,7 +724,7 @@ static int br_ip6_multicast_add_group(struct net_bridge *br,
{ {
struct br_ip br_group; struct br_ip br_group;
if (!ipv6_is_transient_multicast(group)) if (ipv6_addr_is_ll_all_nodes(group))
return 0; return 0;
br_group.u.ip6 = *group; br_group.u.ip6 = *group;
...@@ -1354,7 +1355,7 @@ static void br_ip6_multicast_leave_group(struct net_bridge *br, ...@@ -1354,7 +1355,7 @@ static void br_ip6_multicast_leave_group(struct net_bridge *br,
{ {
struct br_ip br_group; struct br_ip br_group;
if (!ipv6_is_transient_multicast(group)) if (ipv6_addr_is_ll_all_nodes(group))
return; return;
br_group.u.ip6 = *group; br_group.u.ip6 = *group;
...@@ -1495,7 +1496,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, ...@@ -1495,7 +1496,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
return 0; return 0;
/* Prevent flooding this packet if there is no listener present */ /* Prevent flooding this packet if there is no listener present */
if (ipv6_is_transient_multicast(&ip6h->daddr)) if (!ipv6_addr_is_ll_all_nodes(&ip6h->daddr))
BR_INPUT_SKB_CB(skb)->mrouters_only = 1; BR_INPUT_SKB_CB(skb)->mrouters_only = 1;
if (ip6h->nexthdr != IPPROTO_HOPOPTS || if (ip6h->nexthdr != IPPROTO_HOPOPTS ||
......
...@@ -476,16 +476,6 @@ extern void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, ...@@ -476,16 +476,6 @@ extern void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port,
#define mlock_dereference(X, br) \ #define mlock_dereference(X, br) \
rcu_dereference_protected(X, lockdep_is_held(&br->multicast_lock)) rcu_dereference_protected(X, lockdep_is_held(&br->multicast_lock))
#if IS_ENABLED(CONFIG_IPV6)
#include <net/addrconf.h>
static inline int ipv6_is_transient_multicast(const struct in6_addr *addr)
{
if (ipv6_addr_is_multicast(addr) && IPV6_ADDR_MC_FLAG_TRANSIENT(addr))
return 1;
return 0;
}
#endif
static inline bool br_multicast_is_router(struct net_bridge *br) static inline bool br_multicast_is_router(struct net_bridge *br)
{ {
return br->multicast_router == 2 || return br->multicast_router == 2 ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment