pim6d: add pimv6 support for bsmmsg_grpinfo

Signed-off-by: sarita patra <saritap@vmware.com>
This commit is contained in:
sarita patra 2022-03-16 03:17:06 -07:00 committed by Sarita Patra
parent 1407e40fc8
commit 81a688bc7b
2 changed files with 18 additions and 20 deletions

View 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 frag_rp_cnt = 0;
int offset = 0; int offset = 0;
int ins_count = 0; int ins_count = 0;
pim_addr grp_addr;
while (buflen > offset) { while (buflen > offset) {
if (offset + (int)sizeof(struct bsmmsg_grpinfo) > buflen) { 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 */ /* Extract Group tlv from BSM */
memcpy(&grpinfo, buf, sizeof(struct bsmmsg_grpinfo)); memcpy(&grpinfo, buf, sizeof(struct bsmmsg_grpinfo));
grp_addr = grpinfo.group.addr;
if (PIM_DEBUG_BSM) { if (PIM_DEBUG_BSM)
char grp_str[INET_ADDRSTRLEN];
pim_inet4_dump("<Group?>", grpinfo.group.addr, grp_str,
sizeof(grp_str));
zlog_debug( zlog_debug(
"%s, Group %s Rpcount:%d Fragment-Rp-count:%d", "%s, Group %pPAs Rpcount:%d Fragment-Rp-count:%d",
__func__, grp_str, grpinfo.rp_count, __func__, &grp_addr, grpinfo.rp_count,
grpinfo.frag_rp_count); grpinfo.frag_rp_count);
}
buf += sizeof(struct bsmmsg_grpinfo); buf += sizeof(struct bsmmsg_grpinfo);
offset += sizeof(struct bsmmsg_grpinfo); offset += sizeof(struct bsmmsg_grpinfo);
group.family = AF_INET; group.family = PIM_AF;
if (grpinfo.group.mask > IPV4_MAX_BITLEN) { if (grpinfo.group.mask > PIM_MAX_BITLEN) {
if (PIM_DEBUG_BSM) if (PIM_DEBUG_BSM)
zlog_debug( zlog_debug(
"%s, v4 prefix length specified: %d is too long", "%s, prefix length specified: %d is too long",
__func__, grpinfo.group.mask); __func__, grpinfo.group.mask);
return false; return false;
} }
pim_addr_to_prefix(&group, grp_addr);
group.prefixlen = grpinfo.group.mask; group.prefixlen = grpinfo.group.mask;
group.u.prefix4.s_addr = grpinfo.group.addr.s_addr;
/* Get the Group node for the BSM rp table */ /* Get the Group node for the BSM rp table */
bsgrp = pim_bsm_get_bsgrp_node(scope, &group); 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) if (!bsgrp)
continue; continue;
if (PIM_DEBUG_BSM) { if (PIM_DEBUG_BSM)
char grp_str[INET_ADDRSTRLEN]; zlog_debug(
"%s, Rp count is zero for group: %pPAs",
pim_inet4_dump("<Group?>", grpinfo.group.addr, __func__, &grp_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); old_rpinfo = bsm_rpinfos_first(bsgrp->bsrp_list);
if (old_rpinfo) if (old_rpinfo)

View File

@ -193,7 +193,11 @@ struct bsm_hdr {
} __attribute__((packed)); } __attribute__((packed));
struct bsmmsg_grpinfo { struct bsmmsg_grpinfo {
#if PIM_IPV == 4
struct pim_encoded_group_ipv4 group; struct pim_encoded_group_ipv4 group;
#else
struct pim_encoded_group_ipv6 group;
#endif
uint8_t rp_count; uint8_t rp_count;
uint8_t frag_rp_count; uint8_t frag_rp_count;
uint16_t reserved; uint16_t reserved;