diff options
Diffstat (limited to 'internal/pkg/table/table_manager.go')
-rw-r--r-- | internal/pkg/table/table_manager.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/internal/pkg/table/table_manager.go b/internal/pkg/table/table_manager.go index e10f4d6a..2640f622 100644 --- a/internal/pkg/table/table_manager.go +++ b/internal/pkg/table/table_manager.go @@ -21,10 +21,10 @@ import ( "net" "time" - "github.com/osrg/gobgp/pkg/packet/bgp" - farm "github.com/dgryski/go-farm" log "github.com/sirupsen/logrus" + + "github.com/osrg/gobgp/pkg/packet/bgp" ) const ( @@ -335,6 +335,20 @@ func (manager *TableManager) GetPathListWithNexthop(id string, rfList []bgp.Rout return paths } +func (manager *TableManager) GetPathListWithSource(id string, rfList []bgp.RouteFamily, source *PeerInfo) []*Path { + paths := make([]*Path, 0, manager.getDestinationCount(rfList)) + for _, rf := range rfList { + if t, ok := manager.Tables[rf]; ok { + for _, path := range t.GetKnownPathList(id, 0) { + if path.GetSource().Equal(source) { + paths = append(paths, path) + } + } + } + } + return paths +} + func (manager *TableManager) GetDestination(path *Path) *Destination { if path == nil { return nil |