mirror of
https://github.com/moby/moby.git
synced 2026-08-09 01:21:37 +00:00
libnet/d/bridge: Inline InvalidLinkIPAddrError
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
@@ -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() {}
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user