diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-01-27 11:44:42 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-01-27 11:44:42 -0500 |
| commit | c016b6c796fe3a8520fdd0f30ef377cbb73e0037 (patch) | |
| tree | 78c3b29b41860c367390bba20a4a4d16fbaf3469 /pimd/pim_util.c | |
| parent | 75688c44d98af271ca4eb4f3133ede9e7ae709bb (diff) | |
| parent | aceb2285dad63dca7bba7177012aabdb63e1cca5 (diff) | |
Merge remote-tracking branch 'origin/master' into pr/111
Diffstat (limited to 'pimd/pim_util.c')
| -rw-r--r-- | pimd/pim_util.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/pimd/pim_util.c b/pimd/pim_util.c index f5b6a8210a..1125db00a9 100644 --- a/pimd/pim_util.c +++ b/pimd/pim_util.c @@ -21,6 +21,7 @@ #include <zebra.h> #include "log.h" +#include "prefix.h" #include "pim_util.h" @@ -103,3 +104,43 @@ void pim_pkt_dump(const char *label, const uint8_t *buf, int size) size); zlog_hexdump(buf, size); } + +int +pim_is_group_224_0_0_0_24 (struct in_addr group_addr) +{ + static int first = 1; + static struct prefix group_224; + struct prefix group; + + if (first) + { + str2prefix ("224.0.0.0/24", &group_224); + first = 0; + } + + group.family = AF_INET; + group.u.prefix4 = group_addr; + group.prefixlen = 32; + + return prefix_match (&group_224, &group); +} + +int +pim_is_group_224_4 (struct in_addr group_addr) +{ + static int first = 1; + static struct prefix group_all; + struct prefix group; + + if (first) + { + str2prefix ("224.0.0.0/4", &group_all); + first = 0; + } + + group.family = AF_INET; + group.u.prefix4 = group_addr; + group.prefixlen = 32; + + return prefix_match (&group_all, &group); +} |
