network: make link enter failed state on failure in link_update() and link_reset_carrier()

Previously, several failures in link_carrier_gained() make link enter
failed state, and other errors are ignored. Now, all failures in
link_carrier_gained(), moreover, link_update() are critical.
This commit is contained in:
Yu Watanabe
2021-06-08 06:33:27 +09:00
parent 8566df791e
commit f0269653e9
2 changed files with 7 additions and 8 deletions
+4 -7
View File
@@ -2786,18 +2786,14 @@ static int link_carrier_gained(Link *link) {
return r;
if (r > 0) {
r = link_reconfigure(link, false);
if (r < 0) {
link_enter_failed(link);
if (r < 0)
return r;
}
}
if (IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) {
r = link_acquire_dynamic_conf(link);
if (r < 0) {
link_enter_failed(link);
if (r < 0)
return r;
}
r = link_request_static_configs(link);
if (r < 0)
@@ -3136,7 +3132,8 @@ int manager_rtnl_process_link(sd_netlink *rtnl, sd_netlink_message *message, Man
r = link_update(link, message);
if (r < 0) {
log_warning_errno(r, "Could not process link message, ignoring: %m");
log_warning_errno(r, "Could not process link message: %m");
link_enter_failed(link);
return 0;
}
+3 -1
View File
@@ -60,8 +60,10 @@ static int manager_reset_all(Manager *m) {
HASHMAP_FOREACH(link, m->links) {
r = link_carrier_reset(link);
if (r < 0)
if (r < 0) {
log_link_warning_errno(link, r, "Could not reset carrier: %m");
link_enter_failed(link);
}
}
return 0;