From: Yu Watanabe Date: Thu, 21 Oct 2021 07:09:44 +0000 (+0900) Subject: network: dhcp6pd: check link state earlier before assigning prefixes to downstream X-Git-Tag: v250-rc1~439^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F21082%2Fhead;p=thirdparty%2Fsystemd.git network: dhcp6pd: check link state earlier before assigning prefixes to downstream Also, narrow the acceptable range of the states. --- diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index fb13027337f..a92394554af 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -547,13 +547,13 @@ static int dhcp6_pd_prefix_distribute( _cleanup_free_ char *buf = NULL; struct in6_addr assigned_prefix; - if (!link_dhcp6_pd_is_enabled(link)) + if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) continue; - if (link == dhcp6_link && !link->network->dhcp6_pd_assign) + if (!link_dhcp6_pd_is_enabled(link)) continue; - if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)) + if (link == dhcp6_link && !link->network->dhcp6_pd_assign) continue; if (assign_preferred_subnet_id != link_has_preferred_subnet_id(link)) @@ -581,7 +581,7 @@ static int dhcp6_pd_prefix_distribute( } static int dhcp6_pd_prepare(Link *link) { - if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)) + if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) return 0; if (!link_dhcp6_pd_is_enabled(link)) @@ -596,7 +596,7 @@ static int dhcp6_pd_prepare(Link *link) { static int dhcp6_pd_finalize(Link *link) { int r; - if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)) + if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) return 0; if (!link_dhcp6_pd_is_enabled(link))