From ee5e8a4820b32a82cbdfc7b4c088ef9671b2f8f7 Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Mon, 25 Mar 2019 17:25:46 -0400 Subject: [PATCH] zebra: add a fib-specific nexthop-group Add a fib-specific nhg, distinct from the nhg developed from the route-owner / RIB information. Signed-off-by: Mark Stapp --- zebra/rib.h | 15 ++++++++++++++- zebra/zebra_rib.c | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/zebra/rib.h b/zebra/rib.h index 0353c9bb99..a54e164d98 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -87,9 +87,12 @@ struct route_entry { /* Link list. */ struct re_list_item next; - /* Nexthop structure */ + /* Nexthop structure (from RIB) */ struct nexthop_group ng; + /* Nexthop group from FIB (optional) */ + struct nexthop_group fib_ng; + /* Tag */ route_tag_t tag; @@ -529,6 +532,16 @@ static inline void rib_tables_iter_cleanup(rib_tables_iter_t *iter) DECLARE_HOOK(rib_update, (struct route_node * rn, const char *reason), (rn, reason)) +/* + * Access active nexthop-group, either RIB or FIB version + */ +static inline struct nexthop_group *rib_active_nhg(struct route_entry *re) +{ + if (re->fib_ng.nexthop) + return &(re->fib_ng); + else + return &(re->ng); +} extern void zebra_vty_init(void); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 51aef4747d..f1d94ada7e 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2585,6 +2585,8 @@ void rib_unlink(struct route_node *rn, struct route_entry *re) dest->selected_fib = NULL; nexthops_free(re->ng.nexthop); + nexthops_free(re->fib_ng.nexthop); + XFREE(MTYPE_RE, re); } -- 2.39.5