|
@@ -25,6 +25,7 @@
|
|
#include <linux/slab.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/timer.h>
|
|
#include <linux/timer.h>
|
|
#include <linux/inetdevice.h>
|
|
#include <linux/inetdevice.h>
|
|
|
|
+#include <linux/mroute.h>
|
|
#include <net/ip.h>
|
|
#include <net/ip.h>
|
|
#if IS_ENABLED(CONFIG_IPV6)
|
|
#if IS_ENABLED(CONFIG_IPV6)
|
|
#include <net/ipv6.h>
|
|
#include <net/ipv6.h>
|
|
@@ -1638,6 +1639,21 @@ static void br_multicast_err_count(const struct net_bridge *br,
|
|
u64_stats_update_end(&pstats->syncp);
|
|
u64_stats_update_end(&pstats->syncp);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void br_multicast_pim(struct net_bridge *br,
|
|
|
|
+ struct net_bridge_port *port,
|
|
|
|
+ const struct sk_buff *skb)
|
|
|
|
+{
|
|
|
|
+ unsigned int offset = skb_transport_offset(skb);
|
|
|
|
+ struct pimhdr *pimhdr, _pimhdr;
|
|
|
|
+
|
|
|
|
+ pimhdr = skb_header_pointer(skb, offset, sizeof(_pimhdr), &_pimhdr);
|
|
|
|
+ if (!pimhdr || pim_hdr_version(pimhdr) != PIM_VERSION ||
|
|
|
|
+ pim_hdr_type(pimhdr) != PIM_TYPE_HELLO)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ br_multicast_mark_router(br, port);
|
|
|
|
+}
|
|
|
|
+
|
|
static int br_multicast_ipv4_rcv(struct net_bridge *br,
|
|
static int br_multicast_ipv4_rcv(struct net_bridge *br,
|
|
struct net_bridge_port *port,
|
|
struct net_bridge_port *port,
|
|
struct sk_buff *skb,
|
|
struct sk_buff *skb,
|
|
@@ -1650,8 +1666,12 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br,
|
|
err = ip_mc_check_igmp(skb, &skb_trimmed);
|
|
err = ip_mc_check_igmp(skb, &skb_trimmed);
|
|
|
|
|
|
if (err == -ENOMSG) {
|
|
if (err == -ENOMSG) {
|
|
- if (!ipv4_is_local_multicast(ip_hdr(skb)->daddr))
|
|
|
|
|
|
+ if (!ipv4_is_local_multicast(ip_hdr(skb)->daddr)) {
|
|
BR_INPUT_SKB_CB(skb)->mrouters_only = 1;
|
|
BR_INPUT_SKB_CB(skb)->mrouters_only = 1;
|
|
|
|
+ } else if (pim_ipv4_all_pim_routers(ip_hdr(skb)->daddr)) {
|
|
|
|
+ if (ip_hdr(skb)->protocol == IPPROTO_PIM)
|
|
|
|
+ br_multicast_pim(br, port, skb);
|
|
|
|
+ }
|
|
return 0;
|
|
return 0;
|
|
} else if (err < 0) {
|
|
} else if (err < 0) {
|
|
br_multicast_err_count(br, port, skb->protocol);
|
|
br_multicast_err_count(br, port, skb->protocol);
|