From ccfc3370afdba78ac1645a684e7b286b9d7c080e Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Sat, 23 Nov 2019 09:08:14 +0100 Subject: [PATCH] iface-helper: accept new DHCP4 leases The new lease must be accepted or the nettools client will not renew it. --- src/nm-iface-helper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c index 86c97c6593..73511a62d6 100644 --- a/src/nm-iface-helper.c +++ b/src/nm-iface-helper.c @@ -97,6 +97,7 @@ dhcp4_state_changed (NMDhcpClient *client, static NMIP4Config *last_config = NULL; NMIP4Config *existing; gs_unref_ptrarray GPtrArray *ip4_dev_route_blacklist = NULL; + gs_free_error GError *error = NULL; g_return_if_fail (!ip4_config || NM_IS_IP4_CONFIG (ip4_config)); @@ -122,6 +123,9 @@ dhcp4_state_changed (NMDhcpClient *client, NM_IP_ROUTE_TABLE_SYNC_MODE_MAIN)) _LOGW (LOGD_DHCP4, "failed to apply DHCPv4 config"); + if (!last_config && !nm_dhcp_client_accept (client, &error)) + _LOGW (LOGD_DHCP4, "failed to accept lease: %s", error->message); + nm_platform_ip4_dev_route_blacklist_set (NM_PLATFORM_GET, gl.ifindex, ip4_dev_route_blacklist);