From f8e6b7ce450f494c88fdddbd8822673579b6d9b4 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 24 Apr 2024 16:42:08 +0300 Subject: [PATCH] bgpd: Use SLIST_FOREACH_SAFE when iterating over the list in bgp_reuse_timer Signed-off-by: Donatas Abraitis --- bgpd/bgp_damp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index cbeb2275a7..ddf7e0db8f 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -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. */ -- 2.39.5