Lines Matching refs:link
24 bool link_dhcp_pd_is_enabled(Link *link) { in link_dhcp_pd_is_enabled() argument
25 assert(link); in link_dhcp_pd_is_enabled()
27 if (!link->network) in link_dhcp_pd_is_enabled()
30 return link->network->dhcp_pd; in link_dhcp_pd_is_enabled()
33 bool dhcp_pd_is_uplink(Link *link, Link *target, bool accept_auto) { in dhcp_pd_is_uplink() argument
34 assert(link); in dhcp_pd_is_uplink()
37 if (!link_dhcp_pd_is_enabled(link)) in dhcp_pd_is_uplink()
40 if (link->network->dhcp_pd_uplink_name) in dhcp_pd_is_uplink()
41 return streq_ptr(target->ifname, link->network->dhcp_pd_uplink_name) || in dhcp_pd_is_uplink()
42 … strv_contains(target->alternative_names, link->network->dhcp_pd_uplink_name); in dhcp_pd_is_uplink()
44 if (link->network->dhcp_pd_uplink_index > 0) in dhcp_pd_is_uplink()
45 return target->ifindex == link->network->dhcp_pd_uplink_index; in dhcp_pd_is_uplink()
47 if (link->network->dhcp_pd_uplink_index == UPLINK_INDEX_SELF) in dhcp_pd_is_uplink()
48 return link == target; in dhcp_pd_is_uplink()
50 assert(link->network->dhcp_pd_uplink_index == UPLINK_INDEX_AUTO); in dhcp_pd_is_uplink()
74 static void link_remove_dhcp_pd_subnet_prefix(Link *link, const struct in6_addr *prefix) { in link_remove_dhcp_pd_subnet_prefix() argument
77 assert(link); in link_remove_dhcp_pd_subnet_prefix()
78 assert(link->manager); in link_remove_dhcp_pd_subnet_prefix()
81 if (hashmap_get(link->manager->links_by_dhcp_pd_subnet_prefix, prefix) != link) in link_remove_dhcp_pd_subnet_prefix()
84 hashmap_remove2(link->manager->links_by_dhcp_pd_subnet_prefix, prefix, &key); in link_remove_dhcp_pd_subnet_prefix()
88 static int link_add_dhcp_pd_subnet_prefix(Link *link, const struct in6_addr *prefix) { in link_add_dhcp_pd_subnet_prefix() argument
92 assert(link); in link_add_dhcp_pd_subnet_prefix()
99 …r = hashmap_ensure_put(&link->manager->links_by_dhcp_pd_subnet_prefix, &in6_addr_hash_ops_free, co… in link_add_dhcp_pd_subnet_prefix()
109 Link *link; in link_get_by_dhcp_pd_subnet_prefix() local
114 link = hashmap_get(manager->links_by_dhcp_pd_subnet_prefix, prefix); in link_get_by_dhcp_pd_subnet_prefix()
115 if (!link) in link_get_by_dhcp_pd_subnet_prefix()
119 *ret = link; in link_get_by_dhcp_pd_subnet_prefix()
123 static int dhcp_pd_get_assigned_subnet_prefix(Link *link, const struct in6_addr *pd_prefix, uint8_t… in dhcp_pd_get_assigned_subnet_prefix() argument
124 assert(link); in dhcp_pd_get_assigned_subnet_prefix()
127 if (!link_dhcp_pd_is_enabled(link)) in dhcp_pd_get_assigned_subnet_prefix()
130 if (link->network->dhcp_pd_assign) { in dhcp_pd_get_assigned_subnet_prefix()
133 SET_FOREACH(address, link->addresses) { in dhcp_pd_get_assigned_subnet_prefix()
152 SET_FOREACH(route, link->routes) { in dhcp_pd_get_assigned_subnet_prefix()
168 int dhcp_pd_remove(Link *link, bool only_marked) { in dhcp_pd_remove() argument
171 assert(link); in dhcp_pd_remove()
172 assert(link->manager); in dhcp_pd_remove()
174 if (!link_dhcp_pd_is_enabled(link)) in dhcp_pd_remove()
178 link->dhcp_pd_configured = false; in dhcp_pd_remove()
180 if (!link->network->dhcp_pd_assign) { in dhcp_pd_remove()
183 SET_FOREACH(route, link->routes) { in dhcp_pd_remove()
189 if (link->radv) in dhcp_pd_remove()
190 sd_radv_remove_prefix(link->radv, &route->dst.in6, 64); in dhcp_pd_remove()
192 link_remove_dhcp_pd_subnet_prefix(link, &route->dst.in6); in dhcp_pd_remove()
198 route_cancel_request(route, link); in dhcp_pd_remove()
203 SET_FOREACH(address, link->addresses) { in dhcp_pd_remove()
214 if (link->radv) in dhcp_pd_remove()
215 sd_radv_remove_prefix(link->radv, &prefix, 64); in dhcp_pd_remove()
217 link_remove_dhcp_pd_subnet_prefix(link, &prefix); in dhcp_pd_remove()
230 static int dhcp_pd_check_ready(Link *link);
236 assert(address->link); in dhcp_pd_address_ready_callback()
238 SET_FOREACH(a, address->link->addresses) in dhcp_pd_address_ready_callback()
242 return dhcp_pd_check_ready(address->link); in dhcp_pd_address_ready_callback()
245 static int dhcp_pd_check_ready(Link *link) { in dhcp_pd_check_ready() argument
248 assert(link); in dhcp_pd_check_ready()
249 assert(link->network); in dhcp_pd_check_ready()
251 if (link->dhcp_pd_messages > 0) { in dhcp_pd_check_ready()
252 log_link_debug(link, "%s(): DHCP-PD addresses and routes are not set.", __func__); in dhcp_pd_check_ready()
256 if (link->network->dhcp_pd_assign) { in dhcp_pd_check_ready()
260 SET_FOREACH(address, link->addresses) { in dhcp_pd_check_ready()
270 SET_FOREACH(address, link->addresses) in dhcp_pd_check_ready()
274 log_link_debug(link, "%s(): no DHCP-PD address is ready.", __func__); in dhcp_pd_check_ready()
279 link->dhcp_pd_configured = true; in dhcp_pd_check_ready()
281 log_link_debug(link, "DHCP-PD addresses and routes set."); in dhcp_pd_check_ready()
283 r = dhcp_pd_remove(link, /* only_marked = */ true); in dhcp_pd_check_ready()
287 link_check_ready(link); in dhcp_pd_check_ready()
291 static int dhcp_pd_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Request *req, Link *link,… in dhcp_pd_route_handler() argument
294 assert(link); in dhcp_pd_route_handler()
296 …r = route_configure_handler_internal(rtnl, m, link, "Failed to add prefix route for DHCP delegated… in dhcp_pd_route_handler()
300 r = dhcp_pd_check_ready(link); in dhcp_pd_route_handler()
302 link_enter_failed(link); in dhcp_pd_route_handler()
307 static int dhcp_pd_request_route(Link *link, const struct in6_addr *prefix, usec_t lifetime_usec) { in dhcp_pd_request_route() argument
312 assert(link); in dhcp_pd_request_route()
313 assert(link->network); in dhcp_pd_request_route()
316 if (link->network->dhcp_pd_assign) in dhcp_pd_request_route()
328 route->priority = link->network->dhcp_pd_route_metric; in dhcp_pd_request_route()
331 if (route_get(NULL, link, route, &existing) < 0) in dhcp_pd_request_route()
332 link->dhcp_pd_configured = false; in dhcp_pd_request_route()
336 r = link_request_route(link, TAKE_PTR(route), true, &link->dhcp_pd_messages, in dhcp_pd_request_route()
339 return log_link_error_errno(link, r, "Failed to request DHCP-PD prefix route: %m"); in dhcp_pd_request_route()
344 …ress_handler(sd_netlink *rtnl, sd_netlink_message *m, Request *req, Link *link, Address *address) { in dhcp_pd_address_handler() argument
347 assert(link); in dhcp_pd_address_handler()
349 r = address_configure_handler_internal(rtnl, m, link, "Could not set DHCP-PD address"); in dhcp_pd_address_handler()
353 r = dhcp_pd_check_ready(link); in dhcp_pd_address_handler()
355 link_enter_failed(link); in dhcp_pd_address_handler()
360 static void log_dhcp_pd_address(Link *link, const Address *address) { in log_dhcp_pd_address() argument
367 log_level = address_get(link, address, NULL) >= 0 ? LOG_DEBUG : LOG_INFO; in log_dhcp_pd_address()
374 log_link_full(link, log_level, "DHCP-PD address %s (valid %s, preferred %s)", in log_dhcp_pd_address()
381 Link *link, in dhcp_pd_request_address() argument
390 assert(link); in dhcp_pd_request_address()
391 assert(link->network); in dhcp_pd_request_address()
394 if (!link->network->dhcp_pd_assign) in dhcp_pd_request_address()
397 r = dhcp_pd_generate_addresses(link, prefix, &addresses); in dhcp_pd_request_address()
399 …return log_link_warning_errno(link, r, "Failed to generate addresses for acquired DHCP delegated p… in dhcp_pd_request_address()
407 … return log_link_error_errno(link, r, "Failed to allocate address for DHCP delegated prefix: %m"); in dhcp_pd_request_address()
415 … SET_FLAG(address->flags, IFA_F_MANAGETEMPADDR, link->network->dhcp_pd_manage_temporary_address); in dhcp_pd_request_address()
416 address->route_metric = link->network->dhcp_pd_route_metric; in dhcp_pd_request_address()
418 log_dhcp_pd_address(link, address); in dhcp_pd_request_address()
420 if (address_get(link, address, &existing) < 0) in dhcp_pd_request_address()
421 link->dhcp_pd_configured = false; in dhcp_pd_request_address()
425 r = link_request_address(link, TAKE_PTR(address), true, &link->dhcp_pd_messages, in dhcp_pd_request_address()
428 … return log_link_error_errno(link, r, "Failed to request DHCP delegated prefix address: %m"); in dhcp_pd_request_address()
461 Link *link, in dhcp_pd_get_preferred_subnet_prefix() argument
470 assert(link); in dhcp_pd_get_preferred_subnet_prefix()
471 assert(link->manager); in dhcp_pd_get_preferred_subnet_prefix()
472 assert(link->network); in dhcp_pd_get_preferred_subnet_prefix()
475 if (link->network->dhcp_pd_subnet_id >= 0) { in dhcp_pd_get_preferred_subnet_prefix()
478 …r = dhcp_pd_calculate_subnet_prefix(pd_prefix, pd_prefix_len, link->network->dhcp_pd_subnet_id, &p… in dhcp_pd_get_preferred_subnet_prefix()
480 return log_link_warning_errno(link, r, in dhcp_pd_get_preferred_subnet_prefix()
482 … link->network->dhcp_pd_subnet_id, UINT64_C(1) << (64 - pd_prefix_len)); in dhcp_pd_get_preferred_subnet_prefix()
488 if (dhcp_pd_get_assigned_subnet_prefix(link, pd_prefix, pd_prefix_len, ret) >= 0) in dhcp_pd_get_preferred_subnet_prefix()
497 return log_link_warning_errno(link, r, in dhcp_pd_get_preferred_subnet_prefix()
502 if (set_contains(link->manager->dhcp_pd_subnet_ids, &n)) in dhcp_pd_get_preferred_subnet_prefix()
506 if (link_get_by_dhcp_pd_subnet_prefix(link->manager, &prefix, &assigned_link) < 0 || in dhcp_pd_get_preferred_subnet_prefix()
507 assigned_link == link) in dhcp_pd_get_preferred_subnet_prefix()
511 r = link_add_dhcp_pd_subnet_prefix(link, &prefix); in dhcp_pd_get_preferred_subnet_prefix()
513 … return log_link_warning_errno(link, r, "Failed to save acquired free subnet prefix: %m"); in dhcp_pd_get_preferred_subnet_prefix()
520 Link *link, in dhcp_pd_assign_subnet_prefix() argument
531 assert(link); in dhcp_pd_assign_subnet_prefix()
532 assert(link->network); in dhcp_pd_assign_subnet_prefix()
535 r = dhcp_pd_get_preferred_subnet_prefix(link, pd_prefix, pd_prefix_len, &prefix); in dhcp_pd_assign_subnet_prefix()
541 if (link_radv_enabled(link) && link->network->dhcp_pd_announce) { in dhcp_pd_assign_subnet_prefix()
543 log_link_debug(link, "Ignoring Announce= setting on upstream interface."); in dhcp_pd_assign_subnet_prefix()
545 … r = radv_add_prefix(link, &prefix, 64, lifetime_preferred_usec, lifetime_valid_usec); in dhcp_pd_assign_subnet_prefix()
547 return log_link_warning_errno(link, r, in dhcp_pd_assign_subnet_prefix()
553 r = dhcp_pd_request_route(link, &prefix, lifetime_valid_usec); in dhcp_pd_assign_subnet_prefix()
555 return log_link_warning_errno(link, r, in dhcp_pd_assign_subnet_prefix()
559 r = dhcp_pd_request_address(link, &prefix, lifetime_preferred_usec, lifetime_valid_usec); in dhcp_pd_assign_subnet_prefix()
561 return log_link_warning_errno(link, r, in dhcp_pd_assign_subnet_prefix()
565 log_link_debug(link, "Assigned prefix %s", strna(buf)); in dhcp_pd_assign_subnet_prefix()
569 static int dhcp_pd_prepare(Link *link) { in dhcp_pd_prepare() argument
570 if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) in dhcp_pd_prepare()
573 if (!link_dhcp_pd_is_enabled(link)) in dhcp_pd_prepare()
576 if (link_radv_enabled(link) && link->network->dhcp_pd_announce && !link->radv) in dhcp_pd_prepare()
579 link_mark_addresses(link, NETWORK_CONFIG_SOURCE_DHCP_PD, NULL); in dhcp_pd_prepare()
580 link_mark_routes(link, NETWORK_CONFIG_SOURCE_DHCP_PD, NULL); in dhcp_pd_prepare()
585 static int dhcp_pd_finalize(Link *link) { in dhcp_pd_finalize() argument
588 if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) in dhcp_pd_finalize()
591 if (link->dhcp_pd_messages == 0) { in dhcp_pd_finalize()
592 link->dhcp_pd_configured = false; in dhcp_pd_finalize()
594 r = dhcp_pd_remove(link, /* only_marked = */ true); in dhcp_pd_finalize()
599 if (!link->dhcp_pd_configured) in dhcp_pd_finalize()
600 link_set_state(link, LINK_STATE_CONFIGURING); in dhcp_pd_finalize()
602 link_check_ready(link); in dhcp_pd_finalize()
608 Link *link; in dhcp_pd_prefix_lost() local
614 HASHMAP_FOREACH(link, uplink->manager->links_by_index) { in dhcp_pd_prefix_lost()
615 if (!dhcp_pd_is_uplink(link, uplink, /* accept_auto = */ true)) in dhcp_pd_prefix_lost()
618 r = dhcp_pd_remove(link, /* only_marked = */ false); in dhcp_pd_prefix_lost()
620 link_enter_failed(link); in dhcp_pd_prefix_lost()
655 …le_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Request *req, Link *link, Route *route) { in dhcp4_unreachable_route_handler() argument
658 assert(link); in dhcp4_unreachable_route_handler()
660 …r = route_configure_handler_internal(rtnl, m, link, "Failed to set unreachable route for DHCPv4 de… in dhcp4_unreachable_route_handler()
664 r = dhcp4_check_ready(link); in dhcp4_unreachable_route_handler()
666 link_enter_failed(link); in dhcp4_unreachable_route_handler()
671 …le_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Request *req, Link *link, Route *route) { in dhcp6_unreachable_route_handler() argument
674 assert(link); in dhcp6_unreachable_route_handler()
676 …r = route_configure_handler_internal(rtnl, m, link, "Failed to set unreachable route for DHCPv6 de… in dhcp6_unreachable_route_handler()
680 r = dhcp6_check_ready(link); in dhcp6_unreachable_route_handler()
682 link_enter_failed(link); in dhcp6_unreachable_route_handler()
688 Link *link, in dhcp_request_unreachable_route() argument
701 assert(link); in dhcp_request_unreachable_route()
712 …log_link_debug(link, "Not adding a blocking route for DHCP delegated prefix %s since the prefix ha… in dhcp_request_unreachable_route()
731 if (route_get(link->manager, NULL, route, &existing) < 0) in dhcp_request_unreachable_route()
732 link->dhcp6_configured = false; in dhcp_request_unreachable_route()
736 r = link_request_route(link, TAKE_PTR(route), true, counter, callback, NULL); in dhcp_request_unreachable_route()
741 …return log_link_error_errno(link, r, "Failed to request unreachable route for DHCP delegated prefi… in dhcp_request_unreachable_route()
749 Link *link, in dhcp4_request_unreachable_route() argument
755 return dhcp_request_unreachable_route(link, addr, prefixlen, lifetime_usec, in dhcp4_request_unreachable_route()
757 … &link->dhcp4_messages, dhcp4_unreachable_route_handler); in dhcp4_request_unreachable_route()
761 Link *link, in dhcp6_request_unreachable_route() argument
767 return dhcp_request_unreachable_route(link, addr, prefixlen, lifetime_usec, in dhcp6_request_unreachable_route()
769 … &link->dhcp6_messages, dhcp6_unreachable_route_handler); in dhcp6_request_unreachable_route()
772 static int dhcp_pd_prefix_add(Link *link, const struct in6_addr *prefix, uint8_t prefixlen) { in dhcp_pd_prefix_add() argument
777 assert(link); in dhcp_pd_prefix_add()
792 log_link_full(link, in dhcp_pd_prefix_add()
793 set_contains(link->dhcp_pd_prefixes, p) ? LOG_DEBUG : in dhcp_pd_prefix_add()
801 r = set_ensure_consume(&link->dhcp_pd_prefixes, &in_addr_prefix_hash_ops_free, p); in dhcp_pd_prefix_add()
803 … return log_link_error_errno(link, r, "Failed to store DHCP delegated prefix %s: %m", strna(buf)); in dhcp_pd_prefix_add()
808 static int dhcp4_pd_request_default_gateway_on_6rd_tunnel(Link *link, const struct in_addr *br_addr… in dhcp4_pd_request_default_gateway_on_6rd_tunnel() argument
813 assert(link); in dhcp4_pd_request_default_gateway_on_6rd_tunnel()
818 …return log_link_debug_errno(link, r, "Failed to allocate default gateway for DHCP delegated prefix… in dhcp4_pd_request_default_gateway_on_6rd_tunnel()
829 if (route_get(NULL, link, route, &existing) < 0) /* This is a new route. */ in dhcp4_pd_request_default_gateway_on_6rd_tunnel()
830 link->dhcp_pd_configured = false; in dhcp4_pd_request_default_gateway_on_6rd_tunnel()
834 r = link_request_route(link, TAKE_PTR(route), true, &link->dhcp_pd_messages, in dhcp4_pd_request_default_gateway_on_6rd_tunnel()
837 …return log_link_debug_errno(link, r, "Failed to request default gateway for DHCP delegated prefix:… in dhcp4_pd_request_default_gateway_on_6rd_tunnel()
868 static int dhcp4_pd_assign_subnet_prefix(Link *link, Link *uplink) { in dhcp4_pd_assign_subnet_prefix() argument
877 assert(link); in dhcp4_pd_assign_subnet_prefix()
900 r = dhcp_pd_prepare(link); in dhcp4_pd_assign_subnet_prefix()
904 if (streq_ptr(uplink->dhcp4_6rd_tunnel_name, link->ifname)) { in dhcp4_pd_assign_subnet_prefix()
905 … r = dhcp4_pd_request_default_gateway_on_6rd_tunnel(link, &br_addresses[0], lifetime_usec); in dhcp4_pd_assign_subnet_prefix()
910 …r = dhcp_pd_assign_subnet_prefix(link, &pd_prefix, pd_prefixlen, lifetime_usec, lifetime_usec, /* … in dhcp4_pd_assign_subnet_prefix()
914 return dhcp_pd_finalize(link); in dhcp4_pd_assign_subnet_prefix()
917 static int dhcp4_pd_6rd_tunnel_create_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) { in dhcp4_pd_6rd_tunnel_create_handler() argument
921 assert(link); in dhcp4_pd_6rd_tunnel_create_handler()
922 assert(link->manager); in dhcp4_pd_6rd_tunnel_create_handler()
923 assert(link->dhcp4_6rd_tunnel_name); in dhcp4_pd_6rd_tunnel_create_handler()
925 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)) in dhcp4_pd_6rd_tunnel_create_handler()
930 … log_link_message_warning_errno(link, m, r, "Failed to create tunnel device for DHCPv4 6rd"); in dhcp4_pd_6rd_tunnel_create_handler()
931 link_enter_failed(link); in dhcp4_pd_6rd_tunnel_create_handler()
947 Link *link; in dhcp4_pd_prefix_acquired() local
1016 HASHMAP_FOREACH(link, uplink->manager->links_by_index) { in dhcp4_pd_prefix_acquired()
1017 if (!dhcp_pd_is_uplink(link, uplink, /* accept_auto = */ true)) in dhcp4_pd_prefix_acquired()
1020 r = dhcp4_pd_assign_subnet_prefix(link, uplink); in dhcp4_pd_prefix_acquired()
1026 if (link == uplink) in dhcp4_pd_prefix_acquired()
1029 link_enter_failed(link); in dhcp4_pd_prefix_acquired()
1036 static int dhcp6_pd_assign_subnet_prefixes(Link *link, Link *uplink) { in dhcp6_pd_assign_subnet_prefixes() argument
1040 assert(link); in dhcp6_pd_assign_subnet_prefixes()
1044 r = dhcp_pd_prepare(link); in dhcp6_pd_assign_subnet_prefixes()
1074 r = dhcp_pd_assign_subnet_prefix(link, &pd_prefix, pd_prefix_len, in dhcp6_pd_assign_subnet_prefixes()
1076 /* is_uplink = */ link == uplink); in dhcp6_pd_assign_subnet_prefixes()
1081 return dhcp_pd_finalize(link); in dhcp6_pd_assign_subnet_prefixes()
1087 Link *link; in dhcp6_pd_prefix_acquired() local
1130 HASHMAP_FOREACH(link, uplink->manager->links_by_index) { in dhcp6_pd_prefix_acquired()
1131 if (!dhcp_pd_is_uplink(link, uplink, /* accept_auto = */ true)) in dhcp6_pd_prefix_acquired()
1134 r = dhcp6_pd_assign_subnet_prefixes(link, uplink); in dhcp6_pd_prefix_acquired()
1140 if (link == uplink) in dhcp6_pd_prefix_acquired()
1143 link_enter_failed(link); in dhcp6_pd_prefix_acquired()
1150 static bool dhcp4_pd_uplink_is_ready(Link *link) { in dhcp4_pd_uplink_is_ready() argument
1151 assert(link); in dhcp4_pd_uplink_is_ready()
1153 if (!link->network) in dhcp4_pd_uplink_is_ready()
1156 if (!link->network->dhcp_use_6rd) in dhcp4_pd_uplink_is_ready()
1159 if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) in dhcp4_pd_uplink_is_ready()
1162 if (!link->dhcp_client) in dhcp4_pd_uplink_is_ready()
1165 if (sd_dhcp_client_is_running(link->dhcp_client) <= 0) in dhcp4_pd_uplink_is_ready()
1168 if (!link->dhcp_lease) in dhcp4_pd_uplink_is_ready()
1171 return dhcp4_lease_has_pd_prefix(link->dhcp_lease); in dhcp4_pd_uplink_is_ready()
1174 static bool dhcp6_pd_uplink_is_ready(Link *link) { in dhcp6_pd_uplink_is_ready() argument
1175 assert(link); in dhcp6_pd_uplink_is_ready()
1177 if (!link->network) in dhcp6_pd_uplink_is_ready()
1180 if (!link->network->dhcp6_use_pd_prefix) in dhcp6_pd_uplink_is_ready()
1183 if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) in dhcp6_pd_uplink_is_ready()
1186 if (!link->dhcp6_client) in dhcp6_pd_uplink_is_ready()
1189 if (sd_dhcp6_client_is_running(link->dhcp6_client) <= 0) in dhcp6_pd_uplink_is_ready()
1192 if (!link->dhcp6_lease) in dhcp6_pd_uplink_is_ready()
1195 return dhcp6_lease_has_pd_prefix(link->dhcp6_lease); in dhcp6_pd_uplink_is_ready()
1198 int dhcp_pd_find_uplink(Link *link, Link **ret) { in dhcp_pd_find_uplink() argument
1202 assert(link); in dhcp_pd_find_uplink()
1203 assert(link->manager); in dhcp_pd_find_uplink()
1204 assert(link_dhcp_pd_is_enabled(link)); in dhcp_pd_find_uplink()
1207 if (link->network->dhcp_pd_uplink_name) in dhcp_pd_find_uplink()
1208 r = link_get_by_name(link->manager, link->network->dhcp_pd_uplink_name, &uplink); in dhcp_pd_find_uplink()
1209 else if (link->network->dhcp_pd_uplink_index > 0) in dhcp_pd_find_uplink()
1210 r = link_get_by_index(link->manager, link->network->dhcp_pd_uplink_index, &uplink); in dhcp_pd_find_uplink()
1211 else if (link->network->dhcp_pd_uplink_index == UPLINK_INDEX_SELF) in dhcp_pd_find_uplink()
1212 uplink = link; in dhcp_pd_find_uplink()
1230 HASHMAP_FOREACH(uplink, link->manager->links_by_index) { in dhcp_pd_find_uplink()
1246 int dhcp_request_prefix_delegation(Link *link) { in dhcp_request_prefix_delegation() argument
1250 assert(link); in dhcp_request_prefix_delegation()
1252 if (!link_dhcp_pd_is_enabled(link)) in dhcp_request_prefix_delegation()
1255 r = dhcp_pd_find_uplink(link, &uplink); in dhcp_request_prefix_delegation()
1259 … log_link_debug(link, "Requesting subnets of delegated prefixes acquired by DHCPv%c client on %s", in dhcp_request_prefix_delegation()
1263 dhcp4_pd_assign_subnet_prefix(link, uplink) : in dhcp_request_prefix_delegation()
1264 dhcp6_pd_assign_subnet_prefixes(link, uplink); in dhcp_request_prefix_delegation()