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;
/*
* 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);
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;
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);
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);
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);
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++;
}
*/
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++;
}