networkd: DHCP client do not get into a loop while setting MTU (#7460)
authorSusant Sahani <145210+ssahani@users.noreply.github.com>
Sun, 26 Nov 2017 14:21:45 +0000 (19:51 +0530)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 26 Nov 2017 14:21:45 +0000 (15:21 +0100)
Some devices get reset itself while setting the MTU. we get in to a LOOP .
Once the MTU changed then the DHCP client talking with DHCP server never stops.
networkd gets into a loop and generates endless DHCP requests.

fixes #6593
fixes #7380

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

index 9b342b1..0494ee3 100644 (file)
@@ -1314,6 +1314,8 @@ int link_set_mtu(Link *link, uint32_t mtu) {
         if (r < 0)
                 return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
 
+        link->setting_mtu = true;
+
         link_ref(link);
 
         return 0;
@@ -1660,6 +1662,11 @@ static int link_acquire_conf(Link *link) {
 
         assert(link);
 
+        if (link->setting_mtu) {
+                link->setting_mtu = false;
+                return 0;
+        }
+
         r = link_acquire_ipv4_conf(link);
         if (r < 0)
                 return r;
@@ -3101,6 +3108,9 @@ static int link_carrier_lost(Link *link) {
 
         assert(link);
 
+        if (link->setting_mtu)
+                return 0;
+
         r = link_stop_clients(link);
         if (r < 0) {
                 link_enter_failed(link);
index a05a788..25e49c8 100644 (file)
@@ -110,6 +110,7 @@ typedef struct Link {
         bool ipv4ll_route:1;
 
         bool static_configured;
+        bool setting_mtu;
 
         LIST_HEAD(Address, pool_addresses);