diff --git a/libnetwork/drivers/bridge/errors.go b/libnetwork/drivers/bridge/errors.go index dc1248ac12..1357ce55e0 100644 --- a/libnetwork/drivers/bridge/errors.go +++ b/libnetwork/drivers/bridge/errors.go @@ -251,13 +251,3 @@ type IPv6AddrNoMatchError net.IPNet func (ipv6 *IPv6AddrNoMatchError) Error() string { return fmt.Sprintf("bridge IPv6 addresses do not match the expected bridge configuration %s", (*net.IPNet)(ipv6).String()) } - -// InvalidLinkIPAddrError is returned when a link is configured to a container with an invalid ip address -type InvalidLinkIPAddrError string - -func (address InvalidLinkIPAddrError) Error() string { - return fmt.Sprintf("Cannot link to a container with Invalid IP Address '%s'", string(address)) -} - -// BadRequest denotes the type of this error -func (address InvalidLinkIPAddrError) BadRequest() {} diff --git a/libnetwork/drivers/bridge/link.go b/libnetwork/drivers/bridge/link.go index 1670e750fb..d56c445f8e 100644 --- a/libnetwork/drivers/bridge/link.go +++ b/libnetwork/drivers/bridge/link.go @@ -68,11 +68,11 @@ func linkContainers(action, parentIP, childIP string, ports []types.TransportPor ip1 := net.ParseIP(parentIP) if ip1 == nil { - return InvalidLinkIPAddrError(parentIP) + return fmt.Errorf("cannot link to a container with an invalid parent IP address %q", parentIP) } ip2 := net.ParseIP(childIP) if ip2 == nil { - return InvalidLinkIPAddrError(childIP) + return fmt.Errorf("cannot link to a container with an invalid child IP address %q", childIP) } chain := iptables.ChainInfo{Name: DockerChain}