summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--zebra/rib.h18
-rw-r--r--zebra/zebra_dplane.c2
-rw-r--r--zebra/zebra_pw.c4
-rw-r--r--zebra/zebra_rib.c4
4 files changed, 21 insertions, 7 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;
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index 7e7bf1410..290abf7b3 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -2473,7 +2473,7 @@ dplane_route_notif_update(struct route_node *rn,
new_ctx->u.rinfo.zd_ng.nexthop = NULL;
copy_nexthops(&(new_ctx->u.rinfo.zd_ng.nexthop),
- (rib_active_nhg(re))->nexthop, NULL);
+ (rib_get_fib_nhg(re))->nexthop, NULL);
for (ALL_NEXTHOPS(new_ctx->u.rinfo.zd_ng, nexthop))
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c
index 8f0c964c1..2328ab650 100644
--- a/zebra/zebra_pw.c
+++ b/zebra/zebra_pw.c
@@ -550,7 +550,7 @@ static void vty_show_mpls_pseudowire_detail(struct vty *vty)
re = rib_match(family2afi(pw->af), SAFI_UNICAST, pw->vrf_id,
&pw->nexthop, NULL);
if (re) {
- for (ALL_NEXTHOPS_PTR(rib_active_nhg(re), nexthop)) {
+ for (ALL_NEXTHOPS_PTR(rib_get_fib_nhg(re), nexthop)) {
snprintfrr(buf_nh, sizeof(buf_nh), "%pNHv",
nexthop);
vty_out(vty, " Next Hop: %s\n", buf_nh);
@@ -604,7 +604,7 @@ static void vty_show_mpls_pseudowire(struct zebra_pw *pw, json_object *json_pws)
re = rib_match(family2afi(pw->af), SAFI_UNICAST, pw->vrf_id,
&pw->nexthop, NULL);
if (re) {
- for (ALL_NEXTHOPS_PTR(rib_active_nhg(re), nexthop)) {
+ for (ALL_NEXTHOPS_PTR(rib_get_fib_nhg(re), nexthop)) {
json_nexthop = json_object_new_object();
snprintfrr(buf_nh, sizeof(buf_nh), "%pNHv", nexthop);
json_object_string_add(json_nexthop, "nexthop", buf_nh);
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 31582dcb3..d07542ba6 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1931,7 +1931,7 @@ static void rib_process_dplane_notify(struct zebra_dplane_ctx *ctx)
start_count = 0;
if (CHECK_FLAG(re->status, ROUTE_ENTRY_INSTALLED)) {
- for (ALL_NEXTHOPS_PTR(rib_active_nhg(re), nexthop)) {
+ for (ALL_NEXTHOPS_PTR(rib_get_fib_nhg(re), nexthop)) {
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB))
start_count++;
}
@@ -1956,7 +1956,7 @@ static void rib_process_dplane_notify(struct zebra_dplane_ctx *ctx)
*/
end_count = 0;
- for (ALL_NEXTHOPS_PTR(rib_active_nhg(re), nexthop)) {
+ for (ALL_NEXTHOPS_PTR(rib_get_fib_nhg(re), nexthop)) {
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB))
end_count++;
}