From: David Lamparter Date: Thu, 22 Jul 2021 09:49:08 +0000 (+0200) Subject: pimd: correctly process rp-count==0 BSMs X-Git-Tag: base_8.2~200^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F9852%2Fhead;p=mirror%2Ffrr.git pimd: correctly process rp-count==0 BSMs rp-count==0 isn't a broken BSM, it just means the BSR no longer has any Candidate RPs for the group range. Previous behavior is badly mistaken since it stops processing the entire packet. Fix to correctly remove group range on rp-count==0 and continue processing remainder of the packet. Signed-off-by: David Lamparter --- diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c index 2078a859e5..4689b27034 100644 --- a/pimd/pim_bsm.c +++ b/pimd/pim_bsm.c @@ -1168,18 +1168,6 @@ static bool pim_bsm_parse_install_g2rp(struct bsm_scope *scope, uint8_t *buf, buf += sizeof(struct bsmmsg_grpinfo); offset += sizeof(struct bsmmsg_grpinfo); - if (grpinfo.rp_count == 0) { - if (PIM_DEBUG_BSM) { - char grp_str[INET_ADDRSTRLEN]; - - pim_inet4_dump("", grpinfo.group.addr, - grp_str, sizeof(grp_str)); - zlog_debug("%s, Rp count is zero for group: %s", - __func__, grp_str); - } - return false; - } - group.family = AF_INET; if (grpinfo.group.mask > IPV4_MAX_BITLEN) { if (PIM_DEBUG_BSM) @@ -1194,6 +1182,32 @@ static bool pim_bsm_parse_install_g2rp(struct bsm_scope *scope, uint8_t *buf, /* Get the Group node for the BSM rp table */ bsgrp = pim_bsm_get_bsgrp_node(scope, &group); + if (grpinfo.rp_count == 0) { + struct bsm_rpinfo *old_rpinfo; + + /* BSR explicitly no longer has RPs for this group */ + if (!bsgrp) + continue; + + if (PIM_DEBUG_BSM) { + char grp_str[INET_ADDRSTRLEN]; + + pim_inet4_dump("", grpinfo.group.addr, + grp_str, sizeof(grp_str)); + zlog_debug("%s, Rp count is zero for group: %s", + __func__, grp_str); + } + + old_rpinfo = bsm_rpinfos_first(bsgrp->bsrp_list); + if (old_rpinfo) + pim_rp_del(scope->pim, old_rpinfo->rp_address, + group, NULL, RP_SRC_BSR); + + pim_free_bsgrp_node(scope->bsrp_table, &bsgrp->group); + pim_free_bsgrp_data(bsgrp); + continue; + } + if (!bsgrp) { if (PIM_DEBUG_BSM) zlog_debug("%s, Create new BSM Group node.",