Blame tests/hash:net6,port.t

Packit 99347c
# Create a set with timeout
Packit 99347c
0 ipset create test hash:net,port family inet6 hashsize 128 timeout 4
Packit 99347c
# Add zero valued element
Packit 99347c
1 ipset add test ::/0,tcp:8
Packit 99347c
# Test zero valued element
Packit 99347c
1 ipset test test ::/0,tcp:8
Packit 99347c
# Delete zero valued element
Packit 99347c
1 ipset del test ::/0,tcp:8
Packit 99347c
# Try to add /0
Packit 99347c
1 ipset add test 1:1:1::1/0,tcp:8
Packit 99347c
# Try to add /128
Packit 99347c
0 ipset add test 1:1:1::1/128,tcp:8 timeout 0
Packit 99347c
# Add almost zero valued element
Packit 99347c
0 ipset add test 0:0:0::0/1,tcp:8
Packit 99347c
# Test almost zero valued element
Packit 99347c
0 ipset test test 0:0:0::0/1,tcp:8
Packit 99347c
# Test almost zero valued element with UDP
Packit 99347c
1 ipset test test 0:0:0::0/1,udp:8
Packit 99347c
# Delete almost zero valued element
Packit 99347c
0 ipset del test 0:0:0::0/1,tcp:8
Packit 99347c
# Test deleted element
Packit 99347c
1 ipset test test 0:0:0::0/1,tcp:8
Packit 99347c
# Delete element not added to the set
Packit 99347c
1 ipset del test 0:0:0::0/1,tcp:8
Packit 99347c
# Add first random network
Packit 99347c
0 ipset add test 2:0:0::1/24,tcp:8
Packit 99347c
# Add second random network
Packit 99347c
0 ipset add test 192:168:68::69/27,icmpv6:ping
Packit 99347c
# Test first random value
Packit 99347c
0 ipset test test 2:0:0::255,tcp:8
Packit 99347c
# Test second random value
Packit 99347c
0 ipset test test 192:168:68::95,icmpv6:ping
Packit 99347c
# Test value not added to the set
Packit 99347c
1 ipset test test 3:0:0::1,tcp:8
Packit 99347c
# Try to add IP address
Packit 99347c
0 ipset add test 3:0:0::1,tcp:8
Packit 99347c
# Add ICMPv6 by type/code
Packit 99347c
0 ipset add test 192:168:68::95,icmpv6:1/4
Packit 99347c
# Test ICMPv6 by type/code
Packit 99347c
0 ipset test test 192:168:68::95,icmpv6:1/4
Packit 99347c
# Test ICMPv6 by name
Packit 99347c
0 ipset test test 192:168:68::95,icmpv6:port-unreachable
Packit 99347c
# List set
Packit 99347c
0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
Packit 99347c
# Save set
Packit 99347c
0 ipset save test > hash:net6,port.t.restore
Packit 99347c
# Check listing
Packit 99347c
0 diff -u -I 'Size in memory.*' .foo hash:net6,port.t.list0
Packit 99347c
# Sleep 5s so that element can time out
Packit 99347c
0 sleep 5
Packit 99347c
# IP: List set
Packit 99347c
0 ipset -L test 2>/dev/null | grep -v Revision: > .foo0 && ./sort.sh .foo0
Packit 99347c
# IP: Check listing
Packit 99347c
0 diff -u -I 'Size in memory.*' .foo hash:net6,port.t.list1
Packit 99347c
# Destroy set
Packit 99347c
0 ipset x test
Packit 99347c
# Restore set
Packit 99347c
0 ipset restore < hash:net6,port.t.restore && rm hash:net6,port.t.restore
Packit 99347c
# List set
Packit 99347c
0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0
Packit 99347c
# Check listing
Packit 99347c
0 diff -u -I 'Size in memory.*' .foo hash:net6,port.t.list0
Packit 99347c
# Flush test set
Packit 99347c
0 ipset flush test
Packit 99347c
# Add multiple elements in one step
Packit 99347c
0 ipset add test 1::1/64,80-84 timeout 0
Packit 99347c
# Delete multiple elements in one step
Packit 99347c
0 ipset del test 1::1/64,tcp:81-82
Packit 99347c
# Check number of elements after multi-add/multi-del
Packit 99347c
0 n=`ipset save test|wc -l` && test $n -eq 4
Packit 99347c
# Delete test set
Packit 99347c
0 ipset destroy test
Packit 99347c
# Create set to add a range
Packit 99347c
0 ipset new test hash:net,port -6 hashsize 64
Packit 99347c
# Add a range which forces a resizing
Packit 99347c
0 ipset add test 1::1/64,tcp:80-1105
Packit 99347c
# Check that correct number of elements are added
Packit 99347c
0 n=`ipset list test|grep 1::|wc -l` && test $n -eq 1026
Packit 99347c
# Destroy set
Packit 99347c
0 ipset -X test
Packit 99347c
# Create test set with timeout support
Packit 99347c
0 ipset create test hash:net,port family inet6 timeout 30
Packit 99347c
# Add a non-matching IP address entry
Packit 99347c
0 ipset -A test 1:1:1::1,80 nomatch
Packit 99347c
# Add an overlapping matching small net
Packit 99347c
0 ipset -A test 1:1:1::/124,80
Packit 99347c
# Add an overlapping non-matching larger net
Packit 99347c
0 ipset -A test 1:1:1::/120,80 nomatch
Packit 99347c
# Add an even larger matching net
Packit 99347c
0 ipset -A test 1:1:1::/116,80
Packit 99347c
# Check non-matching IP
Packit 99347c
1 ipset -T test 1:1:1::1,80
Packit 99347c
# Check matching IP from non-matchin small net
Packit 99347c
0 ipset -T test 1:1:1::F,80
Packit 99347c
# Check non-matching IP from larger net
Packit 99347c
1 ipset -T test 1:1:1::10,80
Packit 99347c
# Check matching IP from even larger net
Packit 99347c
0 ipset -T test 1:1:1::100,80
Packit 99347c
# Update non-matching IP to matching one
Packit 99347c
0 ipset -! -A test 1:1:1::1,80
Packit 99347c
# Delete overlapping small net
Packit 99347c
0 ipset -D test 1:1:1::/124,80
Packit 99347c
# Check matching IP
Packit 99347c
0 ipset -T test 1:1:1::1,80
Packit 99347c
# Add overlapping small net
Packit 99347c
0 ipset -A test 1:1:1::/124,80
Packit 99347c
# Update matching IP as a non-matching one, with shorter timeout
Packit 99347c
0 ipset -! -A test 1:1:1::1,80 nomatch timeout 2
Packit 99347c
# Check non-matching IP
Packit 99347c
1 ipset -T test 1:1:1::1,80
Packit 99347c
# Sleep 3s so that element can time out
Packit 99347c
0 sleep 3
Packit 99347c
# Check non-matching IP
Packit 99347c
0 ipset -T test 1:1:1::1,80
Packit 99347c
# Check matching IP
Packit 99347c
0 ipset -T test 1:1:1::F,80
Packit 99347c
# Delete test set
Packit 99347c
0 ipset destroy test
Packit 99347c
# Timeout: Check that resizing keeps timeout values
Packit 99347c
0 ./resizet.sh -6 netport
Packit 99347c
# Nomatch: Check that resizing keeps the nomatch flag
Packit 99347c
0 ./resizen.sh -6 netport
Packit 99347c
# Counters: create set
Packit 99347c
0 ipset n test hash:net,port -6 counters
Packit 99347c
# Counters: add element with packet, byte counters
Packit 99347c
0 ipset a test 2:0:0::1/64,80 packets 5 bytes 3456
Packit 99347c
# Counters: check element
Packit 99347c
0 ipset t test 2:0:0::1/64,80
Packit 99347c
# Counters: check counters
Packit 99347c
0 ./check_counters test 2:: 5 3456
Packit 99347c
# Counters: delete element
Packit 99347c
0 ipset d test 2:0:0::1/64,80
Packit 99347c
# Counters: test deleted element
Packit 99347c
1 ipset t test 2:0:0::1/64,80
Packit 99347c
# Counters: add element with packet, byte counters
Packit 99347c
0 ipset a test 2:0:0::20/54,453 packets 12 bytes 9876
Packit 99347c
# Counters: check counters
Packit 99347c
0 ./check_counters test 2:: 12 9876
Packit 99347c
# Counters: update counters
Packit 99347c
0 ipset -! a test 2:0:0::20/54,453 packets 13 bytes 12479
Packit 99347c
# Counters: check counters
Packit 99347c
0 ./check_counters test 2:: 13 12479
Packit 99347c
# Counters: destroy set
Packit 99347c
0 ipset x test
Packit 99347c
# Counters and timeout: create set
Packit 99347c
0 ipset n test hash:net,port -6 counters timeout 600
Packit 99347c
# Counters and timeout: add element with packet, byte counters
Packit 99347c
0 ipset a test 2:0:0::1/64,80 packets 5 bytes 3456
Packit 99347c
# Counters and timeout: check element
Packit 99347c
0 ipset t test 2:0:0::1/64,80
Packit 99347c
# Counters and timeout: check counters
Packit 99347c
0 ./check_extensions test 2:: 600 5 3456
Packit 99347c
# Counters and timeout: delete element
Packit 99347c
0 ipset d test 2:0:0::1/64,80
Packit 99347c
# Counters and timeout: test deleted element
Packit 99347c
1 ipset t test 2:0:0::1/64,80
Packit 99347c
# Counters and timeout: add element with packet, byte counters
Packit 99347c
0 ipset a test 2:0:0::20/54,453 packets 12 bytes 9876
Packit 99347c
# Counters and timeout: check counters
Packit 99347c
0 ./check_extensions test 2:: 600 12 9876
Packit 99347c
# Counters and timeout: update counters
Packit 99347c
0 ipset -! a test 2:0:0::20/54,453 packets 13 bytes 12479
Packit 99347c
# Counters and timeout: check counters
Packit 99347c
0 ./check_extensions test 2:: 600 13 12479
Packit 99347c
# Counters and timeout: update timeout
Packit 99347c
0 ipset -! a test 2:0:0::20/54,453 timeout 700
Packit 99347c
# Counters and timeout: check counters
Packit 99347c
0 ./check_extensions test 2:: 700 13 12479
Packit 99347c
# Counters and timeout: destroy set
Packit 99347c
0 ipset x test
Packit 99347c
# eof