From 24b35d0b8950407ce85eefef18576d54f1e2c20e Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Fri, 13 Jan 2012 22:52:44 +0100 Subject: Exceptions support added to hash:*net* types The "nomatch" keyword and option is added to the hash:*net* types, by which one can add exception entries to sets. Example: ipset create test hash:net ipset add test 192.168.0/24 ipset add test 192.168.0/30 nomatch In this case the IP addresses from 192.168.0/24 except 192.168.0/30 match the elements of the set. --- tests/nethash.t | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/nethash.t') diff --git a/tests/nethash.t b/tests/nethash.t index 706aaf4..40f79fe 100644 --- a/tests/nethash.t +++ b/tests/nethash.t @@ -38,6 +38,32 @@ 0 diff -u -I 'Size in memory.*' .foo nethash.t.list0 # Flush test set 0 ipset -F test +# Add a non-matching IP address entry +0 ipset -A test 1.1.1.1 nomatch +# Add an overlapping matching small net +0 ipset -A test 1.1.1.0/30 +# Add an overlapping non-matching larger net +0 ipset -A test 1.1.1.0/28 nomatch +# Add an even larger matching net +0 ipset -A test 1.1.1.0/26 +# Check non-matching IP +1 ipset -T test 1.1.1.1 +# Check matching IP from non-matchin small net +0 ipset -T test 1.1.1.3 +# Check non-matching IP from larger net +1 ipset -T test 1.1.1.4 +# Check matching IP from even larger net +0 ipset -T test 1.1.1.16 +# Update non-matching IP to matching one +0 ipset -! -A test 1.1.1.1 +# Delete overlapping small net +0 ipset -D test 1.1.1.0/30 +# Check matching IP +0 ipset -T test 1.1.1.1 +# Update matching IP as a non-matching one +0 ipset -! -A test 1.1.1.1 nomatch +# Check non-matching IP +1 ipset -T test 1.1.1.1 # Delete test set 0 ipset -X test # eof -- cgit v1.2.3