-
Notifications
You must be signed in to change notification settings - Fork 1.4k
bgpd: fix crash in aspath remove/replace chain, add a test for it #19575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fdumontet6WIND
wants to merge
2
commits into
FRRouting:master
Choose a base branch
from
fdumontet6WIND:as_path_crash
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+47
−1
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,7 @@ | |
| from lib import topotest | ||
| from lib.topogen import Topogen, TopoRouter, get_topogen | ||
| from functools import partial | ||
| from lib.topolog import logger | ||
|
|
||
| pytestmark = [pytest.mark.bgpd] | ||
|
|
||
|
|
@@ -389,6 +390,44 @@ def _validate_paths(remove_type): | |
| real_path = adj_rib_in["receivedRoutes"][pfx]["path"] | ||
| return real_path == good_path | ||
|
|
||
| def __no_crash(): | ||
| output = json.loads( | ||
| tgen.gears["r2"].vtysh_cmd( | ||
| "show ip bgp neighbor 203.0.113.0 advertised-routes detail json" | ||
| ) | ||
| ) | ||
| logger.info(output) | ||
| logger.info(output["totalPrefixCounter"]) | ||
| if output["totalPrefixCounter"] != 0: | ||
| return True | ||
| return False | ||
|
|
||
| def _crash_scenario(): | ||
| """add list of command making""" | ||
| tgen = get_topogen() | ||
| tgen.gears["r2"].vtysh_cmd( | ||
| """ | ||
| configure terminal | ||
| route-map OLDCORE-INTERNET-IN-IPv4 permit 5 | ||
| set as-path replace any 65398 | ||
| exit | ||
| route-map OLDCORE-INTERNET-OUT-IPv4 permit 5 | ||
| set as-path replace any 65399 | ||
| exit | ||
| router bgp 65002 | ||
| bgp deterministic-med | ||
| address-family ipv4 unicast | ||
| neighbor 203.0.113.0 remove-private-AS all | ||
| neighbor 203.0.113.0 soft-reconfiguration inbound | ||
| neighbor 203.0.113.0 route-map OLDCORE-INTERNET-IN-IPv4 in | ||
| neighbor 203.0.113.0 route-map OLDCORE-INTERNET-OUT-IPv4 out | ||
| exit-address-family | ||
| """ | ||
| ) | ||
| test_func = partial(__no_crash) | ||
| _, result = topotest.run_and_expect(test_func, True, count=60, wait=0.5) | ||
| assert result == True, "bgpd may has major failure" | ||
|
|
||
| ####################### | ||
| # Begin Test | ||
| ####################### | ||
|
|
@@ -408,6 +447,13 @@ def _validate_paths(remove_type): | |
| # the old flag after each iteration so we only test the flags we expect. | ||
| _change_remove_type(rmv_type, "del") | ||
|
|
||
| # verify that nulled as_path don't make a crash. | ||
| _change_remove_type("remove-private-AS all", "add") | ||
| _crash_scenario() | ||
|
|
||
|
|
||
| exit | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leftovers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Up |
||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| args = ["-s"] + sys.argv[1:] | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe we should release
aspath->segmentsif the length is 0 (if we use replace as / remove as)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that point is pertinent. i will study the impact.