Skip to content

Commit

Permalink
Merge pull request FRRouting#16779 from louis-6wind/fix-as-path-exclude
Browse files Browse the repository at this point in the history
bgpd: fix as-path exclude modify crash
  • Loading branch information
ton31337 authored Sep 13, 2024
2 parents 4ab9b85 + 2328d17 commit b916ed3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bgpd/bgp_routemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2357,7 +2357,7 @@ static void route_aspath_exclude_free(void *rule)
if (ase->exclude_aspath_acl) {
acl = ase->exclude_aspath_acl;
as_list_list_del(&acl->exclude_rule, ase);
} else {
} else if (ase->exclude_aspath_acl_name) {
/* no ref to acl, this aspath exclude is orphan */
as_exclude_remove_orphan(ase);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_bgp_set_aspath_exclude():
pytest.skip(tgen.errors)

test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_1)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)

assert result is None, "Failed overriding incoming AS-PATH with route-map"

Expand All @@ -128,7 +128,6 @@ def test_bgp_set_aspath_exclude_access_list():
conf
bgp as-path access-list FIRST permit ^65
route-map r2 permit 6
no set as-path exclude as-path-access-list SECOND
set as-path exclude as-path-access-list FIRST
"""
)
Expand All @@ -140,21 +139,20 @@ def test_bgp_set_aspath_exclude_access_list():
)

test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_2)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)

assert result is None, "Failed change of exclude rule in route map"
r1.vtysh_cmd(
"""
conf
route-map r2 permit 6
no set as-path exclude as-path-access-list FIRST
set as-path exclude as-path-access-list SECOND
"""
)

# tgen.mininet_cli()
test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_1)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)

assert result is None, "Failed reverting exclude rule in route map"

Expand Down Expand Up @@ -182,7 +180,7 @@ def test_no_bgp_set_aspath_exclude_access_list():
)

test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_3)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)

assert result is None, "Failed to removing current accesslist"

Expand All @@ -200,15 +198,15 @@ def test_no_bgp_set_aspath_exclude_access_list():
)

test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_4)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)

assert result is None, "Failed to renegotiate with peers 2"

r1.vtysh_cmd(
"""
conf
route-map r2 permit 6
no set as-path exclude as-path-access-list SECOND
set as-path exclude 65555
"""
)

Expand All @@ -219,7 +217,26 @@ def test_no_bgp_set_aspath_exclude_access_list():
)

test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_3)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)

assert result is None, "Failed to renegotiate with peers 2"

r1.vtysh_cmd(
"""
conf
route-map r2 permit 6
set as-path exclude as-path-access-list NON-EXISTING
"""
)

r1.vtysh_cmd(
"""
clear bgp *
"""
)

test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_3)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)

assert result is None, "Failed to renegotiate with peers 2"

Expand Down

0 comments on commit b916ed3

Please sign in to comment.