bgpd: Ensure we don't crash when registering RA's

There exists a code path that the ifp can be NULL.
Prevent an accident.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2020-02-14 15:15:26 -05:00
parent 547b989938
commit 8c9769e03b

View File

@ -428,9 +428,11 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
ifp = if_lookup_by_index(nexthop->ifindex, ifp = if_lookup_by_index(nexthop->ifindex,
nexthop->vrf_id); nexthop->vrf_id);
zclient_send_interface_radv_req( if (ifp)
zclient, nexthop->vrf_id, ifp, true, zclient_send_interface_radv_req(
BGP_UNNUM_DEFAULT_RA_INTERVAL); zclient, nexthop->vrf_id, ifp,
true,
BGP_UNNUM_DEFAULT_RA_INTERVAL);
} }
/* There is at least one label-switched path */ /* There is at least one label-switched path */
if (nexthop->nh_label && if (nexthop->nh_label &&
@ -898,8 +900,11 @@ void bgp_nht_register_enhe_capability_interfaces(struct peer *peer)
return; return;
for (nhop = bnc->nexthop; nhop; nhop = nhop->next) { for (nhop = bnc->nexthop; nhop; nhop = nhop->next) {
ifp = if_lookup_by_index(nhop->ifindex, ifp = if_lookup_by_index(nhop->ifindex, nhop->vrf_id);
nhop->vrf_id);
if (!ifp)
continue;
zclient_send_interface_radv_req(zclient, zclient_send_interface_radv_req(zclient,
nhop->vrf_id, nhop->vrf_id,
ifp, true, ifp, true,