1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 Copyright © 2014 Intel Corporation. All rights reserved.
6 #include <netinet/in.h>
8 #include <linux/if_arp.h>
11 #include "sd-dhcp6-client.h"
14 #include "hostname-util.h"
15 #include "missing_network.h"
16 #include "network-internal.h"
17 #include "networkd-dhcp6.h"
18 #include "networkd-link.h"
19 #include "networkd-manager.h"
20 #include "siphash24.h"
21 #include "string-util.h"
22 #include "radv-internal.h"
24 static int dhcp6_lease_address_acquired(sd_dhcp6_client
*client
, Link
*link
);
25 static Link
*dhcp6_prefix_get(Manager
*m
, struct in6_addr
*addr
);
26 static int dhcp6_prefix_add(Manager
*m
, struct in6_addr
*addr
, Link
*link
);
27 static int dhcp6_prefix_remove_all(Manager
*m
, Link
*link
);
29 static bool dhcp6_get_prefix_delegation(Link
*link
) {
33 return IN_SET(link
->network
->router_prefix_delegation
,
34 RADV_PREFIX_DELEGATION_DHCP6
,
35 RADV_PREFIX_DELEGATION_BOTH
);
38 static bool dhcp6_enable_prefix_delegation(Link
*dhcp6_link
) {
45 manager
= dhcp6_link
->manager
;
48 HASHMAP_FOREACH(l
, manager
->links
, i
) {
52 if (!dhcp6_get_prefix_delegation(l
))
61 static int dhcp6_lease_information_acquired(sd_dhcp6_client
*client
,
66 static int dhcp6_pd_prefix_assign(Link
*link
, struct in6_addr
*prefix
,
68 uint32_t lifetime_preferred
,
69 uint32_t lifetime_valid
) {
70 sd_radv
*radv
= link
->radv
;
72 _cleanup_(sd_radv_prefix_unrefp
) sd_radv_prefix
*p
= NULL
;
74 r
= sd_radv_prefix_new(&p
);
78 r
= sd_radv_prefix_set_prefix(p
, prefix
, prefix_len
);
82 r
= sd_radv_prefix_set_preferred_lifetime(p
, lifetime_preferred
);
86 r
= sd_radv_prefix_set_valid_lifetime(p
, lifetime_valid
);
90 r
= sd_radv_stop(radv
);
94 r
= sd_radv_add_prefix(radv
, p
, true);
95 if (r
< 0 && r
!= -EEXIST
)
98 r
= dhcp6_prefix_add(link
->manager
, prefix
, link
);
102 return sd_radv_start(radv
);
105 static int dhcp6_route_remove_handler(sd_netlink
*nl
, sd_netlink_message
*m
, Link
*link
) {
110 if (IN_SET(link
->state
, LINK_STATE_FAILED
, LINK_STATE_LINGER
))
113 r
= sd_netlink_message_get_errno(m
);
115 log_link_message_warning_errno(link
, m
, r
, "Received error on unreachable route removal for DHCPv6 delegated subnet");
120 int dhcp6_lease_pd_prefix_lost(sd_dhcp6_client
*client
, Link
* link
) {
122 sd_dhcp6_lease
*lease
;
123 union in_addr_union pd_prefix
;
124 uint8_t pd_prefix_len
;
125 uint32_t lifetime_preferred
, lifetime_valid
;
127 r
= sd_dhcp6_client_get_lease(client
, &lease
);
131 sd_dhcp6_lease_reset_pd_prefix_iter(lease
);
133 while (sd_dhcp6_lease_get_pd(lease
, &pd_prefix
.in6
, &pd_prefix_len
,
135 &lifetime_valid
) >= 0) {
136 _cleanup_free_
char *buf
= NULL
;
137 _cleanup_(route_freep
) Route
*route
= NULL
;
139 if (pd_prefix_len
>= 64)
142 (void) in_addr_to_string(AF_INET6
, &pd_prefix
, &buf
);
144 r
= route_new(&route
);
148 route
->family
= AF_INET6
;
149 route
->dst
= pd_prefix
;
150 route
->dst_prefixlen
= pd_prefix_len
;
151 route
->type
= RTN_UNREACHABLE
;
153 r
= route_remove(route
, link
, dhcp6_route_remove_handler
);
155 log_link_warning_errno(link
, r
, "Cannot delete unreachable route for DHCPv6 delegated subnet %s/%u: %m",
161 log_link_debug(link
, "Removing unreachable route %s/%u",
162 strnull(buf
), pd_prefix_len
);
168 static int dhcp6_pd_prefix_distribute(Link
*dhcp6_link
, Iterator
*i
,
169 struct in6_addr
*pd_prefix
,
170 uint8_t pd_prefix_len
,
171 uint32_t lifetime_preferred
,
172 uint32_t lifetime_valid
) {
174 Manager
*manager
= dhcp6_link
->manager
;
175 union in_addr_union prefix
;
176 uint64_t n_prefixes
, n_used
= 0;
177 _cleanup_free_
char *buf
= NULL
;
178 _cleanup_free_
char *assigned_buf
= NULL
;
182 assert(pd_prefix_len
<= 64);
184 prefix
.in6
= *pd_prefix
;
186 r
= in_addr_mask(AF_INET6
, &prefix
, pd_prefix_len
);
190 n_prefixes
= UINT64_C(1) << (64 - pd_prefix_len
);
192 (void) in_addr_to_string(AF_INET6
, &prefix
, &buf
);
193 log_link_debug(dhcp6_link
, "Assigning up to %" PRIu64
" prefixes from %s/%u",
194 n_prefixes
, strnull(buf
), pd_prefix_len
);
196 while (hashmap_iterate(manager
->links
, i
, (void **)&link
, NULL
)) {
199 if (n_used
== n_prefixes
) {
200 log_link_debug(dhcp6_link
, "Assigned %" PRIu64
"/%" PRIu64
" prefixes from %s/%u",
201 n_used
, n_prefixes
, strnull(buf
), pd_prefix_len
);
206 if (link
== dhcp6_link
)
209 if (!dhcp6_get_prefix_delegation(link
))
212 assigned_link
= dhcp6_prefix_get(manager
, &prefix
.in6
);
213 if (assigned_link
&& assigned_link
!= link
)
216 (void) in_addr_to_string(AF_INET6
, &prefix
, &assigned_buf
);
217 r
= dhcp6_pd_prefix_assign(link
, &prefix
.in6
, 64,
218 lifetime_preferred
, lifetime_valid
);
220 log_link_error_errno(link
, r
, "Unable to %s prefix %s/64 from %s/%u for link: %m",
221 assigned_link
? "update": "assign",
222 strnull(assigned_buf
),
223 strnull(buf
), pd_prefix_len
);
229 log_link_debug(link
, "Assigned prefix %" PRIu64
"/%" PRIu64
" %s/64 from %s/%u to link",
230 n_used
+ 1, n_prefixes
,
231 strnull(assigned_buf
),
232 strnull(buf
), pd_prefix_len
);
236 r
= in_addr_prefix_next(AF_INET6
, &prefix
, 64);
237 if (r
< 0 && n_used
< n_prefixes
)
244 static int dhcp6_route_handler(sd_netlink
*nl
, sd_netlink_message
*m
, Link
*link
) {
249 if (IN_SET(link
->state
, LINK_STATE_FAILED
, LINK_STATE_LINGER
))
252 r
= sd_netlink_message_get_errno(m
);
253 if (r
< 0 && r
!= -EEXIST
)
254 log_link_message_warning_errno(link
, m
, r
, "Received error when adding unreachable route for DHCPv6 delegated subnet");
259 static int dhcp6_lease_pd_prefix_acquired(sd_dhcp6_client
*client
, Link
*link
) {
261 sd_dhcp6_lease
*lease
;
262 union in_addr_union pd_prefix
;
263 uint8_t pd_prefix_len
;
264 uint32_t lifetime_preferred
, lifetime_valid
;
265 Iterator i
= ITERATOR_FIRST
;
267 r
= sd_dhcp6_client_get_lease(client
, &lease
);
271 sd_dhcp6_lease_reset_pd_prefix_iter(lease
);
273 while (sd_dhcp6_lease_get_pd(lease
, &pd_prefix
.in6
, &pd_prefix_len
,
275 &lifetime_valid
) >= 0) {
277 _cleanup_free_
char *buf
= NULL
;
279 (void) in_addr_to_string(AF_INET6
, &pd_prefix
, &buf
);
281 if (pd_prefix_len
> 64) {
282 log_link_debug(link
, "PD Prefix length > 64, ignoring prefix %s/%u",
283 strnull(buf
), pd_prefix_len
);
287 if (pd_prefix_len
< 48)
288 log_link_warning(link
, "PD Prefix length < 48, looks unusual %s/%u",
289 strnull(buf
), pd_prefix_len
);
291 if (pd_prefix_len
< 64) {
292 _cleanup_(route_freep
) Route
*route
= NULL
;
294 r
= route_new(&route
);
298 route
->family
= AF_INET6
;
299 route
->dst
= pd_prefix
;
300 route
->dst_prefixlen
= pd_prefix_len
;
301 route
->table
= link_get_dhcp_route_table(link
);
302 route
->type
= RTN_UNREACHABLE
;
304 r
= route_configure(route
, link
, dhcp6_route_handler
);
306 log_link_warning_errno(link
, r
, "Cannot configure unreachable route for delegated subnet %s/%u: %m",
312 log_link_debug(link
, "Configuring unreachable route for %s/%u",
313 strnull(buf
), pd_prefix_len
);
315 log_link_debug(link
, "Not adding a blocking route since distributed prefix is /64");
317 r
= dhcp6_pd_prefix_distribute(link
, &i
, &pd_prefix
.in6
,
321 if (r
< 0 && r
!= -EAGAIN
)
331 int dhcp6_request_prefix_delegation(Link
*link
) {
335 assert_return(link
, -EINVAL
);
336 assert_return(link
->manager
, -EOPNOTSUPP
);
338 if (dhcp6_get_prefix_delegation(link
) <= 0)
341 log_link_debug(link
, "Requesting DHCPv6 prefixes to be delegated for new link");
343 HASHMAP_FOREACH(l
, link
->manager
->links
, i
) {
349 if (!l
->dhcp6_client
)
352 r
= sd_dhcp6_client_get_prefix_delegation(l
->dhcp6_client
, &enabled
);
354 log_link_warning_errno(l
, r
, "Cannot get prefix delegation when adding new link");
359 r
= sd_dhcp6_client_set_prefix_delegation(l
->dhcp6_client
, 1);
361 log_link_warning_errno(l
, r
, "Cannot enable prefix delegation when adding new link");
366 r
= sd_dhcp6_client_is_running(l
->dhcp6_client
);
371 log_link_debug(l
, "Requesting re-assignment of delegated prefixes after adding new link");
372 (void) dhcp6_lease_pd_prefix_acquired(l
->dhcp6_client
, l
);
377 r
= sd_dhcp6_client_stop(l
->dhcp6_client
);
379 log_link_warning_errno(l
, r
, "Cannot stop DHCPv6 prefix delegation client after adding new link");
383 r
= sd_dhcp6_client_start(l
->dhcp6_client
);
385 log_link_warning_errno(l
, r
, "Cannot restart DHCPv6 prefix delegation client after adding new link");
389 log_link_debug(l
, "Restarted DHCPv6 client to acquire prefix delegations after adding new link");
395 static int dhcp6_address_handler(sd_netlink
*rtnl
, sd_netlink_message
*m
, Link
*link
) {
400 if (IN_SET(link
->state
, LINK_STATE_FAILED
, LINK_STATE_LINGER
))
403 r
= sd_netlink_message_get_errno(m
);
404 if (r
< 0 && r
!= -EEXIST
) {
405 log_link_message_warning_errno(link
, m
, r
, "Could not set DHCPv6 address");
406 link_enter_failed(link
);
409 (void) manager_rtnl_process_address(rtnl
, m
, link
->manager
);
411 r
= link_request_set_routes(link
);
413 link_enter_failed(link
);
420 static int dhcp6_address_change(
422 struct in6_addr
*ip6_addr
,
423 uint32_t lifetime_preferred
,
424 uint32_t lifetime_valid
) {
426 _cleanup_(address_freep
) Address
*addr
= NULL
;
427 _cleanup_free_
char *buffer
= NULL
;
430 r
= address_new(&addr
);
434 addr
->family
= AF_INET6
;
435 addr
->in_addr
.in6
= *ip6_addr
;
436 addr
->flags
= IFA_F_NOPREFIXROUTE
;
437 addr
->prefixlen
= 128;
438 addr
->cinfo
.ifa_prefered
= lifetime_preferred
;
439 addr
->cinfo
.ifa_valid
= lifetime_valid
;
441 (void) in_addr_to_string(addr
->family
, &addr
->in_addr
, &buffer
);
443 "DHCPv6 address %s/%d timeout preferred %d valid %d",
444 strnull(buffer
), addr
->prefixlen
, lifetime_preferred
, lifetime_valid
);
446 r
= address_configure(addr
, link
, dhcp6_address_handler
, true);
448 return log_link_warning_errno(link
, r
, "Could not assign DHCPv6 address: %m");
453 static int dhcp6_lease_address_acquired(sd_dhcp6_client
*client
, Link
*link
) {
455 sd_dhcp6_lease
*lease
;
456 struct in6_addr ip6_addr
;
457 uint32_t lifetime_preferred
, lifetime_valid
;
459 r
= sd_dhcp6_client_get_lease(client
, &lease
);
463 sd_dhcp6_lease_reset_address_iter(lease
);
465 while (sd_dhcp6_lease_get_address(lease
, &ip6_addr
,
467 &lifetime_valid
) >= 0) {
469 r
= dhcp6_address_change(link
, &ip6_addr
, lifetime_preferred
, lifetime_valid
);
477 static void dhcp6_handler(sd_dhcp6_client
*client
, int event
, void *userdata
) {
479 Link
*link
= userdata
;
482 assert(link
->network
);
484 if (IN_SET(link
->state
, LINK_STATE_FAILED
, LINK_STATE_LINGER
))
488 case SD_DHCP6_CLIENT_EVENT_STOP
:
489 case SD_DHCP6_CLIENT_EVENT_RESEND_EXPIRE
:
490 case SD_DHCP6_CLIENT_EVENT_RETRANS_MAX
:
491 if (sd_dhcp6_client_get_lease(client
, NULL
) >= 0)
492 log_link_warning(link
, "DHCPv6 lease lost");
494 (void) dhcp6_lease_pd_prefix_lost(client
, link
);
495 (void) dhcp6_prefix_remove_all(link
->manager
, link
);
498 link
->dhcp6_configured
= false;
501 case SD_DHCP6_CLIENT_EVENT_IP_ACQUIRE
:
502 r
= dhcp6_lease_address_acquired(client
, link
);
504 link_enter_failed(link
);
508 r
= dhcp6_lease_pd_prefix_acquired(client
, link
);
510 log_link_debug(link
, "DHCPv6 did not receive prefixes to delegate");
513 case SD_DHCP6_CLIENT_EVENT_INFORMATION_REQUEST
:
514 r
= dhcp6_lease_information_acquired(client
, link
);
516 link_enter_failed(link
);
521 link
->dhcp6_configured
= true;
526 log_link_warning_errno(link
, event
, "DHCPv6 error: %m");
528 log_link_warning(link
, "DHCPv6 unknown event: %d", event
);
532 link_check_ready(link
);
535 int dhcp6_request_address(Link
*link
, int ir
) {
540 assert(link
->dhcp6_client
);
541 assert(link
->network
);
542 assert(in_addr_is_link_local(AF_INET6
, (const union in_addr_union
*)&link
->ipv6ll_address
) > 0);
544 r
= sd_dhcp6_client_is_running(link
->dhcp6_client
);
549 r
= sd_dhcp6_client_get_prefix_delegation(link
->dhcp6_client
, &pd
);
553 if (pd
&& ir
&& link
->network
->dhcp6_force_pd_other_information
) {
554 log_link_debug(link
, "Enabling managed mode to request DHCPv6 PD with 'Other Information' set");
556 r
= sd_dhcp6_client_set_address_request(link
->dhcp6_client
,
565 r
= sd_dhcp6_client_get_information_request(link
->dhcp6_client
, &inf_req
);
572 r
= sd_dhcp6_client_stop(link
->dhcp6_client
);
576 r
= sd_dhcp6_client_set_local_address(link
->dhcp6_client
, &link
->ipv6ll_address
);
581 r
= sd_dhcp6_client_set_information_request(link
->dhcp6_client
, ir
);
585 r
= sd_dhcp6_client_start(link
->dhcp6_client
);
592 static int dhcp6_set_hostname(sd_dhcp6_client
*client
, Link
*link
) {
593 _cleanup_free_
char *hostname
= NULL
;
599 if (!link
->network
->dhcp_send_hostname
)
601 else if (link
->network
->dhcp_hostname
)
602 hn
= link
->network
->dhcp_hostname
;
604 r
= gethostname_strict(&hostname
);
605 if (r
< 0 && r
!= -ENXIO
) /* ENXIO: no hostname set or hostname is "localhost" */
611 r
= sd_dhcp6_client_set_fqdn(client
, hn
);
612 if (r
== -EINVAL
&& hostname
)
613 /* Ignore error when the machine's hostname is not suitable to send in DHCP packet. */
614 log_link_warning_errno(link
, r
, "DHCP6 CLIENT: Failed to set hostname from kernel hostname, ignoring: %m");
616 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to set hostname: %m");
621 int dhcp6_configure(Link
*link
) {
622 _cleanup_(sd_dhcp6_client_unrefp
) sd_dhcp6_client
*client
= NULL
;
623 sd_dhcp6_option
*send_option
;
629 assert(link
->network
);
631 if (link
->dhcp6_client
)
634 r
= sd_dhcp6_client_new(&client
);
638 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to create DHCP6 client: %m");
640 r
= sd_dhcp6_client_attach_event(client
, NULL
, 0);
642 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to attach event: %m");
644 r
= sd_dhcp6_client_set_mac(client
,
645 (const uint8_t *) &link
->mac
,
646 sizeof (link
->mac
), ARPHRD_ETHER
);
648 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to set MAC address: %m");
650 if (link
->network
->iaid_set
) {
651 r
= sd_dhcp6_client_set_iaid(client
, link
->network
->iaid
);
653 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to set IAID: %m");
656 duid
= link_get_duid(link
);
657 if (duid
->type
== DUID_TYPE_LLT
&& duid
->raw_data_len
== 0)
658 r
= sd_dhcp6_client_set_duid_llt(client
, duid
->llt_time
);
660 r
= sd_dhcp6_client_set_duid(client
,
662 duid
->raw_data_len
> 0 ? duid
->raw_data
: NULL
,
665 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to set DUID: %m");
667 ORDERED_HASHMAP_FOREACH(send_option
, link
->network
->dhcp6_client_send_options
, i
) {
668 r
= sd_dhcp6_client_add_option(client
, send_option
);
672 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to set option: %m");
675 r
= dhcp6_set_hostname(client
, link
);
679 r
= sd_dhcp6_client_set_ifindex(client
, link
->ifindex
);
681 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to set ifindex: %m");
683 if (link
->network
->rapid_commit
) {
684 r
= sd_dhcp6_client_set_request_option(client
, SD_DHCP6_OPTION_RAPID_COMMIT
);
686 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to set request flag for rapid commit: %m");
689 if (link
->network
->dhcp6_mudurl
) {
690 r
= sd_dhcp6_client_set_request_mud_url(client
, link
->network
->dhcp6_mudurl
);
692 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to set MUD URL: %m");
695 r
= sd_dhcp6_client_set_callback(client
, dhcp6_handler
, link
);
697 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to set callback: %m");
699 if (dhcp6_enable_prefix_delegation(link
)) {
700 r
= sd_dhcp6_client_set_prefix_delegation(client
, true);
702 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to set prefix delegation: %m");
705 if (link
->network
->dhcp6_pd_length
> 0) {
706 r
= sd_dhcp6_client_set_prefix_delegation_hint(client
, link
->network
->dhcp6_pd_length
, &link
->network
->dhcp6_pd_address
);
708 return log_link_error_errno(link
, r
, "DHCP6 CLIENT: Failed to set prefix hint: %m");
711 link
->dhcp6_client
= TAKE_PTR(client
);
716 static Link
*dhcp6_prefix_get(Manager
*m
, struct in6_addr
*addr
) {
717 assert_return(m
, NULL
);
718 assert_return(addr
, NULL
);
720 return hashmap_get(m
->dhcp6_prefixes
, addr
);
723 static int dhcp6_route_add_handler(sd_netlink
*nl
, sd_netlink_message
*m
, Link
*link
) {
728 if (IN_SET(link
->state
, LINK_STATE_FAILED
, LINK_STATE_LINGER
))
731 r
= sd_netlink_message_get_errno(m
);
732 if (r
< 0 && r
!= -EEXIST
) {
733 log_link_message_warning_errno(link
, m
, r
, "Received error adding DHCPv6 Prefix Delegation route");
734 link_enter_failed(link
);
741 static int dhcp6_prefix_add(Manager
*m
, struct in6_addr
*addr
, Link
*link
) {
742 _cleanup_(route_freep
) Route
*route
= NULL
;
743 _cleanup_free_
struct in6_addr
*a
= NULL
;
744 _cleanup_free_
char *buf
= NULL
;
748 assert_return(m
, -EINVAL
);
749 assert_return(addr
, -EINVAL
);
751 r
= route_new(&route
);
755 route
->family
= AF_INET6
;
756 route
->dst
.in6
= *addr
;
757 route
->dst_prefixlen
= 64;
759 r
= route_configure(route
, link
, dhcp6_route_add_handler
);
763 (void) in_addr_to_string(AF_INET6
, (union in_addr_union
*) addr
, &buf
);
764 log_link_debug(link
, "Adding prefix route %s/64", strnull(buf
));
766 assigned_link
= hashmap_get(m
->dhcp6_prefixes
, addr
);
768 assert(assigned_link
== link
);
772 a
= newdup(struct in6_addr
, addr
, 1);
776 r
= hashmap_ensure_allocated(&m
->dhcp6_prefixes
, &in6_addr_hash_ops
);
780 r
= hashmap_put(m
->dhcp6_prefixes
, a
, link
);
789 static int dhcp6_prefix_remove_handler(sd_netlink
*nl
, sd_netlink_message
*m
, Link
*link
) {
794 if (IN_SET(link
->state
, LINK_STATE_FAILED
, LINK_STATE_LINGER
))
797 r
= sd_netlink_message_get_errno(m
);
799 log_link_message_warning_errno(link
, m
, r
, "Received error on DHCPv6 Prefix Delegation route removal");
800 link_enter_failed(link
);
807 int dhcp6_prefix_remove(Manager
*m
, struct in6_addr
*addr
) {
808 _cleanup_free_
struct in6_addr
*a
= NULL
;
809 _cleanup_(link_unrefp
) Link
*l
= NULL
;
810 _cleanup_(route_freep
) Route
*route
= NULL
;
811 _cleanup_free_
char *buf
= NULL
;
814 assert_return(m
, -EINVAL
);
815 assert_return(addr
, -EINVAL
);
817 l
= hashmap_remove2(m
->dhcp6_prefixes
, addr
, (void **) &a
);
821 (void) sd_radv_remove_prefix(l
->radv
, addr
, 64);
823 r
= route_new(&route
);
827 route
->family
= AF_INET6
;
828 route
->dst
.in6
= *addr
;
829 route
->dst_prefixlen
= 64;
831 r
= route_remove(route
, l
, dhcp6_prefix_remove_handler
);
835 (void) in_addr_to_string(AF_INET6
, (union in_addr_union
*) addr
, &buf
);
836 log_link_debug(l
, "Removing prefix route %s/64", strnull(buf
));
841 static int dhcp6_prefix_remove_all(Manager
*m
, Link
*link
) {
842 struct in6_addr
*addr
;
846 assert_return(m
, -EINVAL
);
847 assert_return(link
, -EINVAL
);
849 HASHMAP_FOREACH_KEY(l
, addr
, m
->dhcp6_prefixes
, i
)
851 (void) dhcp6_prefix_remove(m
, addr
);