summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-10-21 17:54:06 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-10-22 15:58:38 +0900
commita3ad6acf7b7a1cbec077e777ca603f0eb0ee5157 (patch)
tree901f5dcc2c21bfecc91091fa962c0466dae31d23
parent796273775c917b3e987abcdcb0eaa2b2f031dd8d (diff)
downloadsystemd-a3ad6acf7b7a1cbec077e777ca603f0eb0ee5157.tar.gz
network: dhcp6pd: also call dhcp6_pd_prepare() and dhcp6_pd_finalize() for upstream interface
As now the subnet prefix may be assigned to the upstream interface.
-rw-r--r--src/network/networkd-dhcp6.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index b0ce0187f6..fb13027337 100644
--- a/src/network/networkd-dhcp6.c
+++ b/src/network/networkd-dhcp6.c
@@ -844,12 +844,17 @@ static int dhcp6_pd_prefix_acquired(Link *dhcp6_link) {
return log_link_warning_errno(dhcp6_link, r, "Failed to get timestamp of DHCPv6 lease: %m");
HASHMAP_FOREACH(link, dhcp6_link->manager->links_by_index) {
- if (link == dhcp6_link)
- continue;
-
r = dhcp6_pd_prepare(link);
- if (r < 0)
+ if (r < 0) {
+ /* When failed on the upstream interface (i.e., the case link == dhcp6_link),
+ * immediately abort the assignment of the prefixes. As, the all assigned
+ * prefixes will be dropped soon in link_enter_failed(), and it is meaningless
+ * to continue the assignment. */
+ if (link == dhcp6_link)
+ return r;
+
link_enter_failed(link);
+ }
}
for (sd_dhcp6_lease_reset_pd_prefix_iter(dhcp6_link->dhcp6_lease);;) {
@@ -921,12 +926,13 @@ static int dhcp6_pd_prefix_acquired(Link *dhcp6_link) {
}
HASHMAP_FOREACH(link, dhcp6_link->manager->links_by_index) {
- if (link == dhcp6_link)
- continue;
-
r = dhcp6_pd_finalize(link);
- if (r < 0)
+ if (r < 0) {
+ if (link == dhcp6_link)
+ return r;
+
link_enter_failed(link);
+ }
}
return 0;