diff --git a/internal/iplibrary/action_firewalld.go b/internal/iplibrary/action_firewalld.go index c57148d..4c97b71 100644 --- a/internal/iplibrary/action_firewalld.go +++ b/internal/iplibrary/action_firewalld.go @@ -20,6 +20,8 @@ type FirewalldAction struct { BaseAction config *firewallconfigs.FirewallActionFirewalldConfig + + firewalldNotFound bool } func NewFirewalldAction() *FirewalldAction { @@ -82,6 +84,10 @@ func (this *FirewalldAction) runActionSingleIP(action string, listType IPListTyp if len(path) == 0 { path, err = exec.LookPath("firewall-cmd") if err != nil { + if this.firewalldNotFound { + return nil + } + this.firewalldNotFound = true return err } } diff --git a/internal/iplibrary/action_iptables.go b/internal/iplibrary/action_iptables.go index 2ac2f4b..37e0ced 100644 --- a/internal/iplibrary/action_iptables.go +++ b/internal/iplibrary/action_iptables.go @@ -19,6 +19,8 @@ type IPTablesAction struct { BaseAction config *firewallconfigs.FirewallActionIPTablesConfig + + iptablesNotFound bool } func NewIPTablesAction() *IPTablesAction { @@ -77,6 +79,10 @@ func (this *IPTablesAction) runActionSingleIP(action string, listType IPListType if len(path) == 0 { path, err = exec.LookPath("iptables") if err != nil { + if this.iptablesNotFound { + return nil + } + this.iptablesNotFound = true return err } }