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