diff --git a/command/agent/command.go b/command/agent/command.go index 0db0f0b16..4326ab430 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -361,13 +361,13 @@ func (c *Command) readConfig() *Config { return nil } - if config.AdvertiseAddr == "0.0.0.0" { - c.UI.Error("Advertise address cannot be 0.0.0.0") + if config.AdvertiseAddr == "0.0.0.0" || config.AdvertiseAddr == "::" || config.AdvertiseAddr == "[::]" { + c.UI.Error("Advertise address cannot be " + config.AdvertiseAddr) return nil } - if config.AdvertiseAddrWan == "0.0.0.0" { - c.UI.Error("Advertise WAN address cannot be 0.0.0.0") + if config.AdvertiseAddrWan == "0.0.0.0" || config.AdvertiseAddrWan == "::" || config.AdvertiseAddrWan == "[::]" { + c.UI.Error("Advertise WAN address cannot be " + config.AdvertiseAddrWan) return nil } diff --git a/command/agent/command_test.go b/command/agent/command_test.go index cd4cfb2f9..676df6b19 100644 --- a/command/agent/command_test.go +++ b/command/agent/command_test.go @@ -61,10 +61,26 @@ func TestConfigFail(t *testing.T) { args: []string{"agent", "-server", "-data-dir", "foo", "-advertise", "0.0.0.0"}, out: "==> Advertise address cannot be 0.0.0.0\n", }, + { + args: []string{"agent", "-server", "-data-dir", "foo", "-advertise", "::"}, + out: "==> Advertise address cannot be ::\n", + }, + { + args: []string{"agent", "-server", "-data-dir", "foo", "-advertise", "[::]"}, + out: "==> Advertise address cannot be [::]\n", + }, { args: []string{"agent", "-server", "-data-dir", "foo", "-advertise-wan", "0.0.0.0"}, out: "==> Advertise WAN address cannot be 0.0.0.0\n", }, + { + args: []string{"agent", "-server", "-data-dir", "foo", "-advertise-wan", "::"}, + out: "==> Advertise WAN address cannot be ::\n", + }, + { + args: []string{"agent", "-server", "-data-dir", "foo", "-advertise-wan", "[::]"}, + out: "==> Advertise WAN address cannot be [::]\n", + }, } for _, tt := range tests {