]> git.puffer.fish Git - mirror/frr.git/commitdiff
pim6d: add pimv6 support for bsmmsg_grpinfo
authorsarita patra <saritap@vmware.com>
Wed, 16 Mar 2022 10:17:06 +0000 (03:17 -0700)
committerSarita Patra <saritap@vmware.com>
Thu, 7 Jul 2022 17:56:45 +0000 (10:56 -0700)
Signed-off-by: sarita patra <saritap@vmware.com>
pimd/pim_bsm.c
pimd/pim_bsm.h

index ea61495690f0ed004fe52744fc539bb9bdfc4a61..b6fdf92f8bec21f84d2a1ca9b553f86d8f5f9478 100644 (file)
@@ -1132,6 +1132,7 @@ static bool pim_bsm_parse_install_g2rp(struct bsm_scope *scope, uint8_t *buf,
        int frag_rp_cnt = 0;
        int offset = 0;
        int ins_count = 0;
+       pim_addr grp_addr;
 
        while (buflen > offset) {
                if (offset + (int)sizeof(struct bsmmsg_grpinfo) > buflen) {
@@ -1143,31 +1144,28 @@ static bool pim_bsm_parse_install_g2rp(struct bsm_scope *scope, uint8_t *buf,
                }
                /* Extract Group tlv from BSM */
                memcpy(&grpinfo, buf, sizeof(struct bsmmsg_grpinfo));
+               grp_addr = grpinfo.group.addr;
 
-               if (PIM_DEBUG_BSM) {
-                       char grp_str[INET_ADDRSTRLEN];
-
-                       pim_inet4_dump("<Group?>", grpinfo.group.addr, grp_str,
-                                      sizeof(grp_str));
+               if (PIM_DEBUG_BSM)
                        zlog_debug(
-                               "%s, Group %s  Rpcount:%d Fragment-Rp-count:%d",
-                               __func__, grp_str, grpinfo.rp_count,
+                               "%s, Group %pPAs  Rpcount:%d Fragment-Rp-count:%d",
+                               __func__, &grp_addr, grpinfo.rp_count,
                                grpinfo.frag_rp_count);
-               }
 
                buf += sizeof(struct bsmmsg_grpinfo);
                offset += sizeof(struct bsmmsg_grpinfo);
 
-               group.family = AF_INET;
-               if (grpinfo.group.mask > IPV4_MAX_BITLEN) {
+               group.family = PIM_AF;
+               if (grpinfo.group.mask > PIM_MAX_BITLEN) {
                        if (PIM_DEBUG_BSM)
                                zlog_debug(
-                                       "%s, v4 prefix length specified: %d is too long",
+                                       "%s, prefix length specified: %d is too long",
                                        __func__, grpinfo.group.mask);
                        return false;
                }
+
+               pim_addr_to_prefix(&group, grp_addr);
                group.prefixlen = grpinfo.group.mask;
-               group.u.prefix4.s_addr = grpinfo.group.addr.s_addr;
 
                /* Get the Group node for the BSM rp table */
                bsgrp = pim_bsm_get_bsgrp_node(scope, &group);
@@ -1179,14 +1177,10 @@ static bool pim_bsm_parse_install_g2rp(struct bsm_scope *scope, uint8_t *buf,
                        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);
-                       }
+                       if (PIM_DEBUG_BSM)
+                               zlog_debug(
+                                       "%s, Rp count is zero for group: %pPAs",
+                                       __func__, &grp_addr);
 
                        old_rpinfo = bsm_rpinfos_first(bsgrp->bsrp_list);
                        if (old_rpinfo)
index 04c9c20067137be07ec626d0e6c971bde91e5be4..90bd2f087705b2bed9a053335849ae376d0a6066 100644 (file)
@@ -193,7 +193,11 @@ struct bsm_hdr {
 } __attribute__((packed));
 
 struct bsmmsg_grpinfo {
+#if PIM_IPV == 4
        struct pim_encoded_group_ipv4 group;
+#else
+       struct pim_encoded_group_ipv6 group;
+#endif
        uint8_t rp_count;
        uint8_t frag_rp_count;
        uint16_t reserved;