functions.m4: Make clearchain tolerant of existing chains.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 23 Jul 2011 11:45:38 +0000 (12:45 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 23 Jul 2011 11:54:57 +0000 (12:54 +0100)
It's a handy way to make chains which are populated elsewhere, e.g., by
fail2ban.

functions.m4

index b2e3cb6..fd24364 100644 (file)
@@ -85,7 +85,7 @@ clearchain () {
       *:*) table=${chain%:*} chain=${chain#*:} ;;
       *) table=filter ;;
     esac
-    run ip46tables -t $table -N $chain
+    run ip46tables -t $table -N $chain 2>/dev/null || :
   done
 }