|
Packit |
99347c |
# Create a set with timeout
|
|
Packit |
99347c |
0 ipset create test nethash family inet6 hashsize 128 timeout 4
|
|
Packit |
99347c |
# Add zero valued element
|
|
Packit |
99347c |
1 ipset add test ::/0
|
|
Packit |
99347c |
# Test zero valued element
|
|
Packit |
99347c |
1 ipset test test ::/0
|
|
Packit |
99347c |
# Delete zero valued element
|
|
Packit |
99347c |
1 ipset del test ::/0
|
|
Packit |
99347c |
# Try to add /0
|
|
Packit |
99347c |
1 ipset add test 1:1:1::1/0
|
|
Packit |
99347c |
# Try to add /128
|
|
Packit |
99347c |
0 ipset add test 1:1:1::1/128
|
|
Packit |
99347c |
# Add almost zero valued element
|
|
Packit |
99347c |
0 ipset add test 0:0:0::0/1
|
|
Packit |
99347c |
# Test almost zero valued element
|
|
Packit |
99347c |
0 ipset test test 0:0:0::0/1
|
|
Packit |
99347c |
# Delete almost zero valued element
|
|
Packit |
99347c |
0 ipset del test 0:0:0::0/1
|
|
Packit |
99347c |
# Test deleted element
|
|
Packit |
99347c |
1 ipset test test 0:0:0::0/1
|
|
Packit |
99347c |
# Delete element not added to the set
|
|
Packit |
99347c |
1 ipset del test 0:0:0::0/1
|
|
Packit |
99347c |
# Add first random network
|
|
Packit |
99347c |
0 ipset add test 2:0:0::1/24
|
|
Packit |
99347c |
# Add second random network
|
|
Packit |
99347c |
0 ipset add test 192:168:68::69/27
|
|
Packit |
99347c |
# Test first random value
|
|
Packit |
99347c |
0 ipset test test 2:0:0::255
|
|
Packit |
99347c |
# Test second random value
|
|
Packit |
99347c |
0 ipset test test 192:168:68::95
|
|
Packit |
99347c |
# Test value not added to the set
|
|
Packit |
99347c |
1 ipset test test 3:0:0::1
|
|
Packit |
99347c |
# Try to add IP address
|
|
Packit |
99347c |
0 ipset add test 3:0:0::1
|
|
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.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.t.list1
|
|
Packit |
99347c |
# Flush test set
|
|
Packit |
99347c |
0 ipset flush test
|
|
Packit |
99347c |
# Delete test set
|
|
Packit |
99347c |
0 ipset destroy test
|
|
Packit |
99347c |
# Create test set with timeout support
|
|
Packit |
99347c |
0 ipset create test hash:net family inet6 timeout 30
|
|
Packit |
99347c |
# Add a non-matching IP address entry
|
|
Packit |
99347c |
0 ipset -A test 1:1:1::1 nomatch
|
|
Packit |
99347c |
# Add an overlapping matching small net
|
|
Packit |
99347c |
0 ipset -A test 1:1:1::/124
|
|
Packit |
99347c |
# Add an overlapping non-matching larger net
|
|
Packit |
99347c |
0 ipset -A test 1:1:1::/120 nomatch
|
|
Packit |
99347c |
# Add an even larger matching net
|
|
Packit |
99347c |
0 ipset -A test 1:1:1::/116
|
|
Packit |
99347c |
# Check non-matching IP
|
|
Packit |
99347c |
1 ipset -T test 1:1:1::1
|
|
Packit |
99347c |
# Check matching IP from non-matchin small net
|
|
Packit |
99347c |
0 ipset -T test 1:1:1::F
|
|
Packit |
99347c |
# Check non-matching IP from larger net
|
|
Packit |
99347c |
1 ipset -T test 1:1:1::10
|
|
Packit |
99347c |
# Check matching IP from even larger net
|
|
Packit |
99347c |
0 ipset -T test 1:1:1::100
|
|
Packit |
99347c |
# Update non-matching IP to matching one
|
|
Packit |
99347c |
0 ipset -! -A test 1:1:1::1
|
|
Packit |
99347c |
# Delete overlapping small net
|
|
Packit |
99347c |
0 ipset -D test 1:1:1::/124
|
|
Packit |
99347c |
# Check matching IP
|
|
Packit |
99347c |
0 ipset -T test 1:1:1::1
|
|
Packit |
99347c |
# Add overlapping small net
|
|
Packit |
99347c |
0 ipset -A test 1:1:1::/124
|
|
Packit |
99347c |
# Update matching IP as a non-matching one, with shorter timeout
|
|
Packit |
99347c |
0 ipset -! -A test 1:1:1::1 nomatch timeout 2
|
|
Packit |
99347c |
# Check non-matching IP
|
|
Packit |
99347c |
1 ipset -T test 1:1:1::1
|
|
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
|
|
Packit |
99347c |
# Check matching IP
|
|
Packit |
99347c |
0 ipset -T test 1:1:1::F
|
|
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 net
|
|
Packit |
99347c |
# Nomatch: Check that resizing keeps the nomatch flag
|
|
Packit |
99347c |
0 ./resizen.sh -6 net
|
|
Packit |
99347c |
# Counters: create set
|
|
Packit |
99347c |
0 ipset n test hash:net -6 counters
|
|
Packit |
99347c |
# Counters: add element with packet, byte counters
|
|
Packit |
99347c |
0 ipset a test 2:0:0::1/64 packets 5 bytes 3456
|
|
Packit |
99347c |
# Counters: check element
|
|
Packit |
99347c |
0 ipset t test 2:0:0::1/64
|
|
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
|
|
Packit |
99347c |
# Counters: test deleted element
|
|
Packit |
99347c |
1 ipset t test 2:0:0::1/64
|
|
Packit |
99347c |
# Counters: add element with packet, byte counters
|
|
Packit |
99347c |
0 ipset a test 2:0:0::20/54 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 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 -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 packets 5 bytes 3456
|
|
Packit |
99347c |
# Counters and timeout: check element
|
|
Packit |
99347c |
0 ipset t test 2:0:0::1/64
|
|
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
|
|
Packit |
99347c |
# Counters and timeout: test deleted element
|
|
Packit |
99347c |
1 ipset t test 2:0:0::1/64
|
|
Packit |
99347c |
# Counters and timeout: add element with packet, byte counters
|
|
Packit |
99347c |
0 ipset a test 2:0:0::20/54 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 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 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
|