diff options
-rw-r--r-- | cmd/gobgp/monitor.go | 6 | ||||
-rw-r--r-- | pkg/packet/bgp/bgp.go | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/cmd/gobgp/monitor.go b/cmd/gobgp/monitor.go index bc31bde9..52e1c3b4 100644 --- a/cmd/gobgp/monitor.go +++ b/cmd/gobgp/monitor.go @@ -74,10 +74,10 @@ func makeMonitorRouteArgs(p *api.Path, showIdentifier bgp.BGPAddPathMode) []inte } func monitorRoute(pathList []*api.Path, showIdentifier bgp.BGPAddPathMode) { - var pathStrs [][]interface{} + pathStrs := make([][]interface{}, len(pathList)) - for _, p := range pathList { - pathStrs = append(pathStrs, makeMonitorRouteArgs(p, showIdentifier)) + for i, p := range pathList { + pathStrs[i] = makeMonitorRouteArgs(p, showIdentifier) } format := time.Now().UTC().Format(time.RFC3339) diff --git a/pkg/packet/bgp/bgp.go b/pkg/packet/bgp/bgp.go index c55c4681..5112e7ae 100644 --- a/pkg/packet/bgp/bgp.go +++ b/pkg/packet/bgp/bgp.go @@ -2384,7 +2384,7 @@ func (er *EVPNEthernetAutoDiscoveryRoute) Len() int { func (er *EVPNEthernetAutoDiscoveryRoute) DecodeFromBytes(data []byte) error { er.RD = GetRouteDistinguisher(data) rdLen := er.RD.Len() - if len(data) < rdLen + 14 { // 14 is 10 for + if len(data) < rdLen+14 { // 14 is 10 for return NewMessageError(BGP_ERROR_UPDATE_MESSAGE_ERROR, BGP_ERROR_SUB_MALFORMED_ATTRIBUTE_LIST, nil, "bad Ethernet Auto-discovery Route length") } data = data[er.RD.Len():] @@ -2644,7 +2644,7 @@ func (er *EVPNMulticastEthernetTagRoute) Len() int { func (er *EVPNMulticastEthernetTagRoute) DecodeFromBytes(data []byte) error { er.RD = GetRouteDistinguisher(data) rdLen := er.RD.Len() - if len(data) < rdLen + 4 { + if len(data) < rdLen+4 { return NewMessageError(BGP_ERROR_UPDATE_MESSAGE_ERROR, BGP_ERROR_SUB_MALFORMED_ATTRIBUTE_LIST, nil, "invalid length of multicast ethernet tag route") } data = data[er.RD.Len():] |