summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-08-26 19:19:32 +0200
committerLennart Poettering <lennart@poettering.net>2015-08-26 20:44:20 +0200
commit8eb9058dc1f99a5eb9b8726a978fcc0720837a10 (patch)
tree9e2670f8a77d6fd01d763c7097908f6824694571 /src/libsystemd
parent43f447b121b38c01a7c5626a51cc571a822250b8 (diff)
dhcp,network: implement RFC 4833 (DHCP Timezone option)
This one is simply to add: encode the tzdata timezone in the DHCP options and optionally make use of it.
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-network/sd-network.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c
index b63fdf8fcb..87d87359b8 100644
--- a/src/libsystemd/sd-network/sd-network.c
+++ b/src/libsystemd/sd-network/sd-network.c
@@ -214,6 +214,28 @@ _public_ int sd_network_link_get_lldp(int ifindex, char **lldp) {
return 0;
}
+int sd_network_link_get_timezone(int ifindex, char **ret) {
+ _cleanup_free_ char *s = NULL, *p = NULL;
+ int r;
+
+ assert_return(ifindex > 0, -EINVAL);
+ assert_return(ret, -EINVAL);
+
+ if (asprintf(&p, "/run/systemd/netif/links/%d", ifindex) < 0)
+ return -ENOMEM;
+
+ r = parse_env_file(p, NEWLINE, "TIMEZONE", &s, NULL);
+ if (r == -ENOENT)
+ return -ENODATA;
+ if (r < 0)
+ return r;
+ if (isempty(s))
+ return -ENODATA;
+
+ *ret = s;
+ s = NULL;
+ return 0;
+}
static int network_get_link_strv(const char *key, int ifindex, char ***ret) {
_cleanup_free_ char *p = NULL, *s = NULL;