0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-31 22:21:54 +00:00

Flowspec links must have the destination table service loop locked

This commit is contained in:
Maria Matejka 2023-02-07 17:01:34 +01:00
parent 227352c461
commit e565e045b6

View File

@ -2677,6 +2677,8 @@ rt_flowspec_link(rtable *src_pub, rtable *dst_pub)
int lock_dst = 0; int lock_dst = 0;
birdloop_enter(dst_pub->loop);
RT_LOCKED(src_pub, src) RT_LOCKED(src_pub, src)
{ {
struct rt_flowspec_link *ln = rt_flowspec_find_link(src, dst_pub); struct rt_flowspec_link *ln = rt_flowspec_find_link(src, dst_pub);
@ -2689,7 +2691,7 @@ rt_flowspec_link(rtable *src_pub, rtable *dst_pub)
ln->dst = dst_pub; ln->dst = dst_pub;
ln->req = (struct rt_export_request) { ln->req = (struct rt_export_request) {
.name = mb_sprintf(p, "%s.flowspec.notifier", dst_pub->name), .name = mb_sprintf(p, "%s.flowspec.notifier", dst_pub->name),
.list = &global_work_list, .list = birdloop_event_list(dst_pub->loop),
.trace_routes = src->config->debug, .trace_routes = src->config->debug,
.dump_req = rt_flowspec_dump_req, .dump_req = rt_flowspec_dump_req,
.log_state_change = rt_flowspec_log_state_change, .log_state_change = rt_flowspec_log_state_change,
@ -2706,6 +2708,8 @@ rt_flowspec_link(rtable *src_pub, rtable *dst_pub)
if (lock_dst) if (lock_dst)
rt_lock_table(dst_pub); rt_lock_table(dst_pub);
birdloop_leave(dst_pub->loop);
} }
static void static void
@ -2721,6 +2725,8 @@ rt_flowspec_link_stopped(struct rt_export_request *req)
void void
rt_flowspec_unlink(rtable *src, rtable *dst) rt_flowspec_unlink(rtable *src, rtable *dst)
{ {
birdloop_enter(dst->loop);
struct rt_flowspec_link *ln; struct rt_flowspec_link *ln;
RT_LOCKED(src, t) RT_LOCKED(src, t)
{ {
@ -2731,6 +2737,8 @@ rt_flowspec_unlink(rtable *src, rtable *dst)
if (!--ln->uc) if (!--ln->uc)
rt_stop_export(&ln->req, rt_flowspec_link_stopped); rt_stop_export(&ln->req, rt_flowspec_link_stopped);
} }
birdloop_leave(dst->loop);
} }
static void static void