diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2019-02-14 13:35:44 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-02-16 19:19:01 +0900 |
commit | aaa71b1bf45d077569fb8ff3412d9fa43bcf91d0 (patch) | |
tree | 817e5a86e864a57b422cda6357e98758dbb078c1 /cmd | |
parent | 483a0b6e7dd15e48b0fbfeeba4249fcc0ecda22a (diff) |
cmd/gobgp: fix policy printing
make policy printing same with v1.x
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gobgp/neighbor.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd/gobgp/neighbor.go b/cmd/gobgp/neighbor.go index 106d53be..9226e4e2 100644 --- a/cmd/gobgp/neighbor.go +++ b/cmd/gobgp/neighbor.go @@ -1042,7 +1042,6 @@ func stateChangeNeighbor(cmd string, remoteIP string, args []string) error { } func showNeighborPolicy(remoteIP, policyType string, indent int) error { - var assignment *api.PolicyAssignment var err error var dir api.PolicyDirection @@ -1064,11 +1063,13 @@ func showNeighborPolicy(remoteIP, policyType string, indent int) error { if err != nil { return err } + assignment := &api.PolicyAssignment{} r, err := stream.Recv() - if err != nil { + if err == nil { + assignment = r.Assignment + } else if err != io.EOF { return err } - assignment = r.Assignment if globalOpts.Json { j, _ := json.Marshal(assignment) |