]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: require DHCP protocol to be finished when an address of delegated prefix...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 30 May 2023 06:29:05 +0000 (15:29 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 30 May 2023 08:39:05 +0000 (17:39 +0900)
src/network/networkd-link.c

index c0ad17f9f1fbe76fe0f42e6bdd51a3125f8b01d4..ec6d03ff02bcf86dc531878ab7376a6855d22562 100644 (file)
@@ -462,6 +462,25 @@ void link_check_ready(Link *link) {
                 (!link->network->ipv6_accept_ra_use_autonomous_prefix ||
                  link_check_addresses_ready(link, NETWORK_CONFIG_SOURCE_NDISC));
 
+        /* If the uplink for PD is self, then request the corresponding DHCP protocol is also ready. */
+        if (dhcp_pd_is_uplink(link, link, /* accept_auto = */ false)) {
+                if (link_dhcp4_enabled(link) && link->network->dhcp_use_6rd &&
+                    link->dhcp_lease && dhcp4_lease_has_pd_prefix(link->dhcp_lease)) {
+                        if (!dhcp4_ready)
+                                return (void) log_link_debug(link, "%s(): DHCPv4 6rd prefix is assigned, but DHCPv4 protocol is not finished yet.", __func__);
+                        if (!dhcp_pd_ready)
+                                return (void) log_link_debug(link, "%s(): DHCPv4 is finished, but prefix acquired by DHCPv4-6rd is not assigned yet.", __func__);
+                }
+
+                if (link_dhcp6_enabled(link) && link->network->dhcp6_use_pd_prefix &&
+                    link->dhcp6_lease && dhcp6_lease_has_pd_prefix(link->dhcp6_lease)) {
+                        if (!dhcp6_ready)
+                                return (void) log_link_debug(link, "%s(): DHCPv6 IA_PD prefix is assigned, but DHCPv6 protocol is not finished yet.", __func__);
+                        if (!dhcp_pd_ready)
+                                return (void) log_link_debug(link, "%s(): DHCPv6 is finished, but prefix acquired by DHCPv6 IA_PD is not assigned yet.", __func__);
+                }
+        }
+
         /* At least one dynamic addressing protocol is finished. */
         if (!ipv4ll_ready && !dhcp4_ready && !dhcp6_ready && !dhcp_pd_ready && !ndisc_ready)
                 return (void) log_link_debug(link, "%s(): dynamic addressing protocols are enabled but none of them finished yet.", __func__);