]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Ensure we don't crash when registering RA's
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 14 Feb 2020 20:15:26 +0000 (15:15 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 14 Feb 2020 20:35:37 +0000 (15:35 -0500)
There exists a code path that the ifp can be NULL.
Prevent an accident.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_nht.c

index 3060fe482ce8c13573ce9584bb38274ad190353f..55b44de6fb4e98eaa54f482cc451900e6cb1fa01 100644 (file)
@@ -428,9 +428,11 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
 
                                ifp = if_lookup_by_index(nexthop->ifindex,
                                                         nexthop->vrf_id);
-                               zclient_send_interface_radv_req(
-                                       zclient, nexthop->vrf_id, ifp, true,
-                                       BGP_UNNUM_DEFAULT_RA_INTERVAL);
+                               if (ifp)
+                                       zclient_send_interface_radv_req(
+                                               zclient, nexthop->vrf_id, ifp,
+                                               true,
+                                               BGP_UNNUM_DEFAULT_RA_INTERVAL);
                        }
                        /* There is at least one label-switched path */
                        if (nexthop->nh_label &&
@@ -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,