bgpd: cleanup bgp_damp_info_free

bgp_damp_config, afi and safi are never used.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
Igor Ryzhov 2024-04-30 10:56:33 +03:00 committed by Donatas Abraitis
parent 1d37871588
commit ad97cd00a6
3 changed files with 10 additions and 18 deletions

View File

@ -211,8 +211,7 @@ static void bgp_reuse_timer(struct event *t)
if (bdi->penalty <= bdc->reuse_limit / 2.0) { if (bdi->penalty <= bdc->reuse_limit / 2.0) {
bgp_reuselist_del(&plist, bdi); bgp_reuselist_del(&plist, bdi);
bgp_damp_info_free(bdi, bdc, 1, bdi->afi, bgp_damp_info_free(bdi, 1);
bdi->safi);
} else { } else {
bdi->index = BGP_DAMP_NO_REUSE_LIST_INDEX; bdi->index = BGP_DAMP_NO_REUSE_LIST_INDEX;
bgp_reuselist_switch(&plist, bdi, bgp_reuselist_switch(&plist, bdi,
@ -360,16 +359,15 @@ int bgp_damp_update(struct bgp_path_info *path, struct bgp_dest *dest,
bdi->t_updated = t_now; bdi->t_updated = t_now;
else { else {
bgp_damp_info_unclaim(bdi); bgp_damp_info_unclaim(bdi);
bgp_damp_info_free(bdi, bdc, 0, afi, safi); bgp_damp_info_free(bdi, 0);
} }
return status; return status;
} }
void bgp_damp_info_free(struct bgp_damp_info *bdi, struct bgp_damp_config *bdc, void bgp_damp_info_free(struct bgp_damp_info *bdi, int withdraw)
int withdraw, afi_t afi, safi_t safi)
{ {
assert(bdc && bdi); assert(bdi);
if (bdi->path == NULL) { if (bdi->path == NULL) {
XFREE(MTYPE_BGP_DAMP_INFO, bdi); XFREE(MTYPE_BGP_DAMP_INFO, bdi);
@ -380,10 +378,8 @@ void bgp_damp_info_free(struct bgp_damp_info *bdi, struct bgp_damp_config *bdc,
bgp_path_info_unset_flag(bdi->dest, bdi->path, bgp_path_info_unset_flag(bdi->dest, bdi->path,
BGP_PATH_HISTORY | BGP_PATH_DAMPED); BGP_PATH_HISTORY | BGP_PATH_DAMPED);
if (bdi->lastrecord == BGP_RECORD_WITHDRAW && withdraw) { if (bdi->lastrecord == BGP_RECORD_WITHDRAW && withdraw)
bgp_path_info_delete(bdi->dest, bdi->path); bgp_path_info_delete(bdi->dest, bdi->path);
bgp_process(bdi->path->peer->bgp, bdi->dest, bdi->path, afi, safi);
}
XFREE(MTYPE_BGP_DAMP_INFO, bdi); XFREE(MTYPE_BGP_DAMP_INFO, bdi);
} }
@ -500,13 +496,13 @@ void bgp_damp_info_clean(struct bgp *bgp, struct bgp_damp_config *bdc,
bdi->safi); bdi->safi);
} }
bgp_reuselist_del(list, bdi); bgp_reuselist_del(list, bdi);
bgp_damp_info_free(bdi, bdc, 1, afi, safi); bgp_damp_info_free(bdi, 1);
} }
} }
while ((bdi = SLIST_FIRST(&bdc->no_reuse_list)) != NULL) { while ((bdi = SLIST_FIRST(&bdc->no_reuse_list)) != NULL) {
bgp_reuselist_del(&bdc->no_reuse_list, bdi); bgp_reuselist_del(&bdc->no_reuse_list, bdi);
bgp_damp_info_free(bdi, bdc, 1, afi, safi); bgp_damp_info_free(bdi, 1);
} }
/* Free decay array */ /* Free decay array */

View File

@ -130,9 +130,7 @@ extern int bgp_damp_withdraw(struct bgp_path_info *path, struct bgp_dest *dest,
afi_t afi, safi_t safi, int attr_change); afi_t afi, safi_t safi, int attr_change);
extern int bgp_damp_update(struct bgp_path_info *path, struct bgp_dest *dest, extern int bgp_damp_update(struct bgp_path_info *path, struct bgp_dest *dest,
afi_t afi, safi_t saff); afi_t afi, safi_t saff);
extern void bgp_damp_info_free(struct bgp_damp_info *bdi, extern void bgp_damp_info_free(struct bgp_damp_info *bdi, int withdraw);
struct bgp_damp_config *bdc, int withdraw,
afi_t afi, safi_t safi);
extern void bgp_damp_info_clean(struct bgp *bgp, struct bgp_damp_config *bdc, extern void bgp_damp_info_clean(struct bgp *bgp, struct bgp_damp_config *bdc,
afi_t afi, safi_t safi); afi_t afi, safi_t safi);
extern void bgp_damp_config_clean(struct bgp_damp_config *bdc); extern void bgp_damp_config_clean(struct bgp_damp_config *bdc);

View File

@ -15827,8 +15827,7 @@ static int bgp_clear_damp_route(struct vty *vty, const char *view_name,
pi_temp = pi->next; pi_temp = pi->next;
bgp_damp_info_free( bgp_damp_info_free(
pi->extra->damp_info, pi->extra->damp_info,
&bgp->damp[afi][safi], 1);
1, afi, safi);
pi = pi_temp; pi = pi_temp;
} else } else
pi = pi->next; pi = pi->next;
@ -15867,8 +15866,7 @@ static int bgp_clear_damp_route(struct vty *vty, const char *view_name,
} }
bgp_damp_info_free( bgp_damp_info_free(
pi->extra->damp_info, pi->extra->damp_info,
&bgp->damp[afi][safi], 1);
1, afi, safi);
pi = pi_temp; pi = pi_temp;
} else } else
pi = pi->next; pi = pi->next;