}
/* Assign bucket to the last node */
- node->bucket = bucket;
+ node->original_bucket = bucket;
node->status = IN_FIB;
return node;
}
/* Assign bucket to the last node */
- node->bucket = bucket;
+ node->original_bucket = bucket;
node->status = IN_FIB;
return node;
{
assert(node != NULL);
- if (node->bucket)
+ if (node->original_bucket)
assert(IN_FIB == node->status);
else
assert(NON_FIB == node->status);
if (is_leaf(node))
{
- assert(node->bucket != NULL);
+ assert(node->original_bucket != NULL);
assert(node->potential_buckets_count == 0);
assert(IN_FIB == node->status);
- node_insert_potential_bucket(node, node->bucket);
+ node_insert_potential_bucket(node, node->original_bucket);
return;
}
/* Root node */
if (!node->parent)
- assert(node->bucket != NULL);
+ assert(node->original_bucket != NULL);
/* Initialize bucket from the nearest ancestor that has a bucket */
- if (!node->bucket)
- node->bucket = node->parent->bucket;
+ if (!node->original_bucket)
+ node->original_bucket = node->parent->original_bucket;
for (int i = 0; i < 2; i++)
{
assert(node->potential_buckets_count == 1);
/* The only potential bucket so far is the assigned bucket of the current node */
- assert(BIT32R_TEST(node->potential_buckets, node->bucket->id));
+ assert(BIT32R_TEST(node->potential_buckets, node->original_bucket->id));
return;
}
if (right)
second_pass(right);
- assert(node->bucket != NULL);
+ assert(node->original_bucket != NULL);
/* Imaginary node if this was a complete binary tree */
struct trie_node imaginary_node = {
* Imaginary node is used only for computing sets of potential buckets
* of its parent node.
*/
- node_insert_potential_bucket(&imaginary_node, node->bucket);
+ node_insert_potential_bucket(&imaginary_node, node->original_bucket);
/* Nodes with exactly one child */
if ((left && !right) || (!left && right))
assert(node->ancestor == NULL);
assert(node->selected_bucket == NULL);
- assert(node->bucket != NULL);
+ assert(node->original_bucket != NULL);
assert(node->parent->ancestor != NULL);
assert(node->parent->ancestor->selected_bucket != NULL);
node->ancestor = node->selected_bucket ? node : node->parent->ancestor;
assert(node->ancestor != NULL);
- assert(node->ancestor->bucket != NULL);
+ assert(node->ancestor->original_bucket != NULL);
assert(node->ancestor->selected_bucket != NULL);
const struct trie_node * const left = node->child[0];
*/
struct trie_node imaginary_node = {
.parent = node,
- .bucket = node->bucket,
+ .original_bucket = node->original_bucket,
.depth = node->depth + 1,
};
- node_insert_potential_bucket(&imaginary_node, node->bucket);
+ node_insert_potential_bucket(&imaginary_node, node->original_bucket);
/*
* If the current node (parent of the imaginary node) has a bucket,
if (is_leaf(node))
{
- log("%N -> %p", addr, node->bucket);
+ log("%N -> %p", addr, node->original_bucket);
return;
}
if (IN_FIB == node->status)
{
- log("%N -> %p", addr, node->bucket);
+ log("%N -> %p", addr, node->original_bucket);
}
if (node->child[0])
if (is_leaf(node))
{
- log("%N -> %p", addr, node->bucket);
+ log("%N -> %p", addr, node->original_bucket);
return;
}
if (IN_FIB == node->status)
{
- log("%N -> %p", addr, node->bucket);
+ log("%N -> %p", addr, node->original_bucket);
}
if (node->child[0])
if (is_leaf(node))
{
- assert(node->bucket != NULL);
+ assert(node->original_bucket != NULL);
assert(node->selected_bucket != NULL);
assert(IN_FIB == node->status);
/* Internal node with assigned bucket */
if (IN_FIB == node->status)
{
- assert(node->bucket != NULL);
+ assert(node->original_bucket != NULL);
assert(node->selected_bucket != NULL);
create_route_ip4(p, node->selected_bucket, addr);
if (is_leaf(node))
{
- assert(node->bucket != NULL);
+ assert(node->original_bucket != NULL);
assert(node->selected_bucket != NULL);
assert(IN_FIB == node->status);
- create_route_ip6(p, node->bucket, addr);
+ create_route_ip6(p, node->original_bucket, addr);
*count += 1;
p->leaves++;
return;
/* Internal node with assigned bucket */
if (IN_FIB == node->status)
{
- assert(node->bucket != NULL);
+ assert(node->original_bucket != NULL);
assert(node->selected_bucket != NULL);
create_route_ip6(p, node->selected_bucket, addr);
HASH_INSERT2(p->buckets, AGGR_BUCK, p->p.pool, new_bucket);
/* Assign default route to the root */
- p->root->bucket = new_bucket;
+ p->root->original_bucket = new_bucket;
p->root->status = IN_FIB;
}