| 704 | } |
| 705 | |
| 706 | func (s *BgpServer) filterpath(peer *peer, path, old *table.Path) *table.Path { |
| 707 | path, options, stop := s.prePolicyFilterpath(peer, path, old) |
| 708 | if stop { |
| 709 | return nil |
| 710 | } |
| 711 | options.Validate = s.roaTable.Validate |
| 712 | path = peer.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_EXPORT, path, options) |
| 713 | // When 'path' is filtered (path == nil), check 'old' has been sent to this peer. |
| 714 | // If it has, send withdrawal to the peer. |
| 715 | if path == nil && old != nil { |
| 716 | o := peer.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_EXPORT, old, options) |
| 717 | if o != nil { |
| 718 | path = old.Clone(true) |
| 719 | } |
| 720 | } |
| 721 | |
| 722 | return s.postFilterpath(peer, path) |
| 723 | } |
| 724 | |
| 725 | func clonePathList(pathList []*table.Path) []*table.Path { |
| 726 | l := make([]*table.Path, 0, len(pathList)) |