From 2bc31c4422d3d871b3e9edcb45ba356ad474649d Mon Sep 17 00:00:00 2001 From: Anuradha Karuppiah Date: Fri, 15 Nov 2019 12:28:01 -0800 Subject: [PATCH] pimd: prevent LHR from register forwarding packets for non-FHR sources SPT switchover handling is done by adding pimreg in the OIL of the (*, G) entry on the LHR. This causes multicast data with that destination to be sent to pimd as IGMPMSG_WHOLEPKT. These packets trigger creation of (S,G) and also register forwarding. However register forwarding must only be done if the router is also a FHR. That FHR check was missing causing strange source registrations from multicast routers that were not directly connected to the source. Relevant logs from LHR - PIM: pim_mroute_msg: pim kernel upcall WHOLEPKT type=3 ip_p=0 from fd=9 for (S,G)=(6.0.0.30,239.1.1.111) on pimreg vifi=0 size=98 PIM: Sending (6.0.0.30,239.1.1.111) Register Packet to 81.0.0.5 PIM: pim_register_send: Sending (6.0.0.30,239.1.1.111) Register Packet to 81.0.0.5 on swp2 And 6.0.0.30 is clearly not directly connected on that router - root@tor-11:~# ip route |grep 6.0.0.30 -A2 6.0.0.30 proto ospf metric 20 nexthop via 6.0.0.22 dev swp1 weight 1 onlink nexthop via 6.0.0.23 dev swp2 weight 1 onlink root@tor-11:~# Ticket: CM-24549 Signed-off-by: Anuradha Karuppiah --- pimd/pim_mroute.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 39ced27278..503333a206 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -323,6 +323,15 @@ static int pim_mroute_msg_wholepkt(int fd, struct interface *ifp, pim_str_sg_dump(&sg)); return 0; } + + if (!PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)) { + if (PIM_DEBUG_PIM_REG) + zlog_debug( + "%s register forward skipped, not FHR", + up->sg_str); + return 0; + } + pim_register_send((uint8_t *)buf + sizeof(struct ip), ntohs(ip_hdr->ip_len) - sizeof(struct ip), pim_ifp->primary_address, rpg, 0, up);