Skip to content

Commit 8dce207

Browse files
committed
Disable hostname lookup on chain exists check
Without `-n`, iptables will attempt to lookup hostnames for IP addresses, which can slow down the call dramatically. Since we don't need this, and generally don't even care about the output, use the `-n` flag to disable this. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
1 parent 17ca8a6 commit 8dce207

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

iptables/iptables.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ func RawCombinedOutputNative(args ...string) error {
456456

457457
// ExistChain checks if a chain exists
458458
func ExistChain(chain string, table Table) bool {
459-
if _, err := Raw("-t", string(table), "-L", chain); err == nil {
459+
if _, err := Raw("-t", string(table), "-nL", chain); err == nil {
460460
return true
461461
}
462462
return false

0 commit comments

Comments
 (0)