mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-20 12:50:33 +01:00
dns: fix negative ipv4.dns-priority for systemd-resolved
A negative ipv4.dns-priority and ipv6.dns-priority has the meaning to configure the DNS information of the connection exclusively. With systemd-resolved, that means we must explicitly unset the configuration from other interfaces. https://bugzilla.gnome.org/show_bug.cgi?id=783569
This commit is contained in:
parent
d582176939
commit
70792e51d9
4 changed files with 29 additions and 13 deletions
|
|
@ -561,6 +561,8 @@ update (NMDnsPlugin *plugin,
|
|||
NMDnsDnsmasq *self = NM_DNS_DNSMASQ (plugin);
|
||||
NMDnsDnsmasqPrivate *priv = NM_DNS_DNSMASQ_GET_PRIVATE (self);
|
||||
GVariantBuilder servers;
|
||||
guint i;
|
||||
int prio, first_prio;
|
||||
|
||||
start_dnsmasq (self);
|
||||
|
||||
|
|
@ -569,9 +571,13 @@ update (NMDnsPlugin *plugin,
|
|||
if (global_config)
|
||||
add_global_config (self, &servers, global_config);
|
||||
else {
|
||||
while (*configs) {
|
||||
add_ip_config_data (self, &servers, *configs);
|
||||
configs++;
|
||||
for (i = 0; configs[i]; i++) {
|
||||
prio = nm_dns_ip_config_data_get_dns_priority (configs[i]);
|
||||
if (i == 0)
|
||||
first_prio = prio;
|
||||
else if (first_prio < 0 && first_prio != prio)
|
||||
break;
|
||||
add_ip_config_data (self, &servers, configs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1041,10 +1041,10 @@ _collect_resolv_conf_data (NMDnsManager *self, /* only for logging context, no o
|
|||
get_nameserver_list (current->config, &tmp_gstring));
|
||||
}
|
||||
|
||||
if (!skip) {
|
||||
if (!skip)
|
||||
merge_one_ip_config_data (&rc, current);
|
||||
plugin_confs[j++] = current;
|
||||
}
|
||||
|
||||
plugin_confs[j++] = current;
|
||||
}
|
||||
plugin_confs[j++] = NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ nm_dns_plugin_update (NMDnsPlugin *self,
|
|||
g_return_val_if_fail (NM_DNS_PLUGIN_GET_CLASS (self)->update != NULL, FALSE);
|
||||
|
||||
return NM_DNS_PLUGIN_GET_CLASS (self)->update (self,
|
||||
configs,
|
||||
configs ?: NM_PTRARRAY_EMPTY (const NMDnsIPConfigData *),
|
||||
global_config,
|
||||
hostname);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,8 @@ call_done (GObject *source, GAsyncResult *r, gpointer user_data)
|
|||
static void
|
||||
add_interface_configuration (NMDnsSystemdResolved *self,
|
||||
GArray *interfaces,
|
||||
const NMDnsIPConfigData *data)
|
||||
const NMDnsIPConfigData *data,
|
||||
gboolean skip)
|
||||
{
|
||||
int i;
|
||||
InterfaceConfig *ic = NULL;
|
||||
|
|
@ -130,7 +131,8 @@ add_interface_configuration (NMDnsSystemdResolved *self,
|
|||
ic->ifindex = ifindex;
|
||||
}
|
||||
|
||||
ic->configs = g_list_append (ic->configs, data->config);
|
||||
if (!skip)
|
||||
ic->configs = g_list_append (ic->configs, data->config);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -294,11 +296,19 @@ update (NMDnsPlugin *plugin,
|
|||
{
|
||||
NMDnsSystemdResolved *self = NM_DNS_SYSTEMD_RESOLVED (plugin);
|
||||
GArray *interfaces = g_array_new (TRUE, TRUE, sizeof (InterfaceConfig));
|
||||
const NMDnsIPConfigData *const*c;
|
||||
int i;
|
||||
guint i;
|
||||
int prio, first_prio = 0;
|
||||
|
||||
for (c = configs; *c != NULL; c++)
|
||||
add_interface_configuration (self, interfaces, *c);
|
||||
for (i = 0; configs[i]; i++) {
|
||||
gboolean skip = FALSE;
|
||||
|
||||
prio = nm_dns_ip_config_data_get_dns_priority (configs[i]);
|
||||
if (i == 0)
|
||||
first_prio = prio;
|
||||
else if (first_prio < 0 && first_prio != prio)
|
||||
skip = TRUE;
|
||||
add_interface_configuration (self, interfaces, configs[i], skip);
|
||||
}
|
||||
|
||||
free_pending_updates (self);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue