libnet/d/bridge: Inline IPTableCfgError
This error is only used in defensive checks whereas the precondition is already checked by caller. If we reach it, we messed something else. So it's definitely not a BadRequest. Also, it's not type asserted anywhere, so just inline it. Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
parent
6d37ab0a83
commit
d8f42ee21a
2 changed files with 7 additions and 13 deletions
|
@ -209,16 +209,6 @@ func (fcv6 *FixedCIDRv6Error) Error() string {
|
|||
// InternalError denotes the type of this error
|
||||
func (fcv6 *FixedCIDRv6Error) InternalError() {}
|
||||
|
||||
// IPTableCfgError is returned when an unexpected ip tables configuration is entered
|
||||
type IPTableCfgError string
|
||||
|
||||
func (name IPTableCfgError) Error() string {
|
||||
return fmt.Sprintf("unexpected request to set IP tables for interface: %s", string(name))
|
||||
}
|
||||
|
||||
// BadRequest denotes the type of this error
|
||||
func (name IPTableCfgError) BadRequest() {}
|
||||
|
||||
// InvalidIPTablesCfgError is returned when an invalid ip tables configuration is entered
|
||||
type InvalidIPTablesCfgError string
|
||||
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
|
||||
package bridge
|
||||
|
||||
import "github.com/docker/docker/libnetwork/iptables"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/docker/docker/libnetwork/iptables"
|
||||
)
|
||||
|
||||
func (n *bridgeNetwork) setupFirewalld(config *networkConfiguration, i *bridgeInterface) error {
|
||||
d := n.driver
|
||||
|
@ -12,7 +16,7 @@ func (n *bridgeNetwork) setupFirewalld(config *networkConfiguration, i *bridgeIn
|
|||
|
||||
// Sanity check.
|
||||
if !driverConfig.EnableIPTables {
|
||||
return IPTableCfgError(config.BridgeName)
|
||||
return errors.New("no need to register firewalld hooks, iptables is disabled")
|
||||
}
|
||||
|
||||
iptables.OnReloaded(func() { n.setupIP4Tables(config, i) })
|
||||
|
@ -28,7 +32,7 @@ func (n *bridgeNetwork) setupFirewalld6(config *networkConfiguration, i *bridgeI
|
|||
|
||||
// Sanity check.
|
||||
if !driverConfig.EnableIP6Tables {
|
||||
return IPTableCfgError(config.BridgeName)
|
||||
return errors.New("no need to register firewalld hooks, ip6tables is disabled")
|
||||
}
|
||||
|
||||
iptables.OnReloaded(func() { n.setupIP6Tables(config, i) })
|
||||
|
|
Loading…
Add table
Reference in a new issue