Skip to content

Commit

Permalink
Fix ListPath for ADJ_IN and EnableFiltered=true and add tests.
Browse files Browse the repository at this point in the history
Currently, even though `ApplyPolicy` is called for determining the
accepted routes after apply policy, the new route with attribute
modifications is not returned. This is problematic for gRPC API users.

Tests are added for all four cases that were described in
#2765. This PR makes the behaviour
correct for "Case/Attempt 2" described in the issue.
  • Loading branch information
wenovus committed Mar 15, 2024
1 parent 9d05544 commit 829bbcf
Show file tree
Hide file tree
Showing 2 changed files with 266 additions and 52 deletions.
4 changes: 3 additions & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2627,8 +2627,10 @@ func (s *BgpServer) getAdjRib(addr string, family bgp.RouteFamily, in bool, enab
options := &table.PolicyOptions{
Validate: s.roaTable.Validate,
}
if s.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_IMPORT, path, options) == nil {
if p := s.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_IMPORT, path, options); p == nil {
filtered[path.GetNlri().String()] = path
} else {
adjRib.Update([]*table.Path{p})
}
}
}
Expand Down
Loading

0 comments on commit 829bbcf

Please sign in to comment.