diff options
Diffstat (limited to 'src/core/dhcp/nm-dhcp-systemd.c')
| -rw-r--r-- | src/core/dhcp/nm-dhcp-systemd.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/src/core/dhcp/nm-dhcp-systemd.c b/src/core/dhcp/nm-dhcp-systemd.c index b570f7e5..547e730b 100644 --- a/src/core/dhcp/nm-dhcp-systemd.c +++ b/src/core/dhcp/nm-dhcp-systemd.c @@ -92,6 +92,7 @@ lease_to_ip6_config(NMDhcpSystemd *self, sd_dhcp6_lease *lease, gint32 ts, GErro const char *s; nm_auto_free_gstring GString *str = NULL; int num, i; + gboolean has_any_prefix_delegated = FALSE; nm_assert(lease); @@ -107,6 +108,28 @@ lease_to_ip6_config(NMDhcpSystemd *self, sd_dhcp6_lease *lease, gint32 ts, GErro NM_DHCP_OPTION_DHCP6_NM_IAID, nm_dhcp_iaid_to_hexstr(config->v6.iaid, iaid_buf)); + { + struct in6_addr prefix; + uint8_t prefix_len; + + nm_gstring_prepare(&str); + sd_dhcp6_lease_pd_iterator_reset(lease); + while (!sd_dhcp6_lease_get_pd_prefix(lease, &prefix, &prefix_len)) { + nm_gstring_add_space_delimiter(str); + nm_inet6_ntop(&prefix, addr_str); + g_string_append_printf(str, "%s/%u", addr_str, prefix_len); + sd_dhcp6_lease_pd_iterator_next(lease); + } + if (str->len > 0) { + nm_dhcp_option_add_option(options, + TRUE, + AF_INET6, + NM_DHCP_OPTION_DHCP6_IA_PD, + str->str); + has_any_prefix_delegated = TRUE; + } + } + if (!config->v6.info_only) { gboolean has_any_addresses = FALSE; uint64_t lft_pref; @@ -142,11 +165,11 @@ lease_to_ip6_config(NMDhcpSystemd *self, sd_dhcp6_lease *lease, gint32 ts, GErro str->str); } - if (!has_any_addresses) { + if (!has_any_addresses && !has_any_prefix_delegated) { g_set_error_literal(error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED, - "no address received in managed mode"); + "no address or prefix delegation received in managed mode"); return NULL; } } @@ -166,27 +189,6 @@ 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_pd_iterator_reset(lease); - while (!sd_dhcp6_lease_get_pd_prefix(lease, &prefix, &prefix_len)) { - nm_gstring_add_space_delimiter(str); - nm_inet6_ntop(&prefix, addr_str); - g_string_append_printf(str, "%s/%u", addr_str, prefix_len); - sd_dhcp6_lease_pd_iterator_next(lease); - } - 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); |