Commit 70550e27 authored by Beniamino Galvani's avatar Beniamino Galvani
Browse files

dns: export search list in the D-Bus "domain" attribute

The "domain" key of the D-Bus configuration dictionary specifies the
domains a configuration applies to. In DNS code we consider domains
and searches as equivalent, so they should be exported via D-Bus using
the same logic used to populate resolv.conf and for plugins.
parent b4db0e83
......@@ -1902,6 +1902,7 @@ _get_config_variant (NMDnsManager *self)
GVariantBuilder builder;
NMDnsIPConfigData *ip_data;
const CList *head;
gs_unref_ptrarray GPtrArray *array_domains = NULL;
if (priv->config_variant)
return priv->config_variant;
......@@ -1944,18 +1945,28 @@ _get_config_variant (NMDnsManager *self)
"nameservers",
g_variant_builder_end (&strv_builder));
num = nm_ip_config_get_num_domains (ip_config);
num += nm_ip_config_get_num_searches (ip_config);
if (num > 0) {
g_variant_builder_init (&strv_builder, G_VARIANT_TYPE ("as"));
for (i = 0; i < num; i++) {
g_variant_builder_add (&strv_builder,
"s",
nm_ip_config_get_domain (ip_config, i));
if (!array_domains)
array_domains = g_ptr_array_sized_new (num);
else
g_ptr_array_set_size (array_domains, 0);
add_dns_domains (array_domains, ip_config, FALSE);
if (array_domains->len) {
g_variant_builder_init (&strv_builder, G_VARIANT_TYPE ("as"));
for (i = 0; i < array_domains->len; i++) {
g_variant_builder_add (&strv_builder,
"s",
array_domains->pdata[i]);
}
g_variant_builder_add (&entry_builder,
"{sv}",
"domains",
g_variant_builder_end (&strv_builder));
}
g_variant_builder_add (&entry_builder,
"{sv}",
"domains",
g_variant_builder_end (&strv_builder));
}
ifname = nm_platform_link_get_name (NM_PLATFORM_GET, ip_data->data->ifindex);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment