Fix candidate tier-1 transit detection to stop at failing candidates#12
Merged
Fix candidate tier-1 transit detection to stop at failing candidates#12
Conversation
When a candidate tier-1 (HE/6939, Zayo/6461) is encountered and its next hop is not a true tier-1, stop the search entirely instead of continuing down the path. Previously, the algorithm would skip the failing candidate and find a true tier-1 further along, incorrectly marking all intermediate ASes (including the origin) as customers. Also removes the TIER1/TIER1_V4/TIER1_V6 combined constants and the separate global as2rel pass. Global results are now derived by combining v4 and v6 maps, ensuring consistent behavior across all outputs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TIER1/TIER1_V4/TIER1_V6combined constants and the separate global as2rel pass; global results are now derived by combining v4 and v6 mapsBug
For a path like
13335 → 6939 → 3741 → 3491(origin → collector), the old algorithm would skip 6939 (failing candidate) and continue to find 3491 (true tier-1), then mark13335→6939,6939→3741,3741→3491as customer→provider relationships. This incorrectly classified 13335 as a customer of 6939.The fix returns
Noneimmediately when a candidate is found without a true tier-1 next hop, preventing any relationships from being recorded for that path.Test plan
test_find_transit_point_candidate_blocks_further_search— directly covers the bug scenariotest_he_not_candidate_in_v4— confirms 6939 is not a candidate in IPv4 pathstest_candidate_blocks_when_next_is_candidate_not_true— candidate adjacent to another candidate (not true tier-1) stops search