From: Donald Sharp Date: Fri, 23 Oct 2015 14:10:30 +0000 (-0700) Subject: pimd: Add some code to intelligently handle WHOLEPKT generation X-Git-Tag: frr-2.0-rc1~816 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=04b40f027cd58b1c5bbea8b7c4e2d8caa2b4acda;p=mirror%2Ffrr.git pimd: Add some code to intelligently handle WHOLEPKT generation When we get a NOCACHE call from the kernel, there is no point generating a mcast route for the packet if there is no RP configured, or if PIM-SSM is configured on the interface. Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 4ee2f9b851..6e48222852 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -72,6 +72,22 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg const char *src_str, const char *grp_str) { struct mfcctl mc; + struct pim_interface *pim_ifp = ifp->info; + + /* + * If the incoming interface is unknown OR + * the Interface type is SSM we don't need to + * do anything here + */ + if ((qpim_rp.s_addr == INADDR_NONE) || + (!pim_ifp) || + (pim_ifp->itype == PIM_INTERFACE_SSM)) + return 0; + + if (PIM_DEBUG_PIM_TRACE) { + zlog_debug("%s: Adding a Route for %s from %s for WHOLEPKT consumption", + __PRETTY_FUNCTION__, grp_str, src_str); + } /* * This is just a hack to get the (S,G) received packet up into @@ -92,6 +108,13 @@ static int pim_mroute_msg_wholepkt (int fd, struct interface *ifp, const struct igmpmsg *msg, const char *src_str, const char *grp_str) { + + if (qpim_rp.s_addr == INADDR_NONE) { + if (PIM_DEBUG_PIM_TRACE) { + zlog_debug("%s: Received WHOLEPKT with no RP configured to send it to", + __PRETTY_FUNCTION__); + } + } return 0; } diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index eaafa46ae8..d3cd91673c 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -45,7 +45,7 @@ pim_rp_check_rp (struct in_addr old, struct in_addr new) zlog_debug("%s: %s for old %s new %s", __func__, rp, sold, snew ); } - if (qpim_rp.s_addr == 0) + if (qpim_rp.s_addr == INADDR_NONE) return; if (new.s_addr == qpim_rp.s_addr) @@ -98,7 +98,7 @@ pim_rp_g (struct in_addr group) int pim_rp_set_upstream_addr (struct in_addr *up, struct in_addr source) { - if ((qpim_rp.s_addr == 0) && (source.s_addr == 0xFFFFFFFF)) + if ((qpim_rp.s_addr == INADDR_NONE) && (source.s_addr == 0xFFFFFFFF)) { if (PIM_DEBUG_PIM_TRACE) zlog_debug("%s: Received a (*,G) with no RP configured", __PRETTY_FUNCTION__); diff --git a/pimd/pimd.c b/pimd/pimd.c index 8ed110dc5c..3b2be7975a 100644 --- a/pimd/pimd.c +++ b/pimd/pimd.c @@ -69,7 +69,7 @@ int64_t qpim_mroute_add_last = 0; int64_t qpim_mroute_del_events = 0; int64_t qpim_mroute_del_last = 0; struct list *qpim_static_route_list = 0; -struct in_addr qpim_rp; +struct in_addr qpim_rp = { .s_addr = INADDR_NONE }; int32_t qpim_register_suppress_time = PIM_REGISTER_SUPPRESSION_TIME_DEFAULT; int32_t qpim_register_probe_time = PIM_REGISTER_PROBE_TIME_DEFAULT;