diff options
| author | Sarita Patra <saritap@vmware.com> | 2022-10-12 21:37:28 -0700 |
|---|---|---|
| committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2022-10-21 07:35:14 +0000 |
| commit | a66684d9e697dab6891c4276eb393e75a1973b8f (patch) | |
| tree | 104c767e0baaf9b6098f170b8518d6ddc87aa0d9 | |
| parent | 20293a85ef11fae159c7897b183b4e5734c22913 (diff) | |
pimd, pim6d: Define pim_addr_is_multicast API
pim_addr_is_multicast API will check if the address is multicast
address or not.
Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit dce0f7468d4b1f3bb39dfdd0e768138bebb08b0d)
| -rw-r--r-- | pimd/pim_util.c | 12 | ||||
| -rw-r--r-- | pimd/pim_util.h | 1 |
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 */ |
