Setting UseDNS=no will ignore any received DNS servers.
. This is a short-hand for a [Route] section only containing a Gateway key.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>DNS</varname></term>
+ <listitem>
+ <para>A DNS server address, which must be in the format described in
+ <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ .</para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term><varname>Bridge</varname></term>
<listitem>
prefixlength, if ommitted a full-length host route is assumed.</para>
</listitem>
</varlistentry>
+ </variablelist>
+
+ <para>The <literal>[DHCPv4]</literal> section accepts the following keys:</para>
+
+ <variablelist class='network-directives'>
+ <varlistentry>
+ <term><varname>UseDNS</varname></term>
+ <listitem>
+ <para>When true (the default) the DNS servers received from the DHCP server will
+ be used, and take precedence over any statically configured ones.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
+
</refsect2>
</refsect1>
Address.Label, config_parse_label, 0, 0
Route.Gateway, config_parse_gateway, 0, 0
Route.Destination, config_parse_destination, 0, 0
+DHCPv4.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns)
Bridge.Description, config_parse_string, 0, offsetof(Bridge, description)
Bridge.Name, config_parse_ifname, 0, offsetof(Bridge, name)
int r;
assert(link);
+ assert(link->network);
if (link->state == LINK_STATE_FAILED)
return;
addr = NULL;
rt = NULL;
- r = sd_dhcp_client_get_dns(client, &nameservers);
- if (r >= 0) {
- r = manager_update_resolv_conf(link->manager);
- if (r < 0)
- log_error("Failed to update resolv.conf");
+ if (link->network->dhcp_dns) {
+ r = sd_dhcp_client_get_dns(client, &nameservers);
+ if (r >= 0) {
+ r = manager_update_resolv_conf(link->manager);
+ if (r < 0)
+ log_error("Failed to update resolv.conf");
+ }
}
link_enter_set_addresses(link);
if (!network->filename)
return log_oom();
- r = config_parse(NULL, filename, file, "Match\0Network\0Address\0Route\0", config_item_perf_lookup,
+ network->dhcp_dns = true;
+
+ r = config_parse(NULL, filename, file, "Match\0Network\0Address\0Route\0DHCPv4\0", config_item_perf_lookup,
(void*) network_gperf_lookup, false, false, network);
if (r < 0) {
log_warning("Could not parse config file %s: %s", filename, strerror(-r));
char *description;
Bridge *bridge;
bool dhcp;
+ bool dhcp_dns;
LIST_HEAD(Address, static_addresses);
LIST_HEAD(Route, static_routes);