From 0c9b15a38a558d8f84257455ee24174221069e9e Mon Sep 17 00:00:00 2001 From: Andrew Jeddeloh Date: Thu, 31 Aug 2017 01:58:39 -0700 Subject: [PATCH] networkd: dont crash when mtu changes (#6594) Prevent networkd from crashing when UseMTU is used. Many drivers will bring the link down and then back up to configure a new MTU. Networkd will also asynchonously send rtnl messages to configure the link and may receive responses after the link has gone down and come back up (which networkd will handle and set the lease and network to NULL. This changes the behavior to instead return if this is the case instead of crashing via assert. --- src/network/networkd-dhcp4.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 9229b57..7777168 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -71,8 +71,12 @@ static int link_set_dhcp_routes(Link *link) { int r, n, i; assert(link); - assert(link->dhcp_lease); - assert(link->network); + + if (!link->dhcp_lease) /* link went down while we configured the IP addresses? */ + return 0; + + if (!link->network) /* link went down while we configured the IP addresses? */ + return 0; if (!link->network->dhcp_use_routes) return 0; -- 2.7.4