diff mbox series

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

Message ID 20220701133237.2887854-1-andrew.zaborowski@intel.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/4] dhcp: Set lease->bound_time before emitting event | expand

Commit Message

Andrew Zaborowski July 1, 2022, 1:32 p.m. UTC
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(-)

Comments

Denis Kenzior July 1, 2022, 3:11 p.m. UTC | #1
Hi Andrew,

On 7/1/22 08:32, Andrew Zaborowski wrote:
> 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(-)
> 

All applied, thanks.

Regards,
-Denis
diff mbox series

Patch

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.