($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: ell@lists.linux.dev
Subject: [PATCH 1/4] dhcp: Set lease->bound_time before emitting event
Date: Fri,  1 Jul 2022 15:32:34 +0200	[thread overview]
Message-ID: <20220701133237.2887854-1-andrew.zaborowski@intel.com> (raw)

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


             reply	other threads:[~2022-07-01 13:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 13:32 Andrew Zaborowski [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220701133237.2887854-1-andrew.zaborowski@intel.com \
    --to=andrew.zaborowski@intel.com \
    --cc=ell@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).