From 61a042f112c1ee0ad9504404530256146e122491 Mon Sep 17 00:00:00 2001
From: anlan_cs <anlan_cs@126.com>
Date: Sat, 9 Nov 2024 22:11:33 +0800
Subject: [PATCH] zebra: fix wrong linkdown flag

Add this one line command to one down interface (mask is 192.168.0.0/24):
```
ip link set dev enp2s0 up;ip route add 3.3.3.3/32 via 192.168.0.1 dev enp2s0 proto kernel onlink
```

Before:
```
K>* 3.3.3.3/32 [0/0] via 192.168.0.1, enp2s0 onlink linkdown, weight 1, 00:00:02
```

After:
```
K>* 3.3.3.3/32 [0/0] via 192.168.0.1, enp2s0 onlink, weight 1, 00:00:02
```

It's only display problem, just correct this linkdown flag.

Signed-off-by: anlan_cs <anlan_cs@126.com>
---
 zebra/zebra_nhg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index 1519246c179e..c71c4c0358ae 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -3919,6 +3919,7 @@ void zebra_interface_nhg_reinstall(struct interface *ifp)
 					"%s install nhe %pNG nh type %u flags 0x%x",
 					__func__, rb_node_dep->nhe, nh->type,
 					rb_node_dep->nhe->flags);
+			UNSET_FLAG(nh->flags, NEXTHOP_FLAG_LINKDOWN);
 			zebra_nhg_install_kernel(rb_node_dep->nhe,
 						 ZEBRA_ROUTE_MAX);