From a0bf54c7dec30b12daff1a92d0418679de881a3e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 21 Sep 2018 10:17:48 -0400 Subject: [PATCH 1/3] pimd: Add some extra information to a show command The tracking of who have drpriority on an interface in pim was not displayed anywhere. Add to the show command for future reference. Signed-off-by: Donald Sharp --- pimd/pim_cmd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 1f3336811f..26932eea20 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -1187,8 +1187,9 @@ static void pim_show_interfaces_single(struct pim_instance *pim, vty_out(vty, "Designated Router\n"); vty_out(vty, "-----------------\n"); vty_out(vty, "Address : %s\n", dr_str); - vty_out(vty, "Priority : %d\n", - pim_ifp->pim_dr_priority); + vty_out(vty, "Priority : %d(%d)\n", + pim_ifp->pim_dr_priority, + pim_ifp->pim_dr_num_nondrpri_neighbors); vty_out(vty, "Uptime : %s\n", dr_uptime); vty_out(vty, "Elections : %d\n", pim_ifp->pim_dr_election_count); From 90a084e4a1bbffc2de9a1192fdc3ab30c58a1b80 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 21 Sep 2018 10:28:57 -0400 Subject: [PATCH 2/3] pimd: Add a debug to tell why we are not creating upsteam state When we decide we are not the right pim process to add upstream state for the igmp state received, notice this in a debug to make life easier to debug. Signed-off-by: Donald Sharp --- pimd/pim_zebra.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 4fa4ea857f..4ff9bd6bdc 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -1044,9 +1044,14 @@ void igmp_source_forward_start(struct pim_instance *pim, return; } - if (!(PIM_I_am_DR(pim_oif))) + if (!(PIM_I_am_DR(pim_oif))) { + if (PIM_DEBUG_IGMP_TRACE) + zlog_debug("%s: %s was received on %s interface but we are not DR for that interface", + __PRETTY_FUNCTION__, + pim_str_sg_dump(&sg), + group->group_igmp_sock->interface->name); return; - + } /* Feed IGMPv3-gathered local membership information into PIM per-interface (S,G) state. From b5469d021cd8240bf08bce8f9f0d9e1e644ff05d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 21 Sep 2018 11:41:46 -0400 Subject: [PATCH 3/3] pimd: blackhole traffic when we are not DR for Stream received Suppose we have a bridge with a host and two routers attached to it. r1 r2 | | -------- | host host is sending traffic. r1 and r2 are pim neighbors and r2 is the DR. Both r1 and r2 will receive data from the stream up the pim kernel socket. r1 will notice that it is not the DR and stop processing in pim. This code adds a bit more code to blackhole the route when r1 detects it is not the DR in this scenario. This is being done because the kernel is both keeping state and sending data to the pim process to continue processing this. Additionally if we happen to be running this on a asic, then blackholing the route in the asic can save a significant amount of cpu time handling this situation. Signed-off-by: Donald Sharp --- pimd/pim_mroute.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index c69e2939e4..436e0508f3 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -154,12 +154,12 @@ static int pim_mroute_msg_nocache(int fd, struct interface *ifp, * the Interface type is SSM we don't need to * do anything here */ - if (!rpg || (pim_rpf_addr_is_inaddr_none(rpg)) - || (!(PIM_I_am_DR(pim_ifp)))) { + if (!rpg || pim_rpf_addr_is_inaddr_none(rpg)) { if (PIM_DEBUG_MROUTE_DETAIL) zlog_debug( - "%s: Interface is not configured correctly to handle incoming packet: Could be !DR, !pim_ifp, !SM, !RP", + "%s: Interface is not configured correctly to handle incoming packet: Could be !pim_ifp, !SM, !RP", __PRETTY_FUNCTION__); + return 0; } @@ -179,6 +179,26 @@ static int pim_mroute_msg_nocache(int fd, struct interface *ifp, sg.src = msg->im_src; sg.grp = msg->im_dst; + if (!(PIM_I_am_DR(pim_ifp))) { + struct channel_oil *c_oil; + + if (PIM_DEBUG_MROUTE_DETAIL) + zlog_debug("%s: Interface is not the DR blackholing incoming traffic for %s", + __PRETTY_FUNCTION__, pim_str_sg_dump(&sg)); + + /* + * We are not the DR, but we are still receiving packets + * Let's blackhole those packets for the moment + * As that they will be coming up to the cpu + * and causing us to consider them. + */ + c_oil = pim_channel_oil_add(pim_ifp->pim, &sg, + pim_ifp->mroute_vif_index); + pim_mroute_add(c_oil, __PRETTY_FUNCTION__); + + return 0; + } + up = pim_upstream_find_or_add(&sg, ifp, PIM_UPSTREAM_FLAG_MASK_FHR, __PRETTY_FUNCTION__); if (!up) {