소스 검색

Merge pull request #62 from mccv1r0/nf-tables

Remove iptables mode dependent existsErr code work-around.
Casey Callendrello 5 년 전
부모
커밋
8d5539c5ca
1개의 변경된 파일2개의 추가작업 그리고 7개의 파일을 삭제
  1. 2 7
      iptables/iptables.go

+ 2 - 7
iptables/iptables.go

@@ -373,18 +373,13 @@ func (ipt *IPTables) NewChain(table, chain string) error {
 	return ipt.run("-t", table, "-N", chain)
 }
 
+const existsErr = 1
+
 // ClearChain flushed (deletes all rules) in the specified table/chain.
 // If the chain does not exist, a new one will be created
 func (ipt *IPTables) ClearChain(table, chain string) error {
 	err := ipt.NewChain(table, chain)
 
-	// the exit code for "this table already exists" is different for
-	// different iptables modes
-	existsErr := 1
-	if ipt.mode == "nf_tables" {
-		existsErr = 4
-	}
-
 	eerr, eok := err.(*Error)
 	switch {
 	case err == nil: