diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-02-09 11:02:17 +0100 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-02-13 18:03:41 +0100 |
commit | d4b273c2c160957e8de3fb70ed0843f4b3df6d8b (patch) | |
tree | dbc8c07b6320d22a23b2764a15befb80c7b81b07 | |
parent | f91243cce7ade6924f47b423bab645a2b78a6b92 (diff) | |
download | connman-d4b273c2c160957e8de3fb70ed0843f4b3df6d8b.tar.gz connman-d4b273c2c160957e8de3fb70ed0843f4b3df6d8b.tar.bz2 connman-d4b273c2c160957e8de3fb70ed0843f4b3df6d8b.zip |
test-ippool: Test overlapping ranges
-rw-r--r-- | unit/test-ippool.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/unit/test-ippool.c b/unit/test-ippool.c index 9159547f..2df85618 100644 --- a/unit/test-ippool.c +++ b/unit/test-ippool.c @@ -209,11 +209,39 @@ static void test_ippool_collision0(void) g_assert(flag == 0); - __connman_ippool_newaddr(42, start_ip, 24); + __connman_ippool_newaddr(42, start_ip, 16); g_assert(flag == 1); __connman_ippool_unref(pool); + + flag = 0; + + pool = __connman_ippool_create(23, 1, 100, collision_cb, &flag); + g_assert(pool); + + gateway = __connman_ippool_get_gateway(pool); + broadcast = __connman_ippool_get_broadcast(pool); + subnet_mask = __connman_ippool_get_subnet_mask(pool); + start_ip = __connman_ippool_get_start_ip(pool); + end_ip = __connman_ippool_get_end_ip(pool); + + g_assert(gateway); + g_assert(broadcast); + g_assert(subnet_mask); + g_assert(start_ip); + g_assert(end_ip); + + LOG("\n\tIP range %s --> %s\n" + "\tgateway %s broadcast %s mask %s", start_ip, end_ip, + gateway, broadcast, subnet_mask); + + __connman_ippool_newaddr(45, start_ip, 22); + + g_assert(flag == 1); + + __connman_ippool_unref(pool); + __connman_ippool_cleanup(); } |