static int bus_link_method_set_dns_servers_internal(sd_bus_message *message, void *userdata, sd_bus_error *error, bool extended) {
_cleanup_free_ char *j = NULL;
struct in_addr_full **dns;
+ bool changed = false;
Link *l = userdata;
size_t n;
int r;
dns_server_unlink_all(l->dns_servers);
goto finalize;
}
+
+ changed = true;
}
}
- dns_server_unlink_marked(l->dns_servers);
- link_allocate_scopes(l);
+ changed = dns_server_unlink_marked(l->dns_servers) || changed;
- (void) link_save_user(l);
- (void) manager_write_resolv_conf(l->manager);
- (void) manager_send_changed(l->manager, "DNS");
+ if (changed) {
+ link_allocate_scopes(l);
- if (j)
- log_link_info(l, "Bus client set DNS server list to: %s", j);
- else
- log_link_info(l, "Bus client reset DNS server list.");
+ (void) link_save_user(l);
+ (void) manager_write_resolv_conf(l->manager);
+ (void) manager_send_changed(l->manager, "DNS");
+
+ if (j)
+ log_link_info(l, "Bus client set DNS server list to: %s", j);
+ else
+ log_link_info(l, "Bus client reset DNS server list.");
+ }
r = sd_bus_reply_method_return(message, NULL);
int bus_link_method_set_domains(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *j = NULL;
Link *l = userdata;
+ bool changed = false;
int r;
assert(message);
r = dns_search_domain_new(l->manager, &d, DNS_SEARCH_DOMAIN_LINK, l, name);
if (r < 0)
goto clear;
+
+ changed = true;
}
d->route_only = route_only;
if (r < 0)
goto clear;
- dns_search_domain_unlink_marked(l->search_domains);
+ changed = dns_search_domain_unlink_marked(l->search_domains) || changed;
- (void) link_save_user(l);
- (void) manager_write_resolv_conf(l->manager);
+ if (changed) {
+ (void) link_save_user(l);
+ (void) manager_write_resolv_conf(l->manager);
- if (j)
- log_link_info(l, "Bus client set search domain list to: %s", j);
- else
- log_link_info(l, "Bus client reset search domain list.");
+ if (j)
+ log_link_info(l, "Bus client set search domain list to: %s", j);
+ else
+ log_link_info(l, "Bus client reset search domain list.");
+ }
return sd_bus_reply_method_return(message, NULL);
(void) link_save_user(l);
(void) manager_write_resolv_conf(l->manager);
- }
- log_link_info(l, "Bus client set default route setting: %s", yes_no(b));
+ log_link_info(l, "Bus client set default route setting: %s", yes_no(b));
+ }
return sd_bus_reply_method_return(message, NULL);
}
bus_client_log(message, "LLMNR change");
- l->llmnr_support = mode;
- link_allocate_scopes(l);
- link_add_rrs(l, false);
+ if (l->llmnr_support != mode) {
+ l->llmnr_support = mode;
+ link_allocate_scopes(l);
+ link_add_rrs(l, false);
- (void) link_save_user(l);
+ (void) link_save_user(l);
- log_link_info(l, "Bus client set LLMNR setting: %s", resolve_support_to_string(mode));
+ log_link_info(l, "Bus client set LLMNR setting: %s", resolve_support_to_string(mode));
+ }
return sd_bus_reply_method_return(message, NULL);
}
bus_client_log(message, "mDNS change");
- l->mdns_support = mode;
- link_allocate_scopes(l);
- link_add_rrs(l, false);
+ if (l->mdns_support != mode) {
+ l->mdns_support = mode;
+ link_allocate_scopes(l);
+ link_add_rrs(l, false);
- (void) link_save_user(l);
+ (void) link_save_user(l);
- log_link_info(l, "Bus client set MulticastDNS setting: %s", resolve_support_to_string(mode));
+ log_link_info(l, "Bus client set MulticastDNS setting: %s", resolve_support_to_string(mode));
+ }
return sd_bus_reply_method_return(message, NULL);
}
bus_client_log(message, "D-o-T change");
- link_set_dns_over_tls_mode(l, mode);
+ if (l->dns_over_tls_mode != mode) {
+ link_set_dns_over_tls_mode(l, mode);
- (void) link_save_user(l);
+ (void) link_save_user(l);
- log_link_info(l, "Bus client set DNSOverTLS setting: %s",
- mode < 0 ? "default" : dns_over_tls_mode_to_string(mode));
+ log_link_info(l, "Bus client set DNSOverTLS setting: %s",
+ mode < 0 ? "default" : dns_over_tls_mode_to_string(mode));
+ }
return sd_bus_reply_method_return(message, NULL);
}
bus_client_log(message, "DNSSEC change");
- link_set_dnssec_mode(l, mode);
+ if (l->dnssec_mode != mode) {
+ link_set_dnssec_mode(l, mode);
- (void) link_save_user(l);
+ (void) link_save_user(l);
- log_link_info(l, "Bus client set DNSSEC setting: %s",
- mode < 0 ? "default" : dnssec_mode_to_string(mode));
+ log_link_info(l, "Bus client set DNSSEC setting: %s",
+ mode < 0 ? "default" : dnssec_mode_to_string(mode));
+ }
return sd_bus_reply_method_return(message, NULL);
}
bus_client_log(message, "DNSSEC NTA change");
- set_free_free(l->dnssec_negative_trust_anchors);
- l->dnssec_negative_trust_anchors = TAKE_PTR(ns);
+ if (!set_equal(ns, l->dnssec_negative_trust_anchors)) {
+ set_free_free(l->dnssec_negative_trust_anchors);
+ l->dnssec_negative_trust_anchors = TAKE_PTR(ns);
- (void) link_save_user(l);
+ (void) link_save_user(l);
- if (j)
- log_link_info(l, "Bus client set NTA list to: %s", j);
- else
- log_link_info(l, "Bus client reset NTA list.");
+ if (j)
+ log_link_info(l, "Bus client set NTA list to: %s", j);
+ else
+ log_link_info(l, "Bus client reset NTA list.");
+ }
return sd_bus_reply_method_return(message, NULL);
}