diff options
-rw-r--r-- | server/server.go | 10 | ||||
-rw-r--r-- | test/lib/gobgp.py | 7 |
2 files changed, 9 insertions, 8 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 diff --git a/test/lib/gobgp.py b/test/lib/gobgp.py index 0f86f388..cf72b721 100644 --- a/test/lib/gobgp.py +++ b/test/lib/gobgp.py @@ -268,11 +268,12 @@ class GoBGPContainer(BGPContainer): 'timers': {'config': { 'connect-retry': 10, }}, - 'transport': {'config': { - 'local-address': info['local_addr'].split('/')[0], - }}, + 'transport': {'config': {}}, } + if ':' in info['local_addr']: + n['transport']['config']['local-address'] = info['local_addr'].split('/')[0] + if info['passive']: n['transport']['config']['passive-mode'] = True |