Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pimd: fix misplaced braces/logic error in pim_rp_set_upstream_addr #16299

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions pimd/pim_rp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,28 +1107,25 @@ int pim_rp_set_upstream_addr(struct pim_instance *pim, pim_addr *up,
pim_addr source, pim_addr group)
{
struct rp_info *rp_info;
struct prefix g;
struct prefix g = {};

memset(&g, 0, sizeof(g));
if (!pim_addr_is_any(source)) {
*up = source;
return 1;
}

pim_addr_to_prefix(&g, group);

rp_info = pim_rp_find_match_group(pim, &g);

if (!rp_info || ((pim_rpf_addr_is_inaddr_any(&rp_info->rp)) &&
(pim_addr_is_any(source)))) {
if (!rp_info || pim_rpf_addr_is_inaddr_any(&rp_info->rp)) {
if (PIM_DEBUG_PIM_NHT_RP)
zlog_debug("%s: Received a (*,G) with no RP configured",
__func__);
*up = PIMADDR_ANY;
return 0;
}

if (pim_addr_is_any(source))
*up = rp_info->rp.rpf_addr;
else
*up = source;

*up = rp_info->rp.rpf_addr;
return 1;
}

Expand Down
Loading