mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add debug to iptables
This commit is contained in:
parent
ff8a4ba0aa
commit
00f1398f7a
1 changed files with 4 additions and 1 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -122,10 +123,12 @@ func Raw(args ...string) ([]byte, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ErrIptablesNotFound
|
return nil, ErrIptablesNotFound
|
||||||
}
|
}
|
||||||
|
if os.Getenv("DEBUG") != "" {
|
||||||
|
fmt.Printf("[DEBUG] [iptables]: %s, %v\n", path, args)
|
||||||
|
}
|
||||||
output, err := exec.Command(path, args...).CombinedOutput()
|
output, err := exec.Command(path, args...).CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("iptables failed: iptables %v: %s (%s)", strings.Join(args, " "), output, err)
|
return nil, fmt.Errorf("iptables failed: iptables %v: %s (%s)", strings.Join(args, " "), output, err)
|
||||||
}
|
}
|
||||||
return output, err
|
return output, err
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue