Parcourir la source

Merge pull request #62 from mccv1r0/nf-tables

Remove iptables mode dependent existsErr code work-around.
Casey Callendrello il y a 5 ans
Parent
commit
8d5539c5ca
1 fichiers modifiés avec 2 ajouts et 7 suppressions
  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: