浏览代码

Merge pull request #52 from dcbw/nft-non-existent-chains

iptables in nft mode now prints an error for non-existent chains
Casey Callendrello 5 年之前
父节点
当前提交
0c43e9f803
共有 1 个文件被更改,包括 0 次插入12 次删除
  1. 0 12
      iptables/iptables.go

+ 0 - 12
iptables/iptables.go

@@ -348,18 +348,6 @@ func (ipt *IPTables) executeList(args []string) ([]string, error) {
 		rules = rules[:len(rules)-1]
 	}
 
-	// nftables mode doesn't return an error code when listing a non-existent
-	// chain. Patch that up.
-	if len(rules) == 0 && ipt.mode == "nf_tables" {
-		v := 1
-		return nil, &Error{
-			cmd:        exec.Cmd{Args: args},
-			msg:        fmt.Sprintf("%s: No chain/target/match by that name.\n", getIptablesCommand(ipt.proto)),
-			proto:      ipt.proto,
-			exitStatus: &v,
-		}
-	}
-
 	for i, rule := range rules {
 		rules[i] = filterRuleOutput(rule)
 	}