summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2025-01-02 13:22:54 +0200
committerGitHub <noreply@github.com>2025-01-02 13:22:54 +0200
commit352b97ff00c6aad2b19ceba8f631ea5adba3a2d8 (patch)
treea5dc7980e9809de029a7d2146f84cd913634c9f5
parentf3daeda935e5be5f9519d265c46faba75e87f42b (diff)
parentc2f0206c3c81c500614650aafa7566e0ee587a88 (diff)
Merge pull request #17726 from guoguojia2021/static_fix
staticd: Reduce the frequency of adding routes
-rw-r--r--staticd/static_nht.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/staticd/static_nht.c b/staticd/static_nht.c
index 6be598434d..06d27c6f59 100644
--- a/staticd/static_nht.c
+++ b/staticd/static_nht.c
@@ -21,6 +21,7 @@ static void static_nht_update_path(struct static_path *pn, struct prefix *nhp,
uint32_t nh_num, vrf_id_t nh_vrf_id)
{
struct static_nexthop *nh;
+ bool route_changed = false;
frr_each(static_nexthop_list, &pn->nexthop_list, nh) {
if (nh->nh_vrf_id != nh_vrf_id)
@@ -42,8 +43,10 @@ static void static_nht_update_path(struct static_path *pn, struct prefix *nhp,
nh->nh_valid = !!nh_num;
if (nh->state == STATIC_START)
- static_zebra_route_add(pn, true);
+ route_changed = true;
}
+ if (route_changed)
+ static_zebra_route_add(pn, true);
}
static void static_nht_update_safi(struct prefix *sp, struct prefix *nhp,