summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-06-02 15:48:31 +0000
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-06-02 15:48:31 +0000
commit3c377d437d9380111fb61bd0dc441eaf4e2c5209 (patch)
tree0d2db8803c8c5e6722671a0b487fad73c9af0df9 /server
parent81bc3851b2c1f112f157b98a3cf60757a199a31a (diff)
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 <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r--server/server.go6
1 files changed, 6 insertions, 0 deletions
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