]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Move pim_mroute_connected_to_source to pim_iface.c
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 23 Aug 2016 14:35:16 +0000 (10:35 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:07 +0000 (20:26 -0500)
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 <sharpd@cumulusnetworks.com>
pimd/pim_iface.c
pimd/pim_iface.h
pimd/pim_mroute.c

index fae11b674a07ed65eebf28e1b1b5ea425595e1d6..dab2e0e1e715a07f5f7e6bed18b4c6d1edb602ef 100644 (file)
@@ -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;
+}
index 75b85c306a396ceb456debcb955c6db3271306f6..0be4918d726324c9335734683633425aea1d5f2c 100644 (file)
@@ -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 */
index 32d48748aba7f25bf3b02f5bd81d0cbbfe403ed6..3fb69bc86a2f75bb6cf061d6e6429c58337673b1 100644 (file)
@@ -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] = {
   "<unknown_upcall?>",
   "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;