summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/network-internal.c
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2015-07-06 12:50:47 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2015-08-21 11:23:22 +0300
commitb729fa14aa118d4c7cd6846ff66d8cf1e885d900 (patch)
tree0e644e0b2a39880e4a6e09fca66ff790763066f7 /src/libsystemd-network/network-internal.c
parentbc152ff879a79412e358daaaa3677a0fc226bcb0 (diff)
network: Add function to serialize an IPv6 address
Diffstat (limited to 'src/libsystemd-network/network-internal.c')
-rw-r--r--src/libsystemd-network/network-internal.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
index 3d78bf8b35..d8357c687e 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -32,6 +32,7 @@
#include "conf-parser.h"
#include "condition.h"
#include "network-internal.h"
+#include "sd-icmp6-nd.h"
const char *net_get_name(struct udev_device *device) {
const char *name, *field;
@@ -384,6 +385,20 @@ int deserialize_in_addrs(struct in_addr **ret, const char *string) {
return size;
}
+void serialize_in6_addrs(FILE *f, const struct in6_addr *addresses,
+ size_t size) {
+ unsigned i;
+
+ assert(f);
+ assert(addresses);
+ assert(size);
+
+ for (i = 0; i < size; i++)
+ fprintf(f, SD_ICMP6_ADDRESS_FORMAT_STR"%s",
+ SD_ICMP6_ADDRESS_FORMAT_VAL(addresses[i]),
+ (i < (size - 1)) ? " ": "");
+}
+
int deserialize_in6_addrs(struct in6_addr **ret, const char *string) {
_cleanup_free_ struct in6_addr *addresses = NULL;
int size = 0;