libnet/d/bridge: Inline InvalidIPTablesCfgError

This error can only be reached because of an error in our code, so it's
not a "bad user request". As it's never type asserted, no need to keep
it around.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
Albin Kerouanton 2023-07-31 11:10:28 +02:00
parent d8f42ee21a
commit 7c13985fa1
No known key found for this signature in database
GPG key ID: 630B8E1DCBDB1864
2 changed files with 1 additions and 11 deletions

View file

@ -209,16 +209,6 @@ func (fcv6 *FixedCIDRv6Error) Error() string {
// InternalError denotes the type of this error // InternalError denotes the type of this error
func (fcv6 *FixedCIDRv6Error) InternalError() {} func (fcv6 *FixedCIDRv6Error) InternalError() {}
// InvalidIPTablesCfgError is returned when an invalid ip tables configuration is entered
type InvalidIPTablesCfgError string
func (action InvalidIPTablesCfgError) Error() string {
return fmt.Sprintf("Invalid IPTables action '%s'", string(action))
}
// Internal denotes the type of this error
func (action InvalidIPTablesCfgError) Internal() {}
// IPv4AddrAddError is returned when IPv4 address could not be added to the bridge. // IPv4AddrAddError is returned when IPv4 address could not be added to the bridge.
type IPv4AddrAddError struct { type IPv4AddrAddError struct {
IP *net.IPNet IP *net.IPNet

View file

@ -63,7 +63,7 @@ func linkContainers(action, parentIP, childIP string, ports []types.TransportPor
case "-D": case "-D":
nfAction = iptables.Delete nfAction = iptables.Delete
default: default:
return InvalidIPTablesCfgError(action) return fmt.Errorf("invalid iptables action: %s", action)
} }
ip1 := net.ParseIP(parentIP) ip1 := net.ParseIP(parentIP)