summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pimd/pim_util.c12
-rw-r--r--pimd/pim_util.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/pimd/pim_util.c b/pimd/pim_util.c
index 4b67dbf1b1..150e1a01ea 100644
--- a/pimd/pim_util.c
+++ b/pimd/pim_util.c
@@ -166,3 +166,15 @@ int pim_get_all_mcast_group(struct prefix *prefix)
#endif
return 1;
}
+
+bool pim_addr_is_multicast(pim_addr addr)
+{
+#if PIM_IPV == 4
+ if (IN_MULTICAST(addr.s_addr))
+ return true;
+#else
+ if (IN6_IS_ADDR_MULTICAST(&addr))
+ return true;
+#endif
+ return false;
+}
diff --git a/pimd/pim_util.h b/pimd/pim_util.h
index a4362bef90..6af79ddf6c 100644
--- a/pimd/pim_util.h
+++ b/pimd/pim_util.h
@@ -37,4 +37,5 @@ int pim_is_group_224_0_0_0_24(struct in_addr group_addr);
int pim_is_group_224_4(struct in_addr group_addr);
bool pim_is_group_filtered(struct pim_interface *pim_ifp, pim_addr *grp);
int pim_get_all_mcast_group(struct prefix *prefix);
+bool pim_addr_is_multicast(pim_addr addr);
#endif /* PIM_UTIL_H */