summaryrefslogtreecommitdiffstats
path: root/zebra/rib.h
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2020-05-22 22:36:30 +0200
committerMark Stapp <mjs@voltanet.io>2020-07-07 19:14:01 +0200
commit4db01e79142d33c674ba315bb64bcb8430e5fc13 (patch)
treef9e81d2e0629cdd1c69038e51d3d4c72f8eeafa4 /zebra/rib.h
parentzebra: only use ACTIVE nexthops in recursive resolution (diff)
downloadfrr-4db01e79142d33c674ba315bb64bcb8430e5fc13.tar.xz
frr-4db01e79142d33c674ba315bb64bcb8430e5fc13.zip
zebra: add fib nhg for backups, revise api
Add an nhg for the fib-installed backup nexthops; rename an api to access the fib-installed nexthop nhg. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'zebra/rib.h')
-rw-r--r--zebra/rib.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/zebra/rib.h b/zebra/rib.h
index a024b6dfa..ec992974f 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -94,9 +94,11 @@ struct route_entry {
struct nhg_hash_entry *nhe;
/* Nexthop group from FIB (optional), reflecting what is actually
- * installed in the FIB if that differs.
+ * installed in the FIB if that differs. The 'backup' group is used
+ * when backup nexthops are present in the route's nhg.
*/
struct nexthop_group fib_ng;
+ struct nexthop_group fib_backup_ng;
/* Nexthop group hash entry ID */
uint32_t nhe_id;
@@ -526,7 +528,7 @@ DECLARE_HOOK(rib_update, (struct route_node * rn, const char *reason),
/*
* Access active nexthop-group, either RIB or FIB version
*/
-static inline struct nexthop_group *rib_active_nhg(struct route_entry *re)
+static inline struct nexthop_group *rib_get_fib_nhg(struct route_entry *re)
{
if (re->fib_ng.nexthop)
return &(re->fib_ng);
@@ -534,6 +536,18 @@ static inline struct nexthop_group *rib_active_nhg(struct route_entry *re)
return &(re->nhe->nhg);
}
+/*
+ * Access active nexthop-group, either RIB or FIB version
+ */
+static inline struct nexthop_group *rib_get_fib_backup_nhg(
+ struct route_entry *re)
+{
+ if (re->fib_backup_ng.nexthop)
+ return &(re->fib_backup_ng);
+ else
+ return zebra_nhg_get_backup_nhg(re->nhe);
+}
+
extern void zebra_vty_init(void);
extern pid_t pid;