1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-03 05:18:09 +03:00

network: make bus methods sync link state file

This commit is contained in:
Yu Watanabe 2020-07-21 05:26:06 +09:00
parent c2a6595014
commit 1b14222124

View File

@ -110,7 +110,10 @@ int bus_link_method_set_ntp_servers(sd_bus_message *message, void *userdata, sd_
strv_free_and_replace(l->ntp, ntp);
(void) link_dirty(l);
link_dirty(l);
r = link_save_and_clean(l);
if (r < 0)
return r;
return sd_bus_reply_method_return(message, NULL);
}
@ -150,7 +153,10 @@ static int bus_link_method_set_dns_servers_internal(sd_bus_message *message, voi
free_and_replace(l->dns, dns);
l->n_dns = n;
(void) link_dirty(l);
link_dirty(l);
r = link_save_and_clean(l);
if (r < 0)
return r;
return sd_bus_reply_method_return(message, NULL);
@ -240,7 +246,10 @@ int bus_link_method_set_domains(sd_bus_message *message, void *userdata, sd_bus_
l->search_domains = TAKE_PTR(search_domains);
l->route_domains = TAKE_PTR(route_domains);
(void) link_dirty(l);
link_dirty(l);
r = link_save_and_clean(l);
if (r < 0)
return r;
return sd_bus_reply_method_return(message, NULL);
}
@ -271,7 +280,11 @@ int bus_link_method_set_default_route(sd_bus_message *message, void *userdata, s
if (l->dns_default_route != b) {
l->dns_default_route = b;
(void) link_dirty(l);
link_dirty(l);
r = link_save_and_clean(l);
if (r < 0)
return r;
}
return sd_bus_reply_method_return(message, NULL);
@ -313,7 +326,11 @@ int bus_link_method_set_llmnr(sd_bus_message *message, void *userdata, sd_bus_er
if (l->llmnr != mode) {
l->llmnr = mode;
(void) link_dirty(l);
link_dirty(l);
r = link_save_and_clean(l);
if (r < 0)
return r;
}
return sd_bus_reply_method_return(message, NULL);
@ -355,7 +372,11 @@ int bus_link_method_set_mdns(sd_bus_message *message, void *userdata, sd_bus_err
if (l->mdns != mode) {
l->mdns = mode;
(void) link_dirty(l);
link_dirty(l);
r = link_save_and_clean(l);
if (r < 0)
return r;
}
return sd_bus_reply_method_return(message, NULL);
@ -397,7 +418,11 @@ int bus_link_method_set_dns_over_tls(sd_bus_message *message, void *userdata, sd
if (l->dns_over_tls_mode != mode) {
l->dns_over_tls_mode = mode;
(void) link_dirty(l);
link_dirty(l);
r = link_save_and_clean(l);
if (r < 0)
return r;
}
return sd_bus_reply_method_return(message, NULL);
@ -439,7 +464,11 @@ int bus_link_method_set_dnssec(sd_bus_message *message, void *userdata, sd_bus_e
if (l->dnssec_mode != mode) {
l->dnssec_mode = mode;
(void) link_dirty(l);
link_dirty(l);
r = link_save_and_clean(l);
if (r < 0)
return r;
}
return sd_bus_reply_method_return(message, NULL);
@ -493,7 +522,10 @@ int bus_link_method_set_dnssec_negative_trust_anchors(sd_bus_message *message, v
set_free_free(l->dnssec_negative_trust_anchors);
l->dnssec_negative_trust_anchors = TAKE_PTR(ns);
(void) link_dirty(l);
link_dirty(l);
r = link_save_and_clean(l);
if (r < 0)
return r;
return sd_bus_reply_method_return(message, NULL);
}
@ -519,7 +551,11 @@ int bus_link_method_revert_ntp(sd_bus_message *message, void *userdata, sd_bus_e
return 1; /* Polkit will call us back */
link_ntp_settings_clear(l);
(void) link_dirty(l);
link_dirty(l);
r = link_save_and_clean(l);
if (r < 0)
return r;
return sd_bus_reply_method_return(message, NULL);
}
@ -545,7 +581,11 @@ int bus_link_method_revert_dns(sd_bus_message *message, void *userdata, sd_bus_e
return 1; /* Polkit will call us back */
link_dns_settings_clear(l);
(void) link_dirty(l);
link_dirty(l);
r = link_save_and_clean(l);
if (r < 0)
return r;
return sd_bus_reply_method_return(message, NULL);
}