]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Channel: Fix race condition of a new feed with an update in the table dp-fix-thead-group-conf
authorMaria Matejka <mq@ucw.cz>
Fri, 14 Nov 2025 19:11:59 +0000 (20:11 +0100)
committerMaria Matejka <mq@ucw.cz>
Mon, 17 Nov 2025 09:44:25 +0000 (10:44 +0100)
In case an update arrived while another thread feeding anew, there was
a race condition causing the old route to be counted against the export limit
despite never reached.

In long run, this caused limit counter underflow and a hard assertion failure.

nest/rt-table.c

index 8cb052bf5849a05bd1b2819504960b83cd1addf6..9141ddc6c2da5eb39e530e88bf024f8e8974e42d 100644 (file)
@@ -1463,6 +1463,9 @@ channel_notify_any(void *_channel)
 
              if (old)
              {
+               /* There are more old routes but these we should have
+                * never seen these newer old routes because we haven't
+                * seen the appropriate journal items */
                EXPORT_FLAG_EXPECT(c, oo, accepted, 0);
                EXPORT_FLAG_EXPECT(c, oo, rejected, 0);
                oo->src = NULL;
@@ -1471,6 +1474,15 @@ channel_notify_any(void *_channel)
                old = oo;
            }
 
+           /* Check whether the old route was actually seen because this may
+            * an initial feed. */
+           bool oacc = old && bmap_test(&c->export_accepted_map, old->id);
+           bool orej = old && bmap_test(&c->export_rejected_map, old->id);
+
+           /* Not seen */
+           if (!oacc && !orej)
+             old = NULL;
+
            /* Invalid routes become withdraws */
            if (!rte_is_valid(new))
              new = NULL;