diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2021-08-24 18:21:59 +0200 |
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2025-02-10 15:40:07 -0300 |
| commit | f07d379b74e06f0602f3779e78038dc708aa7345 (patch) | |
| tree | 80b01573958993e1bda24b32184a3dcb085f303d /pimd/pim_igmp.c | |
| parent | baf4c1a78fe4cafdbb2cdbed030a31ea04a18c4a (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_igmp.c')
| -rw-r--r-- | pimd/pim_igmp.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index 12f424248f..fa915719dd 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -1126,6 +1126,9 @@ void pim_igmp_if_init(struct pim_interface *pim_ifp, struct interface *ifp) { char hash_name[64]; + pim_ifp->gm_group_limit = UINT32_MAX; + pim_ifp->gm_source_limit = UINT32_MAX; + pim_ifp->gm_socket_list = list_new(); pim_ifp->gm_socket_list->del = (void (*)(void *))igmp_sock_free; @@ -1416,6 +1419,14 @@ struct gm_group *igmp_add_group_by_addr(struct gm_sock *igmp, __func__, &group_addr); return NULL; } + + if (listcount(pim_ifp->gm_group_list) >= pim_ifp->gm_group_limit) { + if (PIM_DEBUG_GM_TRACE) + zlog_debug("interface %s has reached group limit (%u), refusing to add group %pI4", + igmp->interface->name, pim_ifp->gm_group_limit, &group_addr); + return NULL; + } + /* Non-existant group is created as INCLUDE {empty}: |
