diff options
author | Tom Gundersen <teg@jklm.no> | 2015-08-27 21:38:36 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-08-27 21:38:36 +0200 |
commit | 4a316c44aa6222f3abc7ed2d50d00a0817cd4466 (patch) | |
tree | a66424ffac18c715c70fce1484366cd3c7a9415d /src/libsystemd/sd-network/sd-network.c | |
parent | d56cc298808b2dbfa28ae893d6f47f34df3196b1 (diff) | |
parent | c2c940bda03a07fbacfa3df2590ed865ec3dcc22 (diff) |
Merge pull request #1055 from poettering/dhcp-updates
Various networkd and dhcp updates
Diffstat (limited to 'src/libsystemd/sd-network/sd-network.c')
-rw-r--r-- | src/libsystemd/sd-network/sd-network.c | 22 |
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; |