Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra: Properly note that a nhg's nexthop has gone down #16330

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,7 @@
"fib":true,
"ip":"10.0.8.6",
"afi":"ipv4",
"interfaceName":"eth-rt6",
"active":true
"interfaceName":"eth-rt6"
}
]
}
Expand Down
28 changes: 27 additions & 1 deletion zebra/zebra_nhg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,15 +1050,41 @@ static void zebra_nhg_set_valid(struct nhg_hash_entry *nhe, bool valid)
}

/* Update validity of nexthops depending on it */
frr_each(nhg_connected_tree, &nhe->nhg_dependents, rb_node_dep)
frr_each (nhg_connected_tree, &nhe->nhg_dependents, rb_node_dep) {
if (!valid) {
/*
* Grab the first nexthop from the depending nexthop group
* then let's find the nexthop in that group that matches
* my individual nexthop and mark it as no longer ACTIVE
*/
struct nexthop *nexthop = rb_node_dep->nhe->nhg.nexthop;

while (nexthop) {
if (nexthop_same(nexthop, nhe->nhg.nexthop))
break;

nexthop = nexthop->next;
}

if (nexthop)
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
}
zebra_nhg_set_valid(rb_node_dep->nhe, valid);
}
}

void zebra_nhg_check_valid(struct nhg_hash_entry *nhe)
{
struct nhg_connected *rb_node_dep = NULL;
bool valid = false;

/*
* If I have other nhe's depending on me, then this is a
* singleton nhe so set this nexthops flag as appropriate.
*/
if (nhg_connected_tree_count(&nhe->nhg_depends))
UNSET_FLAG(nhe->nhg.nexthop->flags, NEXTHOP_FLAG_ACTIVE);

/* If anthing else in the group is valid, the group is valid */
frr_each(nhg_connected_tree, &nhe->nhg_depends, rb_node_dep) {
if (CHECK_FLAG(rb_node_dep->nhe->flags, NEXTHOP_GROUP_VALID)) {
Expand Down
2 changes: 1 addition & 1 deletion zebra/zebra_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static char re_status_output_char(const struct route_entry *re,
if (is_fib) {
star_p = !!CHECK_FLAG(nhop->flags,
NEXTHOP_FLAG_FIB);
} else
} else if (CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_ACTIVE))
star_p = true;
}

Expand Down
Loading