From 07dea89f31e3bcfd5aafee5c5ee9c4bfad636ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Schr=C3=B6der?= Date: Wed, 27 Sep 2017 22:57:55 +0200 Subject: [PATCH] fail early when advertise addr is set to ANY (#3507) --- agent/config/builder.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/agent/config/builder.go b/agent/config/builder.go index d02367b93b..ca9e5694ff 100644 --- a/agent/config/builder.go +++ b/agent/config/builder.go @@ -321,6 +321,12 @@ func (b *Builder) Build() (rt RuntimeConfig, err error) { if !isIPAddr(bindAddrs[0]) { return RuntimeConfig{}, fmt.Errorf("bind_addr must be an ip address") } + if ipaddr.IsAny(b.stringVal(c.AdvertiseAddrLAN)) { + return RuntimeConfig{}, fmt.Errorf("Advertise address cannot be 0.0.0.0, :: or [::]") + } + if ipaddr.IsAny(b.stringVal(c.AdvertiseAddrWAN)) { + return RuntimeConfig{}, fmt.Errorf("Advertise WAN address cannot be 0.0.0.0, :: or [::]") + } bindAddr := bindAddrs[0].(*net.IPAddr) advertiseAddr := b.makeIPAddr(b.expandFirstIP("advertise_addr", c.AdvertiseAddrLAN), bindAddr)