Signed-off-by: Solomon Hykes <solomon@docker.com>
Solomon Hykes authored on 2014/08/10 12:50:46... | ... |
@@ -39,12 +39,6 @@ func mainDaemon() { |
39 | 39 |
if !daemonCfg.EnableIptables && !daemonCfg.InterContainerCommunication { |
40 | 40 |
log.Fatal("You specified --iptables=false with --icc=false. ICC uses iptables to function. Please set --icc or --iptables to true.") |
41 | 41 |
} |
42 |
- |
|
43 |
- // FIXME: move this validation to opts.IpOpt |
|
44 |
- if daemonCfg.DefaultIp == nil { |
|
45 |
- log.Fatalf("Specified --ip is not in correct format \"0.0.0.0\".") |
|
46 |
- } |
|
47 |
- |
|
48 | 42 |
eng := engine.New() |
49 | 43 |
signal.Trap(eng.Shutdown) |
50 | 44 |
// Load builtins |
... | ... |
@@ -1,6 +1,7 @@ |
1 | 1 |
package opts |
2 | 2 |
|
3 | 3 |
import ( |
4 |
+ "fmt" |
|
4 | 5 |
"net" |
5 | 6 |
) |
6 | 7 |
|
... | ... |
@@ -17,8 +18,10 @@ func NewIpOpt(ref *net.IP, defaultVal string) *IpOpt { |
17 | 17 |
} |
18 | 18 |
|
19 | 19 |
func (o *IpOpt) Set(val string) error { |
20 |
- // FIXME: return a parse error if the value is not a valid IP? |
|
21 |
- // We are not changing this now to preserve behavior while refactoring. |
|
20 |
+ ip := net.ParseIP(val) |
|
21 |
+ if ip == nil { |
|
22 |
+ return fmt.Errorf("incorrect IP format") |
|
23 |
+ } |
|
22 | 24 |
(*o.IP) = net.ParseIP(val) |
23 | 25 |
return nil |
24 | 26 |
} |