summaryrefslogtreecommitdiffstats
path: root/src/timesync/timesyncd-bus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-12-17 15:30:23 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-12-18 00:59:14 +0100
commit1a126325eb26decfe4d3bb64c6ec1c27cafb8c73 (patch)
tree0ccbaded8061a35c6bfb0d787ca0c0892cb7eb4e /src/timesync/timesyncd-bus.c
parentNEWS: document the usern/mknod borkage in 4.18 a bit (diff)
downloadsystemd-1a126325eb26decfe4d3bb64c6ec1c27cafb8c73.tar.xz
systemd-1a126325eb26decfe4d3bb64c6ec1c27cafb8c73.zip
timesync: fix serialization of IP address
Fixes: #11169
Diffstat (limited to 'src/timesync/timesyncd-bus.c')
-rw-r--r--src/timesync/timesyncd-bus.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/timesync/timesyncd-bus.c b/src/timesync/timesyncd-bus.c
index c945c3bf7b..5a5896f0b7 100644
--- a/src/timesync/timesyncd-bus.c
+++ b/src/timesync/timesyncd-bus.c
@@ -80,6 +80,8 @@ static int property_get_current_server_address(
if (!a)
return sd_bus_message_append(reply, "(iay)", AF_UNSPEC, 0);
+ assert(IN_SET(a->sockaddr.sa.sa_family, AF_INET, AF_INET6));
+
r = sd_bus_message_open_container(reply, 'r', "iay");
if (r < 0)
return r;
@@ -88,7 +90,9 @@ static int property_get_current_server_address(
if (r < 0)
return r;
- r = sd_bus_message_append_array(reply, 'y', &a->sockaddr.in.sin_addr, FAMILY_ADDRESS_SIZE(a->sockaddr.sa.sa_family));
+ r = sd_bus_message_append_array(reply, 'y',
+ a->sockaddr.sa.sa_family == AF_INET ? (void*) &a->sockaddr.in.sin_addr : (void*) &a->sockaddr.in6.sin6_addr,
+ FAMILY_ADDRESS_SIZE(a->sockaddr.sa.sa_family));
if (r < 0)
return r;