summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/sd-dhcp6-lease.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-02-07 13:09:53 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-02-14 07:01:02 +0100
commit9c9fee80027c509a53cdd6a932ededd08ad5a317 (patch)
treedda8035aa4ca32fad06a9fcc5b86a5b545c65801 /src/libsystemd-network/sd-dhcp6-lease.c
parentdhcp-identifier: generate static and constant DUID-EN when the client is runn... (diff)
downloadsystemd-9c9fee80027c509a53cdd6a932ededd08ad5a317.tar.xz
systemd-9c9fee80027c509a53cdd6a932ededd08ad5a317.zip
sd-dhcp6-client: use memcmp_nn() at one more place
Diffstat (limited to 'src/libsystemd-network/sd-dhcp6-lease.c')
-rw-r--r--src/libsystemd-network/sd-dhcp6-lease.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/libsystemd-network/sd-dhcp6-lease.c b/src/libsystemd-network/sd-dhcp6-lease.c
index 90c3373bd5..5617e85212 100644
--- a/src/libsystemd-network/sd-dhcp6-lease.c
+++ b/src/libsystemd-network/sd-dhcp6-lease.c
@@ -621,12 +621,13 @@ static int dhcp6_lease_parse_message(
uint8_t *clientid;
size_t clientid_len;
if (dhcp6_lease_get_clientid(lease, &clientid, &clientid_len) < 0)
- return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EINVAL), "%s message does not contain client ID. Ignoring.",
+ return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EINVAL),
+ "%s message does not contain client ID. Ignoring.",
dhcp6_message_type_to_string(message->type));
- if (clientid_len != client->duid_len ||
- memcmp(clientid, &client->duid, clientid_len) != 0)
- return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EINVAL), "The client ID in %s message does not match. Ignoring.",
+ if (memcmp_nn(clientid, clientid_len, &client->duid, client->duid_len) != 0)
+ return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EINVAL),
+ "The client ID in %s message does not match. Ignoring.",
dhcp6_message_type_to_string(message->type));
if (client->state != DHCP6_STATE_INFORMATION_REQUEST) {
@@ -636,7 +637,8 @@ static int dhcp6_lease_parse_message(
dhcp6_message_type_to_string(message->type));
if (!lease->ia_na && !lease->ia_pd)
- return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EINVAL), "No IA_PD prefix or IA_NA address received. Ignoring.");
+ return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EINVAL),
+ "No IA_PD prefix or IA_NA address received. Ignoring.");
dhcp6_lease_set_lifetime(lease);
}