]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fix aggregator_bucket_unionize()
authorIgor Putovny <igor.putovny@nic.cz>
Thu, 21 Sep 2023 10:37:37 +0000 (12:37 +0200)
committerIgor Putovny <igor.putovny@nic.cz>
Thu, 21 Sep 2023 10:40:00 +0000 (12:40 +0200)
The last two while loops were incorrectly placed inside the first while loop

proto/aggregator/aggregator.c

index 735877efbb0fa8458eb828799333ddf5f07570c2..2065f9510811a9ece3d446427bb96b979f95cab1 100644 (file)
@@ -323,28 +323,28 @@ aggregator_bucket_unionize(struct trie_node *node, const struct trie_node *left,
       default:
         bug("Impossible");
     }
+  }
 
-    while (i < left->potential_buckets_count)
-    {
-      if (node->potential_buckets_count >= MAX_POTENTIAL_NEXTHOP_COUNT)
-        return;
+  while (i < left->potential_buckets_count)
+  {
+    if (node->potential_buckets_count >= MAX_POTENTIAL_NEXTHOP_COUNT)
+      return;
 
-      if (node->potential_buckets_count == 0 || node->potential_buckets[node->potential_buckets_count - 1] != left->potential_buckets[i])
-        node->potential_buckets[node->potential_buckets_count++] = left->potential_buckets[i];
+    if (node->potential_buckets_count == 0 || node->potential_buckets[node->potential_buckets_count - 1] != left->potential_buckets[i])
+      node->potential_buckets[node->potential_buckets_count++] = left->potential_buckets[i];
 
-      i++;
-    }
+    i++;
+  }
 
-    while (j < right->potential_buckets_count)
-    {
-      if (node->potential_buckets_count >= MAX_POTENTIAL_NEXTHOP_COUNT)
-        return;
+  while (j < right->potential_buckets_count)
+  {
+    if (node->potential_buckets_count >= MAX_POTENTIAL_NEXTHOP_COUNT)
+      return;
 
-      if (node->potential_buckets_count == 0 || node->potential_buckets[node->potential_buckets_count - 1] != right->potential_buckets[j])
-        node->potential_buckets[node->potential_buckets_count++] = right->potential_buckets[j];
+    if (node->potential_buckets_count == 0 || node->potential_buckets[node->potential_buckets_count - 1] != right->potential_buckets[j])
+      node->potential_buckets[node->potential_buckets_count++] = right->potential_buckets[j];
 
-      j++;
-    }
+    j++;
   }
 }