summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2012-02-06 16:49:34 +0100
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2012-02-13 18:03:41 +0100
commitda94095914e25fd26a793d348884b39e913a56d2 (patch)
treee65aa44c31cc41ea6e13346da9fac42c20c005fc
parent132f1d6803d1714b4ff44f07e331bf62bf9f5b5f (diff)
downloadconnman-da94095914e25fd26a793d348884b39e913a56d2.tar.gz
connman-da94095914e25fd26a793d348884b39e913a56d2.tar.bz2
connman-da94095914e25fd26a793d348884b39e913a56d2.zip
ippool: Add prefixlen argument to __connman_ippool_new/deladdr()
-rw-r--r--src/connman.h6
-rw-r--r--src/ipconfig.c8
-rw-r--r--src/ippool.c6
-rw-r--r--unit/test-ippool.c4
4 files changed, 14 insertions, 10 deletions
diff --git a/src/connman.h b/src/connman.h
index da4affd0..9a25119b 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -741,8 +741,10 @@ const char *__connman_ippool_get_subnet_mask(struct connman_ippool *pool);
const char *__connman_ippool_get_start_ip(struct connman_ippool *pool);
const char *__connman_ippool_get_end_ip(struct connman_ippool *pool);
-void __connman_ippool_newaddr(int index, const char *address);
-void __connman_ippool_deladdr(int index, const char *address);
+void __connman_ippool_newaddr(int index, const char *address,
+ unsigned char prefixlen);
+void __connman_ippool_deladdr(int index, const char *address,
+ unsigned char prefixlen);
int __connman_bridge_create(const char *name);
int __connman_bridge_remove(const char *name);
diff --git a/src/ipconfig.c b/src/ipconfig.c
index 1f79d2ed..e782fb1b 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -807,7 +807,7 @@ void __connman_ipconfig_newaddr(int index, int family, const char *label,
ipdevice->ifname, address, prefixlen, label, family);
if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
- __connman_ippool_newaddr(index, address);
+ __connman_ippool_newaddr(index, address, prefixlen);
if (ipdevice->config_ipv4 != NULL && family == AF_INET)
connman_ipaddress_copy(ipdevice->config_ipv4->system,
@@ -868,15 +868,15 @@ void __connman_ipconfig_deladdr(int index, int family, const char *label,
ipdevice->address_list = g_slist_remove(ipdevice->address_list,
ipaddress);
+ if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
+ __connman_ippool_deladdr(index, address, prefixlen);
+
connman_ipaddress_clear(ipaddress);
g_free(ipaddress);
connman_info("%s {del} address %s/%u label %s", ipdevice->ifname,
address, prefixlen, label);
- if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
- __connman_ippool_deladdr(index, address);
-
if ((ipdevice->flags & (IFF_RUNNING | IFF_LOWER_UP)) != (IFF_RUNNING | IFF_LOWER_UP))
return;
diff --git a/src/ippool.c b/src/ippool.c
index a4819ee7..f0952ff1 100644
--- a/src/ippool.c
+++ b/src/ippool.c
@@ -196,7 +196,8 @@ static uint32_t find_free_block()
return 0;
}
-void __connman_ippool_newaddr(int index, const char *address)
+void __connman_ippool_newaddr(int index, const char *address,
+ unsigned char prefixlen)
{
struct connman_ippool *pool;
struct in_addr inp;
@@ -225,7 +226,8 @@ void __connman_ippool_newaddr(int index, const char *address)
pool->collision_cb(pool, pool->user_data);
}
-void __connman_ippool_deladdr(int index, const char *address)
+void __connman_ippool_deladdr(int index, const char *address,
+ unsigned char prefixlen)
{
struct in_addr inp;
uint32_t block;
diff --git a/unit/test-ippool.c b/unit/test-ippool.c
index 0794bde9..7b4a91bb 100644
--- a/unit/test-ippool.c
+++ b/unit/test-ippool.c
@@ -179,11 +179,11 @@ static void test_ippool_collision0(void)
"\tgateway %s broadcast %s mask %s", start_ip, end_ip,
gateway, broadcast, subnet_mask);
- __connman_ippool_newaddr(23, start_ip);
+ __connman_ippool_newaddr(23, start_ip, 24);
g_assert(flag == 0);
- __connman_ippool_newaddr(42, start_ip);
+ __connman_ippool_newaddr(42, start_ip, 24);
g_assert(flag == 1);