bgpd: Use SLIST_FOREACH_SAFE when iterating over the list in bgp_reuse_timer

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
Donatas Abraitis 2024-04-24 16:42:08 +03:00
parent 471e373c17
commit f8e6b7ce45

View file

@ -155,7 +155,7 @@ int bgp_damp_decay(time_t tdiff, int penalty, struct bgp_damp_config *bdc)
is evaluated. RFC2439 Section 4.8.7. */
static void bgp_reuse_timer(struct event *t)
{
struct bgp_damp_info *bdi;
struct bgp_damp_info *bdi, *bdi_next;
struct reuselist plist;
struct bgp *bgp;
time_t t_now, t_diff;
@ -179,7 +179,7 @@ static void bgp_reuse_timer(struct event *t)
assert(bdc->reuse_offset < bdc->reuse_list_size);
/* 3. if ( the saved list head pointer is non-empty ) */
while ((bdi = SLIST_FIRST(&plist)) != NULL) {
SLIST_FOREACH_SAFE (bdi, &plist, entry, bdi_next) {
bgp = bdi->path->peer->bgp;
/* Set t-diff = t-now - t-updated. */