]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: add a fib-specific nexthop-group
authorMark Stapp <mjs@voltanet.io>
Mon, 25 Mar 2019 21:25:46 +0000 (17:25 -0400)
committerMark Stapp <mjs@voltanet.io>
Tue, 28 May 2019 12:27:42 +0000 (08:27 -0400)
Add a fib-specific nhg, distinct from the nhg developed from
the route-owner / RIB information.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
zebra/rib.h
zebra/zebra_rib.c

index 0353c9bb99bb9327282f6a484650817bee274c7f..a54e164d98c64c2d4c1dc21280563fdab05ae77d 100644 (file)
@@ -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);
 
index 51aef4747d6e7d5fdf833d30e34ed1a5854ac49d..f1d94ada7e33c3d24528e61e49f91c6ae6155aef 100644 (file)
@@ -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);
 }