]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: optimize "auto_rt" searching procedure for evpn
authoranlan_cs <vic.lan@pica8.com>
Sun, 24 Apr 2022 11:49:02 +0000 (07:49 -0400)
committeranlan_cs <vic.lan@pica8.com>
Mon, 25 Apr 2022 08:36:18 +0000 (04:36 -0400)
RT value will be unique across different VNIs but the
same across routers (in the same AS) for a particula
VNI.

It is unique, so add `break` for search procedure.

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

index d29dacb994ab4d02cda758c3dd16016c7d559f04..78d7bf20eb873af52a3dc0c8e4d3db2184788f81 100644 (file)
@@ -520,8 +520,10 @@ static void form_auto_rt(struct bgp *bgp, vni_t vni, struct list *rtl)
        ecomadd = ecommunity_new();
        ecommunity_add_val(ecomadd, &eval, false, false);
        for (ALL_LIST_ELEMENTS_RO(rtl, node, ecom))
-               if (ecommunity_cmp(ecomadd, ecom))
+               if (ecommunity_cmp(ecomadd, ecom)) {
                        ecom_found = true;
+                       break;
+               }
 
        if (!ecom_found)
                listnode_add_sort(rtl, ecomadd);
@@ -4556,6 +4558,7 @@ void evpn_rt_delete_auto(struct bgp *bgp, vni_t vni, struct list *rtl)
                if (ecommunity_match(ecom, ecom_auto)) {
                        ecommunity_free(&ecom);
                        node_to_del = node;
+                       break;
                }
        }