]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Small changes
authorIgor Putovny <igor.putovny@nic.cz>
Wed, 5 Feb 2025 17:26:03 +0000 (18:26 +0100)
committerIgor Putovny <igor.putovny@nic.cz>
Wed, 5 Feb 2025 17:26:03 +0000 (18:26 +0100)
proto/aggregator/aggregator.c
proto/aggregator/aggregator.h

index 247b9a8a7b966046aad8e5f2164beb3b6aea85a1..937ed7f05bb0332a48349106876df3d839149d1b 100644 (file)
@@ -444,13 +444,17 @@ trie_remove_prefix_ip4(struct trie_node * const root, const struct net_addr_ip4
   memset(node->potential_buckets, 0, sizeof(node->potential_buckets));
 
   /*
-   * If prefix node is a leaf, delete it along with the branch
-   * it resides on, until non-leaf or prefix node is reached.
+   * If prefix node is a leaf, remove it along with the branch
+   * it resides on, until non-leaf or prefix node is reached.
    */
   for (struct trie_node *parent = node->parent; parent; node = parent, parent = node->parent)
   {
-    if (is_leaf(node) && FILLER == node->px_origin)
+    if (FILLER == node->px_origin && is_leaf(node))
+    {
       remove_node(node);
+      assert(node != NULL);
+      assert(parent != NULL);
+    }
     else
       break;
   }
@@ -483,8 +487,12 @@ trie_remove_prefix_ip6(struct trie_node * const root, const struct net_addr_ip6
 
   for (struct trie_node *parent = node->parent; parent; node = parent, parent = node->parent)
   {
-    if (is_leaf(node) && FILLER == node->px_origin)
+    if (FILLER == node->px_origin && is_leaf(node))
+    {
       remove_node(node);
+      assert(node != NULL);
+      assert(parent != NULL);
+    }
     else
       break;
   }
index a42d4e9983ec9b9c3e9d6b0a45b800bd82a6a88e..114432ef8133bf7e39f6de3dd001f01c4e525be4 100644 (file)
@@ -113,14 +113,15 @@ struct aggr_item_node {
 };
 
 enum fib_status {
-  IN_FIB = 1,
-  NON_FIB = 2,
+  UNASSIGNED_STATUS,
+  IN_FIB,
+  NON_FIB,
 };
 
 enum prefix_origin {
-  FILLER = 0,
-  ORIGINAL = 1,
-  AGGREGATED = 2,
+  FILLER,
+  ORIGINAL,
+  AGGREGATED,
 };
 
 struct trie_node {
@@ -129,9 +130,9 @@ struct trie_node {
   struct trie_node *ancestor;
   struct aggregator_bucket *original_bucket;
   struct aggregator_bucket *selected_bucket;
-  u32 potential_buckets[POTENTIAL_BUCKETS_BITMAP_SIZE];
   enum fib_status status;
   enum prefix_origin px_origin;
+  u32 potential_buckets[POTENTIAL_BUCKETS_BITMAP_SIZE];
   int potential_buckets_count;
   int depth;
 };