Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
fix for down cmd unknown args error
Browse files Browse the repository at this point in the history
  • Loading branch information
gesquive committed May 8, 2018
1 parent 03c4202 commit ff1582b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions iptables/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ func LoadIPv4Rules(rules []byte, restoreCounters bool, persist bool) error {
return err
}

counterFlag := ""
var args []interface{}
if restoreCounters {
counterFlag = "-c"
args = append(args, "-c")
}
args = append(args, rulesFile.Name())

err = sh.Command(ip4tablesRestore, counterFlag, rulesFile.Name()).Run()
err = sh.Command(ip4tablesRestore, args...).Run()
if err != nil {
return err
}
Expand All @@ -67,12 +68,13 @@ func LoadIPv6Rules(rules []byte, restoreCounters bool, persist bool) error {
return err
}

counterFlag := ""
var args []interface{}
if restoreCounters {
counterFlag = "-c"
args = append(args, "-c")
}
args = append(args, rulesFile.Name())

err = sh.Command(ip6tablesRestore, counterFlag, rulesFile.Name()).Run()
err = sh.Command(ip6tablesRestore, args...).Run()
if err != nil {
return err
}
Expand Down

0 comments on commit ff1582b

Please sign in to comment.