/* Assign bucket to the last node */
node->original_bucket = bucket;
- node->status = IN_FIB;
node->px_origin = ORIGINAL;
return node;
/* Assign bucket to the last node */
node->original_bucket = bucket;
- node->status = IN_FIB;
node->px_origin = ORIGINAL;
return node;
{
assert(node->original_bucket != NULL);
assert(node->potential_buckets_count == 0);
- assert(IN_FIB == node->status);
+ assert(NON_FIB == node->status);
node_insert_potential_bucket(node, node->original_bucket);
return;
}
*/
if (is_bucket_potential(node, inherited_bucket))
{
- /* Selected bucket is NULL as it has never been assigned */
- assert(node->selected_bucket == NULL);
+ /*
+ * Prefix status is changing from IN_FIB to NON_FIB, thus its route
+ * must be removed from the routing table.
+ */
+ if (IN_FIB == node->status)
+ {
+ assert(node->px_origin == ORIGINAL || node->px_origin == AGGREGATED);
+ assert(node->selected_bucket != NULL);
+
+ log("Planning to remove %s route for %N", px_origin_str[node->px_origin], addr);
+ push_rte_withdraw_ip4(p, addr, node->selected_bucket);
+ }
+
node->selected_bucket = NULL;
node->status = NON_FIB;
/* Assign bucket with the lowest ID to the node */
node->selected_bucket = choose_lowest_id_bucket(p, node);
+ assert(node->selected_bucket != NULL);
+
+ /*
+ * Prefix status is changing from NON_FIB to IN_FIB, thus its route
+ * must be exported to the routing table.
+ */
+ if (NON_FIB == node->status)
+ {
+ log("Exporting %s route for %N", px_origin_str[node->px_origin], addr);
+ create_route_ip4(p, node->selected_bucket, addr);
+ }
+
node->status = IN_FIB;
/*
* is changed to aggregated, because it's going to FIB.
*/
node->px_origin = ORIGINAL == node->px_origin ? ORIGINAL : AGGREGATED;
- assert(node->selected_bucket != NULL);
}
assert((node->selected_bucket != NULL && node->status == IN_FIB) || (node->selected_bucket == NULL && node->status == NON_FIB));
if (ORIGINAL == node->px_origin)
{
assert(node->original_bucket != NULL);
- node->status = IN_FIB;
}
else
{
- node->status = NON_FIB;
node->original_bucket = node->parent->original_bucket;
assert(node->original_bucket != NULL);
}
/* As in the first pass, leaves get one potential bucket */
if (is_leaf(node))
{
- assert(node->status == IN_FIB);
assert(node->px_origin == ORIGINAL);
assert(node->potential_buckets_count == 0);
node_insert_potential_bucket(node, node->original_bucket);
assert(updated_node != NULL);
assert(updated_node->original_bucket != NULL);
- assert(updated_node->status == IN_FIB);
-
assert(updated_node->potential_buckets_count == 1);
assert(BIT32R_TEST(updated_node->potential_buckets, updated_node->original_bucket->id));
+ assert(updated_node->status == NON_FIB);
struct trie_node *node = updated_node;