network: route_configure() do nothing when it returns 0
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 5 Jul 2019 23:47:24 +0000 (08:47 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 11 Jul 2019 13:37:00 +0000 (22:37 +0900)
src/network/networkd-dhcp4.c

index c0d776f..153182e 100644 (file)
@@ -153,8 +153,8 @@ static int link_set_dhcp_routes(Link *link) {
                 r = route_configure(route, link, dhcp4_route_handler);
                 if (r < 0)
                         return log_link_error_errno(link, r, "Could not set host route: %m");
-
-                link->dhcp4_messages++;
+                if (r > 0)
+                        link->dhcp4_messages++;
         }
 
         r = sd_dhcp_lease_get_router(link->dhcp_lease, &router);
@@ -192,8 +192,8 @@ static int link_set_dhcp_routes(Link *link) {
                 r = route_configure(route_gw, link, dhcp4_route_handler);
                 if (r < 0)
                         return log_link_error_errno(link, r, "Could not set host route: %m");
-
-                link->dhcp4_messages++;
+                if (r > 0)
+                        link->dhcp4_messages++;
 
                 r = route_new(&route);
                 if (r < 0)
@@ -209,8 +209,8 @@ static int link_set_dhcp_routes(Link *link) {
                 r = route_configure(route, link, dhcp4_route_handler);
                 if (r < 0)
                         return log_link_error_errno(link, r, "Could not set routes: %m");
-
-                link->dhcp4_messages++;
+                if (r > 0)
+                        link->dhcp4_messages++;
         }
 
         return 0;