network: add DHCPv4.RoutesToDNS= setting

This commit is contained in:
Yu Watanabe 2019-07-17 02:47:20 +09:00
parent 854a1ccfc2
commit a24e12f020
5 changed files with 15 additions and 2 deletions

View File

@ -1322,6 +1322,14 @@
project='man-pages'><refentrytitle>resolv.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>RoutesToDNS=</varname></term>
<listitem>
<para>When true, the routes to the DNS servers received from the DHCP server will be
configured. When <varname>UseDNS=</varname> is disabled, this setting is ignored.
Defaults to <literal>false</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>UseNTP=</varname></term>
<listitem>

View File

@ -118,7 +118,8 @@ static int link_set_dns_routes(Link *link, const struct in_addr *address) {
assert(link->dhcp_lease);
assert(link->network);
if (!link->network->dhcp_use_dns)
if (!link->network->dhcp_use_dns ||
!link->network->dhcp_routes_to_dns)
return 0;
n = sd_dhcp_lease_get_dns(link->dhcp_lease, &dns);
@ -408,7 +409,8 @@ static int dhcp_remove_dns_routes(Link *link, sd_dhcp_lease *lease, const struct
assert(lease);
assert(link->network);
if (!link->network->dhcp_use_dns)
if (!link->network->dhcp_use_dns ||
!link->network->dhcp_routes_to_dns)
return 0;
n = sd_dhcp_lease_get_dns(lease, &dns);

View File

@ -142,6 +142,7 @@ Route.FastOpenNoCookie, config_parse_fast_open_no_cookie,
Route.TTLPropagate, config_parse_route_ttl_propagate, 0, 0
DHCPv4.ClientIdentifier, config_parse_dhcp_client_identifier, 0, offsetof(Network, dhcp_client_identifier)
DHCPv4.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_use_dns)
DHCPv4.RoutesToDNS, config_parse_bool, 0, offsetof(Network, dhcp_routes_to_dns)
DHCPv4.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp_use_ntp)
DHCPv4.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_use_mtu)
DHCPv4.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_use_hostname)

View File

@ -91,6 +91,7 @@ struct Network {
bool dhcp_broadcast;
int dhcp_critical;
bool dhcp_use_dns;
bool dhcp_routes_to_dns;
bool dhcp_use_ntp;
bool dhcp_use_mtu;
bool dhcp_use_routes;

View File

@ -69,6 +69,7 @@ SendRelease=
MaxAttempts=
[DHCPv4]
UseDNS=
RoutesToDNS=
UseDomains=
UseRoutes=
IAID=