[PATCH 1/4] dhcp: Set lease->bound_time before emitting event

Andrew Zaborowski <[email protected]>
Newsgroups dev.linux.lists.ell
Message-ID <[email protected]>
The event handler for L_DHCP_CLIENT_EVENT_LEASE_OBTAINED/RENEWED will
want to use the new lease->bound_time value for expiry time calculation
to we need to set it before we emit the events in the DHCP ACK handler.
---
 ell/dhcp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/ell/dhcp.c b/ell/dhcp.c
index f9c0826..afd5c34 100644
--- a/ell/dhcp.c
+++ b/ell/dhcp.c
@@ -898,6 +898,7 @@ static void dhcp_client_rx_message(const void *data, size_t len, void *userdata,
 		CLIENT_ENTER_STATE(DHCP_STATE_BOUND);
 		l_timeout_remove(client->timeout_resend);
 		client->timeout_resend = NULL;
+		client->lease->bound_time = timestamp;
 
 		if (client->transport->bind) {
 			e = client->transport->bind(client->transport,
@@ -910,8 +911,6 @@ static void dhcp_client_rx_message(const void *data, size_t len, void *userdata,
 
 		dhcp_client_event_notify(client, r);
 
-		client->lease->bound_time = timestamp;
-
 		/*
 		 * Start T1, once it expires we will start the T2 timer.  If
 		 * we renew the lease, we will end up back here.
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.