summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ipaddress.h2
-rw-r--r--src/ipaddress.c16
-rw-r--r--src/ipconfig.c4
3 files changed, 9 insertions, 13 deletions
diff --git a/include/ipaddress.h b/include/ipaddress.h
index 9fff622e..cc6848e2 100644
--- a/include/ipaddress.h
+++ b/include/ipaddress.h
@@ -46,7 +46,7 @@ int connman_ipaddress_set_ipv6(struct connman_ipaddress *ipaddress,
void connman_ipaddress_set_peer(struct connman_ipaddress *ipaddress,
const char *peer);
void connman_ipaddress_clear(struct connman_ipaddress *ipaddress);
-void connman_ipaddress_copy(struct connman_ipaddress *ipaddress,
+void connman_ipaddress_copy_address(struct connman_ipaddress *ipaddress,
struct connman_ipaddress *source);
#ifdef __cplusplus
diff --git a/src/ipaddress.c b/src/ipaddress.c
index e5af9a06..f66bb674 100644
--- a/src/ipaddress.c
+++ b/src/ipaddress.c
@@ -177,7 +177,12 @@ void connman_ipaddress_clear(struct connman_ipaddress *ipaddress)
ipaddress->gateway = NULL;
}
-void connman_ipaddress_copy(struct connman_ipaddress *ipaddress,
+/*
+ * Note that this copy function only copies the actual address and
+ * prefixlen. If you need full copy of ipaddress struct, then you need
+ * to create a new function that does that.
+ */
+void connman_ipaddress_copy_address(struct connman_ipaddress *ipaddress,
struct connman_ipaddress *source)
{
if (ipaddress == NULL || source == NULL)
@@ -188,13 +193,4 @@ void connman_ipaddress_copy(struct connman_ipaddress *ipaddress,
g_free(ipaddress->local);
ipaddress->local = g_strdup(source->local);
-
- g_free(ipaddress->peer);
- ipaddress->peer = g_strdup(source->peer);
-
- g_free(ipaddress->broadcast);
- ipaddress->broadcast = g_strdup(source->broadcast);
-
- g_free(ipaddress->gateway);
- ipaddress->gateway = g_strdup(source->gateway);
}
diff --git a/src/ipconfig.c b/src/ipconfig.c
index 9ca33161..824a3015 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -663,11 +663,11 @@ void __connman_ipconfig_newaddr(int index, int family, const char *label,
__connman_ippool_newaddr(index, address, prefixlen);
if (ipdevice->config_ipv4 != NULL && family == AF_INET)
- connman_ipaddress_copy(ipdevice->config_ipv4->system,
+ connman_ipaddress_copy_address(ipdevice->config_ipv4->system,
ipaddress);
else if (ipdevice->config_ipv6 != NULL && family == AF_INET6)
- connman_ipaddress_copy(ipdevice->config_ipv6->system,
+ connman_ipaddress_copy_address(ipdevice->config_ipv6->system,
ipaddress);
else
return;