summaryrefslogtreecommitdiff
path: root/pimd/pim_igmpv3.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2021-08-24 18:21:59 +0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2025-02-10 15:40:07 -0300
commitf07d379b74e06f0602f3779e78038dc708aa7345 (patch)
tree80b01573958993e1bda24b32184a3dcb085f303d /pimd/pim_igmpv3.c
parentbaf4c1a78fe4cafdbb2cdbed030a31ea04a18c4a (diff)
pimd: implement IGMP group/source count limit
For groups we can just look at the length of the list, for sources we need to count them on a per-interface level. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_igmpv3.c')
-rw-r--r--pimd/pim_igmpv3.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c
index 7348d8130f..7cb168dc5d 100644
--- a/pimd/pim_igmpv3.c
+++ b/pimd/pim_igmpv3.c
@@ -423,6 +423,7 @@ struct gm_source *igmp_find_source_by_addr(struct gm_group *group,
struct gm_source *igmp_get_source_by_addr(struct gm_group *group,
struct in_addr src_addr, bool *new)
{
+ const struct pim_interface *pim_interface = group->interface->info;
struct gm_source *src;
if (new)
@@ -432,6 +433,14 @@ struct gm_source *igmp_get_source_by_addr(struct gm_group *group,
if (src)
return src;
+ if (listcount(group->group_source_list) >= pim_interface->gm_source_limit) {
+ if (PIM_DEBUG_GM_TRACE)
+ zlog_debug("interface %s has reached source limit (%u), refusing to add source %pI4 (group %pI4)",
+ group->interface->name, pim_interface->gm_source_limit,
+ &src_addr, &group->group_addr);
+ return NULL;
+ }
+
if (PIM_DEBUG_GM_TRACE) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];