diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-06-01 17:37:58 +0000 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-06-01 17:37:58 +0000 |
commit | 81bc3851b2c1f112f157b98a3cf60757a199a31a (patch) | |
tree | f08d47343c287a345001207425c27acc99dfe65e /server/server.go | |
parent | addc3902e85959e525a6e577de174dc1229551ac (diff) |
server: fix active connection regression
regression introduced by 4c9cd88c61cb848e36a45657b7cbc63b9c783dc4
also fix test/lib to test configuration without local-address
(configure local-address only if neighbor-address is IPv6)
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, 5 insertions, 5 deletions
diff --git a/server/server.go b/server/server.go index b9c6351d..77c6d8fb 100644 --- a/server/server.go +++ b/server/server.go @@ -270,8 +270,8 @@ func (server *BgpServer) Serve() { conn.Close() return } - localAddrValid := func(laddr net.IP) bool { - if laddr == nil { + localAddrValid := func(laddr string) bool { + if laddr == "0.0.0.0" || laddr == "::" { return true } l := conn.LocalAddr() @@ -281,17 +281,17 @@ func (server *BgpServer) Serve() { } host, _, _ := net.SplitHostPort(l.String()) - if host != laddr.String() { + if host != laddr { log.WithFields(log.Fields{ "Topic": "Peer", "Key": remoteAddr, - "Configured addr": laddr.String(), + "Configured addr": laddr, "Addr": host, }).Info("Mismatched local address") return false } return true - }(net.ParseIP(peer.fsm.pConf.Transport.Config.LocalAddress)) + }(peer.fsm.pConf.Transport.Config.LocalAddress) if localAddrValid == false { conn.Close() return |