diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2017-10-13 11:56:16 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2017-10-16 11:59:43 +0200 |
commit | 361cb9e910e77f657ad39e0be4684b8028711a0c (patch) | |
tree | d01c2c749d1ded405fbec6b5c4feb749f97f80bf /tests/lib | |
parent | 5bacb59a6c314001a053977acb4aece4695b356a (diff) |
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
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/ippool_test.c | 20 | ||||
-rw-r--r-- | tests/lib/ippool_test.ok | 15 |
2 files changed, 20 insertions, 15 deletions
diff --git a/tests/lib/ippool_test.c b/tests/lib/ippool_test.c index 79e43e7..f38c1be 100644 --- a/tests/lib/ippool_test.c +++ b/tests/lib/ippool_test.c @@ -90,20 +90,20 @@ static void test_pool_size(const char *pfx, unsigned int flags, unsigned int exp static void test_pool_sizes(void) { - /* 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:: |