From 16aaf272083fad59c55b3999372bbce296b95586 Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Wed, 30 Aug 2017 12:51:10 -0700 Subject: [PATCH] Default bind/advertise for segments to BindAddr/AdvertiseAddr --- agent/agent.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index 071bdfd376..fb8e896a1c 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -779,10 +779,19 @@ func (a *Agent) segmentConfig() ([]consul.NetworkSegment, error) { for _, segment := range config.Segments { serfConf := consul.DefaultConfig().SerfLANConfig - serfConf.MemberlistConfig.AdvertiseAddr = segment.Advertise + if segment.Advertise != "" { + serfConf.MemberlistConfig.AdvertiseAddr = segment.Advertise + } else { + serfConf.MemberlistConfig.AdvertiseAddr = a.config.AdvertiseAddr + } + if segment.Bind != "" { + serfConf.MemberlistConfig.BindAddr = segment.Bind + } else { + serfConf.MemberlistConfig.BindAddr = a.config.BindAddr + } serfConf.MemberlistConfig.AdvertisePort = segment.Port - serfConf.MemberlistConfig.BindAddr = segment.Bind serfConf.MemberlistConfig.BindPort = segment.Port + if config.ReconnectTimeoutLan != 0 { serfConf.ReconnectTimeout = config.ReconnectTimeoutLan }