Skip to content

Commit

Permalink
daemon: Validate MacAddress on container create
Browse files Browse the repository at this point in the history
This was previously checked only on ContainerStart.

Signed-off-by: Albin Kerouanton <[email protected]>
  • Loading branch information
akerouanton committed Oct 25, 2023
1 parent ee9f0ed commit 61c78d9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions daemon/container_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 61c78d9

Please sign in to comment.