]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Refactor print_prefixes()
authorIgor Putovny <igor.putovny@nic.cz>
Mon, 3 Mar 2025 15:29:49 +0000 (16:29 +0100)
committerIgor Putovny <igor.putovny@nic.cz>
Mon, 3 Mar 2025 15:29:49 +0000 (16:29 +0100)
proto/aggregator/trie.c

index b4ec2d5814179ddd77001a4eb5f5f35b0aa4d903..9189398b0785f3cf6d3f379aa593375e6867f973 100644 (file)
@@ -283,7 +283,7 @@ aggregator_print_prefixes_helper(const struct trie_node *node, ip_addr *prefix,
   {
     struct net_addr addr = { 0 };
     net_fill_ipa(&addr, *prefix, pxlen);
-    log("%N selected bucket: %u", &addr, node->selected_bucket->id);
+    log("%N\t[%u]", &addr, node->selected_bucket->id);
   }
 
   if (node->child[0])
@@ -303,12 +303,10 @@ aggregator_print_prefixes_helper(const struct trie_node *node, ip_addr *prefix,
 }
 
 static void
-aggregator_print_prefixes(const struct trie_node *node, u32 type)
+aggregator_print_prefixes(const struct aggregator_proto *p)
 {
-  ASSERT_DIE(node != NULL);
-
-  ip_addr prefix = (type == NET_IP4) ? ipa_from_ip4(IP4_NONE) : ipa_from_ip6(IP6_NONE);
-  aggregator_print_prefixes_helper(node, &prefix, 0, type);
+  ip_addr prefix = (p->addr_type == NET_IP4) ? ipa_from_ip4(IP4_NONE) : ipa_from_ip6(IP6_NONE);
+  aggregator_print_prefixes_helper(p->root, &prefix, 0, p->addr_type);
 }
 
 static void