summaryrefslogtreecommitdiff
path: root/src/network/networkd-network.c
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/network/networkd-network.c
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/network/networkd-network.c')
-rw-r--r--src/network/networkd-network.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 8f773e738d..3619e3160c 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -124,7 +124,8 @@ static int network_load_one(Manager *manager, const char *filename) {
"Address\0"
"Route\0"
"DHCP\0"
- "DHCPv4\0"
+ "DHCPv4\0" /* compat */
+ "DHCPServer\0"
"Bridge\0"
"BridgeFDB\0",
config_item_perf_lookup, network_network_gperf_lookup,
@@ -258,6 +259,8 @@ void network_free(Network *network) {
condition_free_list(network->match_kernel);
condition_free_list(network->match_arch);
+ free(network->dhcp_server_timezone);
+
free(network);
}
@@ -849,3 +852,38 @@ int config_parse_hostname(
*hostname = hostname_cleanup(hn);
return 0;
}
+
+int config_parse_timezone(
+ const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ char **timezone = data, *tz = NULL;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+
+ r = config_parse_string(unit, filename, line, section, section_line, lvalue, ltype, rvalue, &tz, userdata);
+ if (r < 0)
+ return r;
+
+ if (!timezone_is_valid(tz)) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Timezone is not valid, ignoring assignment: %s", rvalue);
+ free(tz);
+ return 0;
+ }
+
+ free(*timezone);
+ *timezone = tz;
+
+ return 0;
+}