summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2025-01-14 21:12:32 +0100
committerDonald Sharp <sharpd@nvidia.com>2025-01-14 21:12:32 +0100
commitb61424a717fc3c3708d36ff355cdc6ca3e4c38d3 (patch)
tree1c00600bfb6dbc7d8a2ac9dac6bb69d48d738bed
parentMerge pull request #17639 from pguibert6WIND/bmp_import_vrf_view (diff)
downloadfrr-b61424a717fc3c3708d36ff355cdc6ca3e4c38d3.tar.xz
frr-b61424a717fc3c3708d36ff355cdc6ca3e4c38d3.zip
zebra: Nexthops need to be ACTIVE in some cases
Currently if you have an interface down event, Zebra sets the nexthop(s) as !ACTIVE that use it. On interface up events the singleton nexthops are not being set as ACTIVE. Due to timing events it is sometimes possible to end up with a route that is using a singleton Change singleton nexthops to set the nexthop to ACTIVE. This will allow the nexthop to be reinstalled appropriately as well. I was able to easily reproduce this using sharpd since it does not attempt to reinstall the routes when a interface goes up/down. Before: D>* 10.0.0.0/32 [150/0] via 192.168.102.34, dummy2, weight 1, 00:00:01 sharpd@eva ~/frr5 (master)> sudo ip link set dummy2 down ; sudo ip link set dummy2 up D> 10.0.0.0/32 [150/0] (350) via 192.168.102.34, dummy2 inactive, weight 1, 00:00:10 After code change: D>* 10.0.0.0/32 [150/0] (73) via 192.168.102.34, dummy2, weight 1, 00:00:14 sharpd@eva ~/frr5 (master)> sudo ip link set dummy2 down ; sudo ip link set dummy2 up D>* 10.0.0.0/32 [150/0] (73) via 192.168.102.34, dummy2, weight 1, 00:00:21 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r--zebra/zebra_nhg.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index 0a79ed559..095673399 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -3918,7 +3918,14 @@ void zebra_interface_nhg_reinstall(struct interface *ifp)
__func__, ifp->name);
frr_each (nhg_connected_tree, &zif->nhg_dependents, rb_node_dep) {
+ /*
+ * The nexthop associated with this was set as !ACTIVE
+ * so we need to turn it back to active when we get to
+ * this point again
+ */
+ SET_FLAG(rb_node_dep->nhe->nhg.nexthop->flags, NEXTHOP_FLAG_ACTIVE);
nh = rb_node_dep->nhe->nhg.nexthop;
+
if (zebra_nhg_set_valid_if_active(rb_node_dep->nhe)) {
if (IS_ZEBRA_DEBUG_NHG_DETAIL)
zlog_debug(