From ef6874fe57500ec322469af4d6781e7e4a9e0719 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Sat, 4 May 2024 16:19:30 +0000 Subject: [PATCH] fix(firewall): query iptables version for iptables found --- cmd/gluetun/main.go | 4 +--- internal/firewall/iptables.go | 7 +++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cmd/gluetun/main.go b/cmd/gluetun/main.go index bdddd6e8c..a323702f8 100644 --- a/cmd/gluetun/main.go +++ b/cmd/gluetun/main.go @@ -279,9 +279,7 @@ func _main(ctx context.Context, buildInfo models.BuildInformation, {name: "OpenVPN 2.5", getVersion: ovpnConf.Version25}, {name: "OpenVPN 2.6", getVersion: ovpnConf.Version26}, {name: "Unbound", getVersion: dnsConf.Version}, - {name: "IPtables", getVersion: func(ctx context.Context) (version string, err error) { - return firewall.Version(ctx, cmder) - }}, + {name: "IPtables", getVersion: firewallConf.Version}, }) if err != nil { return err diff --git a/internal/firewall/iptables.go b/internal/firewall/iptables.go index 95d6c56f4..c409fb5ba 100644 --- a/internal/firewall/iptables.go +++ b/internal/firewall/iptables.go @@ -11,7 +11,6 @@ import ( "strings" "github.com/qdm12/gluetun/internal/models" - "github.com/qdm12/golibs/command" ) var ( @@ -44,9 +43,9 @@ func flipRule(rule string) string { } // Version obtains the version of the installed iptables. -func Version(ctx context.Context, runner command.Runner) (string, error) { - cmd := exec.CommandContext(ctx, "iptables", "--version") - output, err := runner.Run(cmd) +func (c *Config) Version(ctx context.Context) (string, error) { + cmd := exec.CommandContext(ctx, c.ipTables, "--version") //nolint:gosec + output, err := c.runner.Run(cmd) if err != nil { return "", err }