diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2021-02-01 18:02:37 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2021-02-08 11:14:52 +0100 |
commit | 6ed95bd8e53f5ae274b726bc3fcd78b00058621f (patch) | |
tree | 232e26e954a8acc6bf0dd62e9b7c23a0c9d7a194 | |
parent | 14600548158f8159847ba06a3f2f5eef2bb52881 (diff) | |
download | NetworkManager-bg/dhcp6-pd-stateless.tar.gz |
dhcp: fix requesting prefixes in stateless modebg/dhcp6-pd-stateless
According to RFC3315 section 15.12, Information-request messages can't
include a IA option (such as IA_NA or IA_PD).
When doing stateless DHCPv6, we start the client in the appropriate
mode to issue an Information-request message: with "-S" for dhclient or
calling sd_dhcp6_client_set_information_request(TRUE) for systemd.
However, if we need a prefix later, the client must be restarted to
ask the prefix. Currently both dhclient and systemd clients are still
configured to send an Information-request with prefixes. Fix that.
-rw-r--r-- | src/core/dhcp/nm-dhcp-dhclient.c | 6 | ||||
-rw-r--r-- | src/core/dhcp/nm-dhcp-systemd.c | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/core/dhcp/nm-dhcp-dhclient.c b/src/core/dhcp/nm-dhcp-dhclient.c index 53d1ba760d..431ef4135d 100644 --- a/src/core/dhcp/nm-dhcp-dhclient.c +++ b/src/core/dhcp/nm-dhcp-dhclient.c @@ -437,6 +437,12 @@ dhclient_start(NMDhcpClient *client, if (addr_family == AF_INET6) { g_ptr_array_add(argv, (gpointer) "-6"); + + if (prefixes > 0 && nm_streq0(mode_opt, "-S")) { + /* -S is incompatible with -P, only use the latter */ + mode_opt = NULL; + } + if (mode_opt) g_ptr_array_add(argv, (gpointer) mode_opt); while (prefixes--) diff --git a/src/core/dhcp/nm-dhcp-systemd.c b/src/core/dhcp/nm-dhcp-systemd.c index ea505110ac..ec4a80e644 100644 --- a/src/core/dhcp/nm-dhcp-systemd.c +++ b/src/core/dhcp/nm-dhcp-systemd.c @@ -986,8 +986,11 @@ ip6_start(NMDhcpClient * client, _LOGT("dhcp-client6: set %p", sd_client); - if (nm_dhcp_client_get_info_only(client)) - sd_dhcp6_client_set_information_request(sd_client, 1); + if (nm_dhcp_client_get_info_only(client)) { + sd_dhcp6_client_set_address_request(sd_client, 0); + if (needed_prefixes == 0) + sd_dhcp6_client_set_information_request(sd_client, 1); + } r = sd_dhcp6_client_set_iaid(sd_client, nm_dhcp_client_get_iaid(client)); if (r < 0) { |