summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2012-11-19 11:37:24 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2012-11-19 11:37:24 +0100
commit682708bea031d2b803daa9417f7133106d5c688c (patch)
treec2f3eb8a7616fba9adc436f0d21af5aaae11b508 /tests
parent8a16124b84e908dfd979b4c8489d39023a7e2631 (diff)
Increase the number of maximal sets automatically as needed
The max number of sets was hardcoded at kernel cofiguration time. The patch adds the support to increase the max number of sets automatically.
Diffstat (limited to 'tests')
-rw-r--r--tests/restore.t2
-rwxr-xr-xtests/setlist_resize.sh32
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/restore.t b/tests/restore.t
index b151be8..ffde2d1 100644
--- a/tests/restore.t
+++ b/tests/restore.t
@@ -4,4 +4,6 @@
0 ipset save > .foo && diff restore.t.multi.saved .foo
# Delete all sets
0 ipset x
+# Check auto-increasing maximal number of sets
+0 ./setlist_resize.sh
# eof
diff --git a/tests/setlist_resize.sh b/tests/setlist_resize.sh
new file mode 100755
index 0000000..42b17f8
--- /dev/null
+++ b/tests/setlist_resize.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# set -x
+
+loop=8
+
+for x in ip_set_list_set ip_set_hash_netiface ip_set_hash_ipportnet \
+ ip_set_hash_netport ip_set_hash_net ip_set_hash_ipportip \
+ ip_set_hash_ipport ip_set_bitmap_port ip_set_bitmap_ipmac \
+ ip_set_bitmap_ip xt_set ip_set; do
+ rmmod $x
+done
+
+create() {
+ n=$1
+ while [ $n -le 1024 ]; do
+ ../src/ipset c test$n hash:ip
+ n=$((n+2))
+ done
+}
+
+for x in `seq 1 $loop`; do
+ # echo "test round $x"
+ create 1 &
+ create 2 &
+ wait
+ test `../src/ipset l -n | wc -l` -eq 1024 || exit 1
+ ../src/ipset x
+ test `lsmod|grep -w ^ip_set_hash_ip | awk '{print $3}'` -eq 0 || exit 1
+ rmmod ip_set_hash_ip
+ rmmod ip_set
+done