diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-08-13 12:15:10 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-08-13 20:15:54 +0900 |
commit | 56ca9eee5fddd618878b076c8f70a5b495c4ce27 (patch) | |
tree | 4362bfe62da378773abaf4120aad69bc221f6cb0 /server/server.go | |
parent | af0c03bbec611fca01374eb47da6b8524023b78f (diff) |
api/cli: reuse api.Path in ModPathArguments
kill redundant lines
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/server/server.go b/server/server.go index 4c202209..e365790c 100644 --- a/server/server.go +++ b/server/server.go @@ -846,23 +846,25 @@ func (server *BgpServer) handleModPathRequest(grpcReq *GrpcRequest, peerInfo *ta extcomms := make([]bgp.ExtendedCommunityInterface, 0) var nexthop string var rf bgp.RouteFamily + var path *api.Path arg, ok := grpcReq.Data.(*api.ModPathArguments) if !ok { result.ResponseErr = fmt.Errorf("type assertion failed") goto ERR } + path = arg.Path - if len(arg.RawNlri) > 0 { + if len(path.Nlri) > 0 { nlri = &bgp.NLRInfo{} - err := nlri.DecodeFromBytes(arg.RawNlri) + err := nlri.DecodeFromBytes(path.Nlri) if err != nil { result.ResponseErr = err goto ERR } } - for _, attr := range arg.RawPattrs { + for _, attr := range path.Pattrs { p, err := bgp.GetPathAttribute(attr) if err != nil { result.ResponseErr = err @@ -956,7 +958,7 @@ func (server *BgpServer) handleModPathRequest(grpcReq *GrpcRequest, peerInfo *ta pattr = append(pattr, bgp.NewPathAttributeExtendedCommunities(extcomms)) } - return []*table.Path{table.NewPath(peerInfo, nlri, arg.IsWithdraw, pattr, false, time.Now(), arg.NoImplicitWithdraw)} + return []*table.Path{table.NewPath(peerInfo, nlri, path.IsWithdraw, pattr, false, time.Now(), path.NoImplicitWithdraw)} ERR: grpcReq.ResponseCh <- result close(grpcReq.ResponseCh) |