From: Yu Watanabe Date: Mon, 6 Jul 2020 23:38:37 +0000 (+0900) Subject: network: introduce own address handler for dhcp6 delegated prefix X-Git-Tag: v246-rc1~11^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a211ff4b842fd4638602de347d640bf7df6ae248;p=thirdparty%2Fsystemd.git network: introduce own address handler for dhcp6 delegated prefix Fixes #16365. --- diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 6637e81c66b..73b49a5ec04 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -998,6 +998,31 @@ static int dhcp6_prefix_remove_all(Manager *m, Link *link) { return 0; } +static int dhcp6_assign_delegeted_prefix_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) { + int r; + + assert(link); + + if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)) + return 1; + + r = sd_netlink_message_get_errno(m); + if (r < 0 && r != -EEXIST) { + log_link_message_warning_errno(link, m, r, "Could not set DHCPv6 delegated prefix address "); + link_enter_failed(link); + return 1; + } else if (r >= 0) + (void) manager_rtnl_process_address(rtnl, m, link->manager); + + r = link_request_set_routes(link); + if (r < 0) { + link_enter_failed(link); + return 1; + } + + return 1; +} + static int dhcp6_assign_delegated_prefix(Link *link, const struct in6_addr *prefix, uint8_t prefix_len, @@ -1035,11 +1060,9 @@ static int dhcp6_assign_delegated_prefix(Link *link, link_set_state(link, LINK_STATE_CONFIGURING); - r = address_configure(address, link, address_handler, true); + r = address_configure(address, link, dhcp6_assign_delegeted_prefix_address_handler, true); if (r < 0) return log_link_warning_errno(link, r, "Failed to set acquired DHCPv6 delegated prefix address: %m"); - if (r > 0) - link->address_messages++; return 0; }