From 6f3fd32bbb15db763e94380a1ffbd013f4c139d1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 25 Jan 2022 19:48:50 +0100 Subject: [PATCH] dhcp: for systemd DHCPv6 client always explicitly set prefix-delegation Beginning with [1], prefix delegation will be always enabled by default. Thus, always explicitly set it. [1] https://github.com/systemd/systemd/commit/01b4e90f32c72900f26f8f770cfb0e6d66c14706 --- src/core/dhcp/nm-dhcp-systemd.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/core/dhcp/nm-dhcp-systemd.c b/src/core/dhcp/nm-dhcp-systemd.c index b91cbcb1dc..46da3b7630 100644 --- a/src/core/dhcp/nm-dhcp-systemd.c +++ b/src/core/dhcp/nm-dhcp-systemd.c @@ -934,6 +934,7 @@ ip6_start(NMDhcpClient *client, const struct in6_addr *ll_addr, GError **error) const guint8 *duid_arr; gsize duid_len; GBytes *duid; + gboolean prefix_delegation; g_return_val_if_fail(!priv->client4, FALSE); g_return_val_if_fail(!priv->client6, FALSE); @@ -1007,16 +1008,19 @@ ip6_start(NMDhcpClient *client, const struct in6_addr *ll_addr, GError **error) } } + prefix_delegation = FALSE; if (client_config->v6.needed_prefixes > 0) { - if (client_config->v6.needed_prefixes > 1) + if (client_config->v6.needed_prefixes > 1) { + /* FIXME: systemd-networkd API only allows to request a + * single prefix */ _LOGW("dhcp-client6: only one prefix request is supported"); - /* FIXME: systemd-networkd API only allows to request a - * single prefix */ - r = sd_dhcp6_client_set_prefix_delegation(sd_client, TRUE); - if (r < 0) { - nm_utils_error_set_errno(error, r, "failed to enable prefix delegation: %s"); - return FALSE; } + prefix_delegation = TRUE; + } + r = sd_dhcp6_client_set_prefix_delegation(sd_client, prefix_delegation); + if (r < 0) { + nm_utils_error_set_errno(error, r, "failed to enable prefix delegation: %s"); + return FALSE; } r = sd_dhcp6_client_set_local_address(sd_client, ll_addr);