From 97e7fb39a84468ef802a3d2ec19840eff27de211 Mon Sep 17 00:00:00 2001 From: Susant Sahani <145210+ssahani@users.noreply.github.com> Date: Sun, 26 Nov 2017 19:51:45 +0530 Subject: [PATCH] networkd: DHCP client do not get into a loop while setting MTU (#7460) 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 | 10 ++++++++++ src/network/networkd-link.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 9b342b1..0494ee3 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -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); diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h index a05a788..25e49c8 100644 --- a/src/network/networkd-link.h +++ b/src/network/networkd-link.h @@ -110,6 +110,7 @@ typedef struct Link { bool ipv4ll_route:1; bool static_configured; + bool setting_mtu; LIST_HEAD(Address, pool_addresses); -- 2.7.4