From a1adfe1737b5b35dadc36fc2a92c7bcf77f9b98c Mon Sep 17 00:00:00 2001 From: ssongliu Date: Thu, 4 Dec 2025 11:19:30 +0800 Subject: [PATCH] fix: Add iptables execution timeout --- agent/utils/firewall/client/iptables/common.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/utils/firewall/client/iptables/common.go b/agent/utils/firewall/client/iptables/common.go index 7fb33c89de60..6ad99527c49e 100644 --- a/agent/utils/firewall/client/iptables/common.go +++ b/agent/utils/firewall/client/iptables/common.go @@ -44,7 +44,7 @@ const ( ) func RunWithStd(tab, rule string) (string, error) { - cmdMgr := cmd.NewCommandMgr(cmd.WithIgnoreExist1(), cmd.WithTimeout(20*time.Second)) + cmdMgr := cmd.NewCommandMgr(cmd.WithIgnoreExist1(), cmd.WithTimeout(60*time.Second)) stdout, err := cmdMgr.RunWithStdoutBashCf("%s iptables -w -t %s %s", cmd.SudoHandleCmd(), tab, rule) if err != nil { global.LOG.Errorf("iptables command failed [table=%s, rule=%s]: %v", tab, rule, err) @@ -53,7 +53,7 @@ func RunWithStd(tab, rule string) (string, error) { return stdout, nil } func RunWithoutIgnore(tab, rule string) (string, error) { - cmdMgr := cmd.NewCommandMgr(cmd.WithTimeout(20 * time.Second)) + cmdMgr := cmd.NewCommandMgr(cmd.WithTimeout(60 * time.Second)) stdout, err := cmdMgr.RunWithStdoutBashCf("%s iptables -t %s %s", cmd.SudoHandleCmd(), tab, rule) if err != nil { return stdout, err