diff options
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r-- | src/libsystemd-network/network-internal.c | 7 | ||||
-rw-r--r-- | src/libsystemd-network/network-internal.h | 2 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp-lease.c | 8 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c index 3407537eb5..603ee6dbe9 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/network-internal.c @@ -339,21 +339,16 @@ int net_parse_inaddr(const char *address, int *family, void *dst) { return 0; } -void serialize_in_addrs(FILE *f, const char *key, const struct in_addr *addresses, size_t size) { +void serialize_in_addrs(FILE *f, const struct in_addr *addresses, size_t size) { unsigned i; assert(f); - assert(key); assert(addresses); assert(size); - fprintf(f, "%s=", key); - for (i = 0; i < size; i++) fprintf(f, "%s%s", inet_ntoa(addresses[i]), (i < (size - 1)) ? " ": ""); - - fputs("\n", f); } int deserialize_in_addrs(struct in_addr **ret, const char *string) { diff --git a/src/libsystemd-network/network-internal.h b/src/libsystemd-network/network-internal.h index 765dff4f3f..6dd518bb48 100644 --- a/src/libsystemd-network/network-internal.h +++ b/src/libsystemd-network/network-internal.h @@ -67,7 +67,7 @@ int net_parse_inaddr(const char *address, int *family, void *dst); int net_get_unique_predictable_data(struct udev_device *device, uint8_t result[8]); const char *net_get_name(struct udev_device *device); -void serialize_in_addrs(FILE *f, const char *key, const struct in_addr *addresses, size_t size); +void serialize_in_addrs(FILE *f, const struct in_addr *addresses, size_t size); int deserialize_in_addrs(struct in_addr **addresses, const char *string); int deserialize_in6_addrs(struct in6_addr **addresses, const char *string); diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index 4ed30f5d03..bfd1b0cd18 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -629,13 +629,17 @@ int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) { if (r >= 0) fprintf(f, "MTU=%" PRIu16 "\n", mtu); + fputs("DNS=", f); r = sd_dhcp_lease_get_dns(lease, &addresses); if (r >= 0) - serialize_in_addrs(f, "DNS", addresses, r); + serialize_in_addrs(f, addresses, r); + fputs("\n", f); + fputs("NTP=", f); r = sd_dhcp_lease_get_ntp(lease, &addresses); if (r >= 0) - serialize_in_addrs(f, "NTP", addresses, r); + serialize_in_addrs(f, addresses, r); + fputs("\n", f); r = sd_dhcp_lease_get_domainname(lease, &string); if (r >= 0) |