diff options
-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) |