From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: ell@lists.linux.dev
Subject: [PATCH 1/5] dhcp6: Fix emitting LEASE_OBTAINED in stateless mode
Date: Tue, 4 Oct 2022 00:28:43 +0200 [thread overview]
Message-ID: <20221003222847.699047-1-andrew.zaborowski@intel.com> (raw)
Make sure we emit the LEASE_OBTAINED and not LEASE_RENEWED event after
obtaining a reply to an Information-Request. Only set
client->request_na in stateful mode so as not to require the NA in the
lease object when we're later validating it. Fix switching to BOUND
state after dhcp6_client_receive_reply() returns BOUND.
---
ell/dhcp6.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/ell/dhcp6.c b/ell/dhcp6.c
index 2792ff2..3dbd0cd 100644
--- a/ell/dhcp6.c
+++ b/ell/dhcp6.c
@@ -971,8 +971,9 @@ static void dhcp6_client_setup_lease(struct l_dhcp6_client *client,
client->lease->start_time = timestamp;
/* TODO: Emit IP_CHANGED if any addresses were removed / added */
- if (client->state == DHCP6_STATE_REQUESTING ||
- client->state == DHCP6_STATE_SOLICITING)
+ if (L_IN_SET(client->state, DHCP6_STATE_REQUESTING,
+ DHCP6_STATE_SOLICITING,
+ DHCP6_STATE_REQUESTING_INFORMATION))
event = L_DHCP6_CLIENT_EVENT_LEASE_OBTAINED;
else
event = L_DHCP6_CLIENT_EVENT_LEASE_RENEWED;
@@ -1385,7 +1386,8 @@ static void dhcp6_client_rx_message(const void *data, size_t len,
case DHCP6_STATE_BOUND:
return;
case DHCP6_STATE_REQUESTING_INFORMATION:
- if (dhcp6_client_receive_reply(client, message, len) < 0)
+ r = dhcp6_client_receive_reply(client, message, len);
+ if (r < 0)
return;
break;
@@ -1527,7 +1529,6 @@ LIB_EXPORT struct l_dhcp6_client *l_dhcp6_client_new(uint32_t ifindex)
client->state = DHCP6_STATE_INIT;
client->ifindex = ifindex;
- client->request_na = true;
client->icmp6 = l_icmp6_client_new(ifindex);
l_icmp6_client_add_event_handler(client->icmp6,
@@ -1803,6 +1804,8 @@ LIB_EXPORT bool l_dhcp6_client_start(struct l_dhcp6_client *client)
else
client_duid_generate_addr_plus_time(client);
+ client->request_na = !client->stateless;
+
if (!client->transport) {
client->transport =
_dhcp6_default_transport_new(client->ifindex,
--
2.34.1
next reply other threads:[~2022-10-03 22:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 22:28 Andrew Zaborowski [this message]
2022-10-03 22:28 ` [PATCH 2/5] netconfig: Enable stateless DHCP mode Andrew Zaborowski
2022-10-03 22:28 ` [PATCH 3/5] netconfig: Return SLAAC+DHCP6 DNS info from getters Andrew Zaborowski
2022-10-03 22:28 ` [PATCH 4/5] netconfig: Stop ongoing work on failure Andrew Zaborowski
2022-10-03 22:28 ` [PATCH 5/5] dhcp6: Don't require Client ID in Information-request reply Andrew Zaborowski
2022-10-04 17:44 ` [PATCH 1/5] dhcp6: Fix emitting LEASE_OBTAINED in stateless mode 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=20221003222847.699047-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 NNTP newsgroup(s).