summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2013-04-04 16:32:20 +0200
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2013-04-09 21:42:16 +0200
commitfd9361feaafe075c50c2a2a2a627553d097cb1b3 (patch)
tree2628c04a8c329fe2ea102af0d882a01e61610bd8 /tests
parent2222b6adb0be1bdffd58875c5c874e89b0aec4cd (diff)
Add new testsuite entries to verify counters and the new type implementations
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Diffstat (limited to 'tests')
-rw-r--r--tests/bitmap:ip.t70
-rw-r--r--tests/check_counters9
-rw-r--r--tests/check_extensions10
-rwxr-xr-xtests/check_klog.sh2
-rw-r--r--tests/check_sendip_packets24
-rw-r--r--tests/hash:ip,port,ip.t50
-rw-r--r--tests/hash:ip,port,net.t52
-rw-r--r--tests/hash:ip,port.t50
-rw-r--r--tests/hash:ip.t72
-rw-r--r--tests/hash:ip6,port,ip6.t50
-rw-r--r--tests/hash:ip6,port,net6.t52
-rw-r--r--tests/hash:ip6,port.t50
-rw-r--r--tests/hash:ip6.t50
-rw-r--r--tests/hash:net,iface.t52
-rw-r--r--tests/hash:net,port.t52
-rw-r--r--tests/hash:net.t52
-rw-r--r--tests/hash:net6,port.t52
-rw-r--r--tests/hash:net6.t52
-rw-r--r--tests/macipmap.t48
-rw-r--r--tests/portmap.t48
-rw-r--r--tests/resizen.sh78
-rw-r--r--tests/resizet.sh87
-rwxr-xr-xtests/runtest.sh18
-rw-r--r--tests/setlist.t84
24 files changed, 1156 insertions, 8 deletions
diff --git a/tests/bitmap:ip.t b/tests/bitmap:ip.t
index 4389d8f..252bde4 100644
--- a/tests/bitmap:ip.t
+++ b/tests/bitmap:ip.t
@@ -160,4 +160,74 @@
0 ipset test test 1.1.1.1
# Full: Delete test set
0 ipset destroy test
+# Counters: create set
+0 ipset n test bitmap:ip range 2.0.0.1-2.1.0.0 counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.1 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2.0.0.1
+# Counters: check counters
+0 ./check_counters test 2.0.0.1 5 3456
+# Counters: delete element
+0 ipset d test 2.0.0.1
+# Counters: test deleted element
+1 ipset t test 2.0.0.1
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.10 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2.0.0.10 12 9876
+# Counters: update counters
+0 ipset -! a test 2.0.0.10 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2.0.0.10 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test bitmap:ip range 2.0.0.1-2.1.0.0 counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.1 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2.0.0.1
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.1 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2.0.0.1
+# Counters and timeout: test deleted element
+1 ipset t test 2.0.0.1
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.10 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.10 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2.0.0.10 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.10 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2.0.0.10 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.10 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
+# Counters: require sendip
+skip which sendip
+# Counters: create set
+0 ipset n test bitmap:ip range 10.255.0.0/16 counters
+# Counters: add elemet with zero counters
+0 ipset a test 10.255.255.64
+# Counters: generate packets
+0 ./check_sendip_packets -4 src 5
+# Counters: check counters
+0 ./check_counters test 10.255.255.64 5 $((5*40))
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test bitmap:ip range 10.255.0.0/16 counters timeout 600
+# Counters and timeout: add elemet with zero counters
+0 ipset a test 10.255.255.64
+# Counters and timeout: generate packets
+0 ./check_sendip_packets -4 src 6
+# Counters and timeout: check counters
+0 ./check_extensions test 10.255.255.64 600 6 $((6*40))
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/check_counters b/tests/check_counters
new file mode 100644
index 0000000..0099f23
--- /dev/null
+++ b/tests/check_counters
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+read ip p packets b bytes <<< $(../src/ipset l $1 | grep ^$2)
+test -z "$packets" -o -z "$bytes" && exit 1
+test $packets -ne $3 -o $bytes -ne $4 && exit 1
+exit 0
+
+
+
diff --git a/tests/check_extensions b/tests/check_extensions
new file mode 100644
index 0000000..5848b38
--- /dev/null
+++ b/tests/check_extensions
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+read ip t timeout p packets b bytes <<< $(../src/ipset l $1 | grep ^$2)
+test -z "$timeout" -o -z "$packets" -o -z "$bytes" && exit 1
+test $timeout -gt $3 -o $timeout -lt $(($3 - 10)) && exit 1
+test $packets -ne $4 -o $bytes -ne $5 && exit 1
+exit 0
+
+
+
diff --git a/tests/check_klog.sh b/tests/check_klog.sh
index 489fa71..a39da77 100755
--- a/tests/check_klog.sh
+++ b/tests/check_klog.sh
@@ -37,7 +37,7 @@ proto=`echo $1 | tr a-z A-Z`; shift
port=$1; shift
for setname in $@; do
- match=`grep -e "in set $setname: .* SRC=$ipaddr .* PROTO=$proto SPT=$port .*" /var/log/kern.log`
+ match=`dmesg| tail -n 2 | grep -e "in set $setname: .* SRC=$ipaddr .* PROTO=$proto SPT=$port .*"`
if [ -z "$match" ]; then
echo "no match!"
exit 1
diff --git a/tests/check_sendip_packets b/tests/check_sendip_packets
new file mode 100644
index 0000000..0dad3d0
--- /dev/null
+++ b/tests/check_sendip_packets
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# -4|-6 dirs pkt-count
+
+set -e
+
+if [ "$1" = "-4" ]; then
+ cmd=iptables
+ proto=ipv4
+ src=10.255.255.64
+ dst=127.0.0.1
+else
+ cmd=ip6tables
+ proto=ipv6
+ src=1002:1002:1002:1002::32
+ dst=::1
+fi
+
+$cmd -A INPUT -m set --match-set test $2 -j DROP
+for x in `seq 1 $3`; do
+ sendip -p $proto -id $dst -is $src -p tcp -td 80 -ts 1025 $dst
+done
+$cmd -D INPUT -m set --match-set test $2 -j DROP
+
diff --git a/tests/hash:ip,port,ip.t b/tests/hash:ip,port,ip.t
index 8096d0c..0cb2e0b 100644
--- a/tests/hash:ip,port,ip.t
+++ b/tests/hash:ip,port,ip.t
@@ -98,4 +98,54 @@
0 n=`ipset save test|wc -l` && test $n -eq 1
# Destroy set
0 ipset -X test
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -4 ipportip
+# Counters: create set
+0 ipset n test hash:ip,port,ip counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.1,80,192.168.199.200 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2.0.0.1,80,192.168.199.200
+# Counters: check counters
+0 ./check_counters test 2.0.0.1 5 3456
+# Counters: delete element
+0 ipset d test 2.0.0.1,80,192.168.199.200
+# Counters: test deleted element
+1 ipset t test 2.0.0.1,80,192.168.199.200
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.20,453,10.0.0.1 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2.0.0.20 12 9876
+# Counters: update counters
+0 ipset -! a test 2.0.0.20,453,10.0.0.1 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2.0.0.20 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:ip,port,ip counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.1,80,192.168.199.200 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2.0.0.1,80,192.168.199.200
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.1 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2.0.0.1,80,192.168.199.200
+# Counters and timeout: test deleted element
+1 ipset t test 2.0.0.1,80,192.168.199.200
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.20,453,10.0.0.1 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.20 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2.0.0.20,453,10.0.0.1 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.20 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2.0.0.20,453,10.0.0.1 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.20 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/hash:ip,port,net.t b/tests/hash:ip,port,net.t
index e0c8c08..22c2b13 100644
--- a/tests/hash:ip,port,net.t
+++ b/tests/hash:ip,port,net.t
@@ -128,4 +128,56 @@
0 n=`ipset save test|wc -l` && test $n -eq 1
# Destroy set
0 ipset -X test
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -4 ipportnet
+# Nomatch: Check that resizing keeps the nomatch flag
+0 ./resizen.sh -4 ipportnet
+# Counters: create set
+0 ipset n test hash:ip,port,net counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.1,80,192.168.199.200 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2.0.0.1,80,192.168.199.200
+# Counters: check counters
+0 ./check_counters test 2.0.0.1 5 3456
+# Counters: delete element
+0 ipset d test 2.0.0.1,80,192.168.199.200
+# Counters: test deleted element
+1 ipset t test 2.0.0.1,80,192.168.199.200
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.20,453,10.0.0.1 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2.0.0.20 12 9876
+# Counters: update counters
+0 ipset -! a test 2.0.0.20,453,10.0.0.1 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2.0.0.20 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:ip,port,net counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.1,80,192.168.199.200 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2.0.0.1,80,192.168.199.200
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.1 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2.0.0.1,80,192.168.199.200
+# Counters and timeout: test deleted element
+1 ipset t test 2.0.0.1,80,192.168.199.200
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.20,453,10.0.0.1 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.20 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2.0.0.20,453,10.0.0.1 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.20 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2.0.0.20,453,10.0.0.1 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.20 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/hash:ip,port.t b/tests/hash:ip,port.t
index 253c6af..fc5d466 100644
--- a/tests/hash:ip,port.t
+++ b/tests/hash:ip,port.t
@@ -116,4 +116,54 @@
0 n=`ipset save test|wc -l` && test $n -eq 1
# Destroy set
0 ipset -X test
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -4 ipport
+# Counters: create set
+0 ipset n test hash:ip,port counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.1,80 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2.0.0.1,80
+# Counters: check counters
+0 ./check_counters test 2.0.0.1 5 3456
+# Counters: delete element
+0 ipset d test 2.0.0.1,80
+# Counters: test deleted element
+1 ipset t test 2.0.0.1,80
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.20,453 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2.0.0.20 12 9876
+# Counters: update counters
+0 ipset -! a test 2.0.0.20,453 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2.0.0.20 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:ip,port counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.1,80 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2.0.0.1,80
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.1 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2.0.0.1,80
+# Counters and timeout: test deleted element
+1 ipset t test 2.0.0.1,80
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.20,453 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.20 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2.0.0.20,453 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.20 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2.0.0.20,453 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.20 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/hash:ip.t b/tests/hash:ip.t
index 1f00be7..56b3004 100644
--- a/tests/hash:ip.t
+++ b/tests/hash:ip.t
@@ -134,4 +134,76 @@
0 n=`ipset save test|wc -l` && test $n -eq 1
# Range: Delete test set
0 ipset destroy test
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -4 ip
+# Counters: create set
+0 ipset n test hash:ip counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.1 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2.0.0.1
+# Counters: check counters
+0 ./check_counters test 2.0.0.1 5 3456
+# Counters: delete element
+0 ipset d test 2.0.0.1
+# Counters: test deleted element
+1 ipset t test 2.0.0.1
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.10 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2.0.0.10 12 9876
+# Counters: update counters
+0 ipset -! a test 2.0.0.10 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2.0.0.10 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:ip counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.1 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2.0.0.1
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.1 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2.0.0.1
+# Counters and timeout: test deleted element
+1 ipset t test 2.0.0.1
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.10 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.10 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2.0.0.10 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.10 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2.0.0.10 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.10 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
+# Counters: require sendip
+skip which sendip
+# Counters: create set
+0 ipset n test hash:ip counters
+# Counters: add elemet with zero counters
+0 ipset a test 10.255.255.64
+# Counters: generate packets
+0 ./check_sendip_packets -4 src 5
+# Counters: check counters
+0 ./check_counters test 10.255.255.64 5 $((5*40))
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:ip counters timeout 600
+# Counters and timeout: add elemet with zero counters
+0 ipset a test 10.255.255.64
+# Counters and timeout: generate packets
+0 ./check_sendip_packets -4 src 6
+# Counters and timeout: check counters
+0 ./check_extensions test 10.255.255.64 600 6 $((6*40))
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/hash:ip6,port,ip6.t b/tests/hash:ip6,port,ip6.t
index 80e1534..6f7f4db 100644
--- a/tests/hash:ip6,port,ip6.t
+++ b/tests/hash:ip6,port,ip6.t
@@ -62,4 +62,54 @@
0 n=`ipset list test|grep 1::1|wc -l` && test $n -eq 1026
# Destroy set
0 ipset -X test
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -6 ipportip
+# Counters: create set
+0 ipset n test hash:ip,port,ip -6 counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2:0:0::1,80,2002:24:ff::1 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2:0:0::1,80,2002:24:ff::1
+# Counters: check counters
+0 ./check_counters test 2::1 5 3456
+# Counters: delete element
+0 ipset d test 2:0:0::1,80,2002:24:ff::1
+# Counters: test deleted element
+1 ipset t test 2:0:0::1,80,2002:24:ff::1
+# Counters: add element with packet, byte counters
+0 ipset a test 2:0:0::20,453,2002:ff:24::ab packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2::20 12 9876
+# Counters: update counters
+0 ipset -! a test 2:0:0::20,453,2002:ff:24::ab packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2::20 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:ip,port,ip -6 counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2:0:0::1,80,2002:24:ff::1 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2:0:0::1,80,2002:24:ff::1
+# Counters and timeout: check counters
+0 ./check_extensions test 2::1 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2:0:0::1,80,2002:24:ff::1
+# Counters and timeout: test deleted element
+1 ipset t test 2:0:0::1,80,2002:24:ff::1
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2:0:0::20,453,2002:ff:24::ab packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2::20 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2:0:0::20,453,2002:ff:24::ab packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2::20 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2:0:0::20,453,2002:ff:24::ab timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2::20 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/hash:ip6,port,net6.t b/tests/hash:ip6,port,net6.t
index 1c4e856..d4f9f26 100644
--- a/tests/hash:ip6,port,net6.t
+++ b/tests/hash:ip6,port,net6.t
@@ -88,4 +88,56 @@
0 ipset -T test 2:2:2::2,80,1:1:1::F
# Delete test set
0 ipset destroy test
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -6 ipportnet
+# Nomatch: Check that resizing keeps the nomatch flag
+0 ./resizen.sh -6 ipportnet
+# Counters: create set
+0 ipset n test hash:ip,port,net -6 counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2:0:0::1,80,2002:24:ff::1/64 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2:0:0::1,80,2002:24:ff::1/64
+# Counters: check counters
+0 ./check_counters test 2::1 5 3456
+# Counters: delete element
+0 ipset d test 2:0:0::1,80,2002:24:ff::1/64
+# Counters: test deleted element
+1 ipset t test 2:0:0::1,80,2002:24:ff::1/64
+# Counters: add element with packet, byte counters
+0 ipset a test 2:0:0::20,453,2002:ff:24::ab/54 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2::20 12 9876
+# Counters: update counters
+0 ipset -! a test 2:0:0::20,453,2002:ff:24::ab/54 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2::20 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:ip,port,net -6 counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2:0:0::1,80,2002:24:ff::1/64 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2:0:0::1,80,2002:24:ff::1/64
+# Counters and timeout: check counters
+0 ./check_extensions test 2::1 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2:0:0::1,80,2002:24:ff::1/64
+# Counters and timeout: test deleted element
+1 ipset t test 2:0:0::1,80,2002:24:ff::1/64
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2:0:0::20,453,2002:ff:24::ab/54 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2::20 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2:0:0::20,453,2002:ff:24::ab/54 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2::20 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2:0:0::20,453,2002:ff:24::ab/54 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2::20 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/hash:ip6,port.t b/tests/hash:ip6,port.t
index d583415..b142f22 100644
--- a/tests/hash:ip6,port.t
+++ b/tests/hash:ip6,port.t
@@ -54,4 +54,54 @@
0 n=`ipset list test|grep 1::1|wc -l` && test $n -eq 1026
# Destroy set
0 ipset -X test
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -6 ipport
+# Counters: create set
+0 ipset n test hash:ip,port -6 counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2:0:0::1,80 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2:0:0::1,80
+# Counters: check counters
+0 ./check_counters test 2::1 5 3456
+# Counters: delete element
+0 ipset d test 2:0:0::1,80
+# Counters: test deleted element
+1 ipset t test 2:0:0::1,80
+# Counters: add element with packet, byte counters
+0 ipset a test 2:0:0::20,453 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2::20 12 9876
+# Counters: update counters
+0 ipset -! a test 2:0:0::20,453 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2::20 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:ip,port -6 counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2:0:0::1,80 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2:0:0::1,80
+# Counters and timeout: check counters
+0 ./check_extensions test 2::1 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2:0:0::1,80
+# Counters and timeout: test deleted element
+1 ipset t test 2:0:0::1,80
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2:0:0::20,453 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2::20 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2:0:0::20,453 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2::20 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2:0:0::20,453 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2::20 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/hash:ip6.t b/tests/hash:ip6.t
index 4ab5f5b..2baaa83 100644
--- a/tests/hash:ip6.t
+++ b/tests/hash:ip6.t
@@ -98,4 +98,54 @@
0 diff -u -I 'Size in memory.*' .foo restore.t.list1
# Destroy by restore
0 ipset restore < restore.t.destroy
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -6 ip
+# Counters: create set
+0 ipset n test hash:ip -6 counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2:0:0::1 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2:0:0::1
+# Counters: check counters
+0 ./check_counters test 2::1 5 3456
+# Counters: delete element
+0 ipset d test 2:0:0::1
+# Counters: test deleted element
+1 ipset t test 2:0:0::1
+# Counters: add element with packet, byte counters
+0 ipset a test 2:0:0::20 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2::20 12 9876
+# Counters: update counters
+0 ipset -! a test 2:0:0::20 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2::20 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:ip -6 counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2:0:0::1 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2:0:0::1
+# Counters and timeout: check counters
+0 ./check_extensions test 2::1 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2:0:0::1
+# Counters and timeout: test deleted element
+1 ipset t test 2:0:0::1
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2:0:0::20 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2::20 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2:0:0::20 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2::20 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2:0:0::20 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2::20 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/hash:net,iface.t b/tests/hash:net,iface.t
index f40f10b..21ba1c7 100644
--- a/tests/hash:net,iface.t
+++ b/tests/hash:net,iface.t
@@ -172,4 +172,56 @@
0 ipset -T test 1.1.1.3,eth0
# Delete test set
0 ipset destroy test
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -4 netiface
+# Nomatch: Check that resizing keeps the nomatch flag
+0 ./resizen.sh -4 netiface
+# Counters: create set
+0 ipset n test hash:net,iface counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.1/24,eth0 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2.0.0.1/24,eth0
+# Counters: check counters
+0 ./check_counters test 2.0.0.0/24,eth0 5 3456
+# Counters: delete element
+0 ipset d test 2.0.0.1/24,eth0
+# Counters: test deleted element
+1 ipset t test 2.0.0.1/24,eth0
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.20/25,wlan0 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2.0.0.0/25,wlan0 12 9876
+# Counters: update counters
+0 ipset -! a test 2.0.0.20/25,wlan0 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2.0.0.0/25,wlan0 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:net,iface counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.1/24,eth0 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2.0.0.1/24,eth0
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.0/24,eth0 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2.0.0.1/24,eth0
+# Counters and timeout: test deleted element
+1 ipset t test 2.0.0.1/24,eth0
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.20/25,wlan0 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.0/25,wlan0 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2.0.0.20/25,wlan0 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.0/25,wlan0 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2.0.0.20/25,wlan0 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.0/25,wlan0 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/hash:net,port.t b/tests/hash:net,port.t
index 34b29f1..3d1586b 100644
--- a/tests/hash:net,port.t
+++ b/tests/hash:net,port.t
@@ -114,4 +114,56 @@
0 ipset -T test 1.1.1.3,80
# Delete test set
0 ipset destroy test
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -4 netport
+# Nomatch: Check that resizing keeps the nomatch flag
+0 ./resizen.sh -4 netport
+# Counters: create set
+0 ipset n test hash:net,port counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.1/24,80 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2.0.0.1/24,80
+# Counters: check counters
+0 ./check_counters test 2.0.0.0/24 5 3456
+# Counters: delete element
+0 ipset d test 2.0.0.1/24,80
+# Counters: test deleted element
+1 ipset t test 2.0.0.1/24,80
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.20/25,453 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2.0.0.0/25 12 9876
+# Counters: update counters
+0 ipset -! a test 2.0.0.20/25,453 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2.0.0.0/25 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:net,port counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.1/24,80 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2.0.0.1/24,80
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.0/24 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2.0.0.1/24,80
+# Counters and timeout: test deleted element
+1 ipset t test 2.0.0.1/24,80
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.20/25,453 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.0/25 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2.0.0.20/25,453 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.0/25 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2.0.0.20/25,453 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.0/25 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/hash:net.t b/tests/hash:net.t
index 78efe3d..ef82a6e 100644
--- a/tests/hash:net.t
+++ b/tests/hash:net.t
@@ -102,4 +102,56 @@
0 ipset destroy test
# Check CIDR book-keeping
0 ./check_cidrs.sh
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -4 net
+# Nomatch: Check that resizing keeps the nomatch flag
+0 ./resizen.sh -4 net
+# Counters: create set
+0 ipset n test hash:net counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.1/24 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2.0.0.1/24
+# Counters: check counters
+0 ./check_counters test 2.0.0.0/24 5 3456
+# Counters: delete element
+0 ipset d test 2.0.0.1/24
+# Counters: test deleted element
+1 ipset t test 2.0.0.1/24
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.20/25 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2.0.0.0/25 12 9876
+# Counters: update counters
+0 ipset -! a test 2.0.0.20/25 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2.0.0.0/25 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:net counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.1/24 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2.0.0.1/24
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.0/24 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2.0.0.1/24
+# Counters and timeout: test deleted element
+1 ipset t test 2.0.0.1/24
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.20/25 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.0/25 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2.0.0.20/25 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.0/25 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2.0.0.20/25 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.0/25 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/hash:net6,port.t b/tests/hash:net6,port.t
index b022e06..06f82b7 100644
--- a/tests/hash:net6,port.t
+++ b/tests/hash:net6,port.t
@@ -116,4 +116,56 @@
0 ipset -T test 1:1:1::F,80
# Delete test set
0 ipset destroy test
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -6 netport
+# Nomatch: Check that resizing keeps the nomatch flag
+0 ./resizen.sh -6 netport
+# Counters: create set
+0 ipset n test hash:net,port -6 counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2:0:0::1/64,80 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2:0:0::1/64,80
+# Counters: check counters
+0 ./check_counters test 2:: 5 3456
+# Counters: delete element
+0 ipset d test 2:0:0::1/64,80
+# Counters: test deleted element
+1 ipset t test 2:0:0::1/64,80
+# Counters: add element with packet, byte counters
+0 ipset a test 2:0:0::20/54,453 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2:: 12 9876
+# Counters: update counters
+0 ipset -! a test 2:0:0::20/54,453 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2:: 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:net,port -6 counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2:0:0::1/64,80 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2:0:0::1/64,80
+# Counters and timeout: check counters
+0 ./check_extensions test 2:: 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2:0:0::1/64,80
+# Counters and timeout: test deleted element
+1 ipset t test 2:0:0::1/64,80
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2:0:0::20/54,453 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2:: 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2:0:0::20/54,453 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2:: 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2:0:0::20/54,453 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2:: 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/hash:net6.t b/tests/hash:net6.t
index d0c2652..981dfdb 100644
--- a/tests/hash:net6.t
+++ b/tests/hash:net6.t
@@ -84,4 +84,56 @@
0 ipset -T test 1:1:1::F
# Delete test set
0 ipset destroy test
+# Timeout: Check that resizing keeps timeout values
+0 ./resizet.sh -6 net
+# Nomatch: Check that resizing keeps the nomatch flag
+0 ./resizen.sh -6 net
+# Counters: create set
+0 ipset n test hash:net -6 counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2:0:0::1/64 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2:0:0::1/64
+# Counters: check counters
+0 ./check_counters test 2:: 5 3456
+# Counters: delete element
+0 ipset d test 2:0:0::1/64
+# Counters: test deleted element
+1 ipset t test 2:0:0::1/64
+# Counters: add element with packet, byte counters
+0 ipset a test 2:0:0::20/54 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2:: 12 9876
+# Counters: update counters
+0 ipset -! a test 2:0:0::20/54 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2:: 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test hash:net -6 counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2:0:0::1/64 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2:0:0::1/64
+# Counters and timeout: check counters
+0 ./check_extensions test 2:: 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2:0:0::1/64
+# Counters and timeout: test deleted element
+1 ipset t test 2:0:0::1/64
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2:0:0::20/54 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2:: 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2:0:0::20/54 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2:: 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2:0:0::20/54 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2:: 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/macipmap.t b/tests/macipmap.t
index e10fe03..53b12fa 100644
--- a/tests/macipmap.t
+++ b/tests/macipmap.t
@@ -140,4 +140,52 @@
0 ipset test test 2.0.200.214
# Range: Delete test set
0 ipset -X test
+# Counters: create set
+0 ipset n test bitmap:ip,mac range 2.0.0.1-2.1.0.0 counters
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.1,00:11:22:33:44:57 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 2.0.0.1,00:11:22:33:44:57
+# Counters: check counters
+0 ./check_counters test 2.0.0.1,00:11:22:33:44:57 5 3456
+# Counters: delete element
+0 ipset d test 2.0.0.1,00:11:22:33:44:57
+# Counters: test deleted element
+1 ipset t test 2.0.0.1,00:11:22:33:44:57
+# Counters: add element with packet, byte counters
+0 ipset a test 2.0.0.1,00:11:22:33:44:57 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 2.0.0.1,00:11:22:33:44:57 12 9876
+# Counters: update counters
+0 ipset -! a test 2.0.0.1,00:11:22:33:44:57 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 2.0.0.1,00:11:22:33:44:57 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test bitmap:ip,mac range 2.0.0.1-2.1.0.0 counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.1,00:11:22:33:44:57 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 2.0.0.1,00:11:22:33:44:57
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.1,00:11:22:33:44:57 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 2.0.0.1,00:11:22:33:44:57
+# Counters and timeout: test deleted element
+1 ipset t test 2.0.0.1,00:11:22:33:44:57
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 2.0.0.10,00:11:22:33:44:88 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.10,00:11:22:33:44:88 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 2.0.0.10,00:11:22:33:44:88 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.10,00:11:22:33:44:88 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 2.0.0.10,00:11:22:33:44:88 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 2.0.0.10,00:11:22:33:44:88 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/portmap.t b/tests/portmap.t
index 36ad682..5eeaaff 100644
--- a/tests/portmap.t
+++ b/tests/portmap.t
@@ -90,4 +90,52 @@
0 ipset test test 567
# Full: Delete test set
0 ipset -X test
+# Counters: create set
+0 ipset n test bitmap:port range 1024-65535 counters
+# Counters: add element with packet, byte counters
+0 ipset a test 12345 packets 5 bytes 3456
+# Counters: check element
+0 ipset t test 12345
+# Counters: check counters
+0 ./check_counters test 12345 5 3456
+# Counters: delete element
+0 ipset d test 12345
+# Counters: test deleted element
+1 ipset t test 12345
+# Counters: add element with packet, byte counters
+0 ipset a test 48310 packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test 48310 12 9876
+# Counters: update counters
+0 ipset -! a test 48310 packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test 48310 13 12479
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test bitmap:port range 1024-65535 counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 12345 packets 5 bytes 3456
+# Counters and timeout: check element
+0 ipset t test 12345
+# Counters and timeout: check counters
+0 ./check_extensions test 12345 600 5 3456
+# Counters and timeout: delete element
+0 ipset d test 12345
+# Counters and timeout: test deleted element
+1 ipset t test 12345
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test 48310 packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test 48310 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test 48310 packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test 48310 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test 48310 timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test 48310 700 13 12479
+# Counters and timeout: destroy set
+0 ipset x test
# eof
diff --git a/tests/resizen.sh b/tests/resizen.sh
new file mode 100644
index 0000000..1294efc
--- /dev/null
+++ b/tests/resizen.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+# set -x
+set -e
+
+ipset=../src/ipset
+
+case "$1" in
+ -4)
+ ip=10.0.
+ sep=.
+ net=32
+ ip2=192.168.162.33
+ ;;
+ -6)
+ ip=10::
+ sep=:
+ net=128
+ ip2=192:168::162:33
+ ;;
+esac
+
+case "$2" in
+ ipportnet)
+ $ipset n test hash:ip,port,net $1 hashsize 64
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset a test $ip$x$sep$y,1023,$ip2/$net nomatch
+ done
+ done
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset t test $ip$x$sep$y,1023,$ip2/$net nomatch 2>/dev/null
+ done
+ done
+ ;;
+ net)
+ $ipset n test hash:net $1 hashsize 64
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset a test $ip$x$sep$y/$net nomatch
+ done
+ done
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset t test $ip$x$sep$y/$net nomatch 2>/dev/null
+ done
+ done
+ ;;
+ netport)
+ $ipset n test hash:net,port $1 hashsize 64
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset a test $ip$x$sep$y/$net,1023 nomatch
+ done
+ done
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset t test $ip$x$sep$y/$net,1023 nomatch 2>/dev/null
+ done
+ done
+ ;;
+ netiface)
+ $ipset n test hash:net,iface $1 hashsize 64
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset a test $ip$x$sep$y/$net,eth0 nomatch
+ done
+ done
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset t test $ip$x$sep$y/$net,eth0 nomatch 2>/dev/null
+ done
+ done
+ ;;
+esac
+$ipset x
+exit 0
diff --git a/tests/resizet.sh b/tests/resizet.sh
new file mode 100644
index 0000000..74fb19e
--- /dev/null
+++ b/tests/resizet.sh
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+# set -x
+set -e
+
+ipset=../src/ipset
+
+case "$1" in
+ -4)
+ ip=10.0.
+ sep=.
+ net=32
+ ip2=192.168.162.33
+ ;;
+ -6)
+ ip=10::
+ sep=:
+ net=128
+ ip2=192:168::162:33
+ ;;
+esac
+
+case "$2" in
+ ip)
+ $ipset n test hash:ip $1 hashsize 64 timeout 100
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset a test $ip$x$sep$y
+ done
+ done
+ ;;
+ ipport)
+ $ipset n test hash:ip,port $1 hashsize 64 timeout 100
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset a test $ip$x$sep$y,1023
+ done
+ done
+ ;;
+ ipportip)
+ $ipset n test hash:ip,port,ip $1 hashsize 64 timeout 100
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset a test $ip$x$sep$y,1023,$ip2
+ done
+ done
+ ;;
+ ipportnet)
+ $ipset n test hash:ip,port,net $1 hashsize 64 timeout 100
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset a test $ip$x$sep$y,1023,$ip2/$net
+ done
+ done
+ ;;
+ net)
+ $ipset n test hash:net $1 hashsize 64 timeout 100
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset a test $ip$x$sep$y/$net
+ done
+ done
+ ;;
+ netport)
+ $ipset n test hash:net,port $1 hashsize 64 timeout 100
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset a test $ip$x$sep$y/$net,1023
+ done
+ done
+ ;;
+ netiface)
+ $ipset n test hash:net,iface $1 hashsize 64 timeout 100
+ for x in `seq 0 16`; do
+ for y in `seq 0 255`; do
+ $ipset a test $ip$x$sep$y/$net,eth0
+ done
+ done
+ ;;
+esac
+$ipset l test | grep ^$ip | while read x y z; do
+ if [ $z -lt 10 -o $z -gt 99 ]; then
+ exit 1
+ fi
+done
+$ipset x
+exit 0
diff --git a/tests/runtest.sh b/tests/runtest.sh
index ad2ac42..c34400b 100755
--- a/tests/runtest.sh
+++ b/tests/runtest.sh
@@ -27,11 +27,11 @@ add_tests() {
cmd=ip6tables-save
add=match_target6
fi
- line="`dmesg | tail -1 | cut -d " " -f 2-`"
- if [ ! -e /var/log/kern.log -o -z "`grep -F \"$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
+ #line="`dmesg | tail -1 | cut -d " " -f 2-`"
+ #if [ ! -e /var/log/kern.log -o -z "`grep -F \"$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"
@@ -75,6 +75,14 @@ for types in $tests; do
what=$cmd
continue
;;
+ skip)
+ eval $cmd
+ if [ $? -ne 0 ]; then
+ echo "Skipping tests, '$cmd' failed"
+ break
+ fi
+ continue
+ ;;
*)
;;
esac
diff --git a/tests/setlist.t b/tests/setlist.t
index aa360b9..d505f61 100644
--- a/tests/setlist.t
+++ b/tests/setlist.t
@@ -131,6 +131,86 @@
0 ipset test test a
# Flush all sets
0 ipset flush
-# Delete all sets
-0 ipset -X
+# Delete test set
+0 ipset x test
+# Counters: create set
+0 ipset n test list:set counters
+# Counters: add element with packet, byte counters
+0 ipset a test a packets 5 bytes 3456
+# Counters: check counters
+0 ./check_counters test a 5 3456
+# Counters: delete element
+0 ipset d test a
+# Counters: add element with packet, byte counters
+0 ipset a test b packets 12 bytes 9876
+# Counters: check counters
+0 ./check_counters test b 12 9876
+# Counters: update counters
+0 ipset -! a test b packets 13 bytes 12479
+# Counters: check counters
+0 ./check_counters test b 13 12479
+# Counters: flush test set
+0 ipset f test
+# Counters: destroy set
+0 ipset x test
+# Counters and timeout: create set
+0 ipset n test list:set counters timeout 600
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test a packets 5 bytes 3456
+# Counters and timeout: check counters
+0 ./check_extensions test a 600 5 3456
+# Counters and timeout: add element with packet, byte counters
+0 ipset a test b packets 12 bytes 9876
+# Counters and timeout: check counters
+0 ./check_extensions test b 600 12 9876
+# Counters and timeout: update counters
+0 ipset -! a test b packets 13 bytes 12479
+# Counters and timeout: check counters
+0 ./check_extensions test b 600 13 12479
+# Counters and timeout: update timeout
+0 ipset -! a test b timeout 700
+# Counters and timeout: check counters
+0 ./check_extensions test b 700 13 12479
+# Counters and timeout: flush
+0 ipset f test
+# Counters and timeout: destroy sets
+0 ipset x
+# Counters: require sendip
+skip which sendip >/dev/null
+# Counters: create set
+0 ipset n a hash:ip counters
+# Counters: create list set
+0 ipset n test list:set counters
+# Counters: add elemet with zero counters
+0 ipset a a 10.255.255.64
+# Counters: add set to test set
+0 ipset a test a
+# Counters: generate packets
+0 ./check_sendip_packets -4 src 5
+# Counters: check counters
+0 ./check_counters a 10.255.255.64 5 $((5*40))
+# Counters: check counters in list set
+0 ./check_counters test a 5 $((5*40))
+# Counters: flush sets
+0 ipset f
+# Counters: destroy sets
+0 ipset x
+# Counters and timeout: create set
+0 ipset n a hash:ip counters timeout 600
+# Counters and timeout: create list set
+0 ipset n test list:set counters timeout 600
+# Counters and timeout: add elemet with zero counters
+0 ipset a a 10.255.255.64
+# Counters: add set to test set
+0 ipset a test a
+# Counters and timeout: generate packets
+0 ./check_sendip_packets -4 src 6
+# Counters and timeout: check counters
+0 ./check_extensions a 10.255.255.64 600 6 $((6*40))
+# Counters and timeout: check counters in list set
+0 ./check_extensions test a 600 6 $((6*40))
+# Counters and timeout: flush sets
+0 ipset f
+# Counters and timeout: destroy sets
+0 ipset x
# eof