pim: handle return code to fix a couple of coverity issues

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
This commit is contained in:
Jafar Al-Gharaibeh 2024-12-18 16:58:45 -06:00
parent f78b1786a6
commit c51452d476
2 changed files with 14 additions and 4 deletions

View file

@ -960,8 +960,9 @@ void pim_rp_setup(struct pim_instance *pim)
if (!pim_nht_lookup_ecmp(pim, &rp_info->rp.source_nexthop, nht_p, &rp_info->group, if (!pim_nht_lookup_ecmp(pim, &rp_info->rp.source_nexthop, nht_p, &rp_info->group,
true)) { true)) {
if (PIM_DEBUG_PIM_NHT_RP) if (PIM_DEBUG_PIM_NHT_RP)
zlog_debug( zlog_debug("%s: unable to lookup nexthop for rp %pPA", __func__,
"Unable to lookup nexthop for rp specified"); &rp_info->rp.rpf_addr);
pim_nht_rp_del(rp_info); pim_nht_rp_del(rp_info);
} }
} }
@ -1107,7 +1108,12 @@ struct pim_rpf *pim_rp_g(struct pim_instance *pim, pim_addr group)
__func__, &nht_p, &rp_info->group); __func__, &nht_p, &rp_info->group);
pim_nht_find_or_track(pim, nht_p, NULL, rp_info, NULL); pim_nht_find_or_track(pim, nht_p, NULL, rp_info, NULL);
pim_rpf_set_refresh_time(pim); pim_rpf_set_refresh_time(pim);
pim_nht_lookup_ecmp(pim, &rp_info->rp.source_nexthop, nht_p, &rp_info->group, true); if (!pim_nht_lookup_ecmp(pim, &rp_info->rp.source_nexthop, nht_p, &rp_info->group,
true))
if (PIM_DEBUG_PIM_NHT_RP)
zlog_debug("%s: unable to lookup nexthop for rp %pPA", __func__,
&rp_info->rp.rpf_addr);
return (&rp_info->rp); return (&rp_info->rp);
} }

View file

@ -35,7 +35,11 @@ tib_sg_oil_setup(struct pim_instance *pim, pim_sgaddr sg, struct interface *oif)
up = pim_upstream_find(pim, &sg); up = pim_upstream_find(pim, &sg);
if (up) { if (up) {
memcpy(&nexthop, &up->rpf.source_nexthop, sizeof(struct pim_nexthop)); memcpy(&nexthop, &up->rpf.source_nexthop, sizeof(struct pim_nexthop));
pim_nht_lookup_ecmp(pim, &nexthop, vif_source, &grp, false); if (!pim_nht_lookup_ecmp(pim, &nexthop, vif_source, &grp, false))
if (PIM_DEBUG_PIM_NHT_RP)
zlog_debug("%s: Nexthop Lookup failed vif_src:%pPA, sg.src:%pPA, sg.grp:%pPA",
__func__, &vif_source, &sg.src, &sg.grp);
if (nexthop.interface) if (nexthop.interface)
input_iface_vif_index = pim_if_find_vifindex_by_ifindex( input_iface_vif_index = pim_if_find_vifindex_by_ifindex(
pim, nexthop.interface->ifindex); pim, nexthop.interface->ifindex);