diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-07-16 19:47:20 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-07-18 18:49:39 +0200 |
commit | a24e12f0209b075e2db80cc3adac1c5afb17031e (patch) | |
tree | 9c6eba324e1ebd3bcb631d43761e0ed340b2b899 | |
parent | network: set routes to dns servers provided by DHCPv4 (diff) | |
download | systemd-a24e12f0209b075e2db80cc3adac1c5afb17031e.tar.xz systemd-a24e12f0209b075e2db80cc3adac1c5afb17031e.zip |
network: add DHCPv4.RoutesToDNS= setting
Diffstat (limited to '')
-rw-r--r-- | man/systemd.network.xml | 8 | ||||
-rw-r--r-- | src/network/networkd-dhcp4.c | 6 | ||||
-rw-r--r-- | src/network/networkd-network-gperf.gperf | 1 | ||||
-rw-r--r-- | src/network/networkd-network.h | 1 | ||||
-rw-r--r-- | test/fuzz/fuzz-network-parser/directives.network | 1 |
5 files changed, 15 insertions, 2 deletions
diff --git a/man/systemd.network.xml b/man/systemd.network.xml index cd1aa73f46..041bafc773 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -1323,6 +1323,14 @@ </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> <para>When true (the default), the NTP servers received diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index e5ea6b702e..f20254fc82 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -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); diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 3501ffdd10..f5f837ad63 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -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) diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index 82fad492a8..0fa800841c 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -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; diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network index 69a4281542..c3af95db0d 100644 --- a/test/fuzz/fuzz-network-parser/directives.network +++ b/test/fuzz/fuzz-network-parser/directives.network @@ -69,6 +69,7 @@ SendRelease= MaxAttempts= [DHCPv4] UseDNS= +RoutesToDNS= UseDomains= UseRoutes= IAID= |