summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-dhcp6.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-04-10 04:47:50 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-04-21 14:00:45 +0200
commit294f129b0d82aed9bb3dc8de0da06b72416fea72 (patch)
tree50036d4deea859957f5daf06bf0e6bcc39a51da5 /src/network/networkd-dhcp6.c
parentnetwork: make IAID and DUID for DHCPv6 configurable explicitly (diff)
downloadsystemd-294f129b0d82aed9bb3dc8de0da06b72416fea72.tar.xz
systemd-294f129b0d82aed9bb3dc8de0da06b72416fea72.zip
network: configure non-dhcp configs earlier even DUID-UUID is used by DHCP clients
Previously, if DUID-UUID is used, all configurations are configured after networkd gets product uuid of machine. This makes only DHCP clients are delayed, and other configs are configured earlier.
Diffstat (limited to 'src/network/networkd-dhcp6.c')
-rw-r--r--src/network/networkd-dhcp6.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index 4cd479c584..617bf6b07c 100644
--- a/src/network/networkd-dhcp6.c
+++ b/src/network/networkd-dhcp6.c
@@ -1290,6 +1290,31 @@ int dhcp6_request_address(Link *link, int ir) {
return 0;
}
+int dhcp6_start(Link *link) {
+ assert(link);
+
+ if (!link->dhcp6_client)
+ return 0;
+
+ if (!link_dhcp6_enabled(link))
+ return 0;
+
+ if (link->network->dhcp6_without_ra == DHCP6_CLIENT_START_MODE_NO)
+ return 0;
+
+ if (!in6_addr_is_link_local(&link->ipv6ll_address)) {
+ log_link_debug(link, "IPv6 link-local address is not set, delaying to start DHCPv6 client.");
+ return 0;
+ }
+
+ if (sd_dhcp6_client_is_running(link->dhcp6_client) > 0)
+ return 0;
+
+ log_link_debug(link, "Acquiring DHCPv6 lease");
+
+ return dhcp6_request_address(link, link->network->dhcp6_without_ra == DHCP6_CLIENT_START_MODE_INFORMATION_REQUEST);
+}
+
int dhcp6_request_prefix_delegation(Link *link) {
Link *l;
@@ -1460,6 +1485,10 @@ int dhcp6_configure(Link *link) {
if (link->dhcp6_client)
return -EBUSY;
+ r = dhcp_configure_duid(link, link_get_dhcp6_duid(link));
+ if (r <= 0)
+ return r;
+
r = sd_dhcp6_client_new(&client);
if (r == -ENOMEM)
return log_oom();