]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Set ancestor without another if
authorIgor Putovny <igor.putovny@nic.cz>
Wed, 19 Feb 2025 15:57:29 +0000 (16:57 +0100)
committerIgor Putovny <igor.putovny@nic.cz>
Thu, 20 Feb 2025 11:23:22 +0000 (12:23 +0100)
proto/aggregator/aggregator.c

index 5a8965b410c5d35f03e4011f30b6293127a70fcc..9010acd5355907d367604d9e2302f6424d64e2c7 100644 (file)
@@ -763,6 +763,7 @@ third_pass_helper(struct aggregator_proto *p, struct trie_node *node, ip_addr *p
 
     node->selected_bucket = NULL;
     node->status = NON_FIB;
+    node->ancestor = node->parent->ancestor;
 
     /*
      * We have to keep information whether this prefix was original to enable
@@ -792,16 +793,10 @@ third_pass_helper(struct aggregator_proto *p, struct trie_node *node, ip_addr *p
      */
     node->px_origin = (ORIGINAL == node->px_origin) ? ORIGINAL : AGGREGATED;
     node->status = IN_FIB;
+    node->ancestor = node;
   }
 
   assert((node->selected_bucket != NULL && node->status == IN_FIB) || (node->selected_bucket == NULL && node->status == NON_FIB));
-
-  /*
-   * Node with a bucket is the closest ancestor for all his descendants.
-   * Its closest ancestor is its parent's ancestor otherwise.
-   */
-  node->ancestor = node->selected_bucket ? node : node->parent->ancestor;
-
   assert(node->ancestor != NULL);
   assert(node->ancestor->original_bucket != NULL);
   assert(node->ancestor->selected_bucket != NULL);