From 26a63b81322a3bd8b9fbd43f75897c391708de2c Mon Sep 17 00:00:00 2001 From: mog422 Date: Fri, 25 Sep 2020 00:04:52 +0900 Subject: [PATCH] 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. --- src/libsystemd-network/sd-dhcp6-client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index 7b5b96b1a8..6bbc23f131 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;