0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-10-18 09:58:43 +00:00

fixup! Kernel: protocol shuts down synchronously

This commit is contained in:
Maria Matejka 2024-10-16 09:33:01 +02:00
parent 8fae41780c
commit 56cd93b4ff

View File

@ -881,30 +881,36 @@ krt_shutdown(struct proto *P)
/* FIXME we should flush routes even when persist during reconfiguration */ /* FIXME we should flush routes even when persist during reconfiguration */
if (p->initialized && !KRT_CF->persist && (P->down_code != PDC_CMD_GR_DOWN)) if (p->initialized && !KRT_CF->persist && (P->down_code != PDC_CMD_GR_DOWN))
{ {
/* Synchronous flush */
struct rt_export_feeder req = (struct rt_export_feeder) struct rt_export_feeder req = (struct rt_export_feeder)
{ {
.name = "shutdown.feeder", .name = "krt.shutdown.feeder",
.trace_routes = P->main_channel->debug, .trace_routes = P->main_channel->debug,
}; };
rt_feeder_subscribe(&P->main_channel->table->export_best, &req); rt_feeder_subscribe(&P->main_channel->table->export_best, &req);
/* Walk over the whole table */
RT_FEED_WALK(&req, f) RT_FEED_WALK(&req, f)
{ {
for (uint i = 0; i < f->count_routes; i++) for (uint i = 0; i < f->count_routes; i++)
{ {
rte *e = &f->block[i]; rte *e = &f->block[i];
/* If rejected then no need to delete from kernel */
if (bmap_test(&P->main_channel->export_rejected_map, e->id)) if (bmap_test(&P->main_channel->export_rejected_map, e->id))
continue; continue;
/* if exported then delete from kernel */ /* Otherwise explicitly delete */
krt_replace_rte(p, e->net, NULL, e); krt_replace_rte(p, e->net, NULL, e);
} }
} }
rt_feeder_unsubscribe(&req);
/* Run an empty scan to flush remnants */
krt_do_scan(p); krt_do_scan(p);
krt_cleanup(p); krt_cleanup(p);
/* And now we are actually done */
proto_notify_state(&p->p, PS_DOWN); proto_notify_state(&p->p, PS_DOWN);
rt_feeder_unsubscribe(&req);
} }
else else
krt_cleanup(p); krt_cleanup(p);