mirror of
https://github.com/systemd/systemd.git
synced 2025-03-22 06:50:18 +03:00
network:dhcp4_server_configure returns if not able to get timezone
When /etc/localtime is a symbolic link pointing to another symbolic link, get_timezone will return -EINVAL instead of the timezone. This issue can cause systemd-networkd DHCPServer to fail. Instead of returning failure, log a warning indicating that that the timezone will not be sent. modified: networkd-dhcp-server.c
This commit is contained in:
parent
1fa94a3124
commit
7b5018ca9e
@ -364,21 +364,23 @@ int dhcp4_server_configure(Link *link) {
|
||||
|
||||
if (link->network->dhcp_server_emit_timezone) {
|
||||
_cleanup_free_ char *buffer = NULL;
|
||||
const char *tz;
|
||||
const char *tz = NULL;
|
||||
|
||||
if (link->network->dhcp_server_timezone)
|
||||
tz = link->network->dhcp_server_timezone;
|
||||
else {
|
||||
r = get_timezone(&buffer);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Failed to determine timezone: %m");
|
||||
|
||||
tz = buffer;
|
||||
log_link_warning_errno(link, r, "Failed to determine timezone, not sending timezone: %m");
|
||||
else
|
||||
tz = buffer;
|
||||
}
|
||||
|
||||
r = sd_dhcp_server_set_timezone(link->dhcp_server, tz);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Failed to set timezone for DHCP server: %m");
|
||||
if (tz) {
|
||||
r = sd_dhcp_server_set_timezone(link->dhcp_server, tz);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Failed to set timezone for DHCP server: %m");
|
||||
}
|
||||
}
|
||||
|
||||
ORDERED_HASHMAP_FOREACH(p, link->network->dhcp_server_send_options) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user