Skip to content

Commit

Permalink
pimd: Prevent crash when receiving register message when the RP() is …
Browse files Browse the repository at this point in the history
…unknown

When receiving a register message for a Group, that the group has no
associated RP specified.  Prevent a crash from happening.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed Aug 29, 2023
1 parent dccd9ab commit b082d76
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pimd/pim_register.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ int pim_register_recv(struct interface *ifp, pim_addr dest_addr,
struct pim_interface *pim_ifp = ifp->info;
struct pim_instance *pim = pim_ifp->pim;
pim_addr rp_addr;
struct pim_rpf *rpg;

if (pim_ifp->pim_passive_enable) {
if (PIM_DEBUG_PIM_PACKETS)
Expand Down Expand Up @@ -602,7 +603,14 @@ int pim_register_recv(struct interface *ifp, pim_addr dest_addr,
}
}

rp_addr = (RP(pim, sg.grp))->rpf_addr;
rpg = RP(pim, sg.grp);
if (!rpg) {
zlog_warn("%s: Received Register Message %pSG from %pPa on %s where the RP could not be looked up",
__func__, &sg, &src_addr, ifp->name);
return 0;
}

rp_addr = rpg->rpf_addr;
if (i_am_rp && (!pim_addr_cmp(dest_addr, rp_addr))) {
sentRegisterStop = 0;

Expand Down

0 comments on commit b082d76

Please sign in to comment.