Blame SOURCES/0685-networkd-fix-dhcp4-link-without-routes-not-being-con.patch

17b0f1
From fd14e0686820eaff61c2583d98aefc391a8164fe Mon Sep 17 00:00:00 2001
17b0f1
From: Anssi Hannula <anssi.hannula@iki.fi>
17b0f1
Date: Tue, 17 Apr 2018 18:12:00 +0300
17b0f1
Subject: [PATCH] networkd: fix dhcp4 link without routes not being considered
17b0f1
 ready (#8728)
17b0f1
17b0f1
The dhcp4 code sets link->dhcp4_configured when dhcp4_route_handler()
17b0f1
has processed the last message.
17b0f1
17b0f1
However, in case UseRoutes=no has been set in the [DHCP] section, or
17b0f1
in case the DHCP server simply sends no routes, link_set_dhcp_routes()
17b0f1
will not send any netlink messages and dhcp4_route_handler() will
17b0f1
therefore never be called.
17b0f1
17b0f1
This causes the link to never reach LINK_STATE_CONFIGURED, and e.g.
17b0f1
systemd-networkd-wait-online will not consider the link as ready.
17b0f1
17b0f1
Fix that by setting link->dhcp4_configured = true and calling
17b0f1
link_check_ready() in dhcp4_address_handler() in case
17b0f1
link_set_dhcp_routes() sent no netlink messages (dhcp4_messages is
17b0f1
zero).
17b0f1
17b0f1
(cherry picked from commit 223932c786ada7f758a7b7878a6ad2dae0d1e5fb)
17b0f1
17b0f1
Related: #1663365
17b0f1
17b0f1
[jsynacek: Note that link_client_handler() was used instead of
17b0f1
link_check_ready(). The former is an older version of the latter.]
17b0f1
---
17b0f1
 src/network/networkd-dhcp4.c | 5 +++++
17b0f1
 1 file changed, 5 insertions(+)
17b0f1
17b0f1
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
17b0f1
index 354c760ba9..295e44fdd7 100644
17b0f1
--- a/src/network/networkd-dhcp4.c
17b0f1
+++ b/src/network/networkd-dhcp4.c
17b0f1
@@ -305,6 +305,11 @@ static int dhcp4_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
17b0f1
 
17b0f1
         link_set_dhcp_routes(link);
17b0f1
 
17b0f1
+        if (link->dhcp4_messages == 0) {
17b0f1
+                link->dhcp4_configured = true;
17b0f1
+                link_client_handler(link);
17b0f1
+        }
17b0f1
+
17b0f1
         return 1;
17b0f1
 }
17b0f1