]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Simplify the checking local path 13287/head
authoranlan_cs <vic.lan@pica8.com>
Wed, 12 Apr 2023 13:40:26 +0000 (21:40 +0800)
committeranlan_cs <vic.lan@pica8.com>
Thu, 13 Apr 2023 00:47:06 +0000 (08:47 +0800)
Replace the checking local path code in `update_evpn_type5_route_entry()`
with generic function.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
bgpd/bgp_evpn.c

index 81117e94ef467384ecc6257a246af6fde7308acf..159cb33fee873bb078fe559f2525d6456f8b983f 100644 (file)
@@ -1513,14 +1513,9 @@ static int update_evpn_type5_route_entry(struct bgp *bgp_evpn,
        struct bgp_path_info *tmp_pi = NULL;
 
        *route_changed = 0;
-       /* locate the local route entry if any */
-       for (tmp_pi = bgp_dest_get_bgp_path_info(dest); tmp_pi;
-            tmp_pi = tmp_pi->next) {
-               if (tmp_pi->peer == bgp_evpn->peer_self
-                   && tmp_pi->type == ZEBRA_ROUTE_BGP
-                   && tmp_pi->sub_type == BGP_ROUTE_STATIC)
-                       local_pi = tmp_pi;
-       }
+
+       /* See if this is an update of an existing route, or a new add. */
+       local_pi = bgp_evpn_route_get_local_path(bgp_evpn, dest);
 
        /*
         * create a new route entry if one doesn't exist.