From 45da078e5fc0936d3405377f8a978544913f9b05 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 6 May 2013 12:33:07 +0100 Subject: [PATCH] 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. --- functions.m4 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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 ... -- 2.11.0