From f0cb8e16f03b37af2f22fe73372fa511dd7104e4 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 26 Feb 2019 08:16:11 -0500 Subject: [PATCH] zebra: Add a nhe pointer to the route entry Add a nexthop hash entry to the route_entry so that we can track the nhe with the route entry. Signed-off-by: Donald Sharp --- zebra/rib.h | 2 ++ zebra/zebra_nhg.c | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/zebra/rib.h b/zebra/rib.h index 5b5bd4c27..a95bcc055 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -93,6 +93,8 @@ struct route_entry { /* Nexthop group from FIB (optional) */ struct nexthop_group fib_ng; + struct nhg_hash_entry *nhe; + /* Tag */ route_tag_t tag; diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 47e1054ce..183913331 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -158,8 +158,9 @@ bool zebra_nhg_hash_equal(const void *arg1, const void *arg2) * * Avoiding code duplication hopefully. */ -static void zebra_nhg_lookup_get(struct hash *hash_table, - struct nhg_hash_entry *lookup) +static struct nhg_hash_entry * +zebra_nhg_lookup_get(struct hash *hash_table, + struct nhg_hash_entry *lookup) { struct nhg_hash_entry *nhe; @@ -170,9 +171,7 @@ static void zebra_nhg_lookup_get(struct hash *hash_table, else nhe->refcnt++; - //re->ng = nhe->nhg; - - return; + return nhe; } void zebra_nhg_find_id(uint32_t id, struct nexthop_group *nhg) @@ -194,7 +193,7 @@ void zebra_nhg_find(afi_t afi, struct nexthop_group *nhg, lookup.afi = afi; lookup.nhg = *nhg; - zebra_nhg_lookup_get(zrouter.nhgs, &lookup); + re->nhe = zebra_nhg_lookup_get(zrouter.nhgs, &lookup); } void zebra_nhg_release(afi_t afi, struct route_entry *re) -- 2.39.5