]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not configure routes when dropping addresses
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 Jul 2019 04:02:38 +0000 (13:02 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 Jul 2019 15:51:46 +0000 (00:51 +0900)
Follow-up for 4ff296b02411bb4f0dc38f48cbab06f8645d2a08.

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

index 8a987e84a3c091eff2eed2152ee6e2c12c7ae187..1bb1df32e9e086347aaeeefe6c4a2598f3a1b6f5 100644 (file)
@@ -103,6 +103,11 @@ static int link_set_dhcp_routes(Link *link) {
         if (!link->network->dhcp_use_routes)
                 return 0;
 
+        if (!link_has_carrier(link) && !link->network->configure_without_carrier)
+                /* During configuring addresses, the link lost its carrier. As networkd is dropping
+                 * the addresses now, let's not configure the routes either. */
+                return 0;
+
         table = link_get_dhcp_route_table(link);
 
         r = sd_dhcp_lease_get_address(link->dhcp_lease, &address);
index 66fbeac79d4bc23694fea133eda56c949f94a922..46830290c6391debdfb44f3dd004fac51bb3635f 100644 (file)
@@ -934,6 +934,11 @@ int link_request_set_routes(Link *link) {
 
         link->static_routes_configured = false;
 
+        if (!link_has_carrier(link) && !link->network->configure_without_carrier)
+                /* During configuring addresses, the link lost its carrier. As networkd is dropping
+                 * the addresses now, let's not configure the routes either. */
+                return 0;
+
         r = link_request_set_routing_policy_rule(link);
         if (r < 0)
                 return r;