Skip to content

Commit a1adfe1

Browse files
committed
fix: Add iptables execution timeout
1 parent 5d2084f commit a1adfe1

File tree

1 file changed

+2
-2
lines changed
  • agent/utils/firewall/client/iptables

1 file changed

+2
-2
lines changed

agent/utils/firewall/client/iptables/common.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const (
4444
)
4545

4646
func RunWithStd(tab, rule string) (string, error) {
47-
cmdMgr := cmd.NewCommandMgr(cmd.WithIgnoreExist1(), cmd.WithTimeout(20*time.Second))
47+
cmdMgr := cmd.NewCommandMgr(cmd.WithIgnoreExist1(), cmd.WithTimeout(60*time.Second))
4848
stdout, err := cmdMgr.RunWithStdoutBashCf("%s iptables -w -t %s %s", cmd.SudoHandleCmd(), tab, rule)
4949
if err != nil {
5050
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) {
5353
return stdout, nil
5454
}
5555
func RunWithoutIgnore(tab, rule string) (string, error) {
56-
cmdMgr := cmd.NewCommandMgr(cmd.WithTimeout(20 * time.Second))
56+
cmdMgr := cmd.NewCommandMgr(cmd.WithTimeout(60 * time.Second))
5757
stdout, err := cmdMgr.RunWithStdoutBashCf("%s iptables -t %s %s", cmd.SudoHandleCmd(), tab, rule)
5858
if err != nil {
5959
return stdout, err

0 commit comments

Comments
 (0)