network: add missing error check

This commit is contained in:
Yu Watanabe 2019-02-12 13:03:57 +09:00
parent 966ab36b10
commit 57445b53fb
1 changed files with 18 additions and 8 deletions

View File

@ -142,10 +142,15 @@ int dhcp6_lease_pd_prefix_lost(sd_dhcp6_client *client, Link* link) {
continue;
}
route_add(link, AF_INET6, &pd_prefix, pd_prefix_len,
0, 0, 0, &route);
route_update(route, NULL, 0, NULL, NULL, 0, 0,
RTN_UNREACHABLE);
r = route_add(link, AF_INET6, &pd_prefix, pd_prefix_len, 0, 0, 0, &route);
if (r < 0) {
log_link_warning_errno(link, r, "Failed to add unreachable route to delete for DHCPv6 delegated subnet %s/%u: %m",
strnull(buf),
pd_prefix_len);
continue;
}
route_update(route, NULL, 0, NULL, NULL, 0, 0, RTN_UNREACHABLE);
r = route_remove(route, link, dhcp6_route_remove_handler);
if (r < 0) {
@ -303,10 +308,15 @@ static int dhcp6_lease_pd_prefix_acquired(sd_dhcp6_client *client, Link *link) {
table = link_get_dhcp_route_table(link);
route_add(link, AF_INET6, &pd_prefix, pd_prefix_len,
0, 0, table, &route);
route_update(route, NULL, 0, NULL, NULL, 0, 0,
RTN_UNREACHABLE);
r = route_add(link, AF_INET6, &pd_prefix, pd_prefix_len, 0, 0, table, &route);
if (r < 0) {
log_link_warning_errno(link, r, "Failed to add unreachable route for DHCPv6 delegated subnet %s/%u: %m",
strnull(buf),
pd_prefix_len);
continue;
}
route_update(route, NULL, 0, NULL, NULL, 0, 0, RTN_UNREACHABLE);
r = route_configure(route, link, dhcp6_route_handler);
if (r < 0) {