summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-01-25 19:48:50 +0100
committerThomas Haller <thaller@redhat.com>2022-01-26 18:22:58 +0100
commit6f3fd32bbb15db763e94380a1ffbd013f4c139d1 (patch)
tree6d2bf158069a1b95c111f24a49793f5b5b7c4e8c
parent2cf198d978a95412079d15a24fc6d58d04ad090d (diff)
downloadNetworkManager-6f3fd32bbb15db763e94380a1ffbd013f4c139d1.tar.gz
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
-rw-r--r--src/core/dhcp/nm-dhcp-systemd.c18
1 files 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);