]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Table best export: asserting seqmap consistency
authorMaria Matejka <mq@ucw.cz>
Tue, 4 Mar 2025 12:04:20 +0000 (13:04 +0100)
committerMaria Matejka <mq@ucw.cz>
Tue, 4 Mar 2025 12:04:26 +0000 (13:04 +0100)
In case of some exports have been seen and others not, it makes no sense
for the second one to be seen if the first one was not seen.

nest/rt-table.c

index ca808ea42c545618c606c437786ef4c8c129662e..648f18640c445c5671f3ef15d3f98f453d76cf99 100644 (file)
@@ -2612,10 +2612,14 @@ rt_feed_net_best(struct rt_exporter *e, struct rcu_unwinder *u, u32 index, struc
     best = NULL;
 
   uint ecnt = 0, ocnt = 0;
+  bool export_in_map = true;
   for (const struct rt_pending_export *rpe = first; rpe;
       rpe = atomic_load_explicit(&rpe->next, memory_order_acquire))
-    if (!seen || !bmap_test(seen, rpe->it.seq))
+    if (seen && bmap_test(seen, rpe->it.seq))
+      ASSERT_DIE(export_in_map);
+    else
     {
+      export_in_map = false;
       ecnt++;
       if (rpe->it.old && (!best || (rpe->it.old != &best->rte)))
        ocnt++;