diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2023-08-29 14:59:34 -0400 | 
|---|---|---|
| committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2023-09-01 13:41:20 +0000 | 
| commit | bbbe8b94c00036bee6ac56b74dd42decf43e7ea6 (patch) | |
| tree | 1501c494bbf26e729ff1c4585cdc49248e92d3d1 | |
| parent | fda0db038d47f2a5e905ad6f27ab77e91da8a1b5 (diff) | |
pimd: Prevent crash when receiving register message when the RP() is 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>
(cherry picked from commit 54aa0bf6f294bd3a722d1707aa071ce97aa09a22)
| -rw-r--r-- | pimd/pim_register.c | 10 | 
1 files changed, 9 insertions, 1 deletions
diff --git a/pimd/pim_register.c b/pimd/pim_register.c index b62c646c3d..f075b220df 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -507,6 +507,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) @@ -615,7 +616,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;  | 
