diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-06-02 20:35:13 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-06-06 19:59:09 +0200 |
commit | 1f152e4b41d730c7bbe23d8cbe45b7d342ba8c13 (patch) | |
tree | 888818930313677f44c0b341d2eee2de2a94a4f1 /src | |
parent | 34380032fb8bdfd801fbd43c03acfb7ac664d2bb (diff) |
network: use inet_ntop() rather than SD_NDISC_ADDRESS_FORMAT_VAL() when serializing
Let's use the usual libc API for serializing IPv6 addresses, instead of the
NDISC-specific macro we should get rid of anyway.
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd-network/network-internal.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c index bfaa75880b..ce30b7fc25 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/network-internal.c @@ -380,18 +380,21 @@ 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) { +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_NDISC_ADDRESS_FORMAT_STR"%s", - SD_NDISC_ADDRESS_FORMAT_VAL(addresses[i]), - (i < (size - 1)) ? " ": ""); + for (i = 0; i < size; i++) { + char buffer[INET6_ADDRSTRLEN]; + + fputs(inet_ntop(AF_INET6, addresses+i, buffer, sizeof(buffer)), f); + + if (i < size - 1) + fputc(' ', f); + } } int deserialize_in6_addrs(struct in6_addr **ret, const char *string) { |