From d6ede37b7e62ca7e3544b7319b9234c564365dca Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 13 Oct 2017 11:56:16 +0200 Subject: lib/ippool: Fix listsize calculated 1 elem too small Take the chance this commit is changing test output to also remove use of IPPOOL_NOGATEWAY which is going to be removed soon, and instead test IPPOOL_NOBROADCAST. Change-Id: I95c24bc690490155bec9e3933d678e4668d7745f --- tests/lib/ippool_test.c | 20 ++++++++++---------- tests/lib/ippool_test.ok | 15 ++++++++++----- 2 files changed, 20 insertions(+), 15 deletions(-) (limited to 'tests') diff --git a/tests/lib/ippool_test.c b/tests/lib/ippool_test.c index e8604d9..1d0c3a2 100644 --- a/tests/lib/ippool_test.c +++ b/tests/lib/ippool_test.c @@ -92,20 +92,20 @@ static int test_pool_sizes(void) { struct ippool_t *pool; - /* 255 addresses [0..254] */ - test_pool_size("192.168.23.0/24", 0, 255); + /* 256 addresses [0..255] */ + test_pool_size("192.168.23.0/24", 0, 256); - /* 254 addresses [1..254] */ - test_pool_size("192.168.23.0/24", IPPOOL_NONETWORK, 254); + /* 255 addresses [1..255] */ + test_pool_size("192.168.23.0/24", IPPOOL_NONETWORK, 255); - /* 253 addresses [2..254] */ - test_pool_size("192.168.23.0/24", IPPOOL_NOGATEWAY, 253); + /* 254 addresses [1..254] */ + test_pool_size("192.168.23.0/24", IPPOOL_NONETWORK | IPPOOL_NOBROADCAST, 254); - /* 65533 addresses [3..255.254] */ - test_pool_size("192.168.0.0/16", IPPOOL_NOGATEWAY, 65533); + /* 65534 addresses [0.1..255.254] */ + test_pool_size("192.168.0.0/16", IPPOOL_NONETWORK | IPPOOL_NOBROADCAST, 65534); - /* 255 prefixes of /64 each */ - test_pool_size("2001:DB8::/56", 0, 255); + /* 256 prefixes of /64 each */ + test_pool_size("2001:DB8::/56", 0, 256); } int main(int argc, char **argv) diff --git a/tests/lib/ippool_test.ok b/tests/lib/ippool_test.ok index c1398ab..a0eeb4b 100644 --- a/tests/lib/ippool_test.ok +++ b/tests/lib/ippool_test.ok @@ -1,4 +1,4 @@ -testing pool for prefix 192.168.23.0/24, flags=0x0, expected_size=255 +testing pool for prefix 192.168.23.0/24, flags=0x0, expected_size=256 allocated address 192.168.23.0 allocated address 192.168.23.1 allocated address 192.168.23.2 @@ -254,7 +254,8 @@ allocated address 192.168.23.251 allocated address 192.168.23.252 allocated address 192.168.23.253 allocated address 192.168.23.254 -testing pool for prefix 192.168.23.0/24, flags=0x1, expected_size=254 +allocated address 192.168.23.255 +testing pool for prefix 192.168.23.0/24, flags=0x1, expected_size=255 allocated address 192.168.23.1 allocated address 192.168.23.2 allocated address 192.168.23.3 @@ -509,7 +510,9 @@ allocated address 192.168.23.251 allocated address 192.168.23.252 allocated address 192.168.23.253 allocated address 192.168.23.254 -testing pool for prefix 192.168.23.0/24, flags=0x4, expected_size=253 +allocated address 192.168.23.255 +testing pool for prefix 192.168.23.0/24, flags=0x3, expected_size=254 +allocated address 192.168.23.1 allocated address 192.168.23.2 allocated address 192.168.23.3 allocated address 192.168.23.4 @@ -763,7 +766,8 @@ allocated address 192.168.23.251 allocated address 192.168.23.252 allocated address 192.168.23.253 allocated address 192.168.23.254 -testing pool for prefix 192.168.0.0/16, flags=0x4, expected_size=65533 +testing pool for prefix 192.168.0.0/16, flags=0x3, expected_size=65534 +allocated address 192.168.0.1 allocated address 192.168.0.2 allocated address 192.168.0.3 allocated address 192.168.0.4 @@ -66297,7 +66301,7 @@ allocated address 192.168.255.251 allocated address 192.168.255.252 allocated address 192.168.255.253 allocated address 192.168.255.254 -testing pool for prefix 2001:DB8::/56, flags=0x0, expected_size=255 +testing pool for prefix 2001:DB8::/56, flags=0x0, expected_size=256 allocated address 2001:db8:: allocated address 2001:db8:0:1:: allocated address 2001:db8:0:2:: @@ -66553,3 +66557,4 @@ allocated address 2001:db8:0:fb:: allocated address 2001:db8:0:fc:: allocated address 2001:db8:0:fd:: allocated address 2001:db8:0:fe:: +allocated address 2001:db8:0:ff:: -- cgit v1.2.3