summaryrefslogtreecommitdiff
path: root/proto/bfd/bfd.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2014-04-02 19:58:23 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2014-04-02 19:58:23 +0200
commit864f52a5f4c47ac8dc44a8808beb7f038cbf9899 (patch)
treeb57e4848ef337b75c209f5a6ed4048e5b9475e43 /proto/bfd/bfd.c
parent60442b1698563ebc5837454d89dbe4afa037882d (diff)
Fixes nasty bug in BFD.
When a BFD session is removed while being scheduled for notification, the session stays in notify list and is removed twice, which leads to a strange crash after a while.
Diffstat (limited to 'proto/bfd/bfd.c')
-rw-r--r--proto/bfd/bfd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/proto/bfd/bfd.c b/proto/bfd/bfd.c
index 315d132b..7bbe8c21 100644
--- a/proto/bfd/bfd.c
+++ b/proto/bfd/bfd.c
@@ -477,8 +477,15 @@ bfd_remove_session(struct bfd_proto *p, struct bfd_session *s)
{
ip_addr ip = s->addr;
+ /* Caller should ensure that request list is empty */
+
birdloop_enter(p->loop);
+ /* Remove session from notify list if scheduled for notification */
+ /* No need for bfd_lock_sessions(), we are already protected by birdloop_enter() */
+ if (NODE_VALID(&s->n))
+ rem_node(&s->n);
+
bfd_free_iface(s->ifa);
rfree(s->tx_timer);