summaryrefslogtreecommitdiff
path: root/bgpd/bgp_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_attr.c')
-rw-r--r--bgpd/bgp_attr.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index cdc99ab3..f48a5438 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -2085,9 +2085,16 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
}
else
{
- aspath = aspath_add_seq (aspath, peer->local_as);
- if (peer->change_local_as)
+ if (peer->change_local_as) {
+ /* If replace-as is specified, we only use the change_local_as when
+ advertising routes. */
+ if( ! CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ) {
+ aspath = aspath_add_seq (aspath, peer->local_as);
+ }
aspath = aspath_add_seq (aspath, peer->change_local_as);
+ } else {
+ aspath = aspath_add_seq (aspath, peer->local_as);
+ }
}
}
else if (peer->sort == BGP_PEER_CONFED)