mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-02 15:08:17 +00:00
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>
This commit is contained in:
parent
69053fb4f0
commit
b815998a42
@ -1050,6 +1050,13 @@ struct igmp_group *igmp_add_group_by_addr(struct igmp_sock *igmp,
|
||||
return group;
|
||||
}
|
||||
|
||||
if (!pim_is_group_224_4 (group_addr))
|
||||
{
|
||||
zlog_warn("%s: Group Specified is not part of 224.0.0.0/4",
|
||||
__PRETTY_FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
Non-existant group is created as INCLUDE {empty}:
|
||||
|
||||
@ -1067,7 +1074,7 @@ struct igmp_group *igmp_add_group_by_addr(struct igmp_sock *igmp,
|
||||
if (!group) {
|
||||
zlog_warn("%s %s: XCALLOC() failure",
|
||||
__FILE__, __PRETTY_FUNCTION__);
|
||||
return 0; /* error, not found, could not create */
|
||||
return NULL; /* error, not found, could not create */
|
||||
}
|
||||
|
||||
group->group_source_list = list_new();
|
||||
@ -1075,7 +1082,7 @@ struct igmp_group *igmp_add_group_by_addr(struct igmp_sock *igmp,
|
||||
zlog_warn("%s %s: list_new() failure",
|
||||
__FILE__, __PRETTY_FUNCTION__);
|
||||
XFREE(MTYPE_PIM_IGMP_GROUP, group); /* discard group */
|
||||
return 0; /* error, not found, could not initialize */
|
||||
return NULL; /* error, not found, could not initialize */
|
||||
}
|
||||
group->group_source_list->del = (void (*)(void *)) igmp_source_free;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -33,4 +33,5 @@ uint16_t igmp_msg_decode8to16(uint8_t code);
|
||||
|
||||
void pim_pkt_dump(const char *label, const uint8_t *buf, int size);
|
||||
|
||||
int pim_is_group_224_4 (struct in_addr group_addr);
|
||||
#endif /* PIM_UTIL_H */
|
||||
|
Loading…
Reference in New Issue
Block a user