]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-dhcp6-client: Fix sending prefix delegation request (#17136)
authormog422 <admin@mog422.net>
Thu, 24 Sep 2020 15:04:52 +0000 (00:04 +0900)
committerGitHub <noreply@github.com>
Thu, 24 Sep 2020 15:04:52 +0000 (17:04 +0200)
SD_DHCP6_OPTION_IA_NA does not exist in DHCP6_ADVERTISE packet if DHCP server only provides prefix delegation. So the attempt to send the DHCP6_REQUEST packet fails on r = dhcp6_option_append_ia(&opt, &optlen, &client->lease->ia); forever.

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

index 7b5b96b1a8e7ca5c557cdfdca8fd138126d46a87..6bbc23f131f0093c7a1b86b748f5b44d6b6d1408 100644 (file)
@@ -728,7 +728,7 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
                 if (r < 0)
                         return r;
 
-                if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_NA)) {
+                if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_NA) && client->lease->ia.addresses) {
                         r = dhcp6_option_append_ia(&opt, &optlen,
                                                    &client->lease->ia);
                         if (r < 0)
@@ -767,7 +767,7 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
                                 return r;
                 }
 
-                if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_PD)) {
+                if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_PD) && client->lease->pd.addresses) {
                         r = dhcp6_option_append_pd(opt, optlen, &client->lease->pd, NULL);
                         if (r < 0)
                                 return r;