daemon: Validate MacAddress on container create
This was previously checked only on ContainerStart. Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
parent
ee9f0ed895
commit
61c78d9438
1 changed files with 7 additions and 0 deletions
|
@ -612,6 +612,13 @@ func validateEndpointSettings(nw *libnetwork.Network, nwName string, epConfig *n
|
|||
}
|
||||
}
|
||||
|
||||
if epConfig.MacAddress != "" {
|
||||
_, err := net.ParseMAC(epConfig.MacAddress)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid MAC address %s", epConfig.MacAddress)
|
||||
}
|
||||
}
|
||||
|
||||
if err := multierror.Join(errs...); err != nil {
|
||||
return fmt.Errorf("invalid endpoint settings:\n%w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue