From 020936c8c3375e1efe44a3087c891a4b2cbfe044 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Tue, 22 Jun 2010 10:49:41 +0200 Subject: ipset 5: last new feature added - the hash types can now store protocol together port, not only port - lots of fixes everywhere: parser, error reporting, manpage The last bits on the todo list before announcing ipset 5: - recheck all the error messages - add possibly more tests - polish manpage --- tests/hash:ip,port,ip.t | 50 ++++++++++++++--------------- tests/hash:ip,port.t | 64 +++++++++++++++++++++++++------------ tests/hash:ip,port.t.list2 | 10 ++++++ tests/hash:ip6,port,ip6.t | 50 ++++++++++++++--------------- tests/hash:ip6,port.t | 42 ++++++++++++------------ tests/hash:net.t | 36 ++++++++++----------- tests/hash:net6.t | 36 ++++++++++----------- tests/init.t | 2 ++ tests/ipmap.t | 18 +++++++++++ tests/ipporthash.t | 70 ++++++++++++++++++++-------------------- tests/ipportiphash.t | 80 +++++++++++++++++++++++----------------------- tests/nethash.t | 36 ++++++++++----------- tests/setlist.t | 54 +++++++++++++++---------------- 13 files changed, 300 insertions(+), 248 deletions(-) create mode 100644 tests/hash:ip,port.t.list2 (limited to 'tests') diff --git a/tests/hash:ip,port,ip.t b/tests/hash:ip,port,ip.t index 3c74cd9..cc6783b 100644 --- a/tests/hash:ip,port,ip.t +++ b/tests/hash:ip,port,ip.t @@ -1,51 +1,51 @@ -# Range: Create a set with timeout +# Create a set with timeout 0 ipset create test hash:ip,port,ip timeout 5 -# Range: Add partly zero valued element +# Add partly zero valued element 0 ipset add test 2.0.0.1,0,0.0.0.0 -# Range: Test partly zero valued element +# Test partly zero valued element 0 ipset test test 2.0.0.1,0,0.0.0.0 -# Range: Delete party zero valued element +# Delete party zero valued element 0 ipset del test 2.0.0.1,0,0.0.0.0 -# Range: Add almost zero valued element +# Add almost zero valued element 0 ipset add test 2.0.0.1,0,0.0.0.1 -# Range: Test almost zero valued element +# Test almost zero valued element 0 ipset test test 2.0.0.1,0,0.0.0.1 -# Range: Delete almost zero valued element +# Delete almost zero valued element 0 ipset del test 2.0.0.1,0,0.0.0.1 -# Range: Add lower boundary +# Add lower boundary 0 ipset add test 2.0.0.1,5,1.1.1.1 -# Range: Add upper boundary +# Add upper boundary 0 ipset add test 2.1.0.0,128,2.2.2.2 -# Range: Test lower boundary +# Test lower boundary 0 ipset test test 2.0.0.1,5,1.1.1.1 -# Range: Test upper boundary +# Test upper boundary 0 ipset test test 2.1.0.0,128,2.2.2.2 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset test test 2.0.0.1,5,1.1.1.2 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset test test 2.0.0.1,6,1.1.1.1 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset test test 2.0.0.2,6,1.1.1.1 -# Range: Test value before lower boundary +# Test value before lower boundary 1 ipset test test 2.0.0.0,5,1.1.1.1 -# Range: Test value after upper boundary +# Test value after upper boundary 1 ipset test test 2.1.0.1,128,2.2.2.2 -# Range: Try to add value before lower boundary +# Try to add value before lower boundary 0 ipset add test 2.0.0.0,5,1.1.1.1 -# Range: Try to add value after upper boundary +# Try to add value after upper boundary 0 ipset add test 2.1.0.1,128,2.2.2.2 -# Range: List set +# List set 0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo hash:ip,port,ip.t.list0 && rm .foo -# Range: Sleep 6s so that elements can time out +# Sleep 6s so that elements can time out 0 sleep 6 -# Range: List set +# List set 0 ipset list test > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo hash:ip,port,ip.t.list1 && rm .foo -# Range: Flush test set +# Flush test set 0 ipset flush test -# Range: Delete test set +# Delete test set 0 ipset destroy test # eof diff --git a/tests/hash:ip,port.t b/tests/hash:ip,port.t index cb88f96..e3b292b 100644 --- a/tests/hash:ip,port.t +++ b/tests/hash:ip,port.t @@ -1,43 +1,65 @@ -# Range: Create a set with timeout +# Create a set with timeout 0 ipset create test hash:ip,port timeout 5 -# Range: Add partly zero valued element +# Add partly zero valued element 0 ipset add test 2.0.0.1,0 -# Range: Test partly zero valued element +# Test partly zero valued element 0 ipset test test 2.0.0.1,0 -# Range: Delete partly zero valued element +# Delete partly zero valued element 0 ipset del test 2.0.0.1,0 -# Range: Add lower boundary +# Add lower boundary 0 ipset add test 2.0.0.1,5 -# Range: Add upper boundary +# Add upper boundary 0 ipset add test 2.1.0.0,128 -# Range: Test lower boundary +# Test lower boundary 0 ipset test test 2.0.0.1,5 -# Range: Test upper boundary +# Test upper boundary 0 ipset test test 2.1.0.0,128 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset test test 2.0.0.1,4 -# Range: Delete value not added to the set +# Delete value not added to the set 1 ipset del test 2.0.0.1,6 -# Range: Test value before lower boundary +# Test value before lower boundary 1 ipset test test 2.0.0.0,5 -# Range: Test value after upper boundary +# Test value after upper boundary 1 ipset test test 2.1.0.1,128 -# Range: Try to add value before lower boundary +# Try to add value before lower boundary 0 ipset add test 2.0.0.0,5 -# Range: Try to add value after upper boundary +# Try to add value after upper boundary 0 ipset add test 2.1.0.1,128 -# Range: List set +# List set 0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo hash:ip,port.t.list0 && rm .foo -# Range: Sleep 6s so that elements can time out +# Sleep 6s so that elements can time out 0 sleep 6 -# Range: List set +# List set 0 ipset list test > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo hash:ip,port.t.list1 && rm .foo -# Range: Flush test set +# Flush test set 0 ipset flush test -# Range: Delete test set +# Delete test set +0 ipset destroy test +# Create a set with default TCP protocol +0 ipset create test hash:ip,port proto tcp +# Add element without specifying protocol +0 ipset add test 2.0.0.1,80 +# Add "same" element but with UDP protocol +0 ipset add test 2.0.0.1,udp:80 +# Test element without specifying protocol +0 ipset test test 2.0.0.1,80 +# Test element with TCP protocol +0 ipset test test 2.0.0.1,tcp:80 +# Test element with UDP protocol +0 ipset test test 2.0.0.1,udp:80 +# Add element with ospf +0 ipset add test 2.0.0.1,ospf:0 +# Test element with ospf +0 ipset test test 2.0.0.1,ospf:0 +# List set +0 ipset list test > .foo0 && ./sort.sh .foo0 +# Check listing +0 diff -I 'Size in memory.*' .foo hash:ip,port.t.list2 && rm .foo +# Delete set 0 ipset destroy test # eof diff --git a/tests/hash:ip,port.t.list2 b/tests/hash:ip,port.t.list2 new file mode 100644 index 0000000..e8a9db0 --- /dev/null +++ b/tests/hash:ip,port.t.list2 @@ -0,0 +1,10 @@ +Name: test +Type: hash:ip,port +Header: family inet hashsize 1024 maxelem 65536 proto tcp +Size in memory: 8424 +References: 0 +Members: +2.0.0.1,ospf:0 +2.0.0.1,tcp:80 +2.0.0.1,udp:80 + diff --git a/tests/hash:ip6,port,ip6.t b/tests/hash:ip6,port,ip6.t index 84afdf9..712db33 100644 --- a/tests/hash:ip6,port,ip6.t +++ b/tests/hash:ip6,port,ip6.t @@ -1,51 +1,51 @@ -# Range: Create a set with timeout +# Create a set with timeout 0 ipset create test hash:ip,port,ip family inet6 timeout 5 -# Range: Add partly zero valued element +# Add partly zero valued element 0 ipset add test 2:0:0::1,0,0:0:0::0 -# Range: Test partly zero valued element +# Test partly zero valued element 0 ipset test test 2:0:0::1,0,0:0:0::0 -# Range: Delete party zero valued element +# Delete party zero valued element 0 ipset del test 2:0:0::1,0,0:0:0::0 -# Range: Add almost zero valued element +# Add almost zero valued element 0 ipset add test 2:0:0::1,0,0:0:0::1 -# Range: Test almost zero valued element +# Test almost zero valued element 0 ipset test test 2:0:0::1,0,0:0:0::1 -# Range: Delete almost zero valued element +# Delete almost zero valued element 0 ipset del test 2:0:0::1,0,0:0:0::1 -# Range: Add lower boundary +# Add lower boundary 0 ipset add test 2:0:0::1,5,1:1:1::1 -# Range: Add upper boundary +# Add upper boundary 0 ipset add test 2:1:0::0,128,2:2:2::2 -# Range: Test lower boundary +# Test lower boundary 0 ipset test test 2:0:0::1,5,1:1:1::1 -# Range: Test upper boundary +# Test upper boundary 0 ipset test test 2:1:0::0,128,2:2:2::2 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset test test 2:0:0::1,5,1:1:1::2 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset test test 2:0:0::1,6,1:1:1::1 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset test test 2:0:0::2,6,1:1:1::1 -# Range: Test value before lower boundary +# Test value before lower boundary 1 ipset test test 2:0:0::0,5,1:1:1::1 -# Range: Test value after upper boundary +# Test value after upper boundary 1 ipset test test 2:1:0::1,128,2:2:2::2 -# Range: Try to add value before lower boundary +# Try to add value before lower boundary 0 ipset add test 2:0:0::0,5,1:1:1::1 -# Range: Try to add value after upper boundary +# Try to add value after upper boundary 0 ipset add test 2:1:0::1,128,2:2:2::2 -# Range: List set +# List set 0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo hash:ip6,port,ip6.t.list0 && rm .foo -# Range: Sleep 6s so that elements can time out +# Sleep 6s so that elements can time out 0 sleep 6 -# Range: List set +# List set 0 ipset list test > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo hash:ip6,port,ip6.t.list1 && rm .foo -# Range: Flush test set +# Flush test set 0 ipset flush test -# Range: Delete test set +# Delete test set 0 ipset destroy test # eof diff --git a/tests/hash:ip6,port.t b/tests/hash:ip6,port.t index feb525c..5b00942 100644 --- a/tests/hash:ip6,port.t +++ b/tests/hash:ip6,port.t @@ -1,43 +1,43 @@ -# Range: Create a set with timeout +# Create a set with timeout 0 ipset create test hash:ip,port family inet6 timeout 5 -# Range: Add partly zero valued element +# Add partly zero valued element 0 ipset add test 2:0:0::1,0 -# Range: Test partly zero valued element +# Test partly zero valued element 0 ipset test test 2:0:0::1,0 -# Range: Delete partly zero valued element +# Delete partly zero valued element 0 ipset del test 2:0:0::1,0 -# Range: Add lower boundary +# Add lower boundary 0 ipset add test 2:0:0::1,5 -# Range: Add upper boundary +# Add upper boundary 0 ipset add test 2:1:0::0,128 -# Range: Test lower boundary +# Test lower boundary 0 ipset test test 2:0:0::1,5 -# Range: Test upper boundary +# Test upper boundary 0 ipset test test 2:1:0::0,128 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset test test 2:0:0::1,4 -# Range: Delete value not added to the set +# Delete value not added to the set 1 ipset del test 2:0:0::1,6 -# Range: Test value before lower boundary +# Test value before lower boundary 1 ipset test test 2:0:0::0,5 -# Range: Test value after upper boundary +# Test value after upper boundary 1 ipset test test 2:1:0::1,128 -# Range: Try to add value before lower boundary +# Try to add value before lower boundary 0 ipset add test 2:0:0::0,5 -# Range: Try to add value after upper boundary +# Try to add value after upper boundary 0 ipset add test 2:1:0::1,128 -# Range: List set +# List set 0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo hash:ip6,port.t.list0 && rm .foo -# Range: Sleep 6s so that elements can time out +# Sleep 6s so that elements can time out 0 sleep 6 -# Range: List set +# List set 0 ipset list test > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo hash:ip6,port.t.list1 && rm .foo -# Range: Flush test set +# Flush test set 0 ipset flush test -# Range: Delete test set +# Delete test set 0 ipset destroy test # eof diff --git a/tests/hash:net.t b/tests/hash:net.t index b46ac86..c27bb65 100644 --- a/tests/hash:net.t +++ b/tests/hash:net.t @@ -1,40 +1,40 @@ # Create a set with timeout 0 ipset create test nethash hashsize 128 timeout 6 -# Range: Add zero valued element +# Add zero valued element 1 ipset add test 0.0.0.0/0 -# Range: Test zero valued element +# Test zero valued element 1 ipset test test 0.0.0.0/0 -# Range: Delete zero valued element +# Delete zero valued element 1 ipset del test 0.0.0.0/0 -# Range: Try to add /0 +# Try to add /0 1 ipset add test 1.1.1.1/0 -# Range: Try to add /32 +# Try to add /32 0 ipset add test 1.1.1.1/32 -# Range: Add almost zero valued element +# Add almost zero valued element 0 ipset add test 0.0.0.0/1 -# Range: Test almost zero valued element +# Test almost zero valued element 0 ipset test test 0.0.0.0/1 -# Range: Delete almost zero valued element +# Delete almost zero valued element 0 ipset del test 0.0.0.0/1 -# Range: Test deleted element +# Test deleted element 1 ipset test test 0.0.0.0/1 -# Range: Delete element not added to the set +# Delete element not added to the set 1 ipset del test 0.0.0.0/1 -# Range: Add first random network +# Add first random network 0 ipset add test 2.0.0.1/24 -# Range: Add second random network +# Add second random network 0 ipset add test 192.168.68.69/27 -# Range: Test first random value +# Test first random value 0 ipset test test 2.0.0.255 -# Range: Test second random value +# Test second random value 0 ipset test test 192.168.68.95 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset test test 2.0.1.0 -# Range: Try to add IP address +# Try to add IP address 0 ipset add test 2.0.0.1 -# Range: List set +# List set 0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo hash:net.t.list0 && rm .foo # Sleep 6s so that element can time out 0 sleep 6 diff --git a/tests/hash:net6.t b/tests/hash:net6.t index e4246d9..5a575d1 100644 --- a/tests/hash:net6.t +++ b/tests/hash:net6.t @@ -1,40 +1,40 @@ # Create a set with timeout 0 ipset create test nethash family inet6 hashsize 128 timeout 6 -# Range: Add zero valued element +# Add zero valued element 1 ipset add test ::/0 -# Range: Test zero valued element +# Test zero valued element 1 ipset test test ::/0 -# Range: Delete zero valued element +# Delete zero valued element 1 ipset del test ::/0 -# Range: Try to add /0 +# Try to add /0 1 ipset add test 1:1:1::1/0 -# Range: Try to add /32 +# Try to add /32 0 ipset add test 1:1:1::1/128 -# Range: Add almost zero valued element +# Add almost zero valued element 0 ipset add test 0:0:0::0/1 -# Range: Test almost zero valued element +# Test almost zero valued element 0 ipset test test 0:0:0::0/1 -# Range: Delete almost zero valued element +# Delete almost zero valued element 0 ipset del test 0:0:0::0/1 -# Range: Test deleted element +# Test deleted element 1 ipset test test 0:0:0::0/1 -# Range: Delete element not added to the set +# Delete element not added to the set 1 ipset del test 0:0:0::0/1 -# Range: Add first random network +# Add first random network 0 ipset add test 2:0:0::1/24 -# Range: Add second random network +# Add second random network 0 ipset add test 192:168:68::69/27 -# Range: Test first random value +# Test first random value 0 ipset test test 2:0:0::255 -# Range: Test second random value +# Test second random value 0 ipset test test 192:168:68::95 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset test test 3:0:0::1 -# Range: Try to add IP address +# Try to add IP address 0 ipset add test 3:0:0::1 -# Range: List set +# List set 0 ipset list test | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo hash:net6.t.list0 && rm .foo # Sleep 6s so that element can time out 0 sleep 6 diff --git a/tests/init.t b/tests/init.t index ac15311..3311856 100644 --- a/tests/init.t +++ b/tests/init.t @@ -4,4 +4,6 @@ 1 ipset -L test >/dev/null # Delete our test set: the testsuite fails if it exists 1 ipset -X test +# Check mandatory create arguments +2 ipset -N test # eof diff --git a/tests/ipmap.t b/tests/ipmap.t index 00c35e8..2373176 100644 --- a/tests/ipmap.t +++ b/tests/ipmap.t @@ -1,3 +1,11 @@ +# Range: Check syntax error: missing range/from-to +2 ipset -N test ipmap +# Range: Check syntax error: missing --from +2 ipset -N test ipmap --to 2.1.0.1 +# Range: Check syntax error: missing --to +2 ipset -N test ipmap --from 2.1.0.1 +# Range: Catch invalid IPv4 address +1 ipset -N test ipmap --from 2.0.0.256 --to 2.1.0.1 # Range: Try to create from an invalid range 1 ipset -N test ipmap --from 2.0.0.1 --to 2.1.0.1 # Range: Create a set from a valid range @@ -28,6 +36,16 @@ 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 +# Range: Save set +0 ipset -S test > ipmap.t.restore +# Range: Destroy set +0 ipset -X test +# Range: Restore set and catch error +1 sed 's/2.0.0.131/222.0.0.131/' < ipmap.t.restore | ipset -R +# Range: Destroy set +0 ipset -X test +# Range: Restore set +0 ipset -R < ipmap.t.restore && rm ipmap.t.restore # Range: List set 0 ipset -L test > .foo # Range: Check listing diff --git a/tests/ipporthash.t b/tests/ipporthash.t index dc35bcd..9847830 100644 --- a/tests/ipporthash.t +++ b/tests/ipporthash.t @@ -1,71 +1,71 @@ -# Range: Create a set from a range (range ignored) +# Create a set from a range (range ignored) 0 ipset -N test ipporthash --from 2.0.0.1 --to 2.1.0.0 -# Range: Destroy set +# Destroy set 0 ipset -X test -# Range: Create a set +# Create a set 0 ipset -N test ipporthash -# Range: Add partly zero valued element +# Add partly zero valued element 0 ipset -A test 2.0.0.1,0 -# Range: Test partly zero valued element +# Test partly zero valued element 0 ipset -T test 2.0.0.1,0 -# Range: Delete partly zero valued element +# Delete partly zero valued element 0 ipset -D test 2.0.0.1,0 -# Range: Add lower boundary +# Add lower boundary 0 ipset -A test 2.0.0.1,5 -# Range: Add upper boundary +# Add upper boundary 0 ipset -A test 2.1.0.0,128 -# Range: Test lower boundary +# Test lower boundary 0 ipset -T test 2.0.0.1,5 -# Range: Test upper boundary +# Test upper boundary 0 ipset -T test 2.1.0.0,128 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset -T test 2.0.0.1,4 -# Range: Delete value not added to the set +# Delete value not added to the set 1 ipset -D test 2.0.0.1,6 -# Range: Test value before lower boundary +# Test value before lower boundary 1 ipset -T test 2.0.0.0,5 -# Range: Test value after upper boundary +# Test value after upper boundary 1 ipset -T test 2.1.0.1,128 -# Range: Try to add value before lower boundary +# Try to add value before lower boundary 0 ipset -A test 2.0.0.0,5 -# Range: Try to add value after upper boundary +# Try to add value after upper boundary 0 ipset -A test 2.1.0.1,128 -# Range: List set +# List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo ipporthash.t.list0 && rm .foo -# Range: Flush test set +# Flush test set 0 ipset -F test -# Range: Delete test set +# Delete test set 0 ipset -X test -# Network: Create a set from a network (network ignored) +# Create a set from a network (network ignored) 0 ipset -N test ipporthash --network 2.0.0.0/16 -# Network: Add lower boundary +# Add lower boundary 0 ipset -A test 2.0.0.0,5 -# Network: Add upper boundary +# Add upper boundary 0 ipset -A test 2.0.255.255,128 -# Network: Test lower boundary +# Test lower boundary 0 ipset -T test 2.0.0.0,5 -# Network: Test upper boundary +# Test upper boundary 0 ipset -T test 2.0.255.255,128 -# Network: Test value not added to the set +# Test value not added to the set 1 ipset -T test 2.0.0.0,4 -# Network: Delete value not added to the set +# Delete value not added to the set 1 ipset -D test 2.0.0.0,6 -# Network: Test value before lower boundary +# Test value before lower boundary 1 ipset -T test 1.255.255.255,5 -# Network: Test value after upper boundary +# Test value after upper boundary 1 ipset -T test 2.1.0.0,128 -# Network: Try to add value before lower boundary +# Try to add value before lower boundary 0 ipset -A test 1.255.255.255,5 -# Network: Try to add value after upper boundary +# Try to add value after upper boundary 0 ipset -A test 2.1.0.0,128 -# Network: List set +# List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 -# Network: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo ipporthash.t.list1 && rm .foo -# Network: Flush test set +# Flush test set 0 ipset -F test -# Network: Delete test set +# Delete test set 0 ipset -X test # eof diff --git a/tests/ipportiphash.t b/tests/ipportiphash.t index 3f61947..f6e79cc 100644 --- a/tests/ipportiphash.t +++ b/tests/ipportiphash.t @@ -1,81 +1,81 @@ -# Range: Create a set from a range (range ignored) +# Create a set from a range (range ignored) 0 ipset -N test ipportiphash --from 2.0.0.1 --to 2.1.0.0 -# Range: Destroy set +# Destroy set 0 ipset -X test -# Range: Create a set +# Create a set 0 ipset -N test ipportiphash -# Range: Add partly zero valued element +# Add partly zero valued element 0 ipset -A test 2.0.0.1,0,0.0.0.0 -# Range: Test partly zero valued element +# Test partly zero valued element 0 ipset -T test 2.0.0.1,0,0.0.0.0 -# Range: Delete party zero valued element +# Delete party zero valued element 0 ipset -D test 2.0.0.1,0,0.0.0.0 -# Range: Add almost zero valued element +# Add almost zero valued element 0 ipset -A test 2.0.0.1,0,0.0.0.1 -# Range: Test almost zero valued element +# Test almost zero valued element 0 ipset -T test 2.0.0.1,0,0.0.0.1 -# Range: Delete almost zero valued element +# Delete almost zero valued element 0 ipset -D test 2.0.0.1,0,0.0.0.1 -# Range: Add lower boundary +# Add lower boundary 0 ipset -A test 2.0.0.1,5,1.1.1.1 -# Range: Add upper boundary +# Add upper boundary 0 ipset -A test 2.1.0.0,128,2.2.2.2 -# Range: Test lower boundary +# Test lower boundary 0 ipset -T test 2.0.0.1,5,1.1.1.1 -# Range: Test upper boundary +# Test upper boundary 0 ipset -T test 2.1.0.0,128,2.2.2.2 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset -T test 2.0.0.1,5,1.1.1.2 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset -T test 2.0.0.1,6,1.1.1.1 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset -T test 2.0.0.2,6,1.1.1.1 -# Range: Test value before lower boundary +# Test value before lower boundary 1 ipset -T test 2.0.0.0,5,1.1.1.1 -# Range: Test value after upper boundary +# Test value after upper boundary 1 ipset -T test 2.1.0.1,128,2.2.2.2 -# Range: Try to add value before lower boundary +# Try to add value before lower boundary 0 ipset -A test 2.0.0.0,5,1.1.1.1 -# Range: Try to add value after upper boundary +# Try to add value after upper boundary 0 ipset -A test 2.1.0.1,128,2.2.2.2 -# Range: List set +# List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo ipportiphash.t.list0 && rm .foo -# Range: Flush test set +# Flush test set 0 ipset -F test -# Range: Delete test set +# Delete test set 0 ipset -X test -# Network: Create a set from a valid network (network ignored) +# Create a set from a valid network (network ignored) 0 ipset -N test ipportiphash --network 2.0.0.0/16 -# Network: Add lower boundary +# Add lower boundary 0 ipset -A test 2.0.0.0,5,1.1.1.1 -# Network: Add upper boundary +# Add upper boundary 0 ipset -A test 2.0.255.255,128,2.2.2.2 -# Network: Test lower boundary +# Test lower boundary 0 ipset -T test 2.0.0.0,5,1.1.1.1 -# Network: Test upper boundary +# Test upper boundary 0 ipset -T test 2.0.255.255,128,2.2.2.2 -# Network: Test value not added to the set +# Test value not added to the set 1 ipset -T test 2.0.0.0,5,1.1.1.2 -# Network: Test value not added to the set +# Test value not added to the set 1 ipset -T test 2.0.0.0,6,1.1.1.1 -# Network: Test value before lower boundary +# Test value before lower boundary 1 ipset -T test 1.255.255.255,5,1.1.1.1 -# Network: Test value after upper boundary +# Test value after upper boundary 1 ipset -T test 2.1.0.0,128,2.2.2.2 -# Network: Try to add value before lower boundary +# Try to add value before lower boundary 0 ipset -A test 1.255.255.255,5,1.1.1.1 -# Network: Try to test value before lower boundary +# Try to test value before lower boundary 0 ipset -T test 1.255.255.255,5,1.1.1.1 -# Network: Try to del value before lower boundary +# Try to del value before lower boundary 0 ipset -D test 1.255.255.255,5,1.1.1.1 -# Network: List set +# List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 -# Network: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo ipportiphash.t.list1 && rm .foo -# Network: Flush test set +# Flush test set 0 ipset -F test -# Network: Delete test set +# Delete test set 0 ipset -X test # eof diff --git a/tests/nethash.t b/tests/nethash.t index 400e110..537c0db 100644 --- a/tests/nethash.t +++ b/tests/nethash.t @@ -1,40 +1,40 @@ # Create a set 0 ipset -N test nethash --hashsize 128 -# Range: Add zero valued element +# Add zero valued element 1 ipset -A test 0.0.0.0/0 -# Range: Test zero valued element +# Test zero valued element 1 ipset -T test 0.0.0.0/0 -# Range: Delete zero valued element +# Delete zero valued element 1 ipset -D test 0.0.0.0/0 -# Range: Try to add /0 +# Try to add /0 1 ipset -A test 1.1.1.1/0 -# Range: Try to add /32 +# Try to add /32 0 ipset -A test 1.1.1.1/32 -# Range: Add almost zero valued element +# Add almost zero valued element 0 ipset -A test 0.0.0.0/1 -# Range: Test almost zero valued element +# Test almost zero valued element 0 ipset -T test 0.0.0.0/1 -# Range: Delete almost zero valued element +# Delete almost zero valued element 0 ipset -D test 0.0.0.0/1 -# Range: Test deleted element +# Test deleted element 1 ipset -T test 0.0.0.0/1 -# Range: Delete element not added to the set +# Delete element not added to the set 1 ipset -D test 0.0.0.0/1 -# Range: Add first random network +# Add first random network 0 ipset -A test 2.0.0.1/24 -# Range: Add second random network +# Add second random network 0 ipset -A test 192.168.68.69/27 -# Range: Test first random value +# Test first random value 0 ipset -T test 2.0.0.255 -# Range: Test second random value +# Test second random value 0 ipset -T test 192.168.68.95 -# Range: Test value not added to the set +# Test value not added to the set 1 ipset -T test 2.0.1.0 -# Range: Try to add IP address +# Try to add IP address 0 ipset -A test 2.0.0.1 -# Range: List set +# List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 -# Range: Check listing +# Check listing 0 diff -I 'Size in memory.*' .foo nethash.t.list0 && rm .foo # Flush test set 0 ipset -F test diff --git a/tests/setlist.t b/tests/setlist.t index f80f5ae..d673e8e 100644 --- a/tests/setlist.t +++ b/tests/setlist.t @@ -1,55 +1,55 @@ -# Setlist: Create dummy set +# Create dummy set 0 ipset -N dummy list:set -# Setlist: Create base set foo +# Create base set foo 0 ipset -N foo ipmap --from 2.0.0.1 --to 2.1.0.0 -# Setlist: Create base set bar +# Create base set bar 0 ipset -N bar iphash -# Setlist: Create setlist kind of set +# Create setlist kind of set 0 ipset -N test setlist -# Setlist: Swap test and dumy sets +# Swap test and dumy sets 0 ipset -W test dummy -# Setlist: Destroy dummy set +# Destroy dummy set 0 ipset -X dummy -# Setlist: Add foo set to setlist +# Add foo set to setlist 0 ipset -A test foo -# Setlist: Test foo set in setlist +# Test foo set in setlist 0 ipset -T test foo -# Setlist: Test nonexistent set in setlist +# Test nonexistent set in setlist 1 ipset -T test nonexistent -# Setlist: Try to delete foo set +# Try to delete foo set 1 ipset -X foo -# Setlist: Add bar set to setlist, after foo +# Add bar set to setlist, after foo 0 ipset -A test bar -# Setlist: Test bar,after,foo +# Test bar,after,foo 0 ipset -T test bar,after,foo -# Setlist: Test foo,before,bar +# Test foo,before,bar 0 ipset -T test foo,before,bar -# Setlist: Test bar,before,foo +# Test bar,before,foo 1 ipset -T test bar,before,foo -# Setlist: Test foo,after,bar +# Test foo,after,bar 1 ipset -T test foo,after,bar -# Setlist: Save sets +# Save sets 0 ipset -S > setlist.t.restore -# Setlist: Delete bar,before,foo +# Delete bar,before,foo 1 ipset -D test bar,before,foo -# Setlist: Delete foo,after,bar +# Delete foo,after,bar 1 ipset -D test foo,after,bar -# Setlist: Delete bar,after,foo +# Delete bar,after,foo 0 ipset -D test bar,after,foo -# Setlist: Flush test set +# Flush test set 0 ipset -F test -# Setlist: Delete test set +# Delete test set 0 ipset -X test -# Setlist: Delete all sets +# Delete all sets 0 ipset -X -# Setlist: Restore saved sets +# Restore saved sets 0 ipset -R < setlist.t.restore -# Setlist: List set +# List set 0 ipset -L test > .foo -# Setlist: Check listing +# Check listing 0 diff .foo setlist.t.list0 && rm .foo -# Setlist: Flush all sets +# Flush all sets 0 ipset -F -# Setlist: Delete all sets +# Delete all sets 0 ipset -X && rm setlist.t.restore # eof -- cgit v1.2.3