From: Donald Sharp Date: Tue, 23 Aug 2016 14:35:16 +0000 (-0400) Subject: pimd: Move pim_mroute_connected_to_source to pim_iface.c X-Git-Tag: frr-3.0-branchpoint~64^2~10^2~272 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=3565202d74795b4918a8ac20f5e72658b1fdb17e;p=matthieu%2Ffrr.git pimd: Move pim_mroute_connected_to_source to pim_iface.c Move the pim_mroute_conected_to_source function to pim_iface.c because this is a interface question not a mroute question. Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index fae11b674a..dab2e0e1e7 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -1249,3 +1249,26 @@ void pim_if_create_pimreg (void) pim_if_new(pim_regiface, 0, 0); } } + +int +pim_if_connected_to_source (struct interface *ifp, struct in_addr src) +{ + struct listnode *cnode; + struct connected *c; + struct prefix p; + + p.family = AF_INET; + p.u.prefix4 = src; + p.prefixlen = IPV4_MAX_BITLEN; + + for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c)) + { + if ((c->address->family == AF_INET) && + prefix_match (CONNECTED_PREFIX (c), &p)) + { + return 1; + } + } + + return 0; +} diff --git a/pimd/pim_iface.h b/pimd/pim_iface.h index 75b85c306a..0be4918d72 100644 --- a/pimd/pim_iface.h +++ b/pimd/pim_iface.h @@ -167,4 +167,6 @@ void pim_if_update_join_desired(struct pim_interface *pim_ifp); void pim_if_update_assert_tracking_desired(struct interface *ifp); void pim_if_create_pimreg(void); + +int pim_if_connected_to_source (struct interface *ifp, struct in_addr src); #endif /* PIM_IFACE_H */ diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 32d48748ab..3fb69bc86a 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -75,29 +75,6 @@ static int pim_mroute_set(int fd, int enable) return 0; } -static int -pim_mroute_connected_to_source (struct interface *ifp, struct in_addr src) -{ - struct listnode *cnode; - struct connected *c; - struct prefix p; - - p.family = AF_INET; - p.u.prefix4 = src; - p.prefixlen = IPV4_MAX_BITLEN; - - for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c)) - { - if ((c->address->family == AF_INET) && - prefix_match (CONNECTED_PREFIX (c), &p)) - { - return 1; - } - } - - return 0; -} - static const char *igmpmsgtype2str[IGMPMSG_WRVIFWHOLE + 1] = { "", "NOCACHE", @@ -129,7 +106,7 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg * If we've received a multicast packet that isn't connected to * us */ - if (!pim_mroute_connected_to_source (ifp, msg->im_src)) + if (!pim_if_connected_to_source (ifp, msg->im_src)) { if (PIM_DEBUG_MROUTE_DETAIL) zlog_debug ("%s: Received incoming packet that doesn't originate on our seg", @@ -384,7 +361,7 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf) return -2; } - if (pim_mroute_connected_to_source (ifp, sg.src)) + if (pim_if_connected_to_source (ifp, sg.src)) up->fhr = 1; pim_ifp = ifp->info;