From: Mark Wooding Date: Mon, 6 May 2013 11:33:07 +0000 (+0100) Subject: functions.m4: Partially cope with ipset(8) command-line overhaul. X-Git-Url: https://git.distorted.org.uk/~mdw/firewall/commitdiff_plain/45da078e5fc0936d3405377f8a978544913f9b05?ds=sidebyside functions.m4: Partially cope with ipset(8) command-line overhaul. They've completely changed the syntax. The old one seems still available for now, but we should switch over completely now that wheezy is released. --- diff --git a/functions.m4 b/functions.m4 index 3cd570d..1cd0db5 100644 --- a/functions.m4 +++ b/functions.m4 @@ -109,11 +109,19 @@ clearchain () { makeset () { set -e name=$1; shift - if ipset -nL | grep -q "^Name: $name$"; then - : - else - ipset -N "$name" "$@" - fi + v=$(ipset --version) + createp=t + case "$v" in + "ipset v4"*) + if ipset -nL | grep -q "^Name: $name\$"; then createp=nil; fi + ;; + *) + if ipset -n -L | grep -q "^$name\$"; then createp=nil; fi + ;; + esac + case $createp in + t) ipset -N "$name" "$@" ;; + esac } ## errorchain CHAIN ACTION ARGS ...