]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Use nexthop/interface vrf, not the routes
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 2 Jul 2019 05:16:48 +0000 (01:16 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 25 Oct 2019 15:13:40 +0000 (11:13 -0400)
When hashing/creating the NHE, use the nexthops vrf as its
source of data. This is gotten directly from an interface
and should not come from a route.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
zebra/zebra_mpls.c
zebra/zebra_nhg.c
zebra/zebra_nhg.h
zebra/zebra_rib.c

index cbbb02be35d2a11af26101e05910274a26edd547..42d8c70f4911571184b5bf0a16a7c87e644bb526 100644 (file)
@@ -2658,7 +2658,7 @@ int mpls_ftn_update(int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
        }
 
        if (found) {
-               nhe = zebra_nhg_rib_find(0, &new_grp, re->vrf_id, afi);
+               nhe = zebra_nhg_rib_find(0, &new_grp, afi);
 
                zebra_nhg_re_update_ref(re, nhe);
 
@@ -2922,8 +2922,7 @@ static void mpls_ftn_uninstall_all(struct zebra_vrf *zvrf,
 
                        if (CHECK_FLAG(re->status,
                                       ROUTE_ENTRY_LABELS_CHANGED)) {
-                               nhe = zebra_nhg_rib_find(0, &new_grp,
-                                                        re->vrf_id, afi);
+                               nhe = zebra_nhg_rib_find(0, &new_grp, afi);
                                zebra_nhg_re_update_ref(re, nhe);
                        }
 
index 04a11dfcb6597a17ee81f9d67b814c490db7a8d5..8592e6500d2e7109f890883b512406174969827b 100644 (file)
@@ -663,9 +663,8 @@ static struct nhg_hash_entry *depends_find(struct nexthop *nh, afi_t afi)
 }
 
 /* Rib-side, you get a nexthop group struct */
-struct nhg_hash_entry *zebra_nhg_rib_find(uint32_t id,
-                                         struct nexthop_group *nhg,
-                                         vrf_id_t rt_vrf_id, afi_t rt_afi)
+struct nhg_hash_entry *
+zebra_nhg_rib_find(uint32_t id, struct nexthop_group *nhg, afi_t rt_afi)
 {
        struct nhg_hash_entry *nhe = NULL;
        struct nhg_hash_entry *depend = NULL;
@@ -673,7 +672,7 @@ struct nhg_hash_entry *zebra_nhg_rib_find(uint32_t id,
 
        /* Defualt the nhe to the afi and vrf of the route */
        afi_t nhg_afi = rt_afi;
-       vrf_id_t nhg_vrf_id = rt_vrf_id;
+       vrf_id_t nhg_vrf_id = nhg->nexthop->vrf_id;
 
        if (!nhg) {
                flog_err(EC_ZEBRA_TABLE_LOOKUP_FAILED,
@@ -695,15 +694,6 @@ struct nhg_hash_entry *zebra_nhg_rib_find(uint32_t id,
                /* change the afi/vrf_id since its a group */
                nhg_afi = AFI_UNSPEC;
                nhg_vrf_id = 0;
-       } else {
-               /*
-                * If the vrf_id on the nexthop does not match
-                * the route one, use it instead.
-                */
-               vrf_id_t nh_vrf_id = nhg->nexthop->vrf_id;
-
-               if (nh_vrf_id && nh_vrf_id != rt_vrf_id)
-                       nhg_vrf_id = nh_vrf_id;
        }
 
        if (!zebra_nhg_find(&nhe, id, nhg, &nhg_depends, nhg_vrf_id, nhg_afi,
@@ -1413,7 +1403,7 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re)
                struct nhg_hash_entry *new_nhe = NULL;
                // TODO: Add proto type here
 
-               new_nhe = zebra_nhg_rib_find(0, &new_grp, re->vrf_id, rt_afi);
+               new_nhe = zebra_nhg_rib_find(0, &new_grp, rt_afi);
 
                zebra_nhg_re_update_ref(re, new_nhe);
        }
index 31a2a020a020772a071d15bf9363d2d454b6e745..ff2c73433aa2a2649c08bad240bcb641f3c96185 100644 (file)
@@ -212,10 +212,8 @@ extern int zebra_nhg_kernel_find(uint32_t id, struct nexthop *nh,
                                 vrf_id_t vrf_id, afi_t afi);
 
 /* Find via route creation */
-extern struct nhg_hash_entry *zebra_nhg_rib_find(uint32_t id,
-                                                struct nexthop_group *nhg,
-                                                vrf_id_t rt_vrf_id,
-                                                afi_t rt_afi);
+extern struct nhg_hash_entry *
+zebra_nhg_rib_find(uint32_t id, struct nexthop_group *nhg, afi_t rt_afi);
 
 
 void zebra_nhg_free_members(struct nhg_hash_entry *nhe);
index 0258c240906e4828214aa4471ff4743b5d9be9c2..6be91da54aa90c9afad02655854057e9f1cdf2b1 100644 (file)
@@ -2739,7 +2739,7 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
                        return -1;
                }
        } else {
-               nhe = zebra_nhg_rib_find(0, re->ng, re->vrf_id, afi);
+               nhe = zebra_nhg_rib_find(0, re->ng, afi);
 
                /*
                 * The nexthops got copied over into an nhe,