diff options
| author | guozhongfeng.gzf <guozhongfeng.gzf@alibaba-inc.com> | 2024-12-27 12:16:17 +0800 | 
|---|---|---|
| committer | guozhongfeng.gzf <guozhongfeng.gzf@alibaba-inc.com> | 2024-12-27 12:16:17 +0800 | 
| commit | c2f0206c3c81c500614650aafa7566e0ee587a88 (patch) | |
| tree | 60fa7c7168b0702698a8874149b08e5426609a27 /staticd | |
| parent | ee5a3456d34a756c70ad8856ab7be7bed75ee31c (diff) | |
staticd: Reduce the frequency of adding routes
Signed-off-by: guozhongfeng.gzf <guozhongfeng.gzf@alibaba-inc.com>
Diffstat (limited to 'staticd')
| -rw-r--r-- | staticd/static_nht.c | 5 | 
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,  | 
