1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-23 02:04:32 +03:00

Merge pull request #16379 from yuwata/network-dhcp6-delegated-prefix-address-handler

network: fix assertion in assigning dhcp6 delegated prefix
This commit is contained in:
Yu Watanabe 2020-07-08 10:22:08 +09:00 committed by GitHub
commit c253a95bca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 5 deletions

View File

@ -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;
}

View File

@ -1184,7 +1184,7 @@ static int link_request_set_neighbors(Link *link) {
return 0;
}
int address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
static int address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
int r;
assert(rtnl);

View File

@ -220,7 +220,6 @@ int link_request_set_routes(Link *link);
int link_request_set_nexthop(Link *link);
int link_reconfigure(Link *link, bool force);
int address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link);
int log_link_message_full_errno(Link *link, sd_netlink_message *m, int level, int err, const char *msg);
#define log_link_message_error_errno(link, m, err, msg) log_link_message_full_errno(link, m, LOG_ERR, err, msg)