From 3c377d437d9380111fb61bd0dc441eaf4e2c5209 Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Thu, 2 Jun 2016 15:48:31 +0000 Subject: server: fix another regression of active connection Another regression introduced by 4c9cd88c61cb848e36a45657b7cbc63b9c783dc4 Previous fix (81bc3851b2c1f112f157b98a3cf60757a199a31a) fixes active connection of neighbors configured via configuration file. This fixes that of neighbors configured via gRPC API. Test is also added. Signed-off-by: ISHIDA Wataru --- server/server.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'server') diff --git a/server/server.go b/server/server.go index 77c6d8fb..7efc3686 100644 --- a/server/server.go +++ b/server/server.go @@ -2652,6 +2652,12 @@ func (server *BgpServer) handleAddNeighborRequest(grpcReq *GrpcRequest) ([]*Send if a.Transport != nil { pconf.Transport.Config.LocalAddress = a.Transport.LocalAddress pconf.Transport.Config.PassiveMode = a.Transport.PassiveMode + } else { + if net.ParseIP(a.Conf.NeighborAddress).To4() != nil { + pconf.Transport.Config.LocalAddress = "0.0.0.0" + } else { + pconf.Transport.Config.LocalAddress = "::" + } } if a.EbgpMultihop != nil { pconf.EbgpMultihop.Config.Enabled = a.EbgpMultihop.Enabled -- cgit v1.2.3