Split out -w argument in iptables input (#6304)

This commit is contained in:
Daniel Nelson 2019-08-22 20:00:48 -07:00 committed by GitHub
parent 1848adaf79
commit 66d6b1f1d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -37,7 +37,7 @@ func (ipt *Iptables) SampleConfig() string {
## iptables can be restricted to only list command "iptables -nvL".
use_sudo = false
## Setting 'use_lock' to true runs iptables with the "-w" option.
## Adjust your sudo settings appropriately if using this option ("iptables -wnvl")
## Adjust your sudo settings appropriately if using this option ("iptables -w 5 -nvl")
use_lock = false
## Define an alternate executable, such as "ip6tables". Default is "iptables".
# binary = "ip6tables"
@ -89,11 +89,10 @@ func (ipt *Iptables) chainList(table, chain string) (string, error) {
name = "sudo"
args = append(args, iptablePath)
}
iptablesBaseArgs := "-nvL"
if ipt.UseLock {
iptablesBaseArgs = "-wnvL"
args = append(args, "-w", "5")
}
args = append(args, iptablesBaseArgs, chain, "-t", table, "-x")
args = append(args, "-nvL", chain, "-t", table, "-x")
c := exec.Command(name, args...)
out, err := c.Output()
return string(out), err