diff options
Diffstat (limited to 'pkg/server/server.go')
-rw-r--r-- | pkg/server/server.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pkg/server/server.go b/pkg/server/server.go index 249b791c..229f1a8f 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -2417,12 +2417,17 @@ func (s *BgpServer) ListPath(ctx context.Context, r *api.ListPathRequest, fn fun Prefix: dst.GetNlri().String(), Paths: make([]*api.Path, 0, len(dst.GetAllKnownPathList())), } - for i, path := range dst.GetAllKnownPathList() { + knownPathList := dst.GetAllKnownPathList() + for i, path := range knownPathList { p := toPathApi(path, getValidation(v, idx)) idx++ - if i == 0 && !table.SelectionOptions.DisableBestPathSelection { - switch r.TableType { - case api.TableType_LOCAL, api.TableType_GLOBAL: + if !table.SelectionOptions.DisableBestPathSelection { + if i == 0 { + switch r.TableType { + case api.TableType_LOCAL, api.TableType_GLOBAL: + p.Best = true + } + } else if s.bgpConfig.Global.UseMultiplePaths.Config.Enabled && path.Equal(knownPathList[i-1]) { p.Best = true } } |