network: stop DHCPv4 server in link_stop_clients()

Then, rename link_stop_clients() -> link_stop_engines().
This commit is contained in:
Yu Watanabe 2020-10-15 07:56:27 +09:00
parent a391901eb2
commit 2a99eed02c
3 changed files with 10 additions and 10 deletions

View File

@ -605,7 +605,7 @@ static void link_enter_unmanaged(Link *link) {
link_dirty(link);
}
int link_stop_clients(Link *link, bool may_keep_dhcp) {
int link_stop_engines(Link *link, bool may_keep_dhcp) {
int r = 0, k;
assert(link);
@ -627,6 +627,10 @@ int link_stop_clients(Link *link, bool may_keep_dhcp) {
if (k < 0)
r = log_link_warning_errno(link, k, "Could not stop IPv4 ACD client for DHCPv4: %m");
k = sd_dhcp_server_stop(link->dhcp_server);
if (k < 0)
r = log_link_warning_errno(link, k, "Could not stop DHCPv4 server: %m");
k = sd_ipv4ll_stop(link->ipv4ll);
if (k < 0)
r = log_link_warning_errno(link, k, "Could not stop IPv4 link-local: %m");
@ -665,7 +669,7 @@ void link_enter_failed(Link *link) {
link_set_state(link, LINK_STATE_FAILED);
(void) link_stop_clients(link, false);
(void) link_stop_engines(link, false);
link_dirty(link);
}
@ -2080,12 +2084,10 @@ static int link_reconfigure_internal(Link *link, sd_netlink_message *m, bool for
log_link_info(link, "Re-configuring with %s", network->filename);
/* Dropping old .network file */
r = link_stop_clients(link, false);
r = link_stop_engines(link, false);
if (r < 0)
return r;
(void) sd_dhcp_server_stop(link->dhcp_server);
r = link_drop_config(link);
if (r < 0)
return r;
@ -2530,14 +2532,12 @@ static int link_carrier_lost(Link *link) {
if (link->setting_mtu)
return 0;
r = link_stop_clients(link, false);
r = link_stop_engines(link, false);
if (r < 0) {
link_enter_failed(link);
return r;
}
(void) sd_dhcp_server_stop(link->dhcp_server);
r = link_drop_config(link);
if (r < 0)
return r;

View File

@ -231,7 +231,7 @@ int link_set_mtu(Link *link, uint32_t mtu);
bool link_ipv4ll_enabled(Link *link, AddressFamily mask);
int link_stop_clients(Link *link, bool may_keep_dhcp);
int link_stop_engines(Link *link, bool may_keep_dhcp);
const char* link_state_to_string(LinkState s) _const_;
LinkState link_state_from_string(const char *s) _pure_;

View File

@ -864,7 +864,7 @@ void manager_free(Manager *m) {
free(m->state_file);
HASHMAP_FOREACH(link, m->links)
(void) link_stop_clients(link, true);
(void) link_stop_engines(link, true);
m->dhcp6_prefixes = hashmap_free_with_destructor(m->dhcp6_prefixes, dhcp6_pd_free);
m->dhcp6_pd_prefixes = set_free_with_destructor(m->dhcp6_pd_prefixes, dhcp6_pd_free);