From 7b2cbf2449fd86c1ba90a9d1d05d50ddf673aeef Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 20 Jun 2011 17:22:04 -0700 Subject: [PATCH] Make 'show dynamic ' work correctly with new ipset program Signed-off-by: Tom Eastep --- Shorewall/lib.cli | 4 +++- Shorewall6/lib.cli | 15 ++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Shorewall/lib.cli b/Shorewall/lib.cli index ac341c6b5..cd14ce8a0 100644 --- a/Shorewall/lib.cli +++ b/Shorewall/lib.cli @@ -422,7 +422,9 @@ list_zone() { [ -n "$(mywhich ipset)" ] || fatal_error "The ipset utility cannot be located" - sets=$(find_sets $1) + sets=$(ipset -L -n | grep '^$1_'); + + [ -n "$sets" ] || sets=$(find_sets $1) for setname in $sets; do echo "${setname#${1}_}:" diff --git a/Shorewall6/lib.cli b/Shorewall6/lib.cli index 423287140..0c61b901a 100644 --- a/Shorewall6/lib.cli +++ b/Shorewall6/lib.cli @@ -400,13 +400,6 @@ show_routing() { # # 'list dynamic' command executor # -find_sets() { - local junk - local setname - - ipset -L -n | grep "^Name: ${1}_" | while read junk setname; do echo $setname; done -} - list_zone() { local sets @@ -414,11 +407,11 @@ list_zone() { [ -n "$(mywhich ipset)" ] || fatal_error "The ipset utility cannot be located" - sets=$(find_sets $1) + sets=$(ipset -L -n | grep "^6_$1_") for setname in $sets; do echo "${setname#${1}_}:" - ipset -L $setname -n | awk 'BEGIN {prnt=0;}; \ + ipset -L $setname | awk 'BEGIN {prnt=0;}; \ /^Members:/ {prnt=1; next; }; \ /^Bindings:/ {prnt=0; }; \ { if (prnt == 1) print " ", $1; };' @@ -1293,7 +1286,7 @@ add_command() { for host in $hostlist; do interface=${host%%:*} - ipset=${zone}_${interface}; + ipset=6_${zone}_${interface}; if ! qt $IPSET -L $ipset -n; then fatal_error "Zone $zone, interface $interface is does not have a dynamic host list" @@ -1352,7 +1345,7 @@ delete_command() { for hostent in $hostlist; do interface=${hostent%%:*} - ipset=${zone}_${interface}; + ipset=6_${zone}_${interface}; if ! qt $IPSET -L $ipset -n; then fatal_error "Zone $zone, interface $interface is does not have a dynamic host list"