ryantimwilson / rpms / systemd

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