]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: make link enter failed state on failure in link_update() and link_reset_carr...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 18 May 2021 05:59:10 +0000 (14:59 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 7 Jun 2021 21:33:27 +0000 (06:33 +0900)
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.

src/network/networkd-link.c
src/network/networkd-manager.c

index c4eba5e3dc04c037463d14877420ea2629a267d7..74a73419d6f465cd1385877a222de7571036b532 100644 (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;
                 }
 
index 9406f8c630b80bc0c880d2a3db61cd0b07cbaaee..5b6eefb743376df1459ae876b89a3daef9329d4d 100644 (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;