diff --git a/docker/daemon.go b/docker/daemon.go index 6bff0109d2..089eae5464 100644 --- a/docker/daemon.go +++ b/docker/daemon.go @@ -39,12 +39,6 @@ func mainDaemon() { if !daemonCfg.EnableIptables && !daemonCfg.InterContainerCommunication { log.Fatal("You specified --iptables=false with --icc=false. ICC uses iptables to function. Please set --icc or --iptables to true.") } - - // FIXME: move this validation to opts.IpOpt - if daemonCfg.DefaultIp == nil { - log.Fatalf("Specified --ip is not in correct format \"0.0.0.0\".") - } - eng := engine.New() signal.Trap(eng.Shutdown) // Load builtins diff --git a/opts/ip.go b/opts/ip.go index 3610b14538..f0c29750bc 100644 --- a/opts/ip.go +++ b/opts/ip.go @@ -1,6 +1,7 @@ package opts import ( + "fmt" "net" ) @@ -17,8 +18,10 @@ func NewIpOpt(ref *net.IP, defaultVal string) *IpOpt { } func (o *IpOpt) Set(val string) error { - // FIXME: return a parse error if the value is not a valid IP? - // We are not changing this now to preserve behavior while refactoring. + ip := net.ParseIP(val) + if ip == nil { + return fmt.Errorf("incorrect IP format") + } (*o.IP) = net.ParseIP(val) return nil }