vpn: set search domains

dns-search parameters set on VPN connections should be merged with
domains received through the VPN (which may be empty if the connection
sets ignore-auto-dns).

This is currently not the case because domains received by the VPN
connection are only added through nm_l3_config_data_add_domain.

If dns-search is unset, this behaves correctly because the structure
built in _mgr_configs_data_construct in src/core/dns/nm-dns-manager.c
correctly uses the domains from nm_l3_config_data_get_domains.

However if dns-search is set, nm_l3_config_data_get_searches is no
longer empty and it takes precedence because of the "n_searches > 0"
condition.
This commit is contained in:
François HORTA 2025-12-29 18:48:20 +01:00
parent 128b49fe21
commit 9ecd5868ba
No known key found for this signature in database
GPG key ID: ED6C1E0F36613431

View file

@ -2135,16 +2135,20 @@ _dbus_signal_ip_config_cb(NMVpnConnection *self, int addr_family, GVariant *dict
IS_IPv4 ? NM_VPN_PLUGIN_IP4_CONFIG_DOMAIN
: NM_VPN_PLUGIN_IP6_CONFIG_DOMAIN,
"&s",
&v_str))
&v_str)) {
nm_l3_config_data_add_domain(l3cd, addr_family, v_str);
nm_l3_config_data_add_search(l3cd, addr_family, v_str);
}
if (g_variant_lookup(dict,
IS_IPv4 ? NM_VPN_PLUGIN_IP4_CONFIG_DOMAINS
: NM_VPN_PLUGIN_IP6_CONFIG_DOMAINS,
"as",
&var_iter)) {
while (g_variant_iter_next(var_iter, "&s", &v_str))
while (g_variant_iter_next(var_iter, "&s", &v_str)) {
nm_l3_config_data_add_domain(l3cd, addr_family, v_str);
nm_l3_config_data_add_search(l3cd, addr_family, v_str);
}
g_variant_iter_free(var_iter);
}