mirror of
https://github.com/moby/moby.git
synced 2025-12-10 21:42:47 +03:00
opts.IPVal returns an error on incorrect input
Signed-off-by: Solomon Hykes <solomon@docker.com>
This commit is contained in:
@@ -39,12 +39,6 @@ func mainDaemon() {
|
|||||||
if !daemonCfg.EnableIptables && !daemonCfg.InterContainerCommunication {
|
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.")
|
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()
|
eng := engine.New()
|
||||||
signal.Trap(eng.Shutdown)
|
signal.Trap(eng.Shutdown)
|
||||||
// Load builtins
|
// Load builtins
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package opts
|
package opts
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -17,8 +18,10 @@ func NewIpOpt(ref *net.IP, defaultVal string) *IpOpt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o *IpOpt) Set(val string) error {
|
func (o *IpOpt) Set(val string) error {
|
||||||
// FIXME: return a parse error if the value is not a valid IP?
|
ip := net.ParseIP(val)
|
||||||
// We are not changing this now to preserve behavior while refactoring.
|
if ip == nil {
|
||||||
|
return fmt.Errorf("incorrect IP format")
|
||||||
|
}
|
||||||
(*o.IP) = net.ParseIP(val)
|
(*o.IP) = net.ParseIP(val)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user