Преглед на файлове

Remove iptables mode dependent existsErr code work-around.
iptables fixed in iptables-1.8.1
commit c19fa5833a0bc0eb787799634bd26dea91fcdca1

Michael Cambria преди 5 години
родител
ревизия
a5f18ede38
променени са 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)
 	return ipt.run("-t", table, "-N", chain)
 }
 }
 
 
+const existsErr = 1
+
 // ClearChain flushed (deletes all rules) in the specified table/chain.
 // ClearChain flushed (deletes all rules) in the specified table/chain.
 // If the chain does not exist, a new one will be created
 // If the chain does not exist, a new one will be created
 func (ipt *IPTables) ClearChain(table, chain string) error {
 func (ipt *IPTables) ClearChain(table, chain string) error {
 	err := ipt.NewChain(table, chain)
 	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)
 	eerr, eok := err.(*Error)
 	switch {
 	switch {
 	case err == nil:
 	case err == nil: