0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00

Remove debugging logs

This commit is contained in:
Igor Putovny 2024-03-27 12:23:19 +01:00
parent 7dd30de09d
commit c1f7d66a47
2 changed files with 0 additions and 94 deletions

View File

@ -65,24 +65,6 @@
extern linpool *rte_update_pool;
static void
dump_hash_table(const struct aggregator_proto *p)
{
log("================ HASH TABLE DUMP ================");
HASH_WALK(p->buckets, next_hash, b)
{
for (const struct rte *rte = b->rte; rte; rte = rte->next)
{
struct net_addr *addr = rte->net->n.addr;
log("bucket %p: addr: %N,\troute: %p, net: %p, src: %p", b, addr, rte, rte->net, rte->src);
}
}
HASH_WALK_END;
log("============== END HASH TABLE DUMP ==============");
}
static void aggregator_bucket_update(struct aggregator_proto *p, struct aggregator_bucket *bucket, struct network *net);
static inline int
@ -436,27 +418,15 @@ bucket_sets_are_disjoint(const struct trie_node *left, const struct trie_node *r
int res = aggregator_bucket_compare(left->potential_buckets[i], right->potential_buckets[j]);
if (res == 0)
{
// log("left: %p, right: %p, res: %d, verdict: EQUAL", left->potential_buckets[i], right->potential_buckets[i], res);
// log("Buckets are NOT disjoint");
return 0;
}
else if (res == -1)
{
// log("left: %p, right: %p, res: %d, verdict: LEFT < RIGHT", left->potential_buckets[i], right->potential_buckets[i], res);
i++;
}
else if (res == 1)
{
// log("left: %p, right: %p, res: %d, verdict: LEFT > RIGHT", left->potential_buckets[i], right->potential_buckets[i], res);
j++;
}
else
bug("Impossible");
}
// log("Buckets are disjoint");
// log("==========================================");
return 1;
}
@ -726,8 +696,6 @@ print_prefixes(const struct trie_node *node, int type)
static void
create_route_ip4(struct aggregator_proto *p, const struct net_addr_ip4 *addr, struct aggregator_bucket *bucket)
{
log("create route XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src);
struct {
struct network net;
union net_addr_union u;
@ -754,8 +722,6 @@ create_route_ip6(struct aggregator_proto *p, struct net_addr_ip6 *addr, struct a
static void
collect_prefixes_helper_ip4(const struct trie_node *node, struct net_addr_ip4 *addr, struct aggregator_proto *p, int depth, int *count)
{
log("collect prefixes XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src);
assert(node != NULL);
if (is_leaf(node))
@ -856,25 +822,20 @@ calculate_trie(void *P)
assert(p->addr_type == NET_IP4 || p->addr_type == NET_IP6);
log("====PREFIXES BEFORE ====");
log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src);
first_pass(p->root, p->trie_slab);
log("====FIRST PASS====");
log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src);
print_prefixes(p->root, p->addr_type);
second_pass(p->root);
log("====SECOND PASS====");
log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src);
print_prefixes(p->root, p->addr_type);
third_pass(p->root);
log("====THIRD PASS====");
log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src);
print_prefixes(p->root, p->addr_type);
collect_prefixes(p);
log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src);
log("==== AGGREGATION DONE ====");
}
@ -966,8 +927,6 @@ same_val_list(const struct f_val *v1, const struct f_val *v2, uint len)
static void
aggregator_bucket_update(struct aggregator_proto *p, struct aggregator_bucket *bucket, struct network *net)
{
log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src);
/* Empty bucket */
if (!bucket->rte)
{
@ -1009,9 +968,6 @@ aggregator_bucket_update(struct aggregator_proto *p, struct aggregator_bucket *b
log("New route created: id = %d, protocol: %s", new->src->global_id, new->src->proto->name);
log("===================================================");
log("XXX arte: %p, src: %p", p->default_arte, p->default_arte->rte.src);
/* merge filter needs one argument called "routes" */
struct f_val val = {
.type = T_ROUTES_BLOCK,
@ -1415,8 +1371,6 @@ aggregator_rt_notify(struct proto *P, struct channel *src_ch, net *net, rte *new
sl_free(old_route);
}
dump_hash_table(p);
HASH_WALK(p->buckets, next_hash, bucket)
{
for (const struct rte *rte = bucket->rte; rte; rte = rte->next)
@ -1588,8 +1542,6 @@ aggregator_start(struct proto *P)
arte->rte.net = default_net;
default_net->routes = &arte->rte;
p->default_arte = arte;
HASH_INSERT2(p->routes, AGGR_RTE, p->p.pool, arte);
HASH_INSERT2(p->buckets, AGGR_BUCK, p->p.pool, new_bucket);
@ -1604,61 +1556,16 @@ aggregator_shutdown(struct proto *P)
{
struct aggregator_proto *p = SKIP_BACK(struct aggregator_proto, p, P);
HASH_WALK(p->buckets, next_hash, b)
{
log(L_WARN "Buckets: %u %p", _i, b);
for (struct rte *r = b->rte; r; r = r->next)
{
log(L_WARN " in bucket: %p", SKIP_BACK(struct aggregator_route, rte, r));
}
}
HASH_WALK_END;
HASH_WALK(p->routes, next_hash, r)
{
log(L_WARN "Routes: %u %p, net: %p, src: %p, hash: %x", _i, r, r->rte.net, r->rte.src, aggr_route_hash(&r->rte));
}
HASH_WALK_END;
HASH_WALK_DELSAFE(p->buckets, next_hash, b)
{
while (b->rte)
{
{
HASH_WALK(p->routes, next_hash, r)
{
log(L_WARN "%u %p", _i, r);
}
HASH_WALK_END;
}
log("Hash table dump before");
dump_hash_table(p);
struct aggregator_route *arte = SKIP_BACK(struct aggregator_route, rte, b->rte);
struct net_addr *addr = arte->rte.net->n.addr;
log("Removing arte %p, rte: %p, addr: %N, net: %p, src: %p, hash: %x",
arte, &arte->rte, addr, arte->rte.net, arte->rte.src, aggr_route_hash(&arte->rte));
net_addr_union *n = (void *)arte->rte.net->n.addr;
log("Net type: %d", n->n.type);
b->rte = arte->rte.next;
b->count--;
int count_before_remove = p->routes.count;
assert(n->n.type == NET_IP4);
log("Hash count before HASH_REMOVE: %d", count_before_remove);
HASH_REMOVE(p->routes, AGGR_RTE, arte);
int count_after_remove = p->routes.count;
log("Hash count after HASH_REMOVE: %d", count_after_remove);
assert(count_before_remove == count_after_remove + 1);
rta_free(arte->rte.attrs);
sl_free(arte);
log("Hash table dump after");
dump_hash_table(p);
}
ASSERT_DIE(b->count == 0);

View File

@ -71,7 +71,6 @@ struct aggregator_proto {
slab *trie_slab;
struct trie_node *root;
struct event reload_trie;
struct aggregator_route *default_arte;
};
enum aggr_item_type {