Skip to content
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

bgpd: Allow aspath prepending for default-originate with route-maps #8860

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bgpd/bgp_updgrp_adv.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
struct bgp_path_info_extra tmp_pie;

tmp_attr = *pi->attr;
tmp_attr.aspath = attr.aspath;

prep_for_rmap_apply(&tmp_pi, &tmp_pie, dest, pi,
pi->peer, &tmp_attr);
Expand All @@ -842,7 +843,6 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
continue;
} else {
new_attr = bgp_attr_intern(&tmp_attr);
new_attr->aspath = attr.aspath;

subgroup_announce_reset_nhop(
(peer_cap_enhe(peer, afi, safi)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ bgp community-list standard default seq 5 permit 65000:1
route-map default permit 10
match community default
set metric 123
set as-path prepend 65000 65000 65000
!
route-map internal permit 10
set community 65000:1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def _bgp_converge(router):

def _bgp_default_route_has_metric(router):
output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json"))
expected = {"paths": [{"metric": 123}]}
expected = {
"paths": [{"aspath": {"string": "65000 65000 65000 65000"}, "metric": 123}]
}
return topotest.json_cmp(output, expected)

test_func = functools.partial(_bgp_converge, router)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ router bgp 65000
!
route-map default permit 10
set metric 123
set as-path prepend 65000 65000 65000
!
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ def _bgp_converge(router):

def _bgp_default_route_has_metric(router):
output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json"))
expected = {"paths": [{"metric": 123}]}
expected = {
"paths": [{"aspath": {"string": "65000 65000 65000 65000"}, "metric": 123}]
}
return topotest.json_cmp(output, expected)

test_func = functools.partial(_bgp_converge, router)
Expand Down