zebra: Install the nhe along with the route

Move the installation of an nhe out of nexthop_active_update()
and into the rib install path. So, only install the nhe when
a route using it is being installed.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
Stephen Worley 2019-07-25 13:14:32 -04:00
parent ae9bfa067e
commit 8dfbc65724
2 changed files with 10 additions and 5 deletions

View File

@ -1398,12 +1398,9 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re)
nhe = zebra_nhg_lookup_id(re->nhe_id);
if (nhe) {
if (nhe)
SET_FLAG(nhe->flags, NEXTHOP_GROUP_VALID);
if (!nhe->is_kernel_nh
&& !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_RECURSIVE))
zebra_nhg_install_kernel(nhe);
} else
else
flog_err(
EC_ZEBRA_TABLE_LOOKUP_FAILED,
"Active update on NHE id=%u that we do not have in our tables",

View File

@ -519,6 +519,7 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re,
struct zebra_vrf *zvrf = vrf_info_lookup(re->vrf_id);
const struct prefix *p, *src_p;
enum zebra_dplane_result ret;
struct nhg_hash_entry *nhe;
rib_dest_t *dest = rib_dest_from_rnode(rn);
@ -545,6 +546,13 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re,
}
}
/*
* Install the resolved nexthop object first.
*/
nhe = zebra_nhg_resolve(zebra_nhg_lookup_id(re->nhe_id));
if (!nhe->is_kernel_nh)
zebra_nhg_install_kernel(nhe);
/*
* If this is a replace to a new RE let the originator of the RE
* know that they've lost