Skip to content

Commit

Permalink
Merge pull request #2411 from lemrouch/2410-fix
Browse files Browse the repository at this point in the history
Macvlan network handles netlabel.Internal wrong
  • Loading branch information
selansen authored Jul 15, 2019
2 parents 14f9d75 + 15d891c commit 4f86de7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions drivers/ipvlan/ipvlan_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,12 @@ func parseNetworkOptions(id string, option options.Generic) (*configuration, err
}
}
// setting the parent to "" will trigger an isolated network dummy parent link
if _, ok := option[netlabel.Internal]; ok {
config.Internal = true
// empty --parent= and --internal are handled the same.
config.Parent = ""
if val, ok := option[netlabel.Internal]; ok {
if internal, ok := val.(bool); ok && internal {
config.Internal = true
// empty --parent= and --internal are handled the same.
config.Parent = ""
}
}
return config, nil
}
Expand Down
10 changes: 6 additions & 4 deletions drivers/macvlan/macvlan_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ func parseNetworkOptions(id string, option options.Generic) (*configuration, err
}
}
// setting the parent to "" will trigger an isolated network dummy parent link
if _, ok := option[netlabel.Internal]; ok {
config.Internal = true
// empty --parent= and --internal are handled the same.
config.Parent = ""
if val, ok := option[netlabel.Internal]; ok {
if internal, ok := val.(bool); ok && internal {
config.Internal = true
// empty --parent= and --internal are handled the same.
config.Parent = ""
}
}

return config, nil
Expand Down

0 comments on commit 4f86de7

Please sign in to comment.