if (r < 0)
return r;
- search_domains = ordered_set_new(&string_hash_ops_free);
+ /* The method accepts an empty strv, to override the domains set in .network.
+ * Hence, we need to explicitly allocate empty sets here. */
+ search_domains = ordered_set_new(&dns_name_hash_ops_free);
if (!search_domains)
return -ENOMEM;
- route_domains = ordered_set_new(&string_hash_ops_free);
+ route_domains = ordered_set_new(&dns_name_hash_ops_free);
if (!route_domains)
return -ENOMEM;
#include "sd-dhcp6-lease.h"
#include "alloc-util.h"
+#include "dns-domain.h"
#include "dns-resolver-internal.h"
#include "errno-util.h"
#include "escape.h"
use_domains = is_route ? USE_DOMAINS_ROUTE : USE_DOMAINS_YES;
if (link_domains)
- return ordered_set_put_string_set(s, link_domains);
+ return ordered_set_put_string_set_full(s, &dns_name_hash_ops_free, link_domains);
- r = ordered_set_put_string_set(s, network_domains);
+ r = ordered_set_put_string_set_full(s, &dns_name_hash_ops_free, network_domains);
if (r < 0)
return r;
r = sd_dhcp_lease_get_domainname(link->dhcp_lease, &domainname);
if (r >= 0) {
- r = ordered_set_put_strdup(s, domainname);
+ r = ordered_set_put_strdup_full(s, &dns_name_hash_ops_free, domainname);
if (r < 0)
return r;
}
r = sd_dhcp_lease_get_search_domains(link->dhcp_lease, &domains);
if (r >= 0) {
- r = ordered_set_put_strdupv(s, domains);
+ r = ordered_set_put_strdupv_full(s, &dns_name_hash_ops_free, domains);
if (r < 0)
return r;
}
r = sd_dhcp6_lease_get_domains(link->dhcp6_lease, &domains);
if (r >= 0) {
- r = ordered_set_put_strdupv(s, domains);
+ r = ordered_set_put_strdupv_full(s, &dns_name_hash_ops_free, domains);
if (r < 0)
return r;
}
NDiscDNSSL *a;
SET_FOREACH(a, link->ndisc_dnssl) {
- r = ordered_set_put_strdup(s, ndisc_dnssl_domain(a));
+ r = ordered_set_put_strdup_full(s, &dns_name_hash_ops_free, ndisc_dnssl_domain(a));
if (r < 0)
return r;
}