summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsarita patra <saritap@vmware.com>2022-03-16 03:17:06 -0700
committerSarita Patra <saritap@vmware.com>2022-07-07 10:56:45 -0700
commit81a688bc7b720e2d7e770eed6fa97a3c06c87a2d (patch)
tree1564794ec02b3c27e0ac684382f69271a9b501c7
parent1407e40fc89812341f2dabc4d8a3105cefb3793f (diff)
pim6d: add pimv6 support for bsmmsg_grpinfo
Signed-off-by: sarita patra <saritap@vmware.com>
-rw-r--r--pimd/pim_bsm.c34
-rw-r--r--pimd/pim_bsm.h4
2 files changed, 18 insertions, 20 deletions
diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c
index ea61495690..b6fdf92f8b 100644
--- a/pimd/pim_bsm.c
+++ b/pimd/pim_bsm.c
@@ -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)
diff --git a/pimd/pim_bsm.h b/pimd/pim_bsm.h
index 04c9c20067..90bd2f0877 100644
--- a/pimd/pim_bsm.h
+++ b/pimd/pim_bsm.h
@@ -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;