summaryrefslogtreecommitdiff
path: root/staticd/static_zebra.c
diff options
context:
space:
mode:
authoranlan_cs <vic.lan@pica8.com>2024-07-12 17:03:03 +0800
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-07-15 18:46:25 +0000
commit868364034bcfebb37ccc483100a098845a0a9968 (patch)
tree8ddd856583f77a9ecef6e5a8e5fea3c11f338bde /staticd/static_zebra.c
parentb3d3e3384153783fecf8afef1636070ae81badb9 (diff)
zebra: fix missing static routes
Use `vtysh` with this input file: ``` ip route A nh1 ip route A nh2 ip route B nh1 ip route B nh2 ``` When running "ip route B" with "nh1" and "nh2", the procedure maybe is: 1) Create the two nexthops: "nh1" and "nh2". 2) Register "nh1" with `static_zebra_nht_register()`, then the states of both "nh1" and "nht2" are set to "STATIC_SENT_TO_ZEBRA". 3) Register "nh2" with `static_zebra_nht_register()`, then only the routes with nexthop of "STATIC_START" will be sent to zebra. So, send the routes with the nexthop of "STATIC_SENT_TO_ZEBRA" to zebra. Signed-off-by: anlan_cs <vic.lan@pica8.com> (cherry picked from commit 4518d386f7683289b079708fcdb0c42ced4754d9)
Diffstat (limited to 'staticd/static_zebra.c')
-rw-r--r--staticd/static_zebra.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c
index c4efc14a9d..420ed7903b 100644
--- a/staticd/static_zebra.c
+++ b/staticd/static_zebra.c
@@ -341,7 +341,8 @@ void static_zebra_nht_register(struct static_nexthop *nh, bool reg)
/* refresh with existing data */
afi_t afi = prefix_afi(&lookup.nh);
- if (nh->state == STATIC_NOT_INSTALLED)
+ if (nh->state == STATIC_NOT_INSTALLED ||
+ nh->state == STATIC_SENT_TO_ZEBRA)
nh->state = STATIC_START;
static_nht_update(&rn->p, &nhtd->nh, nhtd->nh_num, afi,
si->safi, nh->nh_vrf_id);