as promised attaching third patch, which prints mark and markmask in hexadecimal. On 9 January 2014 21:02, Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxxxxxx> wrote: > On Thu, 9 Jan 2014, Vytas Dauksa wrote: > >> > Why it's important that the kernel should mask the mark value, when the >> > user could add the intended value directly? The only case where it's >> > required when entries added/deleted by the SET target. It's more natural >> > for me if the markmask value has a meaning and effect for kernel side >> > add/del operations only, and ignored for user add/del/test and kernel >> > tests. What's your opinion? >> >> The kernel must apply the mask at test time - that's the whole reason >> for it. In our use case the desired mask is 0xff000000, because those >> bits identify the protocol, and the other bits are for an unrelated purpose. >> Because the other bits could be set to anything, without a mask there >> might have to be 2^24 entries for the other possible values. >> >> If the kernel applies a mask on test, but values added by the user aren't >> masked, those entries would never match. It seems clearer to mask them >> at add time, so that the user gets sensible errors; for instance, adding two >> different values which mask to the same thing will give the same error as >> adding the same value twice. >> >> Another option we discounted was that each entry could have its own >> mask. This didn't make sense because they're not strictly ordered like >> netmasks, so multiple entries could be equally applicable, and no hashing >> is possible. If 12000000/ff000000 and 00340000/00ff0000 are in the set, >> but one is nomatch, and a packet has mark 12345678, which entry should >> take effect? > > I see - good arguments, keep the original operations then. > >> > A small thing, but I'd prefer if the mark value were printed/saved in hex >> > instead of decimal, similarly to iptables. Better introduce a new print >> > function for it. >> >> Sure, will implement this on Friday > > Best regards, > Jozsef > - > E-mail : kadlec@xxxxxxxxxxxxxxxxx, kadlecsik.jozsef@xxxxxxxxxxxxx > PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt > Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences > H-1525 Budapest 114, POB. 49, Hungary -- Vytas Dauksa Junior Developer vytas.dauksa@xxxxxxxxxxxxxx Smoothwall Ltd Phone: +44 (0) 8701 999500 www.smoothwall.net
From 2d448ff0ae8b2487c496a54808cdc1d811d57e40 Mon Sep 17 00:00:00 2001 From: Vytas Dauksa <vytas.dauksa@xxxxxxxxxxxxxx> Date: Fri, 17 Jan 2014 18:39:16 +0000 Subject: [PATCH] print mark & mark mask in hex rather then decimal modified ipset_print_mark to print in hex rather then decimal and altered accordingly test cases. --- lib/ipset_hash_ipmark.c | 2 +- lib/print.c | 6 +- tests/hash:ip,mark.t | 70 ++++++++-------- tests/hash:ip,mark.t.list0 | 10 +-- tests/hash:ip,mark.t.list1 | 2 +- tests/hash:ip6,mark.t | 188 +++++++++++++++++++++---------------------- tests/hash:ip6,mark.t.list0 | 10 +-- tests/hash:ip6,mark.t.list1 | 2 +- tests/ipmarkhash.t | 46 +++++------ tests/ipmarkhash.t.list0 | 10 +-- tests/ipmarkhash.t.list1 | 10 +-- 11 files changed, 178 insertions(+), 178 deletions(-) diff --git a/lib/ipset_hash_ipmark.c b/lib/ipset_hash_ipmark.c index fdea32f..922e6c0 100644 --- a/lib/ipset_hash_ipmark.c +++ b/lib/ipset_hash_ipmark.c @@ -28,7 +28,7 @@ static const struct ipset_arg hash_ipmark_create_args0[] = { }, { .name = { "markmask", NULL }, .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_MARKMASK, - .parse = ipset_parse_uint32, .print = ipset_print_number, + .parse = ipset_parse_uint32, .print = ipset_print_mark, }, { .name = { "hashsize", NULL }, .has_arg = IPSET_MANDATORY_ARG, .opt = IPSET_OPT_HASHSIZE, diff --git a/lib/print.c b/lib/print.c index 8e2924e..72533ac 100644 --- a/lib/print.c +++ b/lib/print.c @@ -514,12 +514,12 @@ ipset_print_mark(char *buf, unsigned int len, assert(buf); assert(len > 0); assert(data); - assert(opt == IPSET_OPT_MARK); + assert(opt == IPSET_OPT_MARK || opt == IPSET_OPT_MARKMASK); - mark = ipset_data_get(data, IPSET_OPT_MARK); + mark = ipset_data_get(data, opt); assert(mark); - size = snprintf(buf, len, "%u", *mark); + size = snprintf(buf, len, "%08llx", *mark); SNPRINTF_FAILURE(size, len, offset); return offset; diff --git a/tests/hash:ip,mark.t b/tests/hash:ip,mark.t index ad76274..f6bd6ee 100644 --- a/tests/hash:ip,mark.t +++ b/tests/hash:ip,mark.t @@ -1,31 +1,31 @@ # Create a set with timeout 0 ipset create test hash:ip,mark timeout 5 # Add partly zero valued element -0 ipset add test 2.0.0.1,0 +0 ipset add test 2.0.0.1,0x0 # Test partly zero valued element -0 ipset test test 2.0.0.1,0 +0 ipset test test 2.0.0.1,0x0 # Delete partly zero valued element -0 ipset del test 2.0.0.1,0 +0 ipset del test 2.0.0.1,0x0 # Add first random value -0 ipset add test 2.0.0.1,5 +0 ipset add test 2.0.0.1,0x5 # Add second random value -0 ipset add test 2.1.0.0,128 +0 ipset add test 2.1.0.0,0x80 # Test first random value -0 ipset test test 2.0.0.1,5 +0 ipset test test 2.0.0.1,0x5 # Test second random value -0 ipset test test 2.1.0.0,128 +0 ipset test test 2.1.0.0,0x80 # Test value not added to the set -1 ipset test test 2.0.0.1,4 +1 ipset test test 2.0.0.1,0x4 # Delete value not added to the set -1 ipset del test 2.0.0.1,6 +1 ipset del test 2.0.0.1,0x6 # Test value before first random value -1 ipset test test 2.0.0.0,5 +1 ipset test test 2.0.0.0,0x5 # Test value after second random value -1 ipset test test 2.1.0.1,128 +1 ipset test test 2.1.0.1,0x80 # Try to add value before first random value -0 ipset add test 2.0.0.0,5 +0 ipset add test 2.0.0.0,0x5 # Try to add value after second random value -0 ipset add test 2.1.0.1,128 +0 ipset add test 2.1.0.1,0x80 # List set 0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Check listing @@ -39,9 +39,9 @@ # Flush test set 0 ipset flush test # Add multiple elements in one step -0 ipset add test 1.1.1.1-1.1.1.18,80 +0 ipset add test 1.1.1.1-1.1.1.18,0x50 # Delete multiple elements in one step -0 ipset del test 1.1.1.2-1.1.1.3,80 +0 ipset del test 1.1.1.2-1.1.1.3,0x50 # Check number of elements after multi-add/multi-del 0 n=`ipset save test|wc -l` && test $n -eq 17 # Delete test set @@ -49,21 +49,21 @@ # Create set to add a range 0 ipset new test hash:ip,mark hashsize 64 # Add a range which forces a resizing -0 ipset add test 10.0.0.0-10.0.3.255,80 +0 ipset add test 10.0.0.0-10.0.3.255,0x50 # Check that correct number of elements are added 0 n=`ipset list test|grep '^10.0'|wc -l` && test $n -eq 1024 # Flush set 0 ipset flush test # Add an single element -0 ipset add test 10.0.0.1,80 +0 ipset add test 10.0.0.1,0x50 # Check number of elements 0 n=`ipset save test|wc -l` && test $n -eq 2 # Delete the single element -0 ipset del test 10.0.0.1,80 +0 ipset del test 10.0.0.1,0x50 # Check number of elements 0 n=`ipset save test|wc -l` && test $n -eq 1 # Add an IP range -0 ipset add test 10.0.0.1-10.0.0.10,80 +0 ipset add test 10.0.0.1-10.0.0.10,0x50 # Check number of elements 0 n=`ipset save test|wc -l` && test $n -eq 11 # Delete the IP range @@ -77,21 +77,21 @@ # Counters: create set 0 ipset n test hash:ip,mark counters # Counters: add element with packet, byte counters -0 ipset a test 2.0.0.1,80 packets 5 bytes 3456 +0 ipset a test 2.0.0.1,0x50 packets 5 bytes 3456 # Counters: check element -0 ipset t test 2.0.0.1,80 +0 ipset t test 2.0.0.1,0x50 # Counters: check counters 0 ./check_counters test 2.0.0.1 5 3456 # Counters: delete element -0 ipset d test 2.0.0.1,80 +0 ipset d test 2.0.0.1,0x50 # Counters: test deleted element -1 ipset t test 2.0.0.1,80 +1 ipset t test 2.0.0.1,0x50 # Counters: add element with packet, byte counters -0 ipset a test 2.0.0.20,453 packets 12 bytes 9876 +0 ipset a test 2.0.0.20,0x1c5 packets 12 bytes 9876 # Counters: check counters 0 ./check_counters test 2.0.0.20 12 9876 # Counters: update counters -0 ipset -! a test 2.0.0.20,453 packets 13 bytes 12479 +0 ipset -! a test 2.0.0.20,0x1c5 packets 13 bytes 12479 # Counters: check counters 0 ./check_counters test 2.0.0.20 13 12479 # Counters: destroy set @@ -99,34 +99,34 @@ # Counters and timeout: create set 0 ipset n test hash:ip,mark counters timeout 600 # Counters and timeout: add element with packet, byte counters -0 ipset a test 2.0.0.1,80 packets 5 bytes 3456 +0 ipset a test 2.0.0.1,0x50 packets 5 bytes 3456 # Counters and timeout: check element -0 ipset t test 2.0.0.1,80 +0 ipset t test 2.0.0.1,0x50 # Counters and timeout: check counters 0 ./check_extensions test 2.0.0.1 600 5 3456 # Counters and timeout: delete element -0 ipset d test 2.0.0.1,80 +0 ipset d test 2.0.0.1,0x50 # Counters and timeout: test deleted element -1 ipset t test 2.0.0.1,80 +1 ipset t test 2.0.0.1,0x50 # Counters and timeout: add element with packet, byte counters -0 ipset a test 2.0.0.20,453 packets 12 bytes 9876 +0 ipset a test 2.0.0.20,0x1c5 packets 12 bytes 9876 # Counters and timeout: check counters 0 ./check_extensions test 2.0.0.20 600 12 9876 # Counters and timeout: update counters -0 ipset -! a test 2.0.0.20,453 packets 13 bytes 12479 +0 ipset -! a test 2.0.0.20,0x1c5 packets 13 bytes 12479 # Counters and timeout: check counters 0 ./check_extensions test 2.0.0.20 600 13 12479 # Counters and timeout: update timeout -0 ipset -! a test 2.0.0.20,453 timeout 700 +0 ipset -! a test 2.0.0.20,0x1c5 timeout 700 # Counters and timeout: check counters 0 ./check_extensions test 2.0.0.20 700 13 12479 # Counters and timeout: destroy set 0 ipset x test -# Create a set with 65502 ( 0x0000FFDE ) markmask +# Create a set with 0x0000FFDE markmask 0 ipset create test hash:ip,mark markmask 0x0000FFDE -# Add first value with 86111010 ( 0x0521F322 ) mark +# Add first value with 0x0521F322 mark 0 ipset add test 19.16.1.254,0x0521F322 -# Test last entry mark was modified to 62210 ( 0x0000F302 ) +# Test last entry mark was modified to 0x0000F302 0 ipset test test 19.16.1.254,0x0000F302 # Test that mask is applied for tests as well 0 ipset test test 19.16.1.254,0x0521F322 diff --git a/tests/hash:ip,mark.t.list0 b/tests/hash:ip,mark.t.list0 index d83b206..3c62c65 100644 --- a/tests/hash:ip,mark.t.list0 +++ b/tests/hash:ip,mark.t.list0 @@ -1,10 +1,10 @@ Name: test Type: hash:ip,mark -Header: family inet markmask 4294967295 hashsize 1024 maxelem 65536 timeout x +Header: family inet markmask ffffffff hashsize 1024 maxelem 65536 timeout x Size in memory: 8836 References: 0 Members: -2.0.0.0,5 timeout x -2.0.0.1,5 timeout x -2.1.0.0,128 timeout x -2.1.0.1,128 timeout x +2.0.0.0,00000005 timeout x +2.0.0.1,00000005 timeout x +2.1.0.0,00000080 timeout x +2.1.0.1,00000080 timeout x diff --git a/tests/hash:ip,mark.t.list1 b/tests/hash:ip,mark.t.list1 index 400f999..03c1c47 100644 --- a/tests/hash:ip,mark.t.list1 +++ b/tests/hash:ip,mark.t.list1 @@ -1,6 +1,6 @@ Name: test Type: hash:ip,mark -Header: family inet markmask 4294967295 hashsize 1024 maxelem 65536 timeout 5 +Header: family inet markmask ffffffff hashsize 1024 maxelem 65536 timeout 5 Size in memory: 8836 References: 0 Members: diff --git a/tests/hash:ip6,mark.t b/tests/hash:ip6,mark.t index 5c243fa..d4f9200 100644 --- a/tests/hash:ip6,mark.t +++ b/tests/hash:ip6,mark.t @@ -1,31 +1,31 @@ # Create a set with timeout 0 ipset create test hash:ip,mark family inet6 timeout 5 # Add partly zero valued element -0 ipset add test 2:0:0::1,0 +0 ipset add test 2:0:0::1,0x0 # Test partly zero valued element -0 ipset test test 2:0:0::1,0 +0 ipset test test 2:0:0::1,0x0 # Delete partly zero valued element -0 ipset del test 2:0:0::1,0 +0 ipset del test 2:0:0::1,0x0 # Add first random value -0 ipset add test 2:0:0::1,5 +0 ipset add test 2:0:0::1,0x5 # Add second random value -0 ipset add test 2:1:0::0,128 +0 ipset add test 2:1:0::0,0x80 # Test first random value -0 ipset test test 2:0:0::1,5 +0 ipset test test 2:0:0::1,0x5 # Test second random value -0 ipset test test 2:1:0::0,128 +0 ipset test test 2:1:0::0,0x80 # Test value not added to the set -1 ipset test test 2:0:0::1,4 +1 ipset test test 2:0:0::1,0x4 # Delete value not added to the set -1 ipset del test 2:0:0::1,6 +1 ipset del test 2:0:0::1,0x6 # Test value before first random value -1 ipset test test 2:0:0::0,5 +1 ipset test test 2:0:0::0,0x5 # Test value after second random value -1 ipset test test 2:1:0::1,128 +1 ipset test test 2:1:0::1,0x80 # Try to add value before first random value -0 ipset add test 2:0:0::0,5 +0 ipset add test 2:0:0::0,0x5 # Try to add value after second random value -0 ipset add test 2:1:0::1,128 +0 ipset add test 2:1:0::1,0x80 # List set 0 ipset list test | grep -v Revision: | sed 's/timeout ./timeout x/' > .foo0 && ./sort.sh .foo0 # Check listing @@ -41,135 +41,135 @@ # Create set to add a range 0 ipset new test hash:ip,mark -6 hashsize 64 # Add a random value 1 -0 ipset add test 1::1,800000 +0 ipset add test 1::1,0xc3500 # Add a random value 2 -0 ipset add test 1::1,8900000 +0 ipset add test 1::1,0x87cda0 # Add a random value 3 -0 ipset add test 1::3,8900000 +0 ipset add test 1::3,0x87cda0 # Add a random value 4 -0 ipset add test 1::4,8900000 +0 ipset add test 1::4,0x87cda0 # Add a random value 5 -0 ipset add test 1::5,8900000 +0 ipset add test 1::5,0x87cda0 # Add a random value 6 -0 ipset add test 1::6,8900000 +0 ipset add test 1::6,0x87cda0 # Add a random value 7 -0 ipset add test 1::7,8900000 +0 ipset add test 1::7,0x87cda0 # Add a random value 8 -0 ipset add test 1::8,8900000 +0 ipset add test 1::8,0x87cda0 # Add a random value 9 -0 ipset add test 1::9,8900000 +0 ipset add test 1::9,0x87cda0 # Add a random value 10 -0 ipset add test 1::101,8900000 +0 ipset add test 1::101,0x87cda0 # Add a random value 11 -0 ipset add test 1::11,8900000 +0 ipset add test 1::11,0x87cda0 # Add a random value 12 -0 ipset add test 1::12,8900000 +0 ipset add test 1::12,0x87cda0 # Add a random value 13 -0 ipset add test 1::13,8900000 +0 ipset add test 1::13,0x87cda0 # Add a random value 14 -0 ipset add test 1::14,8900000 +0 ipset add test 1::14,0x87cda0 # Add a random value 15 -0 ipset add test 1::15,8900000 +0 ipset add test 1::15,0x87cda0 # Add a random value 16 -0 ipset add test 1::16,8900000 +0 ipset add test 1::16,0x87cda0 # Add a random value 17 -0 ipset add test 1::17,8900000 +0 ipset add test 1::17,0x87cda0 # Add a random value 18 -0 ipset add test 1::18,8900000 +0 ipset add test 1::18,0x87cda0 # Add a random value 19 -0 ipset add test 1::19,8900000 +0 ipset add test 1::19,0x87cda0 # Add a random value 20 -0 ipset add test 1::20,8900000 +0 ipset add test 1::20,0x87cda0 # Add a random value 21 -0 ipset add test 1::21,8900000 +0 ipset add test 1::21,0x87cda0 # Add a random value 22 -0 ipset add test 1::22,8900000 +0 ipset add test 1::22,0x87cda0 # Add a random value 23 -0 ipset add test 1::23,8900000 +0 ipset add test 1::23,0x87cda0 # Add a random value 24 -0 ipset add test 1::24,8900000 +0 ipset add test 1::24,0x87cda0 # Add a random value 25 -0 ipset add test 1::25,8900000 +0 ipset add test 1::25,0x87cda0 # Add a random value 26 -0 ipset add test 1::26,8900000 +0 ipset add test 1::26,0x87cda0 # Add a random value 27 -0 ipset add test 1::27,8900000 +0 ipset add test 1::27,0x87cda0 # Add a random value 28 -0 ipset add test 1::28,8900000 +0 ipset add test 1::28,0x87cda0 # Add a random value 29 -0 ipset add test 1::29,8900000 +0 ipset add test 1::29,0x87cda0 # Add a random value 30 -0 ipset add test 1::301,8900000 +0 ipset add test 1::301,0x87cda0 # Add a random value 31 -0 ipset add test 1::31,8900000 +0 ipset add test 1::31,0x87cda0 # Add a random value 32 -0 ipset add test 1::32,8900000 +0 ipset add test 1::32,0x87cda0 # Add a random value 33 -0 ipset add test 1::33,8900000 +0 ipset add test 1::33,0x87cda0 # Add a random value 34 -0 ipset add test 1::34,8900000 +0 ipset add test 1::34,0x87cda0 # Add a random value 35 -0 ipset add test 1::35,8900000 +0 ipset add test 1::35,0x87cda0 # Add a random value 36 -0 ipset add test 1::36,8900000 +0 ipset add test 1::36,0x87cda0 # Add a random value 37 -0 ipset add test 1::37,8900000 +0 ipset add test 1::37,0x87cda0 # Add a random value 38 -0 ipset add test 1::38,8900000 +0 ipset add test 1::38,0x87cda0 # Add a random value 39 -0 ipset add test 1::39,8900000 +0 ipset add test 1::39,0x87cda0 # Add a random value 40 -0 ipset add test 1::401,8900000 +0 ipset add test 1::401,0x87cda0 # Add a random value 41 -0 ipset add test 1::41,8900000 +0 ipset add test 1::41,0x87cda0 # Add a random value 42 -0 ipset add test 1::42,8900000 +0 ipset add test 1::42,0x87cda0 # Add a random value 43 -0 ipset add test 1::43,8900000 +0 ipset add test 1::43,0x87cda0 # Add a random value 44 -0 ipset add test 1::44,8900000 +0 ipset add test 1::44,0x87cda0 # Add a random value 45 -0 ipset add test 1::45,8900000 +0 ipset add test 1::45,0x87cda0 # Add a random value 46 -0 ipset add test 1::46,8900000 +0 ipset add test 1::46,0x87cda0 # Add a random value 47 -0 ipset add test 1::47,8900000 +0 ipset add test 1::47,0x87cda0 # Add a random value 48 -0 ipset add test 1::48,8900000 +0 ipset add test 1::48,0x87cda0 # Add a random value 49 -0 ipset add test 1::49,8900000 +0 ipset add test 1::49,0x87cda0 # Add a random value 50 -0 ipset add test 1::501,8900000 +0 ipset add test 1::501,0x87cda0 # Add a random value 51 -0 ipset add test 1::51,8900000 +0 ipset add test 1::51,0x87cda0 # Add a random value 52 -0 ipset add test 1::52,8900000 +0 ipset add test 1::52,0x87cda0 # Add a random value 53 -0 ipset add test 1::53,8900000 +0 ipset add test 1::53,0x87cda0 # Add a random value 54 -0 ipset add test 1::54,8900000 +0 ipset add test 1::54,0x87cda0 # Add a random value 55 -0 ipset add test 1::55,8900000 +0 ipset add test 1::55,0x87cda0 # Add a random value 56 -0 ipset add test 1::56,8900000 +0 ipset add test 1::56,0x87cda0 # Add a random value 57 -0 ipset add test 1::57,8900000 +0 ipset add test 1::57,0x87cda0 # Add a random value 58 -0 ipset add test 1::58,8900000 +0 ipset add test 1::58,0x87cda0 # Add a random value 59 -0 ipset add test 1::59,8900000 +0 ipset add test 1::59,0x87cda0 # Add a random value 60 -0 ipset add test 1::601,8900000 +0 ipset add test 1::601,0x87cda0 # Add a random value 61 -0 ipset add test 1::61,8900000 +0 ipset add test 1::61,0x87cda0 # Add a random value 62 -0 ipset add test 1::62,8900000 +0 ipset add test 1::62,0x87cda0 # Add a random value 63 -0 ipset add test 1::63,8900000 +0 ipset add test 1::63,0x87cda0 # Add a random value 64 -0 ipset add test 1::64,8900000 +0 ipset add test 1::64,0x87cda0 # Add a random value 65, that forces a resizing -0 ipset add test 1::65,8900000 +0 ipset add test 1::65,0x87cda0 # Check that correct number of elements are added 0 n=`ipset list test|grep 1::|wc -l` && test $n -eq 65 # Destroy set @@ -179,21 +179,21 @@ # Counters: create set 0 ipset n test hash:ip,mark -6 counters # Counters: add element with packet, byte counters -0 ipset a test 2:0:0::1,80 packets 5 bytes 3456 +0 ipset a test 2:0:0::1,0x50 packets 5 bytes 3456 # Counters: check element -0 ipset t test 2:0:0::1,80 +0 ipset t test 2:0:0::1,0x50 # Counters: check counters 0 ./check_counters test 2::1 5 3456 # Counters: delete element -0 ipset d test 2:0:0::1,80 +0 ipset d test 2:0:0::1,0x50 # Counters: test deleted element -1 ipset t test 2:0:0::1,80 +1 ipset t test 2:0:0::1,0x50 # Counters: add element with packet, byte counters -0 ipset a test 2:0:0::20,453 packets 12 bytes 9876 +0 ipset a test 2:0:0::20,0x1c5 packets 12 bytes 9876 # Counters: check counters 0 ./check_counters test 2::20 12 9876 # Counters: update counters -0 ipset -! a test 2:0:0::20,453 packets 13 bytes 12479 +0 ipset -! a test 2:0:0::20,0x1c5 packets 13 bytes 12479 # Counters: check counters 0 ./check_counters test 2::20 13 12479 # Counters: destroy set @@ -201,34 +201,34 @@ # Counters and timeout: create set 0 ipset n test hash:ip,mark -6 counters timeout 600 # Counters and timeout: add element with packet, byte counters -0 ipset a test 2:0:0::1,80 packets 5 bytes 3456 +0 ipset a test 2:0:0::1,0x50 packets 5 bytes 3456 # Counters and timeout: check element -0 ipset t test 2:0:0::1,80 +0 ipset t test 2:0:0::1,0x50 # Counters and timeout: check counters 0 ./check_extensions test 2::1 600 5 3456 # Counters and timeout: delete element -0 ipset d test 2:0:0::1,80 +0 ipset d test 2:0:0::1,0x50 # Counters and timeout: test deleted element -1 ipset t test 2:0:0::1,80 +1 ipset t test 2:0:0::1,0x50 # Counters and timeout: add element with packet, byte counters -0 ipset a test 2:0:0::20,453 packets 12 bytes 9876 +0 ipset a test 2:0:0::20,0x1c5 packets 12 bytes 9876 # Counters and timeout: check counters 0 ./check_extensions test 2::20 600 12 9876 # Counters and timeout: update counters -0 ipset -! a test 2:0:0::20,453 packets 13 bytes 12479 +0 ipset -! a test 2:0:0::20,0x1c5 packets 13 bytes 12479 # Counters and timeout: check counters 0 ./check_extensions test 2::20 600 13 12479 # Counters and timeout: update timeout -0 ipset -! a test 2:0:0::20,453 timeout 700 +0 ipset -! a test 2:0:0::20,0x1c5 timeout 700 # Counters and timeout: check counters 0 ./check_extensions test 2::20 700 13 12479 # Counters and timeout: destroy set 0 ipset x test -# Create a set with 65502 ( 0x0000FFDE ) markmask +# Create a set with 0x0000FFDE markmask 0 ipset create test hash:ip,mark family inet6 markmask 0x0000FFDE -# Add first value with 86111010 ( 0x0521F322 ) mark +# Add first value with 0x0521F322 mark 0 ipset add test 2:1::1,0x0521F322 -# Test last entry mark was modified to 62210 ( 0x0000F302 ) +# Test last entry mark was modified to 0x0000F302 0 ipset test test 2:1::1,0x0000F302 # Test that mask is applied for tests as well 0 ipset test test 2:1::1,0x0521F322 diff --git a/tests/hash:ip6,mark.t.list0 b/tests/hash:ip6,mark.t.list0 index 0cd930b..75b654a 100644 --- a/tests/hash:ip6,mark.t.list0 +++ b/tests/hash:ip6,mark.t.list0 @@ -1,10 +1,10 @@ Name: test Type: hash:ip,mark -Header: family inet6 markmask 4294967295 hashsize 1024 maxelem 65536 timeout x +Header: family inet6 markmask ffffffff hashsize 1024 maxelem 65536 timeout x Size in memory: 9316 References: 0 Members: -2:1::,128 timeout x -2:1::1,128 timeout x -2::,5 timeout x -2::1,5 timeout x +2:1::,00000080 timeout x +2:1::1,00000080 timeout x +2::,00000005 timeout x +2::1,00000005 timeout x diff --git a/tests/hash:ip6,mark.t.list1 b/tests/hash:ip6,mark.t.list1 index 44bc1da..52221f5 100644 --- a/tests/hash:ip6,mark.t.list1 +++ b/tests/hash:ip6,mark.t.list1 @@ -1,6 +1,6 @@ Name: test Type: hash:ip,mark -Header: family inet6 markmask 4294967295 hashsize 1024 maxelem 65536 timeout 5 +Header: family inet6 markmask ffffffff hashsize 1024 maxelem 65536 timeout 5 Size in memory: 9316 References: 0 Members: diff --git a/tests/ipmarkhash.t b/tests/ipmarkhash.t index 30301fb..e96bbfa 100644 --- a/tests/ipmarkhash.t +++ b/tests/ipmarkhash.t @@ -5,31 +5,31 @@ # Create a set 0 ipset -N test ipmarkhash # Add partly zero valued element -0 ipset -A test 2.0.0.1,0 +0 ipset -A test 2.0.0.1,0x0 # Test partly zero valued element -0 ipset -T test 2.0.0.1,0 +0 ipset -T test 2.0.0.1,0x0 # Delete partly zero valued element -0 ipset -D test 2.0.0.1,0 +0 ipset -D test 2.0.0.1,0x0 # Add first random value -0 ipset -A test 2.0.0.1,5 +0 ipset -A test 2.0.0.1,0x5 # Add second random value -0 ipset -A test 2.1.0.0,128 +0 ipset -A test 2.1.0.0,0x80 # Test first random value -0 ipset -T test 2.0.0.1,5 +0 ipset -T test 2.0.0.1,0x5 # Test second random value -0 ipset -T test 2.1.0.0,128 +0 ipset -T test 2.1.0.0,0x80 # Test value not added to the set -1 ipset -T test 2.0.0.1,4 +1 ipset -T test 2.0.0.1,0x4 # Delete value not added to the set -1 ipset -D test 2.0.0.1,6 +1 ipset -D test 2.0.0.1,0x6 # Test value before first random value -1 ipset -T test 2.0.0.0,5 +1 ipset -T test 2.0.0.0,0x5 # Test value after second random value -1 ipset -T test 2.1.0.1,128 +1 ipset -T test 2.1.0.1,0x80 # Try to add value before first random value -0 ipset -A test 2.0.0.0,5 +0 ipset -A test 2.0.0.0,0x5 # Try to add value after second random value -0 ipset -A test 2.1.0.1,128 +0 ipset -A test 2.1.0.1,0x80 # List set 0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing @@ -41,25 +41,25 @@ # Create a set from a network (network ignored) 0 ipset -N test ipmarkhash --network 2.0.0.0/16 # Add first random value -0 ipset -A test 2.0.0.0,5 +0 ipset -A test 2.0.0.0,0x5 # Add second random value -0 ipset -A test 2.0.255.255,128 +0 ipset -A test 2.0.255.255,0x80 # Test first random value -0 ipset -T test 2.0.0.0,5 +0 ipset -T test 2.0.0.0,0x5 # Test second random value -0 ipset -T test 2.0.255.255,128 +0 ipset -T test 2.0.255.255,0x80 # Test value not added to the set -1 ipset -T test 2.0.0.0,4 +1 ipset -T test 2.0.0.0,0x4 # Delete value not added to the set -1 ipset -D test 2.0.0.0,6 +1 ipset -D test 2.0.0.0,0x6 # Test value before first random value -1 ipset -T test 1.255.255.255,5 +1 ipset -T test 1.255.255.255,0x5 # Test value after second random value -1 ipset -T test 2.1.0.0,128 +1 ipset -T test 2.1.0.0,0x80 # Try to add value before first random value -0 ipset -A test 1.255.255.255,5 +0 ipset -A test 1.255.255.255,0x5 # Try to add value after second random value -0 ipset -A test 2.1.0.0,128 +0 ipset -A test 2.1.0.0,0x80 # List set 0 ipset -L test | grep -v Revision: > .foo0 && ./sort.sh .foo0 # Check listing diff --git a/tests/ipmarkhash.t.list0 b/tests/ipmarkhash.t.list0 index 4ada53a..6370ce4 100644 --- a/tests/ipmarkhash.t.list0 +++ b/tests/ipmarkhash.t.list0 @@ -1,10 +1,10 @@ Name: test Type: hash:ip,mark -Header: family inet markmask 4294967295 hashsize 1024 maxelem 65536 +Header: family inet markmask ffffffff hashsize 1024 maxelem 65536 Size in memory: 8516 References: 0 Members: -2.0.0.0,5 -2.0.0.1,5 -2.1.0.0,128 -2.1.0.1,128 +2.0.0.0,00000005 +2.0.0.1,00000005 +2.1.0.0,00000080 +2.1.0.1,00000080 diff --git a/tests/ipmarkhash.t.list1 b/tests/ipmarkhash.t.list1 index 74d2869..01f7b6e 100644 --- a/tests/ipmarkhash.t.list1 +++ b/tests/ipmarkhash.t.list1 @@ -1,10 +1,10 @@ Name: test Type: hash:ip,mark -Header: family inet markmask 4294967295 hashsize 1024 maxelem 65536 +Header: family inet markmask ffffffff hashsize 1024 maxelem 65536 Size in memory: 8468 References: 0 Members: -1.255.255.255,5 -2.0.0.0,5 -2.0.255.255,128 -2.1.0.0,128 +1.255.255.255,00000005 +2.0.0.0,00000005 +2.0.255.255,00000080 +2.1.0.0,00000080 -- 1.7.9.5