From 6ec215a045bfb210d350ba883dc3d652e116f08c Mon Sep 17 00:00:00 2001 From: mzz2017 Date: Thu, 8 Sep 2022 23:12:20 +0800 Subject: [PATCH] feat: support iptables-nft if iptables is not valid --- service/core/iptables/iptables.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service/core/iptables/iptables.go b/service/core/iptables/iptables.go index a5bd7b00..83459fbe 100644 --- a/service/core/iptables/iptables.go +++ b/service/core/iptables/iptables.go @@ -56,6 +56,10 @@ func (c Setter) Run(stopAtError bool) error { if common.IsDocker() { commands = strings.ReplaceAll(commands, "iptables", "iptables-legacy") commands = strings.ReplaceAll(commands, "ip6tables", "ip6tables-legacy") + } else if !cmds.IsCommandValid("iptables") && + cmds.IsCommandValid("iptables-nft") { + commands = strings.ReplaceAll(commands, "iptables", "iptables-nft") + commands = strings.ReplaceAll(commands, "ip6tables", "ip6tables-nft") } var errs []error if c.PreFunc != nil {