mirror of
https://github.com/minio/minio.git
synced 2025-03-03 15:20:08 -05:00
Treat 0.0.0.0 as local address in --address flag (#4386)
This commit is contained in:
parent
28c26a9e59
commit
3c5db69ffd
@ -319,7 +319,10 @@ func CheckLocalServerAddr(serverAddr string) error {
|
|||||||
return fmt.Errorf("port number must be between 1 to 65535")
|
return fmt.Errorf("port number must be between 1 to 65535")
|
||||||
}
|
}
|
||||||
|
|
||||||
if host != "" {
|
// 0.0.0.0 is a wildcard address and refers to local network
|
||||||
|
// addresses. I.e, 0.0.0.0:9000 like ":9000" refers to port
|
||||||
|
// 9000 on localhost.
|
||||||
|
if host != "" && host != net.IPv4zero.String() {
|
||||||
isLocalHost, err := isLocalHost(host)
|
isLocalHost, err := isLocalHost(host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -221,6 +221,7 @@ func TestCheckLocalServerAddr(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{":54321", nil},
|
{":54321", nil},
|
||||||
{"localhost:54321", nil},
|
{"localhost:54321", nil},
|
||||||
|
{"0.0.0.0:9000", nil},
|
||||||
{"", fmt.Errorf("missing port in address")},
|
{"", fmt.Errorf("missing port in address")},
|
||||||
{"localhost", fmt.Errorf("missing port in address localhost")},
|
{"localhost", fmt.Errorf("missing port in address localhost")},
|
||||||
{"example.org:54321", fmt.Errorf("host in server address should be this server")},
|
{"example.org:54321", fmt.Errorf("host in server address should be this server")},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user