diff options
author | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-03-29 12:50:10 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-03-29 14:00:13 +0900 |
commit | 49448ac67d61bf769e0b443a4dccd9972ebae117 (patch) | |
tree | 1c4e3368e103fdda90f36193eab053bba3416d51 | |
parent | 8ee5f62074c63d82eed8082102737f7a4a3d4080 (diff) |
server: fix ListPath handle UseMultiPath option
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
-rw-r--r-- | cmd/gobgp/neighbor.go | 2 | ||||
-rw-r--r-- | pkg/server/server.go | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/cmd/gobgp/neighbor.go b/cmd/gobgp/neighbor.go index fbb7b52d..9acb4f18 100644 --- a/cmd/gobgp/neighbor.go +++ b/cmd/gobgp/neighbor.go @@ -496,7 +496,7 @@ func getPathSymbolString(p *api.Path, idx int, showBest bool) string { } if showBest { - if idx == 0 && !p.IsNexthopInvalid { + if p.Best && !p.IsNexthopInvalid { symbols += "*>" } else { symbols += "* " 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 } } |