summary refs log tree commit diff
path: root/src/core/dhcp/nm-dhcp-systemd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/dhcp/nm-dhcp-systemd.c')
-rw-r--r--src/core/dhcp/nm-dhcp-systemd.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/core/dhcp/nm-dhcp-systemd.c b/src/core/dhcp/nm-dhcp-systemd.c
index 6f9312da..0fc5f928 100644
--- a/src/core/dhcp/nm-dhcp-systemd.c
+++ b/src/core/dhcp/nm-dhcp-systemd.c
@@ -155,6 +155,26 @@ lease_to_ip6_config(NMDhcpSystemd *self, sd_dhcp6_lease *lease, gint32 ts, GErro
                                   str->str);
     }
 
+    {
+        struct in6_addr prefix;
+        uint8_t         prefix_len;
+
+        nm_gstring_prepare(&str);
+        sd_dhcp6_lease_reset_pd_prefix_iter(lease);
+        while (!sd_dhcp6_lease_get_pd(lease, &prefix, &prefix_len, NULL, NULL)) {
+            nm_gstring_add_space_delimiter(str);
+            nm_inet6_ntop(&prefix, addr_str);
+            g_string_append_printf(str, "%s/%u", addr_str, prefix_len);
+        }
+        if (str->len > 0) {
+            nm_dhcp_option_add_option(options,
+                                      TRUE,
+                                      AF_INET6,
+                                      NM_DHCP_OPTION_DHCP6_IA_PD,
+                                      str->str);
+        }
+    }
+
     num = sd_dhcp6_lease_get_domains(lease, &domains);
     if (num > 0) {
         nm_gstring_prepare(&str);
@@ -366,6 +386,15 @@ ip6_start(NMDhcpClient *client, const struct in6_addr *ll_addr, GError **error)
             _LOGW("dhcp-client6: only one prefix request is supported");
         }
         prefix_delegation = TRUE;
+        if (client_config->v6.pd_hint_length > 0) {
+            r = sd_dhcp6_client_set_prefix_delegation_hint(sd_client,
+                                                           client_config->v6.pd_hint_length,
+                                                           &client_config->v6.pd_hint_addr);
+            if (r < 0) {
+                nm_utils_error_set_errno(error, r, "failed to set prefix delegation hint: %s");
+                return FALSE;
+            }
+        }
     }
     r = sd_dhcp6_client_set_prefix_delegation(sd_client, prefix_delegation);
     if (r < 0) {