summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2018-01-12 14:18:00 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-01-24 08:18:50 +0900
commit549b7037381ec51d0c5b9a0abbe8f73000fda70c (patch)
tree40ed8a74f1b75990071b79e363e331887e7db51e /server
parentb391322bcbf56d623ca0a6b667c026b92f1e9e4d (diff)
*: Use strconv.ParseUint instead of strconv.Atoi()
For the 32-bit platform compatibility. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'server')
-rw-r--r--server/fsm.go18
-rw-r--r--server/rpki.go9
-rw-r--r--server/zclient.go12
3 files changed, 23 insertions, 16 deletions
diff --git a/server/fsm.go b/server/fsm.go
index c3c2910e..9db3a552 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -17,19 +17,21 @@ package server
import (
"fmt"
- "github.com/eapache/channels"
- "github.com/osrg/gobgp/config"
- "github.com/osrg/gobgp/packet/bgp"
- "github.com/osrg/gobgp/packet/bmp"
- "github.com/osrg/gobgp/table"
- log "github.com/sirupsen/logrus"
- "gopkg.in/tomb.v2"
"io"
"math/rand"
"net"
"strconv"
"strings"
"time"
+
+ "github.com/eapache/channels"
+ log "github.com/sirupsen/logrus"
+ "gopkg.in/tomb.v2"
+
+ "github.com/osrg/gobgp/config"
+ "github.com/osrg/gobgp/packet/bgp"
+ "github.com/osrg/gobgp/packet/bmp"
+ "github.com/osrg/gobgp/table"
)
type FsmStateReason string
@@ -272,7 +274,7 @@ func hostport(addr net.Addr) (string, uint16) {
if err != nil {
return "", 0
}
- p, _ := strconv.Atoi(port)
+ p, _ := strconv.ParseUint(port, 10, 16)
return host, uint16(p)
}
return "", 0
diff --git a/server/rpki.go b/server/rpki.go
index b6aec254..8f286930 100644
--- a/server/rpki.go
+++ b/server/rpki.go
@@ -25,12 +25,13 @@ import (
"time"
"github.com/armon/go-radix"
+ log "github.com/sirupsen/logrus"
+ "golang.org/x/net/context"
+
"github.com/osrg/gobgp/config"
"github.com/osrg/gobgp/packet/bgp"
"github.com/osrg/gobgp/packet/rtr"
"github.com/osrg/gobgp/table"
- log "github.com/sirupsen/logrus"
- "golang.org/x/net/context"
)
const (
@@ -453,7 +454,9 @@ func (c *roaManager) GetServers() []*config.RpkiServer {
l = append(l, &config.RpkiServer{
Config: config.RpkiServerConfig{
Address: addr,
- Port: func() uint32 { p, _ := strconv.Atoi(port); return uint32(p) }(),
+ // Note: RpkiServerConfig.Port is uint32 type, but the TCP/UDP
+ // port is 16-bit length.
+ Port: func() uint32 { p, _ := strconv.ParseUint(port, 10, 16); return uint32(p) }(),
},
State: client.state,
})
diff --git a/server/zclient.go b/server/zclient.go
index 46cab1a1..2e2c0187 100644
--- a/server/zclient.go
+++ b/server/zclient.go
@@ -17,15 +17,17 @@ package server
import (
"fmt"
- "github.com/osrg/gobgp/packet/bgp"
- "github.com/osrg/gobgp/table"
- "github.com/osrg/gobgp/zebra"
- log "github.com/sirupsen/logrus"
"net"
"strconv"
"strings"
"syscall"
"time"
+
+ log "github.com/sirupsen/logrus"
+
+ "github.com/osrg/gobgp/packet/bgp"
+ "github.com/osrg/gobgp/table"
+ "github.com/osrg/gobgp/zebra"
)
type pathList []*table.Path
@@ -249,7 +251,7 @@ func newIPRouteBody(dst pathList) (body *zebra.IPRouteBody, isWithdraw bool) {
return nil, false
}
msgFlags := zebra.MESSAGE_NEXTHOP
- plen, _ := strconv.Atoi(l[1])
+ plen, _ := strconv.ParseUint(l[1], 10, 8)
med, err := path.GetMed()
if err == nil {
msgFlags |= zebra.MESSAGE_METRIC