From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: ell@lists.linux.dev
Subject: [PATCH 5/5] dhcp6: Don't require Client ID in Information-request reply
Date: Tue, 4 Oct 2022 00:28:47 +0200 [thread overview]
Message-ID: <20221003222847.699047-5-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <20221003222847.699047-1-andrew.zaborowski@intel.com>
Since we don't include our Client ID option when sending an
Information-request, the server can't send it back in its Reply. Don't
require it when validating.
RFC 8415 Section 18.2.6 has this to say about the Client ID:
"The client SHOULD include a Client Identifier option (see Section 21.2)
to identify itself to the server (however, see Section 4.3.1 of [RFC7844]
for reasons why a client may not want to include this option). If the
client does not include a Client Identifier option, the server will not
be able to return any client-specific options to the client, or the
server may choose not to respond to the message at all."
RFC 7833 Section 4.3.1 says this:
"When using stateless DHCPv6, clients wanting to protect their privacy
SHOULD NOT include client identifiers in their Information-request
messages. This will prevent the server from specifying client-specific
options if it is configured to do so, but the need for anonymity
precludes such options anyway."
---
ell/dhcp6.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/ell/dhcp6.c b/ell/dhcp6.c
index 3dbd0cd..a17dc49 100644
--- a/ell/dhcp6.c
+++ b/ell/dhcp6.c
@@ -1098,6 +1098,7 @@ bool _dhcp6_option_iter_next(struct dhcp6_option_iter *iter, uint16_t *type,
}
static int dhcp6_client_validate_message(struct l_dhcp6_client *client,
+ bool expect_client_id,
const struct dhcp6_message *message,
size_t len)
{
@@ -1205,7 +1206,7 @@ static int dhcp6_client_validate_message(struct l_dhcp6_client *client,
}
}
- if (!duid_verified) {
+ if (expect_client_id && !duid_verified) {
CLIENT_DEBUG("Message %s - no client id option found", mstr);
return -EBADMSG;
}
@@ -1229,7 +1230,7 @@ static int dhcp6_client_receive_advertise(struct l_dhcp6_client *client,
if (advertise->msg_type != DHCP6_MESSAGE_TYPE_ADVERTISE)
return -EINVAL;
- r = dhcp6_client_validate_message(client, advertise, len);
+ r = dhcp6_client_validate_message(client, true, advertise, len);
if (r < 0)
return r;
@@ -1311,11 +1312,17 @@ static int dhcp6_client_receive_reply(struct l_dhcp6_client *client,
struct l_dhcp6_lease *lease;
struct dhcp6_option_iter iter;
int r;
+ /*
+ * Per RFC 7844 Section 4.3.1 we never send Client ID options in
+ * Information-requests so don't expect the replies to contain them.
+ */
+ bool expect_client_id =
+ (client->state != DHCP6_STATE_REQUESTING_INFORMATION);
if (reply->msg_type != DHCP6_MESSAGE_TYPE_REPLY)
return -EINVAL;
- r = dhcp6_client_validate_message(client, reply, len);
+ r = dhcp6_client_validate_message(client, expect_client_id, reply, len);
if (r < 0)
return r;
--
2.34.1
next prev parent 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 [PATCH 1/5] dhcp6: Fix emitting LEASE_OBTAINED in stateless mode Andrew Zaborowski
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 ` Andrew Zaborowski [this message]
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-5-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).