moby/libnetwork/controller_others.go
Sebastiaan van Stijn a5f45b47a3
libnetwork: Controller: combine iptablesEnabled and ip6tablesEnabled
These functions were mostly identical, except for iptables being enabled
by default (unless explicitly disabled by config).

Rewrite the function to a enabledIptablesVersions, which returns the list
of iptables-versions that are enabled for the controller. This prevents
having to acquire a lock twice, and simplifies arrangeUserFilterRule, which
can now just iterate over the enabled versions.

Also moving this function to a linux-only file, as other platforms don't have
the iptables types defined.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-21 20:08:53 +02:00

8 lines
168 B
Go

//go:build !linux
package libnetwork
// enabledIptablesVersions is a no-op on non-Linux systems.
func (c *Controller) enabledIptablesVersions() []any {
return nil
}