]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: correctly process rp-count==0 BSMs 9852/head
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 22 Jul 2021 09:49:08 +0000 (11:49 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Wed, 17 Nov 2021 10:17:44 +0000 (11:17 +0100)
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 <equinox@opensourcerouting.org>
pimd/pim_bsm.c

index 2078a859e571510ca2ff65ddb0cb367b85a9328c..4689b270348b5c83f006313dcf6e2985c58b5ba0 100644 (file)
@@ -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("<Group?>", 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("<Group?>", 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.",