diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-07-20 22:26:06 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-07-22 12:55:15 +0200 |
commit | 1b1422212458d85af6358465637f1a09eb554914 (patch) | |
tree | a06899fb9d6d7734b88b5c4aa9df5080abf13233 /src/network/networkd-link-bus.c | |
parent | network: introduce link_save_and_clean() (diff) | |
download | systemd-1b1422212458d85af6358465637f1a09eb554914.tar.xz systemd-1b1422212458d85af6358465637f1a09eb554914.zip |
network: make bus methods sync link state file
Diffstat (limited to 'src/network/networkd-link-bus.c')
-rw-r--r-- | src/network/networkd-link-bus.c | 62 |
1 files changed, 51 insertions, 11 deletions
diff --git a/src/network/networkd-link-bus.c b/src/network/networkd-link-bus.c index ad114e1173..f623a9b4a1 100644 --- a/src/network/networkd-link-bus.c +++ b/src/network/networkd-link-bus.c @@ -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); } |