]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-dhcp6-client: ignore broken non-critical options
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 13 Jan 2022 11:13:03 +0000 (20:13 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 13 Jan 2022 11:20:19 +0000 (20:20 +0900)
The commit b89a3758e92894162e3c2dcb594a55acff3274d5 made the validity
check of the received message stricter. E.g. if the client received a
message with broken NTP server option, then the entire message is
dropped.

This relaxes the check. If some non-critical options are broken, then
ignore the options, but the message itself is still accepted.

Fixes #22099.

src/libsystemd-network/sd-dhcp6-client.c

index d3c667974dccef8be4f59fe383fae45534d3a030..8150227d7e18a88aceb0418d4e158e84728be75d 100644 (file)
@@ -1261,35 +1261,35 @@ static int client_parse_message(
                 case SD_DHCP6_OPTION_DNS_SERVERS:
                         r = dhcp6_lease_add_dns(lease, optval, optlen);
                         if (r < 0)
-                                return r;
+                                log_dhcp6_client_errno(client, r, "Failed to parse DNS server option, ignoring: %m");
 
                         break;
 
                 case SD_DHCP6_OPTION_DOMAIN_LIST:
                         r = dhcp6_lease_add_domains(lease, optval, optlen);
                         if (r < 0)
-                                return r;
+                                log_dhcp6_client_errno(client, r, "Failed to parse domain list option, ignoring: %m");
 
                         break;
 
                 case SD_DHCP6_OPTION_NTP_SERVER:
                         r = dhcp6_lease_add_ntp(lease, optval, optlen);
                         if (r < 0)
-                                return r;
+                                log_dhcp6_client_errno(client, r, "Failed to parse NTP server option, ignoring: %m");
 
                         break;
 
                 case SD_DHCP6_OPTION_SNTP_SERVERS:
                         r = dhcp6_lease_add_sntp(lease, optval, optlen);
                         if (r < 0)
-                                return r;
+                                log_dhcp6_client_errno(client, r, "Failed to parse SNTP server option, ignoring: %m");
 
                         break;
 
                 case SD_DHCP6_OPTION_CLIENT_FQDN:
                         r = dhcp6_lease_set_fqdn(lease, optval, optlen);
                         if (r < 0)
-                                return r;
+                                log_dhcp6_client_errno(client, r, "Failed to parse FQDN option, ignoring: %m");
 
                         break;