From 8dd10256cb24ceade8b40bd1604f03ddac8589e2 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Tue, 29 Jun 2010 21:14:40 +0200 Subject: ipset 5: Sparc related and compatibility fixes ipset 5 is tested on Sparc, which revealed some compatibility issues and those are fixed. Kernels from 2.6.31 onward are supported. The testsuite checkings are completed to run match/target checks. The README file is updated to reflect the requirements to install and run ipset 5. --- tests/bitmap:ip.t | 14 +++++++------- tests/ipmap.t | 10 +++++----- tests/iptables.sh | 1 + tests/macipmap.t | 8 ++++---- tests/portmap.t | 8 ++++---- tests/runtest.sh | 9 +++++++-- tests/setlist.t | 2 +- 7 files changed, 29 insertions(+), 23 deletions(-) (limited to 'tests') diff --git a/tests/bitmap:ip.t b/tests/bitmap:ip.t index 03cbe0d..29a1a5a 100644 --- a/tests/bitmap:ip.t +++ b/tests/bitmap:ip.t @@ -37,13 +37,13 @@ # Range: List set 0 ipset list test | sed 's/timeout ./timeout x/' > .foo # Range: Check listing -0 diff .foo bitmap:ip.t.list4 && rm .foo +0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list4 && rm .foo # Sleep 10s so that entries can time out 0 sleep 10s # Range: List set after timeout 0 ipset list test > .foo # Range: Check listing -0 diff .foo bitmap:ip.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list0 && rm .foo # Range: Flush test set 0 ipset flush test # Range: Delete test set @@ -79,13 +79,13 @@ # Network: List set 0 ipset list test | sed 's/timeout ./timeout x/' > .foo # Network: Check listing -0 diff .foo bitmap:ip.t.list5 && rm .foo +0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list5 && rm .foo # Sleep 10s so that entries can time out 0 sleep 10s # Network: List set 0 ipset list test > .foo # Network: Check listing -0 diff .foo bitmap:ip.t.list1 && rm .foo +0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list1 && rm .foo # Network: Flush test set 0 ipset flush test # Network: Delete test set @@ -121,13 +121,13 @@ # Subnets: List set 0 ipset list test | sed 's/timeout ./timeout x/' > .foo # Subnets: Check listing -0 diff .foo bitmap:ip.t.list6 && rm .foo +0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list6 && rm .foo # Sleep 10s so that entries can time out 0 sleep 10s # Subnets: List set 0 ipset list test > .foo # Subnets: Check listing -0 diff .foo bitmap:ip.t.list2 && rm .foo +0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list2 && rm .foo # Subnets: Flush test set 0 ipset flush test # Subnets: Delete test set @@ -147,7 +147,7 @@ # Full: List set 0 ipset list test > .foo # Full: Check listing -0 diff .foo bitmap:ip.t.list3 && rm .foo +0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list3 && rm .foo # Full: Delete test set 0 ipset destroy test # eof diff --git a/tests/ipmap.t b/tests/ipmap.t index 2373176..f6dd367 100644 --- a/tests/ipmap.t +++ b/tests/ipmap.t @@ -49,13 +49,13 @@ # Range: List set 0 ipset -L test > .foo # Range: Check listing -0 diff .foo ipmap.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo ipmap.t.list0 && rm .foo # Range: Delete a range of elements 0 ipset -! -D test 2.0.0.128-2.0.0.132 # Range: List set 0 ipset -L test > .foo # Range: Check listing -0 diff .foo ipmap.t.list1 && rm .foo +0 diff -I 'Size in memory.*' .foo ipmap.t.list1 && rm .foo # Range: Flush test set 0 ipset -F test # Range: Delete test set @@ -91,7 +91,7 @@ # Network: List set 0 ipset -L test > .foo # Network: Check listing -0 diff .foo ipmap.t.list2 && rm .foo +0 diff -I 'Size in memory.*' .foo ipmap.t.list2 && rm .foo # Network: Flush test set 0 ipset -F test # Network: Delete test set @@ -127,7 +127,7 @@ # Subnets: List set 0 ipset -L test > .foo # Subnets: Check listing -0 diff .foo ipmap.t.list3 && rm .foo +0 diff -I 'Size in memory.*' .foo ipmap.t.list3 && rm .foo # Subnets: FLush test set 0 ipset -F test # Subnets: Delete test set @@ -153,7 +153,7 @@ # Full: List set 0 ipset -L test > .foo # Full: Check listing -0 diff .foo ipmap.t.list4 && rm .foo +0 diff -I 'Size in memory.*' .foo ipmap.t.list4 && rm .foo # Full: Delete test set 0 ipset -X test # eof diff --git a/tests/iptables.sh b/tests/iptables.sh index 935b236..213e748 100755 --- a/tests/iptables.sh +++ b/tests/iptables.sh @@ -1,5 +1,6 @@ #!/bin/sh +# set -x set -e # We play with the following networks: diff --git a/tests/macipmap.t b/tests/macipmap.t index 90f09ba..7cf0cff 100644 --- a/tests/macipmap.t +++ b/tests/macipmap.t @@ -41,7 +41,7 @@ # Range: List set 0 ipset -L test > .foo # Range: Check listing -0 diff .foo macipmap.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo macipmap.t.list0 && rm .foo # Range: Flush test set 0 ipset -F test # Range: Delete test set @@ -81,7 +81,7 @@ # Network: List set 0 ipset -L test > .foo # Network: Check listing -0 diff .foo macipmap.t.list1 && rm .foo +0 diff -I 'Size in memory.*' .foo macipmap.t.list1 && rm .foo # Network: Flush test set 0 ipset -F test # Network: Delete test set @@ -121,13 +121,13 @@ # Range: List set 0 ipset -L test | sed 's/timeout ./timeout x/' > .foo # Range: Check listing -0 diff .foo macipmap.t.list3 && rm .foo +0 diff -I 'Size in memory.*' .foo macipmap.t.list3 && rm .foo # Range: wait 10s so that elements can timeout 0 sleep 10 # Range: List set 0 ipset -L test > .foo # Range: Check listing -0 diff .foo macipmap.t.list2 && rm .foo +0 diff -I 'Size in memory.*' .foo macipmap.t.list2 && rm .foo # Range: Flush test set 0 ipset -F test # Range: Delete test set diff --git a/tests/portmap.t b/tests/portmap.t index b2ebf55..54fd6f1 100644 --- a/tests/portmap.t +++ b/tests/portmap.t @@ -27,7 +27,7 @@ # Range: List set 0 ipset -L test > .foo # Range: Check listing -0 diff .foo portmap.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo portmap.t.list0 && rm .foo # Range: Flush test set 0 ipset -F test # Range: Delete test set @@ -47,7 +47,7 @@ # Full: List set 0 ipset -L test > .foo # Full: Check listing -0 diff .foo portmap.t.list1 && rm .foo +0 diff -I 'Size in memory.*' .foo portmap.t.list1 && rm .foo # Full: Flush test set 0 ipset -F test # Full: Delete test set @@ -71,13 +71,13 @@ # Full: List set 0 ipset -L test | sed 's/timeout ./timeout x/' > .foo # Full: Check listing -0 diff .foo portmap.t.list3 && rm .foo +0 diff -I 'Size in memory.*' .foo portmap.t.list3 && rm .foo # Full: sleep 10s so that elements can timeout 0 sleep 10 # Full: List set 0 ipset -L test > .foo # Full: Check listing -# 0 diff .foo portmap.t.list2 && rm .foo +# 0 diff -I 'Size in memory.*' .foo portmap.t.list2 && rm .foo # Full: Flush test set 0 ipset -F test # Full: Delete test set diff --git a/tests/runtest.sh b/tests/runtest.sh index 32702c9..cc6678a 100755 --- a/tests/runtest.sh +++ b/tests/runtest.sh @@ -19,11 +19,16 @@ add_tests() { cmd=ip6tables-save add=match_target6 fi - modprobe ip_tables - if [ ! -e /var/log/kern.log -a -z "`grep 'kernel: ip_tables: ' /var/log/kern/log`" ]; then + line="`dmesg | tail -1 | cut -d " " -f 2-`" + if [ ! -e /var/log/kern.log -o -z "`grep \"$line\" /var/log/kern.log`" ]; then echo "The destination for kernel log is not /var/log/kern.log, skipping $1 match and target tests" return fi + c=${cmd%%-save} + if [ "`$c -m set -h 2>&1| grep 'cannot open shared object'`" ]; then + echo "$c does not support set match, skipping $1 match and target tests" + return + fi if [ `$cmd -t filter | wc -l` -eq 7 -a \ `$cmd -t filter | grep ACCEPT | wc -l` -eq 3 ]; then if [ -z "`which sendip`" ]; then diff --git a/tests/setlist.t b/tests/setlist.t index d673e8e..b5e060d 100644 --- a/tests/setlist.t +++ b/tests/setlist.t @@ -47,7 +47,7 @@ # List set 0 ipset -L test > .foo # Check listing -0 diff .foo setlist.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo setlist.t.list0 && rm .foo # Flush all sets 0 ipset -F # Delete all sets -- cgit v1.2.3