From 21cf8e9e6de9badd521fa8926eff1b3867406d78 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 5 Dec 2021 05:15:57 +0900 Subject: [PATCH] network: dhcp6pd: first check prefixes, then calculate lifetime --- src/network/networkd-dhcp-prefix-delegation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c index d2d676c6f50..180a758c43f 100644 --- a/src/network/networkd-dhcp-prefix-delegation.c +++ b/src/network/networkd-dhcp-prefix-delegation.c @@ -800,9 +800,6 @@ static int dhcp6_pd_assign_prefixes(Link *link, Link *uplink) { if (r < 0) break; - lifetime_preferred_usec = usec_add(lifetime_preferred_sec * USEC_PER_SEC, timestamp_usec); - lifetime_valid_usec = usec_add(lifetime_valid_sec * USEC_PER_SEC, timestamp_usec); - if (pd_prefix_len > 64) continue; @@ -811,6 +808,9 @@ static int dhcp6_pd_assign_prefixes(Link *link, Link *uplink) { if (r < 0) return r; + lifetime_preferred_usec = usec_add(lifetime_preferred_sec * USEC_PER_SEC, timestamp_usec); + lifetime_valid_usec = usec_add(lifetime_valid_sec * USEC_PER_SEC, timestamp_usec); + r = dhcp6_pd_assign_prefix(link, &pd_prefix, pd_prefix_len, lifetime_preferred_usec, lifetime_valid_usec); if (r < 0) return r; -- 2.47.3