aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Zaborowski <andrew.zaborowski@intel.com>2022-10-04 00:28:47 +0200
committerDenis Kenzior <denkenz@gmail.com>2022-10-04 12:43:51 -0500
commitfd8ca1bef698eb7607294e3f2bc05c5c0d281fd3 (patch)
tree323701e4cc3442f3fb5c55266fd66fe4642c8278
parenta062e5f1e1500e36bd3ee72afb18be99e19d0e52 (diff)
dhcp6: Don't require Client ID in Information-request reply
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."
-rw-r--r--ell/dhcp6.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ell/dhcp6.c b/ell/dhcp6.c
index 3dbd0cd9..a17dc495 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;