mirror of
https://github.com/systemd/systemd.git
synced 2026-08-06 08:00:57 +00:00
networkd: Request prefixes when configured to do so
Request prefixes via DHCPv6 if there are networks that are configured to distribute them. As specified in RFC 3633, a DHCPv6 client cannot redistribute the prefixes via Router Advertisements on the same link. Ignore such networks, and print out a warning if the link where DHCPv6 is enabled tries to do so.
This commit is contained in:
@@ -30,6 +30,45 @@
|
||||
|
||||
static int dhcp6_lease_address_acquired(sd_dhcp6_client *client, Link *link);
|
||||
|
||||
static bool dhcp6_verify_link(Link *link) {
|
||||
if (!link->network) {
|
||||
log_link_info(link, "Link is not managed by us");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IN_SET(link->network->router_prefix_delegation,
|
||||
RADV_PREFIX_DELEGATION_DHCP6,
|
||||
RADV_PREFIX_DELEGATION_BOTH)) {
|
||||
log_link_debug(link, "Link does not request DHCPv6 prefix delegation");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool dhcp6_enable_prefix_delegation(Link *dhcp6_link) {
|
||||
Manager *manager;
|
||||
Link *l;
|
||||
Iterator i;
|
||||
|
||||
assert(dhcp6_link);
|
||||
|
||||
manager = dhcp6_link->manager;
|
||||
assert(manager);
|
||||
|
||||
HASHMAP_FOREACH(l, manager->links, i) {
|
||||
if (l == dhcp6_link)
|
||||
continue;
|
||||
|
||||
if (!dhcp6_verify_link(l))
|
||||
continue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int dhcp6_lease_information_acquired(sd_dhcp6_client *client,
|
||||
Link *link) {
|
||||
return 0;
|
||||
@@ -283,6 +322,12 @@ int dhcp6_configure(Link *link) {
|
||||
if (r < 0)
|
||||
goto error;
|
||||
|
||||
if (dhcp6_enable_prefix_delegation(link)) {
|
||||
r = sd_dhcp6_client_set_prefix_delegation(client, true);
|
||||
if (r < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
link->dhcp6_client = client;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user