<filename>systemd-timesyncd.service</filename>.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>RoutesToNTP=</varname></term>
+ <listitem>
+ <para>When true, the routes to the NTP servers received from the DHCP server will be
+ configured. When <varname>UseNTP=</varname> is disabled, this setting is ignored.
+ Defaults to true.</para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term><varname>UseSIP=</varname></term>
<listitem>
return link_set_routes_to_servers(link, dns, r, gw);
}
+static int link_set_routes_to_ntp(Link *link, const struct in_addr *gw) {
+ const struct in_addr *ntp;
+ int r;
+
+ assert(link);
+ assert(link->dhcp_lease);
+ assert(link->network);
+ assert(gw);
+
+ if (!link->network->dhcp_use_ntp ||
+ !link->network->dhcp_routes_to_ntp)
+ return 0;
+
+ r = sd_dhcp_lease_get_ntp(link->dhcp_lease, &ntp);
+ if (IN_SET(r, 0, -ENODATA))
+ return 0;
+ if (r < 0)
+ return r;
+
+ return link_set_routes_to_servers(link, ntp, r, gw);
+}
+
static int link_set_dhcp_routes(Link *link) {
struct in_addr gw = {};
Route *rt;
if (r < 0)
return log_link_error_errno(link, r, "DHCP error: Could not set routes to DNS servers: %m");
+ r = link_set_routes_to_ntp(link, &gw);
+ if (r < 0)
+ return log_link_error_errno(link, r, "DHCP error: Could not set routes to NTP servers: %m");
+
return 0;
}
DHCPv4.UseDNS, config_parse_dhcp_use_dns, 0, 0
DHCPv4.RoutesToDNS, config_parse_bool, 0, offsetof(Network, dhcp_routes_to_dns)
DHCPv4.UseNTP, config_parse_dhcp_use_ntp, 0, 0
+DHCPv4.RoutesToNTP, config_parse_bool, 0, offsetof(Network, dhcp_routes_to_ntp)
DHCPv4.UseSIP, config_parse_bool, 0, offsetof(Network, dhcp_use_sip)
DHCPv4.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_use_mtu)
DHCPv4.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_use_hostname)
.dhcp_duid.type = _DUID_TYPE_INVALID,
.dhcp_critical = -1,
.dhcp_use_ntp = true,
+ .dhcp_routes_to_ntp = true,
.dhcp_use_sip = true,
.dhcp_use_dns = true,
.dhcp_routes_to_dns = true,
bool dhcp_routes_to_dns;
bool dhcp_use_ntp;
bool dhcp_use_ntp_set;
+ bool dhcp_routes_to_ntp;
bool dhcp_use_sip;
bool dhcp_use_mtu;
bool dhcp_use_routes;
IAID=
UserClass=
UseNTP=
+RoutesToNTP=
UseSIP=
UseMTU=
UseDomainName=