Skip to content

Commit

Permalink
bgp: implement the "disable-peer-as-filter" configuration option
Browse files Browse the repository at this point in the history
This option, "disable-peer-as-filter", is disabled by default,
which means route suppression based on the AS_PATH will occur unless
explicitly disabled by configuration.

Signed-off-by: Renato Westphal <[email protected]>
  • Loading branch information
rwestphal committed Feb 22, 2024
1 parent 6932977 commit 0998877
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions holo-bgp/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,14 @@ pub(crate) fn advertise_routes<A>(
// Create an iterator over the best routes, filtering out routes that
// should not be redistributed to this neighbor.
let routes = routes.iter().filter(|(_, route)| {
// Suppress advertisements to peers if their AS number is present
// in the AS path of the route, unless overridden by configuration.
if !nbr.config.as_path_options.disable_peer_as_filter
&& route.attrs.base.value.as_path.contains(nbr.config.peer_as)
{
return false;
}

// RFC 4271 - Section 9.2:
// "When a BGP speaker receives an UPDATE message from an internal
// peer, the receiving BGP speaker SHALL NOT re-distribute the
Expand Down

0 comments on commit 0998877

Please sign in to comment.