Igor Putovny [Fri, 28 Feb 2025 17:12:47 +0000 (18:12 +0100)]
Bugfix
This was another bug tricky to find.
It manifested in a following way. After running aggregator with configuration A,
reconfiguring it to B (this works now as it was fixed in the previous commit)
and reconfiguring back to A, no routes from A were exported to the routing
table, despite prefixes being present in the trie.
It was found that aggregator_bucket_update() is correctly called, however, it
returned on the first "if", meaning that bucket was empty. It was found that
there were two different buckets with the same ID. The culprit turned out to
be freeing bucket ID when the bucket becomes empty in rt_notify() due to
reconfiguration. When that happens, freed ID will be used again for new bucket
created during reconfiguration.
However, the bucket pointer in the bucket list was never updated and pointer to
old bucket was still kept there at position [ID]. When the aggregator decided
for creating new route after reconfiguring back to A, it found bucket pointer
by its ID. However, this pointer was actually pointer to an empty bucket.
This triggered early return from aggregator_bucket_update(), which means that
control flow never reached the point where new route could be exported.
Either way, the empty bucket means that rte_update2() would be called with
wrong arguments and route export would still be unsuccessful.
Igor Putovny [Fri, 28 Feb 2025 12:38:59 +0000 (13:38 +0100)]
Bugfix
When removing prefix from the trie, we need to find the closest IN_FIB
ancestor of the updated node. However, since the updated node may still
have IN_FIB status, we need to check that the target node and updated node
are not the same.
This bug manifested itself in a following way. After running aggregator with
configuation A and reconfiguring it to configuration B, routes from A, which
should have been removed, were still present in the routing table. This was
caused by old prefixes not being removed from the trie.
Because of the missing condition that the updated node and its ancestor are not
the same, trie recalculation was called on prefix nodes which were, in most
cases, leaves. Therefore, trie was not updated at all. All prefixes were still
present in the trie, and thus in the routing table as well.
Igor Putovny [Thu, 27 Feb 2025 15:43:43 +0000 (16:43 +0100)]
Bugfix
Fix aggregator_trie_remove_prefix()
Never change FIB status except in the third pass. FIB status is decided only
by the algorithm and no one else. Never withdraw route except in the third pass.
Again, route exports and withdrawals are solely the algorithm's responsibility.
Keep selected bucket because it will be needed for route withdrawal in the
third pass.
Igor Putovny [Mon, 24 Feb 2025 13:18:48 +0000 (14:18 +0100)]
Bugfix
Do not add potential bucket during deaggregation, this is done in the second
pass now that the first pass is omitted.
Change node status to FILLER if it's not ORIGINAL during deaggregation.
Igor Putovny [Thu, 6 Feb 2025 14:55:02 +0000 (15:55 +0100)]
Do not set IN_FIB status for newly added prefixes
FIB status now truly reflects whether prefix is in export table or not.
Based on the change of FIB status, third pass can now decide whether
the export or route removal is needed.