]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Flowspec links must have the destination table service loop locked
authorMaria Matejka <mq@ucw.cz>
Tue, 7 Feb 2023 16:01:34 +0000 (17:01 +0100)
committerMaria Matejka <mq@ucw.cz>
Tue, 4 Apr 2023 15:00:58 +0000 (17:00 +0200)
nest/rt-table.c

index fce51662c0d93cbba2cdf8d3410e1c1c51ede2d2..bd7cb259b87f629a09d7d310288ab51c9aa6a769 100644 (file)
@@ -2677,6 +2677,8 @@ rt_flowspec_link(rtable *src_pub, rtable *dst_pub)
 
   int lock_dst = 0;
 
+  birdloop_enter(dst_pub->loop);
+
   RT_LOCKED(src_pub, src)
   {
     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->req = (struct rt_export_request) {
        .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,
        .dump_req = rt_flowspec_dump_req,
        .log_state_change = rt_flowspec_log_state_change,
@@ -2706,6 +2708,8 @@ rt_flowspec_link(rtable *src_pub, rtable *dst_pub)
 
   if (lock_dst)
     rt_lock_table(dst_pub);
+
+  birdloop_leave(dst_pub->loop);
 }
 
 static void
@@ -2721,6 +2725,8 @@ rt_flowspec_link_stopped(struct rt_export_request *req)
 void
 rt_flowspec_unlink(rtable *src, rtable *dst)
 {
+  birdloop_enter(dst->loop);
+
   struct rt_flowspec_link *ln;
   RT_LOCKED(src, t)
   {
@@ -2731,6 +2737,8 @@ rt_flowspec_unlink(rtable *src, rtable *dst)
     if (!--ln->uc)
       rt_stop_export(&ln->req, rt_flowspec_link_stopped);
   }
+
+  birdloop_leave(dst->loop);
 }
 
 static void