MCPcopy
hub / github.com/osrg/gobgp / filterpath

Method filterpath

pkg/server/server.go:706–723  ·  view source on GitHub ↗
(peer *peer, path, old *table.Path)

Source from the content-addressed store, hash-verified

704}
705
706func (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
725func clonePathList(pathList []*table.Path) []*table.Path {
726 l := make([]*table.Path, 0, len(pathList))

Calls 5

prePolicyFilterpathMethod · 0.95
postFilterpathMethod · 0.95
ApplyPolicyMethod · 0.80
TableIDMethod · 0.80
CloneMethod · 0.45

Tested by 1