diff options
Diffstat (limited to 'tests/hash:net,port.t')
-rw-r--r-- | tests/hash:net,port.t | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/hash:net,port.t b/tests/hash:net,port.t index 993893d..5b60476 100644 --- a/tests/hash:net,port.t +++ b/tests/hash:net,port.t @@ -76,4 +76,42 @@ 0 n=`ipset list test|grep '^10.0'|wc -l` && test $n -eq 2052 # Destroy set 0 ipset -X test +# Create test set with timeout support +0 ipset create test hash:net,port timeout 30 +# Add a non-matching IP address entry +0 ipset -A test 1.1.1.1,80 nomatch +# Add an overlapping matching small net +0 ipset -A test 1.1.1.0/30,80 +# Add an overlapping non-matching larger net +0 ipset -A test 1.1.1.0/28,80 nomatch +# Add an even larger matching net +0 ipset -A test 1.1.1.0/26,80 +# Check non-matching IP +1 ipset -T test 1.1.1.1,80 +# Check matching IP from non-matchin small net +0 ipset -T test 1.1.1.3,80 +# Check non-matching IP from larger net +1 ipset -T test 1.1.1.4,80 +# Check matching IP from even larger net +0 ipset -T test 1.1.1.16,80 +# Update non-matching IP to matching one +0 ipset -! -A test 1.1.1.1,80 +# Delete overlapping small net +0 ipset -D test 1.1.1.0/30,80 +# Check matching IP +0 ipset -T test 1.1.1.1,80 +# Add overlapping small net +0 ipset -A test 1.1.1.0/30,80 +# Update matching IP as a non-matching one, with shorter timeout +0 ipset -! -A test 1.1.1.1,80 nomatch timeout 2 +# Check non-matching IP +1 ipset -T test 1.1.1.1,80 +# Sleep 3s so that element can time out +0 sleep 3 +# Check non-matching IP +0 ipset -T test 1.1.1.1,80 +# Check matching IP +0 ipset -T test 1.1.1.3,80 +# Delete test set +0 ipset destroy test # eof |