summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/hash:mac.t53
-rw-r--r--tests/hash:mac.t.list07
-rw-r--r--tests/hash:mac.t.list112
-rw-r--r--tests/hash:mac.t.list28
-rwxr-xr-xtests/runtest.sh2
-rwxr-xr-xtests/setlist_resize.sh2
6 files changed, 82 insertions, 2 deletions
diff --git a/tests/hash:mac.t b/tests/hash:mac.t
new file mode 100644
index 0000000..25739da
--- /dev/null
+++ b/tests/hash:mac.t
@@ -0,0 +1,53 @@
+# MAC: Create a set with timeout
+0 ipset -N test machash --hashsize 128 timeout 5
+# Range: Add zero valued element
+1 ipset -A test 0:0:0:0:0:0
+# Range: Test zero valued element
+1 ipset -T test 0:0:0:0:0:0
+# MAC: Add first random value
+0 ipset -A test 0:0:0:0:2:0 timeout 5
+# MAC: Add second random value
+0 ipset -A test 0:a:0:0:0:0 timeout 0
+# MAC: Test first random value
+0 ipset -T test 0:0:0:0:2:0
+# MAC: Test second random value
+0 ipset -T test 0:a:0:0:0:0
+# MAC: Test value not added to the set
+1 ipset -T test 0:0:0:0:1:0
+# MAC: Add third random value
+0 ipset -A test 1:2:3:4:a:b
+# MAC: Delete the same value
+0 ipset -D test 1:2:3:4:a:b
+# MAC: List set
+0 ipset -L test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
+# MAC: Check listing
+0 diff -u -I 'Size in memory.*' .foo hash:mac.t.list2
+# Sleep 5s so that element can time out
+0 sleep 5
+# MAC: List set
+0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0
+# MAC: Check listing
+0 diff -u -I 'Size in memory.*' .foo hash:mac.t.list0
+# MAC: Destroy test set
+0 ipset -X test
+# MAC: Create a set with skbinfo extension
+0 ipset n test hash:mac skbinfo
+# MAC: Add element with mark
+0 ipset a test 1:2:3:4:5:6 skbmark 0x123456
+# MAC: Add element with mark/mask
+0 ipset a test 1:2:3:4:5:7 skbmark 0x1234ab/0x0000ffff
+# MAC: Add element with skbprio
+0 ipset a test 1:2:3:4:5:8 skbprio 1:20
+# MAC: Add element with skbqueue
+0 ipset a test 1:2:3:4:5:9 skbqueue 11
+# MAC: Add element with mark and skbprio
+0 ipset a test 1:2:3:4:5:10 skbmark 0xaabbccdd skbprio 22:1
+# MAC: Add element with mark, skbprio and skbqueue
+0 ipset a test 1:2:3:4:5:11 skbmark 0x11223344/0xffff0000 skbprio 2:1 skbqueue 8
+# MAC: List set
+0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0
+# MAC: Check listing
+0 diff -u -I 'Size in memory.*' .foo hash:mac.t.list1
+# MAC: Destroy test set
+0 ipset -X test
+# eof
diff --git a/tests/hash:mac.t.list0 b/tests/hash:mac.t.list0
new file mode 100644
index 0000000..c2bbfd6
--- /dev/null
+++ b/tests/hash:mac.t.list0
@@ -0,0 +1,7 @@
+Name: test
+Type: hash:mac
+Header: hashsize 128 maxelem 65536 timeout 5
+Size in memory: 2488
+References: 0
+Members:
+00:0A:00:00:00:00 timeout 0
diff --git a/tests/hash:mac.t.list1 b/tests/hash:mac.t.list1
new file mode 100644
index 0000000..185f35f
--- /dev/null
+++ b/tests/hash:mac.t.list1
@@ -0,0 +1,12 @@
+Name: test
+Type: hash:mac
+Header: hashsize 1024 maxelem 65536 skbinfo
+Size in memory: 17304
+References: 0
+Members:
+01:02:03:04:05:06 skbmark 0x123456
+01:02:03:04:05:07 skbmark 0x1234ab/0xffff
+01:02:03:04:05:08 skbprio 1:20
+01:02:03:04:05:09 skbqueue 11
+01:02:03:04:05:10 skbmark 0xaabbccdd skbprio 22:1
+01:02:03:04:05:11 skbmark 0x11223344/0xffff0000 skbprio 2:1 skbqueue 8
diff --git a/tests/hash:mac.t.list2 b/tests/hash:mac.t.list2
new file mode 100644
index 0000000..2bec98d
--- /dev/null
+++ b/tests/hash:mac.t.list2
@@ -0,0 +1,8 @@
+Name: test
+Type: hash:mac
+Header: hashsize 128 maxelem 65536 timeout x
+Size in memory: 2488
+References: 0
+Members:
+00:00:00:00:02:00 timeout x
+00:0A:00:00:00:00 timeout x
diff --git a/tests/runtest.sh b/tests/runtest.sh
index fbfa154..05550c6 100755
--- a/tests/runtest.sh
+++ b/tests/runtest.sh
@@ -14,7 +14,7 @@ tests="$tests ipportiphash hash:ip,port,ip hash:ip6,port,ip6"
tests="$tests nethash hash:net hash:net6 hash:net,port hash:net6,port"
tests="$tests hash:ip,port,net hash:ip6,port,net6 hash:net,net hash:net6,net6"
tests="$tests hash:net,port,net hash:net6,port,net6"
-tests="$tests hash:net,iface.t"
+tests="$tests hash:net,iface.t hash:mac.t"
tests="$tests comment setlist restore"
# tests="$tests iptree iptreemap"
diff --git a/tests/setlist_resize.sh b/tests/setlist_resize.sh
index 01d1cfc..3255656 100755
--- a/tests/setlist_resize.sh
+++ b/tests/setlist_resize.sh
@@ -9,7 +9,7 @@ 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_hash_ip ip_set_hash_netnet \
- ip_set_hash_netportnet ip_set_hash_ipmark \
+ ip_set_hash_netportnet ip_set_hash_ipmark ip_set_hash_mac \
ip_set_bitmap_port ip_set_bitmap_ipmac \
ip_set_bitmap_ip xt_set ip_set; do
rmmod $x