1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

sd-dhcp6-lease: ignore invalid byte(s) at the end of the packet

Oracle Cloud sends malformed DHCPv6 replies that have an invalid
byte at the end, which cannot be parsed as an option code.

networkd currently can cope with the invalid option (it is ignored),
but the whole packet is ignored altogether because of the additional
null at the end.

It's better to be liberal in what we accept and actually assign an
address, given that the reply contains a valid IA_NA.

Fixes #28183.
This commit is contained in:
Philipp Kern 2023-06-23 10:39:52 +02:00 committed by Yu Watanabe
parent 49bf8bd57a
commit 81b7335912

View File

@ -465,6 +465,11 @@ static int dhcp6_lease_parse_message(
size_t optlen;
const uint8_t *optval;
if (len - offset < offsetof(DHCP6Option, data)) {
log_dhcp6_client(client, "Ignoring %zu invalid byte(s) at the end of the packet", len - offset);
break;
}
r = dhcp6_option_parse(message->options, len, &offset, &optcode, &optlen, &optval);
if (r < 0)
return log_dhcp6_client_errno(client, r,