bfdd: remove profiles when removing bfd node

Fixes #8379.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
Igor Ryzhov 2021-04-01 15:29:18 +03:00
parent d6cfe1b884
commit e93c3c003d
3 changed files with 10 additions and 0 deletions

View File

@ -1941,6 +1941,14 @@ void bfd_sessions_remove_manual(void)
hash_iterate(bfd_key_hash, _bfd_session_remove_manual, NULL); hash_iterate(bfd_key_hash, _bfd_session_remove_manual, NULL);
} }
void bfd_profiles_remove(void)
{
struct bfd_profile *bp;
while ((bp = TAILQ_FIRST(&bplist)) != NULL)
bfd_profile_free(bp);
}
/* /*
* Profile related hash functions. * Profile related hash functions.
*/ */

View File

@ -619,6 +619,7 @@ void bfd_session_free(struct bfd_session *bs);
const struct bfd_session *bfd_session_next(const struct bfd_session *bs, const struct bfd_session *bfd_session_next(const struct bfd_session *bs,
bool mhop); bool mhop);
void bfd_sessions_remove_manual(void); void bfd_sessions_remove_manual(void);
void bfd_profiles_remove(void);
/** /**
* Set the BFD session echo state. * Set the BFD session echo state.

View File

@ -246,6 +246,7 @@ int bfdd_bfd_destroy(struct nb_cb_destroy_args *args)
case NB_EV_APPLY: case NB_EV_APPLY:
bfd_sessions_remove_manual(); bfd_sessions_remove_manual();
bfd_profiles_remove();
break; break;
case NB_EV_ABORT: case NB_EV_ABORT: