From 9638db5fc2e23f882a1de2879da96f88c44d6c1a Mon Sep 17 00:00:00 2001 From: Igor Putovny Date: Mon, 10 Mar 2025 14:57:24 +0100 Subject: [PATCH] Minor changes --- proto/aggregator/aggregator.c | 1 - proto/aggregator/config.Y | 3 +-- proto/aggregator/trie.c | 12 +++++------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c index 8ec2a9927..167e42425 100644 --- a/proto/aggregator/aggregator.c +++ b/proto/aggregator/aggregator.c @@ -811,7 +811,6 @@ aggregator_init_trie(struct aggregator_proto *p) /* Allocate bucket for root node */ struct aggregator_bucket *new_bucket = lp_allocz(p->bucket_pool, sizeof(*new_bucket)); - ASSERT_DIE(new_bucket->id == 0); u64 haux = 0; mem_hash_init(&haux); diff --git a/proto/aggregator/config.Y b/proto/aggregator/config.Y index f73a6dfa2..8ac9a8a9d 100644 --- a/proto/aggregator/config.Y +++ b/proto/aggregator/config.Y @@ -57,8 +57,6 @@ aggregator_proto_item: int count = 0; for (const struct aggr_item_node *item = $3; item; item = item->next) { - log(L_WARN "type %d sacode %d", item->i.type, item->i.sa.sa_code); - /* * If NET attribute is present, aggregate routes within the same net * and receive updates with any routes. @@ -74,6 +72,7 @@ aggregator_proto_item: AGGREGATOR_CFG->aggr_on = cfg_alloc(sizeof(struct aggr_item) * count); int pos = 0; + for (const struct aggr_item_node *item = $3; item; item = item->next) { if (item->i.type == AGGR_ITEM_DYNAMIC_ATTR) AGGREGATOR_CFG->aggr_on_da_count++; diff --git a/proto/aggregator/trie.c b/proto/aggregator/trie.c index 863d7e8fc..6684ea69d 100644 --- a/proto/aggregator/trie.c +++ b/proto/aggregator/trie.c @@ -387,7 +387,7 @@ aggregator_create_route(struct aggregator_proto *p, ip_addr prefix, u32 pxlen, s struct net_addr addr = { 0 }; net_fill_ipa(&addr, prefix, pxlen); - struct network *n = allocz(sizeof(*n) + sizeof(struct net_addr)); + struct network *n = allocz(sizeof(*n) + sizeof(addr)); net_copy(n->n.addr, &addr); aggregator_bucket_update(p, bucket, n); @@ -604,9 +604,7 @@ aggregator_second_pass(struct trie_node *node, int recomputing) ASSERT_DIE(node->original_bucket != NULL); /* Imaginary node if this was a complete binary tree */ - struct trie_node imaginary_node = { - .parent = node, - }; + struct trie_node imaginary_node = { 0 }; /* * Imaginary node is used only for computing sets of potential buckets @@ -980,6 +978,7 @@ aggregator_recompute(struct aggregator_proto *p, struct aggregator_route *old, s /* Find the closest IN_FIB ancestor of the updated node */ // TODO: use node ancestor pointer instead of traversing + /* while (1) { if ((ancestor->status == IN_FIB && ancestor != updated_node) || !ancestor->parent) @@ -987,8 +986,8 @@ aggregator_recompute(struct aggregator_proto *p, struct aggregator_route *old, s ancestor = ancestor->parent; } + */ - /* while (ancestor = ancestor->parent) { ASSERT_DIE(ancestor != updated_node); @@ -996,7 +995,6 @@ aggregator_recompute(struct aggregator_proto *p, struct aggregator_route *old, s if (ancestor->status == IN_FIB || !ancestor->parent) break; } - */ // TODO: root should never get here ASSERT_DIE(ancestor != NULL); @@ -1010,5 +1008,5 @@ aggregator_recompute(struct aggregator_proto *p, struct aggregator_route *old, s ASSERT_DIE(highest_node != NULL); aggregator_third_pass(p, highest_node); - check_trie_after_aggregation(p->root); + check_trie_after_aggregation(highest_node); } -- 2.47.2