summaryrefslogtreecommitdiff
path: root/lib/bfd.c
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2021-04-12 17:59:52 -0300
committerRafael Zalamena <rzalamena@opensourcerouting.org>2021-04-22 15:12:18 -0300
commit464e6541b112ba7b3c77dbe8d105fcebb58056dc (patch)
tree295c30c5760d7e1c1234655a1ce11edde01c2303 /lib/bfd.c
parentb38f1fd03dacfcd2536d96379f575156d3844ee9 (diff)
lib: fix possible crash on BFD notification
Allow sessions to remove themselves from the notifications without risking crashes. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'lib/bfd.c')
-rw-r--r--lib/bfd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/bfd.c b/lib/bfd.c
index bf3eaa32db..b821094cdd 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -1080,7 +1080,7 @@ static int zclient_bfd_session_reply(ZAPI_CALLBACK_ARGS)
static int zclient_bfd_session_update(ZAPI_CALLBACK_ARGS)
{
- struct bfd_session_params *bsp;
+ struct bfd_session_params *bsp, *bspn;
size_t sessions_updated = 0;
struct interface *ifp;
int remote_cbit = false;
@@ -1137,7 +1137,7 @@ static int zclient_bfd_session_update(ZAPI_CALLBACK_ARGS)
now = monotime(NULL);
/* Notify all matching sessions about update. */
- TAILQ_FOREACH (bsp, &bsglobal.bsplist, entry) {
+ TAILQ_FOREACH_SAFE (bsp, &bsglobal.bsplist, entry, bspn) {
/* Skip not installed entries. */
if (!bsp->installed)
continue;