pimd: Handle rpf_addr in join/prune processing

Signed-off-by: sarita patra <saritap@vmware.com>
This commit is contained in:
sarita patra 2022-04-27 01:29:34 -07:00 committed by Sarita Patra
parent 5262018dbf
commit fc9f6f88e5
2 changed files with 9 additions and 14 deletions

View file

@ -86,7 +86,7 @@ static void recv_join(struct interface *ifp, struct pim_neighbor *neigh,
* If the RP sent in the message is not * If the RP sent in the message is not
* our RP for the group, drop the message * our RP for the group, drop the message
*/ */
rpf_addr = pim_addr_from_prefix(&rp->rpf_addr); rpf_addr = rp->rpf_addr;
if (pim_addr_cmp(sg->src, rpf_addr)) { if (pim_addr_cmp(sg->src, rpf_addr)) {
zlog_warn( zlog_warn(
"%s: Specified RP(%pPAs) in join is different than our configured RP(%pPAs)", "%s: Specified RP(%pPAs) in join is different than our configured RP(%pPAs)",
@ -427,7 +427,6 @@ int pim_joinprune_send(struct pim_rpf *rpf, struct list *groups)
size_t packet_left = 0; size_t packet_left = 0;
size_t packet_size = 0; size_t packet_size = 0;
size_t group_size = 0; size_t group_size = 0;
pim_addr rpf_addr;
if (rpf->source_nexthop.interface) if (rpf->source_nexthop.interface)
pim_ifp = rpf->source_nexthop.interface->info; pim_ifp = rpf->source_nexthop.interface->info;
@ -436,9 +435,8 @@ int pim_joinprune_send(struct pim_rpf *rpf, struct list *groups)
return -1; return -1;
} }
rpf_addr = pim_addr_from_prefix(&rpf->rpf_addr);
on_trace(__func__, rpf->source_nexthop.interface, rpf_addr); on_trace(__func__, rpf->source_nexthop.interface, rpf->rpf_addr);
if (!pim_ifp) { if (!pim_ifp) {
zlog_warn("%s: multicast not enabled on interface %s", __func__, zlog_warn("%s: multicast not enabled on interface %s", __func__,
@ -446,11 +444,11 @@ int pim_joinprune_send(struct pim_rpf *rpf, struct list *groups)
return -1; return -1;
} }
if (pim_addr_is_any(rpf_addr)) { if (pim_addr_is_any(rpf->rpf_addr)) {
if (PIM_DEBUG_PIM_J_P) if (PIM_DEBUG_PIM_J_P)
zlog_debug( zlog_debug(
"%s: upstream=%pPA is myself on interface %s", "%s: upstream=%pPA is myself on interface %s",
__func__, &rpf_addr, __func__, &rpf->rpf_addr,
rpf->source_nexthop.interface->name); rpf->source_nexthop.interface->name);
return 0; return 0;
} }
@ -473,7 +471,7 @@ int pim_joinprune_send(struct pim_rpf *rpf, struct list *groups)
memset(msg, 0, sizeof(*msg)); memset(msg, 0, sizeof(*msg));
pim_msg_addr_encode_ucast((uint8_t *)&msg->addr, pim_msg_addr_encode_ucast((uint8_t *)&msg->addr,
rpf_addr); rpf->rpf_addr);
msg->reserved = 0; msg->reserved = 0;
msg->holdtime = htons(PIM_JP_HOLDTIME); msg->holdtime = htons(PIM_JP_HOLDTIME);
@ -492,7 +490,7 @@ int pim_joinprune_send(struct pim_rpf *rpf, struct list *groups)
if (PIM_DEBUG_PIM_J_P) if (PIM_DEBUG_PIM_J_P)
zlog_debug( zlog_debug(
"%s: sending (G)=%pPAs to upstream=%pPA on interface %s", "%s: sending (G)=%pPAs to upstream=%pPA on interface %s",
__func__, &group->group, &rpf_addr, __func__, &group->group, &rpf->rpf_addr,
rpf->source_nexthop.interface->name); rpf->source_nexthop.interface->name);
group_size = pim_msg_get_jp_group_size(group->sources); group_size = pim_msg_get_jp_group_size(group->sources);
@ -516,7 +514,7 @@ int pim_joinprune_send(struct pim_rpf *rpf, struct list *groups)
memset(msg, 0, sizeof(*msg)); memset(msg, 0, sizeof(*msg));
pim_msg_addr_encode_ucast((uint8_t *)&msg->addr, pim_msg_addr_encode_ucast((uint8_t *)&msg->addr,
rpf_addr); rpf->rpf_addr);
msg->reserved = 0; msg->reserved = 0;
msg->holdtime = htons(PIM_JP_HOLDTIME); msg->holdtime = htons(PIM_JP_HOLDTIME);

View file

@ -110,7 +110,6 @@ pim_jp_agg_get_interface_upstream_switch_list(struct pim_rpf *rpf)
struct pim_interface *pim_ifp; struct pim_interface *pim_ifp;
struct pim_iface_upstream_switch *pius; struct pim_iface_upstream_switch *pius;
struct listnode *node, *nnode; struct listnode *node, *nnode;
pim_addr rpf_addr;
if (!ifp) if (!ifp)
return NULL; return NULL;
@ -121,18 +120,16 @@ pim_jp_agg_get_interface_upstream_switch_list(struct pim_rpf *rpf)
if (!pim_ifp) if (!pim_ifp)
return NULL; return NULL;
rpf_addr = pim_addr_from_prefix(&rpf->rpf_addr);
for (ALL_LIST_ELEMENTS(pim_ifp->upstream_switch_list, node, nnode, for (ALL_LIST_ELEMENTS(pim_ifp->upstream_switch_list, node, nnode,
pius)) { pius)) {
if (!pim_addr_cmp(pius->address, rpf_addr)) if (!pim_addr_cmp(pius->address, rpf->rpf_addr))
break; break;
} }
if (!pius) { if (!pius) {
pius = XCALLOC(MTYPE_PIM_JP_AGG_GROUP, pius = XCALLOC(MTYPE_PIM_JP_AGG_GROUP,
sizeof(struct pim_iface_upstream_switch)); sizeof(struct pim_iface_upstream_switch));
pius->address = rpf_addr; pius->address = rpf->rpf_addr;
pius->us = list_new(); pius->us = list_new();
listnode_add_sort(pim_ifp->upstream_switch_list, pius); listnode_add_sort(pim_ifp->upstream_switch_list, pius);
} }