ell.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] dhcp: Set lease->bound_time before emitting event
@ 2022-07-01 13:32 Andrew Zaborowski
  2022-07-01 13:32 ` [PATCH 2/4] useful: Add a cleanup handler for fd variables Andrew Zaborowski
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Andrew Zaborowski @ 2022-07-01 13:32 UTC (permalink / raw)
  To: ell

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-01 15:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01 13:32 [PATCH 1/4] dhcp: Set lease->bound_time before emitting event Andrew Zaborowski
2022-07-01 13:32 ` [PATCH 2/4] useful: Add a cleanup handler for fd variables Andrew Zaborowski
2022-07-01 13:32 ` [PATCH 3/4] netconfig: Restore net.ipv6.conf...disable_ipv6 on stop Andrew Zaborowski
2022-07-01 13:32 ` [PATCH 4/4] netconfig: Fix leaking domain name string Andrew Zaborowski
2022-07-01 15:11 ` [PATCH 1/4] dhcp: Set lease->bound_time before emitting event Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).