summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bitmap:ip.t151
-rw-r--r--tests/bitmap:ip.t.list09
-rw-r--r--tests/bitmap:ip.t.list19
-rw-r--r--tests/bitmap:ip.t.list29
-rw-r--r--tests/bitmap:ip.t.list310
-rw-r--r--tests/hash:ip.t79
-rw-r--r--tests/hash:ip.t.list09
-rw-r--r--tests/hash:ip.t.list19
-rw-r--r--tests/iphash.t.restore.old131
-rw-r--r--tests/ipmap.t.list410
-rw-r--r--tests/macipmap.t.list29
-rw-r--r--tests/portmap.t.list29
12 files changed, 444 insertions, 0 deletions
diff --git a/tests/bitmap:ip.t b/tests/bitmap:ip.t
new file mode 100644
index 0000000..b44f5c4
--- /dev/null
+++ b/tests/bitmap:ip.t
@@ -0,0 +1,151 @@
+# Range: Try to create from an invalid range with timeout
+1 ipset create test bitmap:ip range 2.0.0.1-2.1.0.1 timeout 5
+# Range: Create a set from a valid range with timeout
+0 ipset create test bitmap:ip range 2.0.0.1-2.1.0.0 timeout 5
+# Range: Add lower boundary
+0 ipset add test 2.0.0.1 timeout 10
+# Range: Add upper boundary
+0 ipset add test 2.1.0.0 timeout 0
+# Range: Test lower boundary
+0 ipset test test 2.0.0.1
+# Range: Test upper boundary
+0 ipset test test 2.1.0.0
+# Range: Test element not added to the set
+1 ipset test test 2.0.0.2
+# Range: Test element before lower boundary
+1 ipset test test 2.0.0.0
+# Range: Test element after upper boundary
+1 ipset test test 2.1.0.1
+# Range: Try to add element before lower boundary
+1 ipset add test 2.0.0.0
+# Range: Try to add element after upper boundary
+1 ipset add test 2.1.0.1
+# Range: Delete element not added to the set
+1 ipset -D test 2.0.0.2
+# Range: Delete element not added to the set, with exist flag
+0 ipset -x -D test 2.0.0.2
+# Range: Add element in the middle
+0 ipset -A test 2.0.0.128
+# Range: Add element in the middle again
+1 ipset -A test 2.0.0.128
+# Range: Add element in the middle again, with exist flag
+0 ipset -x -A test 2.0.0.128
+# Range: Delete the same element
+0 ipset -D test 2.0.0.128
+# Range: Add a range of elements
+0 ipset -A test 2.0.0.128-2.0.0.131 timeout 6
+# Range: List set
+0 ipset list test > .foo
+# Range: Check listing
+0 grep '2.0.0.1 timeout' .foo >/dev/null
+# 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
+# Range: Flush test set
+0 ipset flush test
+# Range: Delete test set
+0 ipset destroy test
+# Network: Try to create a set from an invalid network with timeout
+1 ipset create test bitmap:ip range 2.0.0.0/15
+# Network: Create a set from a valid network with timeout
+0 ipset create test bitmap:ip range 2.0.0.0/16 timeout 5
+# Network: Add lower boundary
+0 ipset add test 2.0.0.0 timeout 0
+# Network: Add upper boundary
+0 ipset add test 2.0.255.255 timeout 10
+# Network: Test lower boundary
+0 ipset test test 2.0.0.0
+# Network: Test upper boundary
+0 ipset test test 2.0.255.255
+# Network: Test element not added to the set
+1 ipset test test 2.0.0.1
+# Network: Test element before lower boundary
+1 ipset test test 1.255.255.255
+# Network: Test element after upper boundary
+1 ipset test test 2.1.0.0
+# Network: Try to add element before lower boundary
+1 ipset add test 1.255.255.255
+# Network: Try to add element after upper boundary
+1 ipset add test 2.1.0.0
+# Network: Delete element not added to the set
+1 ipset -D test 2.0.0.2
+# Network: Add element in the middle
+0 ipset -A test 2.0.0.128 timeout 20
+# Network: Delete the same element
+0 ipset -D test 2.0.0.128
+# Network: List set
+0 ipset list test > .foo
+# Network: Check listing
+0 grep '2.0.255.255 timeout' .foo >/dev/null
+# 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
+# Network: Flush test set
+0 ipset flush test
+# Network: Delete test set
+0 ipset destroy test
+# Subnets: Create a set to store networks with timeout
+0 ipset create test bitmap:ip range 10.0.0.0/8 netmask 24 timeout 5
+# Subnets: Add lower boundary
+0 ipset add test 10.0.0.0 timeout 10
+# Subnets: Add upper boundary
+0 ipset add test 10.255.255.255 timeout 0
+# Subnets: Test lower boundary
+0 ipset test test 10.0.0.255
+# Subnets: Test upper boundary
+0 ipset test test 10.255.255.0
+# Subnets: Test element not added to the set
+1 ipset test test 10.1.0.0
+# Subnets: Test element before lower boundary
+1 ipset test test 9.255.255.255
+# Subnets: Test element after upper boundary
+1 ipset test test 11.0.0.0
+# Subnets: Try to add element before lower boundary
+1 ipset add test 9.255.255.255
+# Subnets: Try to add element after upper boundary
+1 ipset add test 11.0.0.0
+# Subnets: Try to delete element not added to the set
+1 ipset -D test 10.2.0.0
+# Subnets: Add element to the set
+0 ipset -A test 10.2.0.0
+# Subnets: Delete the same element from the set
+0 ipset -D test 10.2.0.0
+# Subnets: Add a subnet of subnets
+0 ipset -A test 10.8.0.0/16 timeout 8
+# Subnets: Check listing
+0 ipset list test | grep '10.0.0.0 timeout' >/dev/null
+# 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
+# Subnets: Flush test set
+0 ipset flush test
+# Subnets: Delete test set
+0 ipset destroy test
+# Full: Create full IPv4 space with /16 networks and timeout
+0 ipset create test bitmap:ip range 0.0.0.0/0 netmask 16 timeout 5
+# Full: Add lower boundary
+0 ipset add test 0.0.255.255 timeout 0
+# Full: Add upper boundary
+0 ipset add test 255.255.0.0 timeout 0
+# Full: Test lower boundary
+0 ipset test test 0.0.0.0
+# Full: Test upper boundary
+0 ipset test test 255.255.255.255
+# Full: Test element not added to the set
+1 ipset test test 0.1.0.0
+# Full: List set
+0 ipset list test > .foo
+# Full: Check listing
+0 diff .foo bitmap:ip.t.list3 && rm .foo
+# Full: Delete test set
+0 ipset destroy test
+# eof
diff --git a/tests/bitmap:ip.t.list0 b/tests/bitmap:ip.t.list0
new file mode 100644
index 0000000..0be60c0
--- /dev/null
+++ b/tests/bitmap:ip.t.list0
@@ -0,0 +1,9 @@
+Name: test
+Type: bitmap:ip
+Header: range 2.0.0.1-2.1.0.0 timeout 5
+Elements: 1
+Size in memory: 524288
+References: 0
+Members:
+2.1.0.0 timeout 0
+
diff --git a/tests/bitmap:ip.t.list1 b/tests/bitmap:ip.t.list1
new file mode 100644
index 0000000..02ccdaa
--- /dev/null
+++ b/tests/bitmap:ip.t.list1
@@ -0,0 +1,9 @@
+Name: test
+Type: bitmap:ip
+Header: range 2.0.0.0-2.0.255.255 timeout 5
+Elements: 1
+Size in memory: 524288
+References: 0
+Members:
+2.0.0.0 timeout 0
+
diff --git a/tests/bitmap:ip.t.list2 b/tests/bitmap:ip.t.list2
new file mode 100644
index 0000000..7b17999
--- /dev/null
+++ b/tests/bitmap:ip.t.list2
@@ -0,0 +1,9 @@
+Name: test
+Type: bitmap:ip
+Header: range 10.0.0.0-10.255.255.255 netmask 24 timeout 5
+Elements: 1
+Size in memory: 524288
+References: 0
+Members:
+10.255.255.0 timeout 0
+
diff --git a/tests/bitmap:ip.t.list3 b/tests/bitmap:ip.t.list3
new file mode 100644
index 0000000..677bb2a
--- /dev/null
+++ b/tests/bitmap:ip.t.list3
@@ -0,0 +1,10 @@
+Name: test
+Type: bitmap:ip
+Header: range 0.0.0.0-255.255.255.255 netmask 16 timeout 5
+Elements: 2
+Size in memory: 524288
+References: 0
+Members:
+0.0.0.0 timeout 0
+255.255.0.0 timeout 0
+
diff --git a/tests/hash:ip.t b/tests/hash:ip.t
new file mode 100644
index 0000000..de6b0df
--- /dev/null
+++ b/tests/hash:ip.t
@@ -0,0 +1,79 @@
+# IP: Create a set with timeout
+0 ipset -N test iphash --hashsize 128 timeout 5
+# Range: Add zero valued element
+1 ipset -A test 0.0.0.0
+# Range: Test zero valued element
+1 ipset -T test 0.0.0.0
+# IP: Add first random value
+0 ipset -A test 2.0.0.1 timeout 5
+# IP: Add second random value
+0 ipset -A test 192.168.68.69 timeout 0
+# IP: Test first random value
+0 ipset -T test 2.0.0.1
+# IP: Test second random value
+0 ipset -T test 192.168.68.69
+# IP: Test value not added to the set
+1 ipset -T test 2.0.0.2
+# IP: Add third random value
+0 ipset -A test 200.100.0.12
+# IP: Delete the same value
+0 ipset -D test 200.100.0.12
+# Sleep 6s so that element can time out
+0 sleep 6
+# IP: List set
+0 ipset -L test 2>/dev/null > .foo0 && ./sort.sh .foo0
+# IP: Check listing
+0 diff .foo hash:ip.t.list0 && rm .foo
+# IP: Flush test set
+0 ipset -F test
+# IP: Delete test set
+0 ipset -X test
+# IP: Restore values so that rehashing is triggered
+0 sed 's/hashsize 128/hashsize 128 timeout 6/' iphash.t.restore | ipset -R
+# IP: Check that the values are restored
+0 test `ipset -S test| grep add| wc -l` -eq 129
+# Sleep 8s so that elements can time out
+0 sleep 8
+# IP: check that elements timed out
+0 test `ipset -S test| grep add| wc -l` -eq 0
+# IP: Flush test set
+0 ipset -F test
+# IP: Delete test set
+0 ipset -X test
+# Network: Create a set with timeout
+0 ipset -N test iphash --hashsize 128 --netmask 24 timeout 6
+# Network: Add zero valued element
+1 ipset -A test 0.0.0.0
+# Network: Test zero valued element
+1 ipset -T test 0.0.0.0
+# Network: Delete zero valued element
+1 ipset -D test 0.0.0.0
+# Network: Add first random network
+0 ipset -A test 2.0.0.1
+# Network: Add second random network
+0 ipset -A test 192.168.68.69
+# Network: Test first random value
+0 ipset -T test 2.0.0.255
+# Network: Test second random value
+0 ipset -T test 192.168.68.95
+# Network: Test value not added to the set
+1 ipset -T test 2.0.1.0
+# Network: List set
+0 ipset -L test > .foo && grep '2.0.0.0 timeout' .foo >/dev/null && grep '192.168.68.0 timeout' .foo >/dev/null && rm .foo
+# Network: Add third element
+0 ipset -A test 200.100.10.1 timeout 0
+# Network: Add third random network
+0 ipset -A test 200.100.0.12
+# Network: Delete the same network
+0 ipset -D test 200.100.0.12
+# Sleep 6s so that elements can time out
+0 sleep 6
+# Network: List set
+0 ipset -L test > .foo
+# Network: Check listing
+0 diff .foo hash:ip.t.list1 && rm .foo
+# Network: Flush test set
+0 ipset -F test
+# Network: Delete test set
+0 ipset -X test
+# eof
diff --git a/tests/hash:ip.t.list0 b/tests/hash:ip.t.list0
new file mode 100644
index 0000000..cf2ecac
--- /dev/null
+++ b/tests/hash:ip.t.list0
@@ -0,0 +1,9 @@
+Name: test
+Type: hash:ip
+Header: hashsize 128 maxelem 65536 probes 4 resize 50 timeout 5
+Elements: 1
+Size in memory: 2048
+References: 0
+Members:
+192.168.68.69 timeout 0
+
diff --git a/tests/hash:ip.t.list1 b/tests/hash:ip.t.list1
new file mode 100644
index 0000000..c564ba0
--- /dev/null
+++ b/tests/hash:ip.t.list1
@@ -0,0 +1,9 @@
+Name: test
+Type: hash:ip
+Header: hashsize 128 maxelem 65536 probes 4 resize 50 netmask 24 timeout 6
+Elements: 1
+Size in memory: 2048
+References: 0
+Members:
+200.100.10.0 timeout 0
+
diff --git a/tests/iphash.t.restore.old b/tests/iphash.t.restore.old
new file mode 100644
index 0000000..fd915cc
--- /dev/null
+++ b/tests/iphash.t.restore.old
@@ -0,0 +1,131 @@
+-N test iphash --hashsize 128
+-A test 10.0.0.0
+-A test 10.0.0.1
+-A test 10.0.0.10
+-A test 10.0.0.100
+-A test 10.0.0.101
+-A test 10.0.0.102
+-A test 10.0.0.103
+-A test 10.0.0.104
+-A test 10.0.0.105
+-A test 10.0.0.106
+-A test 10.0.0.107
+-A test 10.0.0.108
+-A test 10.0.0.109
+-A test 10.0.0.11
+-A test 10.0.0.110
+-A test 10.0.0.111
+-A test 10.0.0.112
+-A test 10.0.0.113
+-A test 10.0.0.114
+-A test 10.0.0.115
+-A test 10.0.0.116
+-A test 10.0.0.117
+-A test 10.0.0.118
+-A test 10.0.0.119
+-A test 10.0.0.12
+-A test 10.0.0.120
+-A test 10.0.0.121
+-A test 10.0.0.122
+-A test 10.0.0.123
+-A test 10.0.0.124
+-A test 10.0.0.125
+-A test 10.0.0.126
+-A test 10.0.0.127
+-A test 10.0.0.128
+-A test 10.0.0.13
+-A test 10.0.0.14
+-A test 10.0.0.15
+-A test 10.0.0.16
+-A test 10.0.0.17
+-A test 10.0.0.18
+-A test 10.0.0.19
+-A test 10.0.0.2
+-A test 10.0.0.20
+-A test 10.0.0.21
+-A test 10.0.0.22
+-A test 10.0.0.23
+-A test 10.0.0.24
+-A test 10.0.0.25
+-A test 10.0.0.26
+-A test 10.0.0.27
+-A test 10.0.0.28
+-A test 10.0.0.29
+-A test 10.0.0.3
+-A test 10.0.0.30
+-A test 10.0.0.31
+-A test 10.0.0.32
+-A test 10.0.0.33
+-A test 10.0.0.34
+-A test 10.0.0.35
+-A test 10.0.0.36
+-A test 10.0.0.37
+-A test 10.0.0.38
+-A test 10.0.0.39
+-A test 10.0.0.4
+-A test 10.0.0.40
+-A test 10.0.0.41
+-A test 10.0.0.42
+-A test 10.0.0.43
+-A test 10.0.0.44
+-A test 10.0.0.45
+-A test 10.0.0.46
+-A test 10.0.0.47
+-A test 10.0.0.48
+-A test 10.0.0.49
+-A test 10.0.0.5
+-A test 10.0.0.50
+-A test 10.0.0.51
+-A test 10.0.0.52
+-A test 10.0.0.53
+-A test 10.0.0.54
+-A test 10.0.0.55
+-A test 10.0.0.56
+-A test 10.0.0.57
+-A test 10.0.0.58
+-A test 10.0.0.59
+-A test 10.0.0.6
+-A test 10.0.0.60
+-A test 10.0.0.61
+-A test 10.0.0.62
+-A test 10.0.0.63
+-A test 10.0.0.64
+-A test 10.0.0.65
+-A test 10.0.0.66
+-A test 10.0.0.67
+-A test 10.0.0.68
+-A test 10.0.0.69
+-A test 10.0.0.7
+-A test 10.0.0.70
+-A test 10.0.0.71
+-A test 10.0.0.72
+-A test 10.0.0.73
+-A test 10.0.0.74
+-A test 10.0.0.75
+-A test 10.0.0.76
+-A test 10.0.0.77
+-A test 10.0.0.78
+-A test 10.0.0.79
+-A test 10.0.0.8
+-A test 10.0.0.80
+-A test 10.0.0.81
+-A test 10.0.0.82
+-A test 10.0.0.83
+-A test 10.0.0.84
+-A test 10.0.0.85
+-A test 10.0.0.86
+-A test 10.0.0.87
+-A test 10.0.0.88
+-A test 10.0.0.89
+-A test 10.0.0.9
+-A test 10.0.0.90
+-A test 10.0.0.91
+-A test 10.0.0.92
+-A test 10.0.0.93
+-A test 10.0.0.94
+-A test 10.0.0.95
+-A test 10.0.0.96
+-A test 10.0.0.97
+-A test 10.0.0.98
+-A test 10.0.0.99
+COMMIT
diff --git a/tests/ipmap.t.list4 b/tests/ipmap.t.list4
new file mode 100644
index 0000000..f498ba9
--- /dev/null
+++ b/tests/ipmap.t.list4
@@ -0,0 +1,10 @@
+Name: test
+Type: bitmap:ip
+Header: range 0.0.0.0-255.255.255.255 netmask 16
+Elements: 2
+Size in memory: 8192
+References: 0
+Members:
+0.0.0.0
+255.255.0.0
+
diff --git a/tests/macipmap.t.list2 b/tests/macipmap.t.list2
new file mode 100644
index 0000000..9d0413e
--- /dev/null
+++ b/tests/macipmap.t.list2
@@ -0,0 +1,9 @@
+Name: test
+Type: bitmap:ip,mac
+Header: range 2.0.0.1-2.1.0.0 timeout 10
+Elements: 1
+Size in memory: 1048576
+References: 0
+Members:
+2.1.0.0 timeout 5
+
diff --git a/tests/portmap.t.list2 b/tests/portmap.t.list2
new file mode 100644
index 0000000..66e06b8
--- /dev/null
+++ b/tests/portmap.t.list2
@@ -0,0 +1,9 @@
+Name: test
+Type: bitmap:port
+Header: range 0-65535 timeout 8
+Elements: 1
+Size in memory: 524288
+References: 0
+Members:
+65535 timeout 0
+