summaryrefslogtreecommitdiff
path: root/pimd/pim_util.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-12-01 17:12:21 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-12-21 20:26:17 -0500
commitb815998a4296c6e7ce12faa37eaff0d7d0f697d7 (patch)
tree3f9e034a0b260ff3869ce413ef2ae646b24b6f82 /pimd/pim_util.c
parent69053fb4f0bf1b66a91b28e43c1a9a64db739d65 (diff)
pimd: Don't allow invalid groups to be passed for igmp
When we receive a invalid group( say outside of the 224/4 range) don't allow it to create state. Nicely reject the rejectable. Ticket: CM-13821 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_util.c')
-rw-r--r--pimd/pim_util.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/pimd/pim_util.c b/pimd/pim_util.c
index daee941f8b..f5255a241d 100644
--- a/pimd/pim_util.c
+++ b/pimd/pim_util.c
@@ -22,6 +22,7 @@
#include <zebra.h>
#include "log.h"
+#include "prefix.h"
#include "pim_util.h"
@@ -104,3 +105,20 @@ void pim_pkt_dump(const char *label, const uint8_t *buf, int size)
size);
zlog_hexdump(buf, size);
}
+
+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);
+
+ group.family = AF_INET;
+ group.u.prefix4 = group_addr;
+ group.prefixlen = 32;
+
+ return prefix_match (&group_all, &group);
+}