git://git.halfball.org
/
cni.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6008de1
)
Check n.IPAM before use it in LoadIPAMConfig function
author
Tang Le
<tangle3@wanda.cn>
Thu, 2 Mar 2017 02:25:19 +0000
(10:25 +0800)
committer
Tang Le
<tangle3@wanda.cn>
Thu, 2 Mar 2017 02:25:19 +0000
(10:25 +0800)
Signed-off-by: Tang Le <tangle3@wanda.cn>
plugins/ipam/host-local/backend/allocator/config.go
patch
|
blob
|
history
diff --git
a/plugins/ipam/host-local/backend/allocator/config.go
b/plugins/ipam/host-local/backend/allocator/config.go
index
d261d0f
..
8c00448
100644
(file)
--- a/
plugins/ipam/host-local/backend/allocator/config.go
+++ b/
plugins/ipam/host-local/backend/allocator/config.go
@@
-54,6
+54,10
@@
func LoadIPAMConfig(bytes []byte, args string) (*IPAMConfig, string, error) {
return nil, "", err
}
+ if n.IPAM == nil {
+ return nil, "", fmt.Errorf("IPAM config missing 'ipam' key")
+ }
+
if args != "" {
n.IPAM.Args = &IPAMArgs{}
err := types.LoadArgs(args, n.IPAM.Args)
@@
-62,10
+66,6
@@
func LoadIPAMConfig(bytes []byte, args string) (*IPAMConfig, string, error) {
}
}
- if n.IPAM == nil {
- return nil, "", fmt.Errorf("IPAM config missing 'ipam' key")
- }
-
// Copy net name into IPAM so not to drag Net struct around
n.IPAM.Name = n.Name