summaryrefslogtreecommitdiff
path: root/nest/proto.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2019-12-10 18:18:02 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2019-12-10 18:18:02 +0100
commit4ab54f1aefd6a3ecc5e2340cbc15d492444daff5 (patch)
treef680a6a976d0a8e04279dadb0847034d904e98c8 /nest/proto.c
parentff2ca10cba9c5a3be690ec1a77a068e23395ef20 (diff)
Nest: Fix bitmap cleanup
Channel currently does not have independent pool and uses protocol pool, which is freed when protocol changes state to down, while channel is still in flushing. Move some some cleanup code to channel_do_flush() so it is done before freeing of protocol pool.
Diffstat (limited to 'nest/proto.c')
-rw-r--r--nest/proto.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/nest/proto.c b/nest/proto.c
index ac34d86f..6051ba9d 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -397,6 +397,12 @@ channel_do_flush(struct channel *c)
channel_graceful_restart_unlock(c);
CALL(c->channel->shutdown, c);
+
+ /* This have to be done in here, as channel pool is freed before channel_do_down() */
+ bmap_free(&c->export_map);
+ c->in_table = NULL;
+ c->reload_event = NULL;
+ c->out_table = NULL;
}
static void
@@ -411,7 +417,7 @@ channel_do_down(struct channel *c)
if ((c->stats.imp_routes + c->stats.filt_routes) != 0)
log(L_ERR "%s: Channel %s is down but still has some routes", c->proto->name, c->name);
- bmap_free(&c->export_map);
+ // bmap_free(&c->export_map);
memset(&c->stats, 0, sizeof(struct proto_stats));
c->in_table = NULL;