From: mog422 Date: Thu, 24 Sep 2020 15:04:52 +0000 (+0900) Subject: sd-dhcp6-client: Fix sending prefix delegation request (#17136) X-Git-Tag: v247-rc1~174 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fsystemd.git;a=commitdiff_plain;h=26a63b81322a3bd8b9fbd43f75897c391708de2c sd-dhcp6-client: Fix sending prefix delegation request (#17136) 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. --- diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index 7b5b96b1a8e..6bbc23f131f 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -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;