mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Looking for iptables in PATH
This commit is contained in:
parent
4825d3a537
commit
dfc3904f77
1 changed files with 5 additions and 1 deletions
|
@ -68,7 +68,11 @@ func networkSize(mask net.IPMask) (int32, error) {
|
|||
|
||||
// Wrapper around the iptables command
|
||||
func iptables(args ...string) error {
|
||||
if err := exec.Command("/sbin/iptables", args...).Run(); err != nil {
|
||||
path, err := exec.LookPath("iptables")
|
||||
if err != nil {
|
||||
log.Fatal("command not found: iptables")
|
||||
}
|
||||
if err := exec.Command(path, args...).Run(); err != nil {
|
||||
return fmt.Errorf("iptables failed: iptables %v", strings.Join(args, " "))
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue